fix(android): grant all permissions after resetting app state#4844
fix(android): grant all permissions after resetting app state#4844
Conversation
e1fb2a2 to
e22443c
Compare
e22443c to
f29156c
Compare
d4vidi
left a comment
There was a problem hiding this comment.
This is all really cool so it makes it more difficult to be breaking the bad news -
In where Detox for Android is right now, we just always install apps with all permissions granted in advance (see the -g flag in the ADB install function) -
So it's really great we can allow for permissions granularity within a reasonable effort but unfortunately, first we're going to have to undo the full-permissions as a default (thus addressing a years outstanding long feature request).
I suggest that for this specific scenario, we'd just stick to just granting all permissions right after the reset, keeping things as seamless as possible.
|
Is there an update on this issue? @noomorph |
|
Mmm, I suggest this approach, @d4vidi
Speaking Bash: if [ -n "$APP_PERMISSIONS_MAP" ]; then
# Install without -g
adb install "$APK_PATH"
# Grant each permission explicitly
for perm in $APP_PERMISSIONS_MAP; do
adb shell pm grant "$PACKAGE_NAME" "$perm"
done
else
# Install with -g
adb install -g "$APK_PATH"
# Fallback: grant all permissions in resetAppState
adb shell pm grant "$PACKAGE_NAME" --all-permissions
fi
|
f29156c to
ad5b655
Compare
3e6efad to
6cbf373
Compare
6cbf373 to
e7356f2
Compare
Description
In this pull request, I have added extra calls to adb shell
pm grant --all-permissionsto imitate ouradb install -gcalls for normal case.