Skip to content
Commit fa539d13 authored by Darryl L Johnson's avatar Darryl L Johnson
Browse files

Add DeviceStateManagerService shell commands to get and override state.

This also introduces the CONTROL_DEVICE_STATE permission to protect
against setting the device state. The permission is granted to the shell
to allow overriding via ADB.

Two ADB commands are introduced with this change:

-> adb shell cmd device_state print-states
will print the list of states supported by the device
Ex:
$ adb shell cmd device_state print-states
[ 0, 1, 2 ]

-> adb shell cmd device_state state [reset|OVERRIDE_DEVICE_STATE]
will print the current device state or override the current device
state with the supplied override state.
Ex:
$ adb shell cmd device_state 0

Ex:
$ adb shell cmd device_state state
Device state: 0
----------------------
Base state: 2
Override state: 0

Bug: 159401801
Test: atest DeviceStateManagerServiceTest
Test: adb shell cmd device_state print-states
Test: adb shell cmd device_state state

Change-Id: I8a74f1f2bf8189523bdae861fb38f86988c21b2a
parent f7d857c0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment