Additional debug logging

-Add some additional logging around screen off and location battery
saver mode.
-Fix a minor bug in refreshing locationSettingsIgnored location
requests.

Test: manual + presubmit
Change-Id: I897d65dc8e9af05f3f9f5bf4233e6a58c8aec55a
This commit is contained in:
Soonil Nagarkar
2020-10-05 13:57:39 -07:00
parent 6ca55a317a
commit 35017cbc13
3 changed files with 24 additions and 2 deletions

View File

@@ -524,16 +524,18 @@ class LocationProviderManager extends
}
}
if (baseRequest.isLocationSettingsIgnored()) {
boolean locationSettingsIgnored = baseRequest.isLocationSettingsIgnored();
if (locationSettingsIgnored) {
// if we are not currently allowed use location settings ignored, disable it
if (!mSettingsHelper.getIgnoreSettingsPackageWhitelist().contains(
getIdentity().getPackageName()) && !mLocationManagerInternal.isProvider(
null, getIdentity())) {
builder.setLocationSettingsIgnored(false);
locationSettingsIgnored = false;
}
}
if (!baseRequest.isLocationSettingsIgnored() && !isThrottlingExempt()) {
if (!locationSettingsIgnored && !isThrottlingExempt()) {
// throttle in the background
if (!mForeground) {
builder.setIntervalMillis(max(baseRequest.getIntervalMillis(),

View File

@@ -16,7 +16,13 @@
package com.android.server.location.util;
import static android.os.PowerManager.locationPowerSaveModeToString;
import static com.android.server.location.LocationManagerService.D;
import static com.android.server.location.LocationManagerService.TAG;
import android.os.PowerManager.LocationPowerSaveMode;
import android.util.Log;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -60,7 +66,12 @@ public abstract class LocationPowerSaveModeHelper {
protected final void notifyLocationPowerSaveModeChanged(
@LocationPowerSaveMode int locationPowerSaveMode) {
if (D) {
Log.d(TAG, "location power save mode is now " + locationPowerSaveModeToString(
locationPowerSaveMode));
}
mLocationEventLog.logLocationPowerSaveMode(locationPowerSaveMode);
for (LocationPowerSaveModeChangedListener listener : mListeners) {
listener.onLocationPowerSaveModeChanged(locationPowerSaveMode);
}

View File

@@ -16,6 +16,11 @@
package com.android.server.location.util;
import static com.android.server.location.LocationManagerService.D;
import static com.android.server.location.LocationManagerService.TAG;
import android.util.Log;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -55,6 +60,10 @@ public abstract class ScreenInteractiveHelper {
}
protected final void notifyScreenInteractiveChanged(boolean interactive) {
if (D) {
Log.d(TAG, "screen interactive is now " + interactive);
}
for (ScreenInteractiveChangedListener listener : mListeners) {
listener.onScreenInteractiveChanged(interactive);
}