Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15799756 authored by Calvin On's avatar Calvin On
Browse files

Fix PEERS_MAC_ADDRESS permission for Ble Scanning.

This changes the location permissions check to only throw a SecurityException
if *both* location and peers mac address permissions are missing.

Bug: 27837639
Change-Id: I5e10c8f0564d1f7edab23ad22dbd5aa5fdcbbf76
parent 55ef0b58
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -291,8 +291,13 @@ final public class Utils {
        }
        // Enforce location permission for apps targeting M and later versions
        if (isMApp(context, callingPackage)) {
            // PEERS_MAC_ADDRESS is another way to get scan results without
            // requiring location permissions, so only throw an exception here
            // if PEERS_MAC_ADDRESS permission is missing as well
            if (!checkCallerHasPeersMacAddressPermission(context)) {
                throw new SecurityException("Need ACCESS_COARSE_LOCATION or "
                        + "ACCESS_FINE_LOCATION permission to get scan results");
            }
        } else {
            // Pre-M apps running in the foreground should continue getting scan results
            if (isForegroundApp(context, callingPackage)) {