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

Commit 3358eb08 authored by Jason Monk's avatar Jason Monk Committed by Android (Google) Code Review
Browse files

Merge "Add way to get the network location provider package" into mnc-dev

parents 0925136b b71218ae
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ interface ILocationManager
    String getBestProvider(in Criteria criteria, boolean enabledOnly);
    boolean providerMeetsCriteria(String provider, in Criteria criteria);
    ProviderProperties getProviderProperties(String provider);
    String getNetworkProviderPackage();
    boolean isProviderEnabled(String provider);

    void addTestProvider(String name, in ProviderProperties properties, String opPackageName);
+21 −0
Original line number Diff line number Diff line
@@ -1958,6 +1958,27 @@ public class LocationManagerService extends ILocationManager.Stub {
        return p.getProperties();
    }

    /**
     * @return null if the provider does not exist
     * @throws SecurityException if the provider is not allowed to be
     * accessed by the caller
     */
    @Override
    public String getNetworkProviderPackage() {
        LocationProviderInterface p;
        synchronized (mLock) {
            if (mProvidersByName.get(LocationManager.NETWORK_PROVIDER) == null) {
                return null;
            }
            p = mProvidersByName.get(LocationManager.NETWORK_PROVIDER);
        }

        if (p instanceof LocationProviderProxy) {
            return ((LocationProviderProxy) p).getConnectedPackageName();
        }
        return null;
    }

    @Override
    public boolean isProviderEnabled(String provider) {
        // Fused provider is accessed indirectly via criteria rather than the provider-based APIs,