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

Commit 5140e4fb authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Add API to expose ignore settings whitelist for GTS

Bug: 124517571
Test: manually
Change-Id: I846f9112c3cc3dde1466ff13e740ccf72c16b833
parent 93d196b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ package android.location {

  public class LocationManager {
    method public String[] getBackgroundThrottlingWhitelist();
    method public String[] getIgnoreSettingsWhitelist();
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper);
    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean, android.os.UserHandle);
+2 −1
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ interface ILocationManager
    // for reporting callback completion
    void locationCallbackFinished(ILocationListener listener);

    // used by gts tests to verify throttling whitelist
    // used by gts tests to verify whitelists
    String[] getBackgroundThrottlingWhitelist();
    String[] getIgnoreSettingsWhitelist();
}
+12 −0
Original line number Diff line number Diff line
@@ -413,6 +413,18 @@ public class LocationManager {
        }
    }

    /**
     * @hide
     */
    @TestApi
    public String[] getIgnoreSettingsWhitelist() {
        try {
            return mService.getIgnoreSettingsWhitelist();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide - hide this constructor because it has a parameter
     * of type ILocationManager, which is a system private class. The
+7 −0
Original line number Diff line number Diff line
@@ -2136,6 +2136,13 @@ public class LocationManagerService extends ILocationManager.Stub {
        }
    }

    @Override
    public String[] getIgnoreSettingsWhitelist() {
        synchronized (mLock) {
            return mIgnoreSettingsPackageWhitelist.toArray(new String[0]);
        }
    }

    @GuardedBy("mLock")
    private boolean isThrottlingExemptLocked(CallerIdentity callerIdentity) {
        if (callerIdentity.mUid == Process.SYSTEM_UID) {