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

Commit 3fe9e991 authored by Dante Russo's avatar Dante Russo Committed by Steve Kondik
Browse files

gps: LocationManager CTS proximity test fix

CTS proximity tests needs to use GeoFenceManager
for GeoFences to be able to see mock locations
CRs-Fixed: 452172

Change-Id: Ie7fca5e8078340e8fbbce6f9bb6a4cc62b72866d
parent a7b5ab98
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ public class LocationManagerService extends ILocationManager.Stub {
    private GeofenceManager mGeofenceManager;
    private String mGeoFencerPackageName;
    private GeoFencerBase mGeoFencer;
    private boolean mGeoFencerEnabled;
    private PackageManager mPackageManager;
    private PowerManager mPowerManager;
    private GeocoderProxy mGeocodeProvider;
@@ -199,6 +200,7 @@ public class LocationManagerService extends ILocationManager.Stub {
        super();
        mContext = context;
        mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
        mGeoFencerEnabled = false;

        if (D) Log.d(TAG, "Constructed");

@@ -437,8 +439,10 @@ public class LocationManagerService extends ILocationManager.Stub {
        if (mGeoFencerPackageName != null &&
                mPackageManager.resolveService(new Intent(mGeoFencerPackageName), 0) != null) {
            mGeoFencer = GeoFencerProxy.getGeoFencerProxy(mContext, mGeoFencerPackageName);
            mGeoFencerEnabled = true;
        } else {
            mGeoFencer = null;
            mGeoFencerEnabled = false;
        }

    }
@@ -1502,7 +1506,7 @@ public class LocationManagerService extends ILocationManager.Stub {
        }
        long identity = Binder.clearCallingIdentity();
        try {
            if (mGeoFencer != null) {
            if (mGeoFencer != null && mGeoFencerEnabled) {
                long expiration;
                if (sanitizedRequest.getExpireAt() == Long.MAX_VALUE) {
                    expiration = -1; // -1 means forever
@@ -1531,7 +1535,7 @@ public class LocationManagerService extends ILocationManager.Stub {
        // geo-fence manager uses the public location API, need to clear identity
        long identity = Binder.clearCallingIdentity();
        try {
            if (mGeoFencer != null) {
            if (mGeoFencer != null && mGeoFencerEnabled) {
                mGeoFencer.remove(intent);
            } else {
                mGeofenceManager.removeFence(geofence, intent);
@@ -2067,6 +2071,9 @@ public class LocationManagerService extends ILocationManager.Stub {
            if (mProvidersByName.get(name) != null) {
                throw new IllegalArgumentException("Provider \"" + name + "\" already exists");
            }

            mGeoFencerEnabled = false;

            addProviderLocked(provider);
            mMockProviders.put(name, provider);
            mLastLocation.put(name, null);
@@ -2087,6 +2094,10 @@ public class LocationManagerService extends ILocationManager.Stub {
            long identity = Binder.clearCallingIdentity();
            removeProviderLocked(mProvidersByName.get(provider));

            if (mGeoFencer != null) {
                mGeoFencerEnabled = true;
            }

            // reinstate real provider if available
            LocationProviderInterface realProvider = mRealProviders.get(provider);
            if (realProvider != null) {
@@ -2233,7 +2244,7 @@ public class LocationManagerService extends ILocationManager.Stub {
            }

            mGeofenceManager.dump(pw);
            if (mGeoFencer != null) {
            if (mGeoFencer != null && mGeoFencerEnabled) {
                mGeoFencer.dump(pw, "");
            }