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

Commit 54dedc4d authored by Jason Monk's avatar Jason Monk Committed by Android Git Automerger
Browse files

am 3358eb08: Merge "Add way to get the network location provider package" into mnc-dev

* commit '3358eb08':
  Add way to get the network location provider package
parents 55353cfb 3358eb08
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,