Is there any adb command to enable developer optio

2019-04-13 06:38发布

问题:

Developer Options can be enabled by tapping 7 times on build number. I am using

adb shell input tap x y command to tap on build number. is there any adb command to tap on build number 7 times?

回答1:

much easier way:

adb shell settings put global development_settings_enabled 1


回答2:

That info is stored in a shared preference of the settings app. Which is located at: /data/user_de/0/com.android.settings/shared_prefs/development.xml it has a boolean named show stored, if set to true, developer options is shown, gone otherwise.

If device IS ROOTED, you could do:

  1. adb root
  2. adb shell sed -i -e 's/false/true/g' data/user_de/0/com.android.settings/shared_prefs/development.xml
  3. adb shell chown system:system data/user_de/0/com.android.settings/shared_prefs/development.xml
  4. adb shell cat data/user_de/0/com.android.settings/shared_prefs/development.xml
  5. adb shell am force-stop com.android.settings

This is the explanation for each command:

  1. Make sure we are root
  2. We intend to change the value from false to true. There is only this value stored in that XML, in that sense it's save for now.
  3. Change the owner and group to system, because after we modified it, it was set to root:root.
  4. Verify the value is correctly set. (could be done before step 3, it doesn't matter)
  5. Kill settings app so we force it to read the value again.

If device is NOT rooted, I can not think of a way to accomplish this.

Even if we have a rooted device, this method is way longer than doing 7 keyevents through adb (after a swipe to the end). So I think you're better off with your current method. (Sorry to say)