From 3d6c31a320284b054489d49ba56db816c98d21f3 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Tue, 16 Apr 2019 14:42:42 -0700 Subject: [PATCH] Always request coarse location with fine location If an app can access the fine location it can obviously also access the coarse location. There is code inside checkPermission that encapsulates the logic. This code fixes two issues: - checkPermission might return for the coarse location even though the permission is not even mentioned in PackageInfo.requestedPermissions. Now the coarse location is always added to requstedPermissions when the fine location is in the manifest even if the app does not have the coarse location in the manifest - If the app requests the fine location only we might unintentionally kill the requesting app. 1. App does not have any permissions granted 2. App request FINE_LOCATION 3. Permission controller reads (and caches) permission state: FINE=revoked, COARSE=revoked 4. User grants FINE_LOCATION -> Perm controller updates internal state: FINE=revoked, COARSE=revoke 5. Perm controller applies FINE_LOCATION state to the system 6. Perm controller looks as COARSE and checks if it is granted. Because it is implied, it now shows up as granted. Hence perm controller will try to revoke it which kills the app The solution is that it will be impossible to only request FINE_LOCATION by itself. This change will automatically add requesting COARSE_LOCATION, whenever FINE_LOCATION is requested Fixes: 130358762 Test: Reproduced scenario in bug 130358762 Change-Id: I217c0b23063617f60b98c805af1d122a6ec0608e --- data/etc/platform.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 0e957df4dc14c..c54208b96031a 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -180,6 +180,9 @@ + + +