Can I disable unlocking of screen before creating a session

Hi All

I have a android ui-automation project in which i am using both appium and uiautomator. I have few question which i want to ask:

  1. Can I use UI Automator commands when i have already created a Appium session. I tried this but was getting Accessibility error.

  2. I have a UIAutomator code to unlock the device. Once unlocked i want to create an appium session and use appium apis. But currently when i create a session automatically it tries to unlock by disabling keyguard. Can I disable this feature.?

  3. The wakeup apk is not working on Samsung phones if it is PIN locked. Is there any other solution for this

I had to get rid of appium’s unlock function as it would bork the phone when it tried to unlock it, requiring a reboot.

My fix is simple, inelegant, but effective.
Edit: appium/lib/devices/android/android.js
Replace androidController.unlock with:

androidController.unlock = function (cb) {
this.adb.isScreenLocked(function (err, isLocked) {
if (err) return cb(err);
return cb(null, {
status: status.codes.Success.code
, value: null
});
}.bind(this));
};

If you have to unlock with appium’s unlocker, you can always use adb to call their apk:
adb shell am start -n io.appium.unlock/.Unlock

3 Likes

Awesome, this solution worked great. Finally got rid of unlock always blocking the emulator. Thanks!