<commit_before>/******************************************************************************
 * Copyright 2015 <NAME>                                                 *
 *                                                                            *
 *   Licensed under the Apache License, Version 2.0 (the "License");          *
 *   you may not use this file except in compliance with the License.         *
 *   You may obtain a copy of the License at                                  *
 *                                                                            *
 *       http://www.apache.org/licenses/LICENSE-2.0                           *
 *                                                                            *
 *   Unless required by applicable law or agreed to in writing, software      *
 *   distributed under the License is distributed on an "AS IS" BASIS,        *
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 *   See the License for the specific language governing permissions and      *
 *   limitations under the License.                                           *
 ******************************************************************************/

package net.segv11.bootunlocker;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import android.util.Log;

/**
 * @description
 * 		manages the interface to the bootloader for locking and unlocking
 *
 */
public class bootLoader {
	// TODO: JavaDoc
	
	/** constants describing bootloader state */
	public static final int BL_UNSUPPORTED_DEVICE = -2;
	public static final int BL_UNKNOWN = -1;
	public static final int BL_UNLOCKED = 0;
	public static final int BL_LOCKED = 1;
	public static final int BL_TAMPERED_UNLOCKED = 2;
	public static final int BL_TAMPERED_LOCKED = 3;
	
	// how long to wait after calling su to update param
	// before we update the UI:
	public static final long delayAfterChange = 200;	// 200ms
	private static final long launchDelay = 30;			// 30ms

	/** For logging */
	private static final String TAG = "net.segv11.bootloader";
	
    /** checks if we know how to lock/unlock the bootloader on this device */
    public static bootLoader makeBootLoader() {
    	Log.v(TAG, "DEVICE = " + android.os.Build.DEVICE);
    	if (android.os.Build.DEVICE.equals("maguro")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("toro")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("toroplus")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("manta")) {
    		return new bootLoader_N10();
    	} else if (android.os.Build.DEVICE.equals("mako")) {
    		return new bootLoader_N4();
    	} else if (android.os.Build.DEVICE.equals("hammerhead")) {
    		return new bootLoader_N5();
    	} else if (android.os.Build.DEVICE.equals("flo")) {
    		return new bootLoader_N7_2013();
        } else if (android.os.Build.DEVICE.equals("deb")) {
            return new bootLoader_N7_2013();
        } else if (android.os.Build.DEVICE.equals("bacon")) {
            return new bootLoader_OnePlusOne();
        } else if (android.os.Build.DEVICE.equals("A0001")) {
            return new bootLoader_OnePlusOne();
    	} else {
    		return null;<commit_msg>Add code names for N6 and N9<commit_after>/******************************************************************************
 * Copyright 2015 <NAME>                                                 *
 *                                                                            *
 *   Licensed under the Apache License, Version 2.0 (the "License");          *
 *   you may not use this file except in compliance with the License.         *
 *   You may obtain a copy of the License at                                  *
 *                                                                            *
 *       http://www.apache.org/licenses/LICENSE-2.0                           *
 *                                                                            *
 *   Unless required by applicable law or agreed to in writing, software      *
 *   distributed under the License is distributed on an "AS IS" BASIS,        *
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 *   See the License for the specific language governing permissions and      *
 *   limitations under the License.                                           *
 ******************************************************************************/

package net.segv11.bootunlocker;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import android.util.Log;

/**
 * @description
 * 		manages the interface to the bootloader for locking and unlocking
 *
 */
public class bootLoader {
	// TODO: JavaDoc
	
	/** constants describing bootloader state */
	public static final int BL_UNSUPPORTED_DEVICE = -2;
	public static final int BL_UNKNOWN = -1;
	public static final int BL_UNLOCKED = 0;
	public static final int BL_LOCKED = 1;
	public static final int BL_TAMPERED_UNLOCKED = 2;
	public static final int BL_TAMPERED_LOCKED = 3;
	
	// how long to wait after calling su to update param
	// before we update the UI:
	public static final long delayAfterChange = 200;	// 200ms
	private static final long launchDelay = 30;			// 30ms

	/** For logging */
	private static final String TAG = "net.segv11.bootloader";
	
    /** checks if we know how to lock/unlock the bootloader on this device */
    public static bootLoader makeBootLoader() {
    	Log.v(TAG, "DEVICE = " + android.os.Build.DEVICE);
    	if (android.os.Build.DEVICE.equals("maguro")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("toro")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("toroplus")) {
    		return new bootLoader_Gnex();
    	} else if (android.os.Build.DEVICE.equals("manta")) {
    		return new bootLoader_N10();
    	} else if (android.os.Build.DEVICE.equals("mako")) {
    		return new bootLoader_N4();
    	} else if (android.os.Build.DEVICE.equals("hammerhead")) {
    		return new bootLoader_N5();
        } else if (android.os.Build.DEVICE.equals("flo")) {
            return new bootLoader_N7_2013();
        } else if (android.os.Build.DEVICE.equals("deb")) {
            return new bootLoader_N7_2013();
        } else if (android.os.Build.DEVICE.equals("shamu")) {
            return null;    // new bootLoader_N6(); // TODO: Support Nexus 6
        } else if (android.os.Build.DEVICE.equals("flounder")) {
            return null;    // new bootLoader_N9(); // TODO: Support Nexus 9
        } else if (android.os.Build.DEVICE.equals("bacon")) {
            return new bootLoader_OnePlusOne();
        } else if (android.os.Build.DEVICE.equals("A0001")) {
            return new bootLoader_OnePlusOne();
    	} else {
    		return null;
{'fraction_non_alphanumeric': 0.13737605977870385, 'fraction_numerical': 0.014082483115390142, 'mean_word_length': 2.0905861456483126, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6436909', 'n_tokens_mistral': 1882, 'n_tokens_neox': 1777, 'n_words': 559}