Revert "Revert "Replace permissions API with onPackageInstalled().""
This reverts commit 84ee067aca0ef89d310b05bff0b8e4d53277b3cd.
Reason for revert: Fixed the issue where allowlisted restricted
permissions were removed upon package update due to the original
CL. This was caused by the fact that previously the allowlisted
permissions passed in by installer are used to replace the set of
existing allowlisted permissions, and this is inconsistent with the
granted permissions passed in by installer where we simply grant the
specified permissions instead of revoking permissions that weren't in
the list passed in. So I believe making the allowlisted permissions an
addition instead of replacement makes more sense and also solves the
issue.
The other change is that onPackageInstalled() is now called on a
per-user basis, because permission allowlist addition has to be done
per-user unlike the previous replacement. This also gives us a cleaner
API.
Bug: 158736025
Test: RestrictedStoragePermissionTest
Change-Id: I7a47afebf88406dc16f64942db6dcaff4e18ab75
3 files changed