Adding new Battery Saver location mode.

When this new mode (LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF) is
enabled, LocationManagerService will avoid sending almost all
LocationRequests to providers. The only requests that will continue to
be sent will be providers are the requests that ignore location
settings.

Bug: 121256487
Bug: 122849003
Bug: 119261320
Test: atest android.os.cts.batterysaving.BatterySaverLocationTest
Change-Id: Iee95a6fb5ca11d4db7a0f0661bf3cb1051a5d710
This commit is contained in:
Kweku Adams
2019-02-01 16:03:27 -08:00
parent 6dabb47132
commit 4fb074e7f4
10 changed files with 160 additions and 22 deletions

View File

@@ -1626,6 +1626,23 @@ public class LocationManager {
setTestProviderStatus(provider, LocationProvider.AVAILABLE, null, 0L);
}
/**
* Get the last list of {@link LocationRequest}s sent to the provider.
*
* @hide
*/
@TestApi
@NonNull
public List<LocationRequest> getTestProviderCurrentRequests(String providerName) {
checkProvider(providerName);
try {
return mService.getTestProviderCurrentRequests(providerName,
mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
// --- GPS-specific support ---
// This class is used to send Gnss status events to the client's specific thread.