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

Commit 1b8604e9 authored by Tushar Janefalkar's avatar Tushar Janefalkar Committed by Linux Build Service Account
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 51d71e80
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -2331,11 +2331,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();
        }
@@ -2347,8 +2357,11 @@ 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 Combo Nlp for screening
                        }
                        // send location to Combo Nlp for screening
                        if (!r.mReceiver.callLocationChangedLocked(location)) {
                            Slog.w(TAG, "RemoteException calling onLocationChanged on "
                                   + r.mReceiver);
@@ -2357,10 +2370,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");
            }