Match ONE_TIME flag on location accuracy upgrade
When an app's "Location accuracy" is enabled, this essentially means
that both FINE_LOCATION and COARSE_LOCATION are granted. (When it's
disabled, the app is only granted COARSE_LOCATION.)
If an app only requests COARSE_LOCATION, the user is asked whether to
mark it with the ONE_TIME flag (or not). If the same app then requests
FINE_LOCATION, the user is (again) asked whether to mark *that*
permission with the ONE_TIME flag. The result is that both permissions
can independently be given the ONE_TIME flag. For certain
permutations, this makes sense. But it does not makes sense for
COARSE_LOCATION to have the ONE_TIME flag while FINE_LOCATION does not.
To solve this, whenever the "Location accuracy" becomes enabled (i.e.,
FINE_LOCATION is granted), then copy FINE_LOCATION's ONE_TIME flag
(which will have just recently been selected by the user) to
COARSE_LOCATION.
Bug: 341599029
Test: atest OneTimePermissionTest
Change-Id: Ib66f718cc0d28a6e8a10abd05c01cffc2e9ed7de
1 file changed