[Solved][OH3] [androiddebugbridge] command "adb shell:dumpsys activity | grep mWakefulness" failed

  • Platform information:
    • Hardware: VirtualBox
    • OS: Ubuntu 20.04 LTS
    • Java Runtime Environment: Zulu 11
    • openHAB version: 3.1.0-SNAPSHOT (#2220)

I configured my smartphone (Xiaomi Mi A1 with LineageOS 17.1) to test the binding.
The status of the thing is Online.

The binding does a test for ‘adb awake state’ with a command
adb shell:dumpsys activity | grep mWakefulness, which fails.
If i do the same command manually in a shell, it also fails.
If I correct the command to
adb shell dumpsys activity | grep mWakefulness
(without colon after shell) it is executed without errors.

openhab.log (with TRACE on):

19:01:00.898 [DEBUG] [dge.internal.AndroidDebugBridgeDevice] - 192.168.nnn.nn - shell:dumpsys activity | grep mWakefulness
19:01:05.907 [WARN ] [ge.internal.AndroidDebugBridgeHandler] - Unable to refresh awake state: Timeout
19:01:15.257 [DEBUG] [dge.internal.AndroidDebugBridgeDevice] - 192.168.nnn.nn - shell:input keyevent KEYCODE_POWER
19:01:20.260 [WARN ] [ge.internal.AndroidDebugBridgeHandler] - 192.168.nnn.nn - timeout error
19:01:35.910 [DEBUG] [ge.internal.AndroidDebugBridgeHandler] - Refresh device 192.168.nnn.nn status
19:01:35.911 [DEBUG] [dge.internal.AndroidDebugBridgeDevice] - 192.168.nnn.nn - shell:dumpsys activity | grep mWakefulness
19:01:40.912 [WARN ] [ge.internal.AndroidDebugBridgeHandler] - Unable to refresh awake state: Timeout

Can anyone reproduce or confirm my problem?
Does anyone have a solution suggestion for me?

Could it be that the colon between shell and dumpsys is just debug output ?
The source code of the binding in line125 does not show a colon:

I thought the logger command is from inside the function runAdbShell (at line 278).
In line 280 the command AdbStream stream = adb.open("shell:" + cmd); is build.
I do not know a lot about java, but could it be, that this is the problematic line?

That is the line that is responsible for the output of the logging information.
Two rows below ( AdbStream stream = … ) is the command that is being executed then.

I must have misunderstood something. Basically, the binding works.
It was my mistake, the target device was running a firewall that did not allow wifi debugging.