Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox test fails to install and launch if Samsung Secure Folder is enabled #4396

Open
1 of 2 tasks
ericswpark opened this issue Mar 11, 2024 · 0 comments · May be fixed by #4421
Open
1 of 2 tasks

Detox test fails to install and launch if Samsung Secure Folder is enabled #4396

ericswpark opened this issue Mar 11, 2024 · 0 comments · May be fixed by #4421

Comments

@ericswpark
Copy link

ericswpark commented Mar 11, 2024

What happened?

If Samsung Secure Folder is enabled, a new user with id 150 is created, which makes certain adb invocations fail.

What was the expected behaviour?

Detox should use the default user ID of 0 when running ADB commands.

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

  • Enable Samsung Secure Folder
  • Attempt to run Detox Android attached tests

In what environment did this happen?

Detox version: 20.18.4
React Native version: 0.73.4
Has Fabric (React Native's new rendering system) enabled: (yes/no) N/A
Node version: v21.6.1
Device model: Samsung Galaxy Z Fold5
Android version: 14
Test-runner (select one): jest

Detox logs

Detox logs
 FAIL  e2e/initial-launch-screen.test.js
  ● Test suite failed to run
                                                                                 
    ChildProcessError: Command failed: "D:\Android\Sdk\platform-tools\adb.EXE" -s DEVIDHERE shell "pm list packages app.package.name"

    Exception occurred while executing 'list':
    java.lang.SecurityException: Shell does not have permission to access user 150
     com.android.server.am.ActivityManagerService.handleIncomingUser:15882 android.app.ActivityManager.handleIncomingUser:5133 com.android.server.pm.PackageManagerShellCommand.translateUserId:3733
        at com.android.server.am.UserController.handleIncomingUser(UserController.java:2892)
        at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:15882)
        at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:5133)
        at com.android.server.pm.PackageManagerShellCommand.translateUserId(PackageManagerShellCommand.java:3733)
        at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:1074)
        at com.android.server.pm.PackageManagerShellCommand.runListPackages(PackageManagerShellCommand.java:960)
        at com.android.server.pm.PackageManagerShellCommand.runList(PackageManagerShellCommand.java:800)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:237)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:7088)
        at android.os.Binder.shellCommand(Binder.java:1104)
        at android.os.Binder.onTransact(Binder.java:914)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4905)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:7072)
        at android.os.Binder.execTransactInternal(Binder.java:1380)
        at android.os.Binder.execTransact(Binder.java:1311)
     `"D:\Android\Sdk\platform-tools\adb.EXE" -s DEVIDHERE shell "pm list packages app.package.name"` (exited with error code 255)

      at callback (node_modules/child-process-promise/lib/index.js:33:27)        

Test Suites: 1 failed, 1 total
Tests:       0 total                                                             
Snapshots:   0 total
Time:        1.723 s
Ran all test suites.
18:54:00.569 detox[1536] E Command failed with exit code = 1:                    
jest --config e2e/jest.config.js   

Device logs

Device logs

N/A

More data, please!

Also see:

ericswpark added a commit to ericswpark/Detox that referenced this issue Mar 24, 2024
Fixes wix#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).
@ericswpark ericswpark linked a pull request Mar 24, 2024 that will close this issue
2 tasks
ericswpark added a commit to ericswpark/Detox that referenced this issue Mar 26, 2024
Fixes wix#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).
ericswpark added a commit to Purdue-CS307-tsundoku/tsundoku that referenced this issue Mar 29, 2024
See issue wix/Detox#4396 for more info
PR of this patch available at wix/Detox#4421
Remove this patch once the PR is merged or an alternative fix is
applied!
ericswpark added a commit to ericswpark/Detox that referenced this issue Apr 17, 2024
Fixes wix#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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant