The appium-android-driver cannot unlock the screen on some devices
See original GitHub issue@nghiadhd commented on Thu May 19 2016
Appium@1.5.2 Issue devices:
- Galaxy Note 3: Model: SM-N9005, version: 4.4.2
- Galaxy S4: Model: GT-I9500, version: 4.4.2
- HTC one: Model: HTC6525LVW, version: 5.0.1
Other devices still work well
Note: In the past, the Galaxy S4 still works well, but after upgrade to newer OS version, it doesn’t work any more
Issue: “Encountered internal error running command: Error: Screen did not unlock successfully” Expectation: The screen should be unlocked
After do some investigating, found that the adb command to start the unlock doesn’t work
adb with args: ["-P",5037,"-s","xxxxxxxxxx","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
I can reproduce the issue by adb command
adb -s <UDID> shell am start -n ‘io.appium.unlock/.Unlock’ -S -a ‘android.intent.action.MAIN’ -c ‘android.intent.category.LAUNCHER’ -f ‘0x10200000’
Some addresses
The ‘-S’ option doesn’t work (should be remove from command) If the unlock is on foreground, the command doesn’t make effect
My solution, use ‘adb shell am force-stop’ to kill ‘unlock’ and ‘adb shell am start’ to restart ‘unlock’ app. I tested on issue devices and confirm it works well
adb -s <UDID> shell am force-stop 'io.appium.unlock
adb -s <UDID> shell am start -n 'io.appium.unlock/.Unlock' -a 'android.intent.action.MAIN' -c 'android.intent.category.LAUNCHER' -f '0x10200000'
adb -s <UDID> shell am start -n 'io.appium.unlock/.Unlock' -a 'android.intent.action.MAIN' -c 'android.intent.category.LAUNCHER' -f '0x10200000'
Weird that after force-stop, we should call ‘am start’ 2 times to invoke the ‘unlock’ app. That’s should be the reason why ‘-S’ option doesn’t work
@imurchie commented on Fri May 20 2016
Interesting! Thank you for the detailed update. I’ll take a look at this!
@nghiadhd commented on Mon May 23 2016
Thank @imurchie
That’s seem a critical issue. The test script always failed if the screen cannot unlocked
@rkavalap commented on Mon Aug 01 2016
+1
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
Fixed: https://github.com/appium/appium-android-driver/blob/master/docs/UNLOCK.md
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.