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

Commit 0bc78fec authored by Dante Russo's avatar Dante Russo Committed by Steve Kondik
Browse files

Combo Provider: Specific location screening

Only screen network locations if Combo provider is
the connected network location provider.

CRs-fixed: 608477

Change-Id: I513bddae9cff493dd9aac4460168864548e4bfb4
parent 491ac57c
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -2138,11 +2138,21 @@ public class LocationManagerService extends ILocationManager.Stub {

    private Location screenLocationLocked(Location location, String provider) {

        if (mComboNlpPackageName == null || false == provider.equals(LocationManager.NETWORK_PROVIDER)) {
        LocationProviderProxy providerProxy =
                (LocationProviderProxy)mProvidersByName.get(LocationManager.NETWORK_PROVIDER);
        if (mComboNlpPackageName == null || providerProxy == null ||
            false == provider.equals(LocationManager.NETWORK_PROVIDER) ||
            isMockProvider(LocationManager.NETWORK_PROVIDER)) {
            return location;
        }

        String connectedNlpPackage = providerProxy.getConnectedPackageName();
        if (connectedNlpPackage == null || !connectedNlpPackage.equals(mComboNlpPackageName)) {
            return location;
        }

        Bundle extras = location.getExtras();
        boolean isBeingScreened = false;
        if (extras == null) {
            extras = new Bundle();
        }
@@ -2154,7 +2164,10 @@ public class LocationManagerService extends ILocationManager.Stub {
            if (records != null) {
                for (UpdateRecord r : records) {
                    if (r.mReceiver.mPackageName.equals(mComboNlpPackageName)) {
                        if (!isBeingScreened) {
                            isBeingScreened = true;
                            extras.putBoolean(mComboNlpScreenMarker, true);
                        }
                        // send location to Combo Nlp for screening
                        if (!r.mReceiver.callLocationChangedLocked(location)) {
                            Slog.w(TAG, "RemoteException calling onLocationChanged on "
@@ -2164,10 +2177,12 @@ public class LocationManagerService extends ILocationManager.Stub {
                                Log.d(TAG, "Sending location for screening");
                            }
                        }
                        return null;
                    }
                }
            }
            if (isBeingScreened) {
                return null;
            }
            if (D) {
                Log.d(TAG, "Not screening locations");
            }