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

Commit 1ebe049a authored by Mike Lockwood's avatar Mike Lockwood Committed by Android Git Automerger
Browse files

am 1b571bd3: am 1d28a840: Merge "Location Manager: Fix...

am 1b571bd3: am 1d28a840: Merge "Location Manager: Fix LocationManager.getBestProvider filtering." into gingerbread
parents 977d3622 1b571bd3
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -577,15 +577,16 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
                 || LocationManager.PASSIVE_PROVIDER.equals(provider))
            && (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED)) {
            throw new SecurityException("Requires ACCESS_FINE_LOCATION permission");
            throw new SecurityException("Provider " + provider
                    + " requires ACCESS_FINE_LOCATION permission");
        }
        if (LocationManager.NETWORK_PROVIDER.equals(provider)
            && (mContext.checkCallingOrSelfPermission(ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED)
            && (mContext.checkCallingOrSelfPermission(ACCESS_COARSE_LOCATION)
                != PackageManager.PERMISSION_GRANTED)) {
            throw new SecurityException(
                "Requires ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission");
            throw new SecurityException("Provider " + provider
                    + " requires ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission");
        }
    }

@@ -744,9 +745,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
    private LocationProviderInterface best(List<String> providerNames) {
        ArrayList<LocationProviderInterface> providers;
        synchronized (mLock) {
            providers = new ArrayList<LocationProviderInterface>(mProviders.size());
            for (int i = mProviders.size() - 1; i >= 0; i--) {
                providers.add(mProviders.get(i));
            providers = new ArrayList<LocationProviderInterface>(providerNames.size());
            for (String name : providerNames) {
                providers.add(mProvidersByName.get(name));
            }
        }