I want to use some third party software to clear my device's screen unlock pattern which I forgot. They require USB debugging enabled but I don't have it enabled in my Android.
How do I turn on USB Debugging through Recovery mode, or Fastboot?
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.
Sign up to join this communityI want to use some third party software to clear my device's screen unlock pattern which I forgot. They require USB debugging enabled but I don't have it enabled in my Android.
How do I turn on USB Debugging through Recovery mode, or Fastboot?
Details for that can be found in our usb-debugging tag-wiki (where I've just added them):
By default, USB debugging is disabled with stock ROMs (some custom ROMs however have it enabled by default). To toggle it on or off, you can find the corresponding switch in Settings › Development – a section originally hidden with Android 4.2 and up. You can make this section visible by going to Settings › About device and "hammering" the entry telling your ROM's build version until a toast-message congratulates you for having become a developer.
If your issue is however that you cannot boot up your device normally, and thus cannot reach the settings section described above, please take a look at the following questions:
Based on OP's clarification done in the comments below Izzy's answer, I propose the following solution if one's device is locked out and ADB is not enabled under Settings.
Note that this method is tested on Stock Android 4.2.1 and Stock CM 12.0 (Android 5.0) , both devices having custom Recovery (ADB always enabled as default) . If your Stock Recovery allows ADB shell access then you may also consider this solution.
Since I would never try step 1., I would do the following:
Open a shell on PC and type:
adb pull /data/property/persist.sys.usb.config ~/
Repace ~/
with home directory of your OS.
Open that file in a text editor and you would possibly see mtp
written there. Change it to mtp,adb
.
Note that sometimes Android doesn't understand the text file changes if the line terminator is "DOS Terminators" which Notepad would probably do on Windows (mine is Linux so no issue here).
In that case, I would suggest not using adb pull
but doing:
adb shell
echo 'mtp,adb' > /data/property/persist.sys.usb.config
You may verify that the echo
command overwrote the file by using:
adb pull /data/property/persist.sys.usb.config ~/
and seeing the file's content in some text editor.
Unmount Data
and reboot into Android OS. USB Debugging would probably be enabled.
JB 4.2.1 users can also follow this method if the previous one didn't work for them.
We need to tweak some parameters in settings.db
. Type:
adb pull /data/data/com.android.providers.settings/databases/settings.db ~/
global
table, change the value for:
adb_enabled
to 1
development_settings_enabled
to 1
verifier_verify_adb_installs
is set to 1
in the global
table.Check that as default, in the secure
table:
adb_notify
is 1
adb_port
is -1
These checks in step 6 and 7 are not necessary but should be done so that troubleshooting becomes rather easy if the solution doesn't work for you.
Save the changes in settings.db
and copy it back into Android by typing:
adb shell
rm /data/data/com.android.providers.settings/databases/settings.db
exit
adb push ~/settings.db /data/data/com.android.providers.settings/databases/
That delete (rm
) command is not necessary since adb push
should overwrite the file, but I executed it for my peace of mind.
Data
and reboot into Android OS. ADB probably would be enabled. This is how it actually worked out when tested on my devices.
Source: Not really a source but got a hint from a comment under this answer.
/data/system/users/0/
. The files have the naming scheme settings_*.xml
.