From 7cec13d66e48c04821815cca7ef9a67974f71649 Mon Sep 17 00:00:00 2001 From: Eric Park Date: Sun, 24 Mar 2024 10:34:39 -0400 Subject: [PATCH] Use first user account on attached Android devices Fixes #4396 This hardcodes the user ID of 0 when fetching the package list on Android, otherwise it will fail on devices that have multiple users (devices with the work profile or Samsung Secure Folder (Knox) enabled). --- detox/src/devices/common/drivers/android/exec/ADB.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detox/src/devices/common/drivers/android/exec/ADB.js b/detox/src/devices/common/drivers/android/exec/ADB.js index 3600972fac..28b03e1fae 100644 --- a/detox/src/devices/common/drivers/android/exec/ADB.js +++ b/detox/src/devices/common/drivers/android/exec/ADB.js @@ -96,7 +96,7 @@ class ADB { } async isPackageInstalled(deviceId, packageId) { - const output = await this.shell(deviceId, `pm list packages ${packageId}`); + const output = await this.shell(deviceId, `pm list packages --user 0 ${packageId}`); const packageRegexp = new RegExp(`^package:${escape.inQuotedRegexp(packageId)}$`, 'm'); const isInstalled = packageRegexp.test(output);