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

Commit fddea604 authored by Victoria Lease's avatar Victoria Lease Committed by Android Git Automerger
Browse files

am dfc8e799: Merge "Handle other providers in isAllowedProviderSafe()" into jb-mr1-dev

* commit 'dfc8e799':
  Handle other providers in isAllowedProviderSafe()
parents b1cc90c5 dfc8e799
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -640,7 +640,27 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
                    == PackageManager.PERMISSION_GRANTED) ||
                    (mContext.checkCallingOrSelfPermission(ACCESS_COARSE_LOCATION)
                    == PackageManager.PERMISSION_GRANTED);
        } else {
            // mock providers
            LocationProviderInterface lp = mMockProviders.get(provider);
            if (lp != null) {
                ProviderProperties properties = lp.getProperties();
                if (properties != null) {
                    if (properties.mRequiresSatellite) {
                        // provider requiring satellites require FINE permission
                        return mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
                                == PackageManager.PERMISSION_GRANTED;
                    } else if (properties.mRequiresNetwork || properties.mRequiresCell) {
                        // provider requiring network and or cell require COARSE or FINE
                        return (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
                                == PackageManager.PERMISSION_GRANTED) ||
                                (mContext.checkCallingOrSelfPermission(ACCESS_COARSE_LOCATION)
                                 == PackageManager.PERMISSION_GRANTED);
                    }
                }
            }
        }

        return false;
    }