From 942d384389833fd5f3651c0477470b44aa68df56 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Thu, 8 Apr 2021 10:03:33 -0700 Subject: [PATCH] Add log detail on throttling events Record the throttled/unthrottled provider request as well. Bug: 184851488 Test: manual Change-Id: Ie5248f315d2fa44382cc0932925c6e91b226a2b8 --- .../server/location/eventlog/LocationEventLog.java | 13 ++++++++----- .../StationaryThrottlingLocationProvider.java | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/location/eventlog/LocationEventLog.java b/services/core/java/com/android/server/location/eventlog/LocationEventLog.java index 045e06d001e6b..2ffc62a0731bf 100644 --- a/services/core/java/com/android/server/location/eventlog/LocationEventLog.java +++ b/services/core/java/com/android/server/location/eventlog/LocationEventLog.java @@ -178,8 +178,9 @@ public class LocationEventLog extends LocalEventLog { } /** Logs that a provider has entered or exited stationary throttling. */ - public void logProviderStationaryThrottled(String provider, boolean throttled) { - addLogEvent(EVENT_PROVIDER_STATIONARY_THROTTLED, provider, throttled); + public void logProviderStationaryThrottled(String provider, boolean throttled, + ProviderRequest request) { + addLogEvent(EVENT_PROVIDER_STATIONARY_THROTTLED, provider, throttled, request); } /** Logs that the location power save mode has changed. */ @@ -217,7 +218,7 @@ public class LocationEventLog extends LocalEventLog { (Integer) args[1], (CallerIdentity) args[2]); case EVENT_PROVIDER_STATIONARY_THROTTLED: return new ProviderStationaryThrottledEvent(timeDelta, (String) args[0], - (Boolean) args[1]); + (Boolean) args[1], (ProviderRequest) args[2]); case EVENT_LOCATION_POWER_SAVE_MODE_CHANGE: return new LocationPowerSaveModeEvent(timeDelta, (Integer) args[0]); default: @@ -355,17 +356,19 @@ public class LocationEventLog extends LocalEventLog { private static final class ProviderStationaryThrottledEvent extends ProviderEvent { private final boolean mStationaryThrottled; + private final ProviderRequest mRequest; ProviderStationaryThrottledEvent(long timeDelta, String provider, - boolean stationaryThrottled) { + boolean stationaryThrottled, ProviderRequest request) { super(timeDelta, provider); mStationaryThrottled = stationaryThrottled; + mRequest = request; } @Override public String getLogString() { return mProvider + " provider stationary/idle " + (mStationaryThrottled ? "throttled" - : "unthrottled"); + : "unthrottled") + ", request = " + mRequest; } } diff --git a/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java b/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java index ab7e526a8e682..22a675ad39ab6 100644 --- a/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java +++ b/services/core/java/com/android/server/location/provider/StationaryThrottlingLocationProvider.java @@ -206,7 +206,7 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation if (D) { Log.d(TAG, mName + " provider stationary throttled"); } - EVENT_LOG.logProviderStationaryThrottled(mName, true); + EVENT_LOG.logProviderStationaryThrottled(mName, true, mOutgoingRequest); } if (mDeliverLastLocationCallback != null) { @@ -224,7 +224,7 @@ public final class StationaryThrottlingLocationProvider extends DelegateLocation } } else { if (oldThrottlingIntervalMs != INTERVAL_DISABLED) { - EVENT_LOG.logProviderStationaryThrottled(mName, false); + EVENT_LOG.logProviderStationaryThrottled(mName, false, mOutgoingRequest); if (D) { Log.d(TAG, mName + " provider stationary unthrottled"); }