[General Questions and Answers] Dush123:
Hello,

I have Oneplus One 64 gb variant, yesterday my nephew somehow changed my phone's lock pattern and now my phone is locked. USB debugging was disabled at that time. I am not able to get into my phone through any means. I have lot of important data in my phone and don't want to hard reset my device. I found a solution online to get usb debugging on through adb , but I am a ultra noob and don't understand how that has to be done. please dumb it down so that I can save my precious data and unlock my phone when debugging gets enabled. Also I don't have any custom recovery installed on my phone.

This is what is mentioned in the solution.

"Instructions

1. You should try your pattern-cracking software (or whatsoever the genre it has) from inside the Stock Recovery to see whether it works with the former's environment (ADB shell available there or not).

2.Since I would never try step 1., I would do the following:

-For Jellybean 4.2.1:

1. Boot into Recovery and mount Data partition.

2. Open a shell on PC and type:

adb pull /data/property/persist.sys.usb.config ~/

Repace ~/ with home directory of your OS.

3. 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.

4. Unmount Data and reboot into Android OS. USB Debugging would probably be enabled.

-For Lollipop 5.0:

JB 4.2.1 users can also follow this method if the previous one didn't work for them.

1. Boot into Recovery and mount Data partition.

2. Repeat step 2 and 3 used in JB 4.2.1 method.

3. We need to tweak some parameters in settings.db. Type:

adb pull /data/data/com.android.providers.settings/databases/settings.db ~/

4. Back it up at some other location too, and open the file in an SQLITE editor. I'm running Linux and DB Browser for SQLite works well. It's also available for Windows OS/OSX.

5. In the global table, change the value for:

adb_enabled to 1

development_settings_enabled to 1

6. Check that verifier_verify_adb_installs is set to 1 in the global table.

7. 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.

8. 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.

8. Unmount Data and reboot into Android OS. ADB probably would be enabled.

source:- https://android.stackexchange.com/questions/112040/how-to-enable-usb-debugging-in-android-if-forgotten-pattern-for-screen-unlock"

Please help me understand this code and be a life saver.

Thanks in advance..:)