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

Use first user account on attached Android devices #4421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ericswpark
Copy link

Description

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).

In this pull request, I have hardcoded in a value of user ID 0 when listing packages using ADB.

This should work in the majority of cases -- however there might be some developers that want to test their app in a work profile. I really need Android tests to work right now, so I just hardcoded in the ID value, but maybe a future PR can make this a configurable option. I don't foresee a ton of use for this as there aren't any issues filed about it (other than mine).


None of the below are applicable.

For features/enhancements:

  • I have added/updated the relevant references in the documentation files.

For API changes:

  • I have made the necessary changes in the types index file.

@ericswpark
Copy link
Author

Just a quick note: the value of 0 is the default for any Android device, and even Expo uses it in their codebase, see: expo/expo@275d855 (yes they have it user configurable but the default value set is 0)

@noomorph
Copy link
Collaborator

@ericswpark, I see what the idea is, but I need to make sure whether this is actually the ONLY place that needs this addition. For now, I suggest using patch-package, if this helps you.

I'll try to find a spare time to look at this more closely in a week or two, with some Android phone at my disposal.

ericswpark added a commit to Purdue-CS307-tsundoku/tsundoku that referenced this pull request 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
Copy link
Author

@noomorph I know you want to take a closer look to see if there are additional places that need the patch, but can those be added in a separate PR/branch? I've been running with the patch for the last few weeks and it has been rock stable so far.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detox test fails to install and launch if Samsung Secure Folder is enabled
2 participants