Add API to expose ignore settings whitelist for GTS

Bug: 124517571
Test: manually
Change-Id: I846f9112c3cc3dde1466ff13e740ccf72c16b833
This commit is contained in:
Soonil Nagarkar
2019-02-14 17:21:33 -08:00
parent 93d196b3a8
commit 5140e4fb86
4 changed files with 22 additions and 1 deletions

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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) {