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

Commit 942d3843 authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Add log detail on throttling events

Record the throttled/unthrottled provider request as well.

Bug: 184851488
Test: manual
Change-Id: Ie5248f315d2fa44382cc0932925c6e91b226a2b8
parent 6c84cf58
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -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;
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -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");
                }