Android Device Update

Factory Reset an Android Device

Note: This process should only be followed if you are prepared to factory reset the Android device. This means that any previously installed app along with its data will be deleted. These instructions are best followed using Santoku Linux, although this is not a requirement.

Requirements:

  • Android Device with USB cable

  • A Linux Host/VM (not specifically required, but these instructions are best followed using Linux (Santoku))

  • Internet Connection (to download the factory image)

Steps:

  1. Download the Google factory image here: https://developers.google.com/android/nexus/images. For example, navigate to the “hammerhead” for Nexus 5 (GSM/LTE) for Nexus 5 images.

  2. Connect the device to the Linux environment using the USB cable. If you are using a VM, ensure that the device has been properly passed through.

  3. Start the device in fastboot mode with one of the following methods:

  • Using adb: With the device powered on, execute: “adb reboot bootloader”

  • Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device. For example, to put a Nexus 5 (“hammerhead”) into fastboot mode, press and hold Volume Up + Volume Down + Power as the device begins booting up.

  1. If necessary, unlock the device’s bootloader by running: “sudo fastboot oem unlock”.  The device will show you a confirmation screen.  (This erases all data on the target device.)

  2. Open a terminal and navigate to the unzipped system image directory.

  3. Execute the flash-all script.  This script installs the necessary bootloader, baseband firmware(s), and operating system.  You can do this by running: “sudo ./flash-all.sh” from within the directory.

  4. When this process completes, the device will reboot, and you will have successfully flashed to a stock state.

Rooting an Android Device (Android 6.0)

Note: This method is specifically for non-rooted Nexus 5 and Nexus 6 devices running Android 6. NowSecure Lab version 3.5.2 or higher is required. Please backup all necessary data and root your device with caution.

Requirements:

  • Nexus 5 or 6 device running Android 6.0 (Marshmallow)

  • A Linux Host/VM (not specifically required, but these instructions are best followed using Linux (Santoku))

Steps:

  1. Connect the device to the Linux environment using the USB cable.  If you are using a VM, ensure that the device has been properly passed through.

  2. Ensure USB Debugging is enabled. To do so: ​​

  • On Device, go to Settings->About Phone.

  • Scroll to the bottom and tap “Build Number” 7 times.

  • Go back to the previous screen (Settings), and you should now see “Developer Options.”

  • Go there and check “USB Debugging” to enable the setting.

  • You should receive an RSA Fingerprint prompt on the device.

  • Click allow to continue

  1. Download Open TWRP Recovery for the correct device: http://techerrata.com/browse/twrp2/ (“hammerhead” for Nexus 5, for example)

  2. Copy the openrecovery-twrp-{device}.img file to /usr/share/vialab/data/bin/files

  3. From a terminal, change the directory to /usr/share/vialab/data/bin/files

  4. Run the root linux script to root your device: sudo ./root-nexus6.sh

Note: The script will complete with following dialog:

Done processing script file
Device will reboot into stock recovery. Please perform a factory reset from stock recovery:
1\. Press and hold the power button, then press volume up. A menu will appear.
2\. Select 'Wipe data/factory reset' in the menu
3\. When the factory reset is performed, you can reboot into system normally. DONE!
  • On the device, perform option 1.  Press and hold the power button, then press volume up.  A menu will appear on the device, “Reboot system now” is selected by default

  • Press the Power button to select

  • The device will reboot.  The SuperSU app should be installed. You are now ready for provisioning.

Rooting an Android Device (Android 4.x/5.x)

Note: This method utilizes the Chainfire Auto-Root method for gaining root access and installing SuperSU. If you are not using a Google Device (Nexus series), then rooting your device may get a little more complicated. This method is intended to keep things simple, and is provided as a way to easily root the standard NowSecure Lab devices. NowSecure Lab version 3.5.2 is required for Android 5 and up.

Requirements:

  • Non-Rooted Android Device that is compatible with the CF-Auto-Root method.

  • A Linux Host/VM (not specifically required, but these instructions are best followed using Linux (Santoku))

  • Internet Connection (to download the auto-root utility)

Steps:

  1. Download the CF-Auto-Root utility for your specific device: http://autoroot.chainfire.eu/

  2. If this is your first time using this utility, you may want to take the time to read through the initial instructions. When you are ready, scroll all the way to the bottom for Google devices.

  3. Connect the device to the Linux environment using the USB cable. If you are using a VM, ensure that the device has been properly passed through.

  4. Start the device in fastboot mode with one of the following methods:

  • Using adb: With the device powered on, execute: “adb reboot bootloader”

  • Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device. For example, to put a Nexus 5 (“hammerhead”) into fastboot mode, press and hold Volume Up + Volume Down + Power as the device begins booting up.

  1. You will need to extract the downloaded zip file, and navigate to that directory using a terminal window. From there you can run this command: “sudo ./root-linux.sh”

  2. A red android pirate should appear on the screen. Once the process completes, the device will reboot, and will be successfully rooted.

Provisioning an Android Device for Lab Workstation

These instructions assume that you have already factory reset your device on 4.0.4 - 4.4.2 or that you have already rooted your 4.4.3+ device. Click for root instructions on Android 4.x/5.x or Android 6.

Android Device Provisioning

NowSecure Lab 3.0+ now includes the ability to provision devices automatically. In order to do this, we must make certain assumptions about the device:

Android 4.0.4 - 4.3

In this case, NowSecure Lab performs both the provisioning, and the rooting process automatically. You can start with a stock device, and NowSecure Lab do the rest. Although we attempt to keep our list of supported devices up-to-date, it is best if your device is on this list.

Android 4.4+ and up

As mentioned previously, 4.4 devices will need to already be rooted, and have the SuperSU application installed. If you have already completed these steps, you will just need to walk-through the device provisioning wizard, which has been outlined below:

Using the NowSecure Lab Device Provisioning Wizard (Android)

The Device Provisioning wizard is designed to make the provisioning process easy, and can be brought up from the Device Manager window. From the Device Manager window, click on “Provision Device”.

You will be presented with the wizard, which can use to step through the whole process. Simply check the “I agree to the terms above” box, and select Continue (make sure that Android is selected as well).

The next screen will check to see if the device is ready for the provisioning process. During this step, we are basically ensuring that we can connect to the device (USB Debugging is enabled on the device), that it is on a compatible OS version, and to make sure it is rooted (4.4.x and up only). To start this test, click “Check”. If all of the checks pass, you will see a green check mark. You can now proceed to the next section.

On the next screen, select “Provision” to start the process. During this time, there will be multiple files sent to the device, so it is common to see multiple notifications pop-up on the Android screen. This is all expected, and all you need to do it just let it finish. When complete, the “Finished” button will appear at the bottom of the terminal window and let you continue on.