I did some more testing on the display on/off front, maybe someone can read something out of it (I’m not a developer, certainly not an Android developer)
Short version:
Quite a few commands/parameters that I’ve found should turn on/off the screen, or indicate the state don’t to so.
However, the adb shell input keyevent 26
command worked in my tests, to send the screen to sleep.
The mScreenBrightness and mScreenBrightnessModeSetting parameters seem to properly indicate, if the screen is on or off.
I could not find a reliable way yet, to wake the display, nor do I know (yet?) how to make use of these findings to turn off the display without accessing the device over adb.
I’ve actually uninstalled the Home Assistant app in the meantime, so this is not the root cause for the screen not going to sleep. The issue also persists when using WallPanel.
Long version:
There is an adb command to press the “virtual” power button (actually, there are even more than one). It seems that the adb shell input keyevent 26
command on this device does actually only work for turning off the display, it won’t wake the device.
Logcat presents the following output after sending that event:
01-20 15:27:52.336 11186 11186 D AndroidRuntime: Calling main entry com.android.commands.input.Input
01-20 15:27:52.340 11186 11186 I Input : injectKeyEvent: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_POWER, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=64181066, downTime=64181066, deviceId=-1, source=0x101 }
01-20 15:27:52.342 1206 1352 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:27:52.345 1206 1352 D AppOps : startOperation: allowing code 40 uid 1000 package android
01-20 15:27:52.357 11186 11186 I Input : injectKeyEvent: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_POWER, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=64181066, downTime=64181066, deviceId=-1, source=0x101 }
01-20 15:27:52.357 1206 1352 I PowerManagerService: Going to sleep due to power button (uid 1000)...
01-20 15:27:52.360 1206 1352 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:27:52.363 11186 11186 D AndroidRuntime: Shutting down VM
01-20 15:28:00.001 1206 1269 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:28:00.005 1360 1360 D KeyguardUpdateMonitor: received broadcast android.intent.action.TIME_TICK
01-20 15:28:00.006 1360 1360 D KeyguardUpdateMonitor: handleTimeUpdate
01-20 15:28:00.019 1206 1206 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
01-20 15:28:43.065 1360 1360 D KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
01-20 15:28:43.065 1322 1808 D HeadsetStateMachine: Disconnected process message: 10, size: 0
01-20 15:28:43.065 1322 1808 D HeadsetStateMachine: Enter processIntentBatteryChanged()
01-20 15:28:43.065 1322 1808 D HeadsetStateMachine: Exit processIntentBatteryChanged()
01-20 15:28:43.065 1322 1808 D HeadsetStateMachine: Exit Disconnected processMessage()
01-20 15:28:43.067 1577 1577 D QtiCarrierConfigHelper: WARNING, no carrier configs on phone Id: 0
01-20 15:28:43.069 1360 1360 D KeyguardUpdateMonitor: handleBatteryUpdate
01-20 15:28:53.727 1206 1216 I zygote : Background concurrent copying GC freed 116463(18MB) AllocSpace objects, 18(808KB) LOS objects, 58% free, 12MB/30MB, paused 193us total 150.355ms
01-20 15:29:00.001 1206 1269 I PowerManagerService: Going to sleep due to screen timeout (uid 1000)...
If this command is sent, the screen actually dims more or less immediately, and after the screen timeout setting (at least it appears so), it goes dark completely.
When comparing certain parameters, that should indicate if the screen is currently on or off, I’ve found that most of the values don’t really help. I actually tried the following commands to compare the parameters:
adb shell dumpsys display | grep "mScreen"
adb shell dumpsys power
adb shell dumpsys power | grep mPowerState (no value returned)
adb shell dumpsys input_method | grep mInteractive=true
the following return values differed between on and off:
- mScreenBrightness (on: 255, off: 10)
- mScreenBrightnessModeSetting (on: 1, off: 0)
- the Looper state returned 3 messages when the screen was on (including the AutomaticBrightnessHandler when the screen was on), vs. only 1 message when the screen was off