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

Commit 9f53a8d8 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Combo Provider: Specific location screening"

parents 416b35cd 03bf383a
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -2135,11 +2135,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();
        }
@@ -2151,7 +2161,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 "
@@ -2161,10 +2174,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");
            }