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
Loading
Please register or sign in to comment