Error finding unlock pin buttons! (Samsung A8)

Hi, in my testsuite I am using Desired Capabilities to unlock the mobile device which I use for testing. On the Samsung A5 model (with android 8) this is working fine, but now I also want to test the same testsuite on a Samsung A8 model (with Android 9). But I am getting an error ‘Error finding unlock pin buttons!’.

I am using Katalon Studio 7.2.1 with Appium 1.17.0

This is the testcode:

RunConfiguration.setMobileDriverPreferencesProperty("adbExecTimeout", '30000')
RunConfiguration.setMobileDriverPreferencesProperty("appWaitActivity", '*')
RunConfiguration.setMobileDriverPreferencesProperty("appWaitDuration", '30000')
RunConfiguration.setMobileDriverPreferencesProperty("unlockType", 'pin')
RunConfiguration.setMobileDriverPreferencesProperty("unlockKey", '000001')

Mobile.startExistingApplication('xxxxxxx')

Mobile.pressHome()

'Close application on current selected android device'
Mobile.closeApplication()

When the testcode is executed I see the mobile device unlock screen lights up for a moment but then is turning off. The complete console output is printed below. Does anyone know what the problem can be? Or is there a workaround?
I already tried to execute ADB shell commands from the terminal to unlock the device which works fine.

2020-11-16 15:02:04.670 INFO  c.k.katalon.core.main.TestSuiteExecutor  - START Test Suites/01-meos-test-suite
2020-11-16 15:02:04.780 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostName = xxx    2020-11-16 15:02:04.781 INFO  c.k.katalon.core.main.TestSuiteExecutor  - os = Mac OS X 64bit
2020-11-16 15:02:04.782 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostAddress = xxx
2020-11-16 15:02:04.801 INFO  c.k.katalon.core.main.TestSuiteExecutor  - katalonVersion = 7.2.1.1
Test Suites/01-test-suite
2020-11-16 15:02:05.376 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['deviceId', 'xxxxxxxxxx']
2020-11-16 15:02:05.376 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['adbExecTimeout', '30000.0']
2020-11-16 15:02:05.377 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appWaitActivity', '*']
2020-11-16 15:02:05.378 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appWaitDuration', '30000.0']
2020-11-16 15:02:05.378 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appPackage', 'xxxxxxxx']
2020-11-16 15:02:05.381 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appActivity', 'xxx']
2020-11-16 15:02:05.381 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['unlockType', 'pin']
2020-11-16 15:02:05.381 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['unlockKey', '000001']
e[35m[Appium]e[39m Welcome to Appium v1.17.0
e[35m[Appium]e[39m Non-default server args:
e[35m[Appium]e[39m   port: 59568
e[35m[Appium]e[39m   loglevel: info
e[35m[Appium]e[39m   tmpDir: /var/folders/y1/g57jz0sn2lsdr24d_6rxwymjr5wmy7/T//Katalon/Appium/Temp1605535325434
e[35m[Appium]e[39m   chromedriverPort: 59569
e[35m[Appium]e[39m Deprecated server args:
e[35m[Appium]e[39m   e[31m--chromedriver-porte[39m => --default-capabilities '{"chromedriverPort":59569}'
e[35m[Appium]e[39m Default capabilities, which will be added to each request unless overridden by desired capabilities:
e[35m[Appium]e[39m   chromedriverPort: 59569
e[35m[Appium]e[39m Appium REST http interface listener started on 0.0.0.0:59568
2020-11-16 15:02:46.196 INFO  c.k.k.c.a.driver.AppiumDriverManager     - Appium server started on port 59,568
e[35m[HTTP]e[39m e[37m-->e[39m e[37mGETe[39m e[37m/wd/hub/statuse[39m
e[35m[HTTP]e[39m e[90m{}e[39m
e[35m[HTTP]e[39m e[37m<-- GET /wd/hub/status e[39me[32m200e[39m e[90m6 ms - 68e[39m
e[35m[HTTP]e[39m e[90me[39m
e[35m[HTTP]e[39m e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m
e[35m[HTTP]e[39m e[90m{"desiredCapabilities":{"appPackage":"XXXXXX","appWaitActivity":"*","unlockKey":"000001","deviceId":"XXXXXXX","deviceName":"samsung SM-A530F (Android 9)","platform":"ANDROID","appWaitDuration":"30000.0","appActivity":"XXXX","newCommandTimeout":1800,"adbExecTimeout":"30000.0","platformVersion":"9","automationName":"uiautomator2","unlockType":"pin","autoGrantPermissions":true,"platformName":"Android","udid":"XXXXXXX","systemPort":8278},"capabilities":{"firstMatch":[{"adbExecTimeout":"30000.0","appium:appActivity":"MEOS","appium:appPackage":"XXXXX","appium:appWaitActivity":"*","appium:appWaitDuration":"30000.0","appium:autoGrantPermissions":true,"appium:automationName":"uiautomator2","deviceId":"XXXXXX","appium:deviceName":"samsung SM-A530F (Android 9)","appium:newCommandTimeout":1800,"platform":"ANDROID","platformName":"android","appium:platformVersion":"9","appium:systemPort":8278,"appium:udid":"XXXXXX","unlockKey":"000001e[39m
e[35m[BaseDriver]e[39m The following capabilities are not standard capabilities and should have an extension prefix:
e[35m[BaseDriver]e[39m   adbExecTimeout
e[35m[BaseDriver]e[39m   deviceId
e[35m[BaseDriver]e[39m   platform
e[35m[BaseDriver]e[39m   unlockKey
e[35m[BaseDriver]e[39m   unlockType
e[35m[BaseDriver]e[39m   chromedriverPort
e[35m[Appium]e[39m Appium v1.17.0 creating new AndroidUiautomator2Driver (v1.44.2) session
e[35m[BaseDriver]e[39m Number capability passed in as string. Functionality may be compromised.
e[35m[BaseDriver]e[39m Number capability passed in as string. Functionality may be compromised.
e[35m[BaseDriver]e[39m Capability 'appWaitDuration' changed from string ('30000.0') to integer (30000). This may cause unexpected behavior
e[35m[BaseDriver]e[39m Capability 'adbExecTimeout' changed from string ('30000.0') to integer (30000). This may cause unexpected behavior
e[35m[BaseDriver]e[39m The following capabilities were provided, but are not recognized by Appium:
e[35m[BaseDriver]e[39m   deviceId
e[35m[BaseDriver]e[39m   platform
e[35m[BaseDriver]e[39m Session created with session id: 31c41a27-666f-4fc5-ba6d-92bbc1d29cbf
e[35m[UiAutomator2]e[39m Starting 'XXXXXX' directly on the device
e[35m[ADB]e[39m Found 3 'build-tools' folders under '/Users/xxxxxx/.katalon/tools/android_sdk' (newest first):
e[35m[ADB]e[39m     /Users/xxxxxxxx/.katalon/tools/android_sdk/build-tools/30.0.2
e[35m[ADB]e[39m     /Users/xxxxxxxx/.katalon/tools/android_sdk/build-tools/28.0.3
e[35m[ADB]e[39m     /Users/xxxxxxxx/.katalon/tools/android_sdk/build-tools/28.0.0
e[35m[ADB]e[39m Using 'adb' from '/Users/xxxxxxxx/.katalon/tools/android_sdk/platform-tools/adb'
e[35m[AndroidDriver]e[39m Retrieving device list
e[35m[AndroidDriver]e[39m Using device: 52009d4d42b3b52d
e[35m[ADB]e[39m Using 'adb' from '/Users/xxxxxxx/.katalon/tools/android_sdk/platform-tools/adb'
e[35m[ADB]e[39m Getting device platform version
e[35m[UiAutomator2]e[39m Relaxing hidden api policy
e[35m[AndroidDriver]e[39m No app sent in, not parsing package/activity
e[35m[ADB]e[39m Using 'apksigner.jar' from '/Users/xxxxxx/.katalon/tools/android_sdk/build-tools/30.0.2/lib/apksigner.jar'
e[35m[UiAutomator2]e[39m Server packages are not going to be (re)installed
e[35m[UiAutomator2]e[39m Starting UIAutomator2 server 4.5.5
e[35m[UiAutomator2]e[39m Using UIAutomator2 server from '/Users/xxxxxxxx/dev/appium/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v4.5.5.apk' and test from '/Users/xxxxxxxx/dev/appium/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
e[35m[UiAutomator2]e[39m Waiting up to 30000ms for UiAutomator2 to be online...
e[35m[WD Proxy]e[39m Got response with unknown status: {"code":"ECONNRESET"}
e[35m[WD Proxy]e[39m Got response with unknown status: {"code":"ECONNRESET"}
e[35m[WD Proxy]e[39m Got response with unknown status: {"code":"ECONNRESET"}
e[35m[WD Proxy]e[39m Determined the downstream protocol as 'W3C'
e[35m[AndroidDriver]e[39m Trying to unlock device using pin 000001
e[35m[AndroidDriver]e[39m Waking up the device to unlock it
e[35m[AndroidDriver]e[39m Dismiss notifications from unlock view
e[35m[AndroidDriver]e[39m Trying to dismiss keyguard
e[35m[UiAutomator2]e[39m Restoring hidden api policy to the device default configuration
e[35m[HTTP]e[39m e[37m<-- POST /wd/hub/session e[39me[31m500e[39m e[90m15666 ms - 587e[39m
e[35m[HTTP]e[39m e[90me[39m
2020-11-16 15:03:03.284 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceId = XXXXXXXX
2020-11-16 15:03:03.285 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceName = samsung SM-A530F (Android 9)
2020-11-16 15:03:03.286 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceModel = SM-A530F
2020-11-16 15:03:03.287 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceManufacturer = samsung
2020-11-16 15:03:03.287 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceOS = Android
2020-11-16 15:03:03.288 INFO  c.k.k.c.a.driver.AppiumDriverManager     - deviceOSVersion = 9
2020-11-16 15:03:03.304 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Unable to start app with application ID: 'XXXXXX' (Root cause: org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Error finding unlock pin buttons!
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'C02V30RRJ1GG', ip: '192.168.1.5', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '1.8.0_181'
Driver info: driver.version: MobileDriverFactory$startMobileDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error finding unlock pin buttons!
    at getResponseForW3CError (/Users/xxxxxxxx/dev/appium/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
    at asyncHandler (/Users/xxxxxxxx/dev/appium/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:392:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'C02V30RRJ1GG', ip: '192.168.1.5', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '1.8.0_181'
Driver info: driver.version: MobileDriverFactory$startMobileDriver
	at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
	at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
	at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:85)
	at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.<init>(SwipeableAndroidDriver.java:24)
	at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:497)
	at com.kms.katalon.core.appium.driver.AppiumDriverManager.createMobileDriver(AppiumDriverManager.java:479)
	at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory.startMobileDriver(MobileDriverFactory.java:339)
	at com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory$startMobileDriver.call(Unknown Source)
	at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy:40)
	at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword$_startApplication_closure1.doCall(StartExistingApplicationKeyword.groovy)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
	at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain$runKeyword.call(Unknown Source)
	at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.startApplication(StartExistingApplicationKeyword.groovy:43)
	at com.kms.katalon.core.mobile.keyword.builtin.StartExistingApplicationKeyword.execute(StartExistingApplicationKeyword.groovy:34)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.startExistingApplication(MobileBuiltInKeywords.groovy:89)
	at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$startExistingApplication.call(Unknown Source)
	at MeosTestListener.beforeTestSuite(MeosTestListener.groovy:81)
	at MeosTestListener.invokeMethod(MeosTestListener.groovy)
	at com.kms.katalon.core.context.internal.TestHooker.invokeMethod(TestHooker.java:111)
	at com.kms.katalon.core.context.internal.TestHooker.lambda$3(TestHooker.java:95)
	at com.kms.katalon.core.context.internal.TestHooker.invokeContextMethods(TestHooker.java:94)
	at com.kms.katalon.core.context.internal.TestListenerCollector.lambda$3(TestListenerCollector.java:88)
	at com.kms.katalon.core.context.internal.TestListenerCollector.handleListenerEvent(TestListenerCollector.java:85)
	at com.kms.katalon.core.context.internal.ExecutionEventManager.publicEvent(ExecutionEventManager.java:36)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:89)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1605535317237.run(TempTestSuite1605535317237.groovy:36)
Caused by: java.lang.reflect.InvocationTargetException
	at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
	... 38 more

As a workaround I want to run some Appium commands to unlock the phone with a pin code before I start an existing application with this code:

AppiumDriver<MobileElement> driver = MobileDriverFactory.getDriver()
driver.pressKeyCode(82);
Thread.sleep(2000);
driver.getKeyboard().sendKeys("000001");
Thread.sleep(1000);
driver.pressKeyCode(66);
Thread.sleep(1000);

But when I put this code before the Mobile.startExistingApplication(‘app.name’) command I get an error:

2020-11-18 15:06:05.683 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2020-11-18 15:06:05.685 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/Unlock screen
2020-11-18 15:06:06.308 DEBUG testcase.Unlock screen                   - 1: capabilities = new org.openqa.selenium.remote.DesiredCapabilities()
2020-11-18 15:06:06.318 DEBUG testcase.Unlock screen                   - 2: setMobileDriverPreferencesProperty("deviceId", "52006f995XXX")
2020-11-18 15:06:06.321 DEBUG testcase.Unlock screen                   - 3: setMobileDriverPreferencesProperty("adbExecTimeout", "60000")
2020-11-18 15:06:06.325 DEBUG testcase.Unlock screen                   - 4: setMobileDriverPreferencesProperty("appWaitActivity", "*")
2020-11-18 15:06:06.327 DEBUG testcase.Unlock screen                   - 5: comment("Unlock phone")
2020-11-18 15:06:06.371 INFO  c.k.k.c.keyword.builtin.CommentKeyword   - Unlock phone
2020-11-18 15:06:06.371 DEBUG testcase.Unlock screen                   - 6: driver = getDriver()
2020-11-18 15:06:06.566 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/Unlock screen FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: No application is started yet.

Does anyone know if this is possible? or is there another workaround?