How do I keep my screen unlocked during USB debugging?

前端 未结 19 1357
清酒与你
清酒与你 2020-12-13 07:55

Android OS2.2 used to have an option under Settings/Applications/Development to disable screen lock during USB debugging. After upgrading my Samsung Galaxy S to OS2.3.3 this

19条回答
  •  醉话见心
    2020-12-13 08:49

    Tell PowerManager to keep the screen on (it will still dim):

    adb shell settings put global stay_on_while_plugged_in 3
    

    The value 3 is the following two types OR'd together:

    BatteryManager#BATTERY_PLUGGED_AC and BatteryManager#BATTERY_PLUGGED_USB.

    Use adb shell dumpsys power | grep mStayOnWhilePluggedInSetting to see the current value.

    To revert to normal behavior set the value to zero like so:

    adb shell settings put global stay_on_while_plugged_in 0
    

    Verified working on Android 4.4 through 9.0.

提交回复
热议问题