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

Commit 7392f388 authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Add # of location info to aggregate stats" into sc-dev

parents d9b5f615 dedc9b52
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1253,7 +1253,8 @@ public class LocationManagerService extends ILocationManager.Stub {
        ArrayMap<String, ArrayMap<String, LocationEventLog.AggregateStats>> aggregateStats =
                mEventLog.copyAggregateStats();
        for (int i = 0; i < aggregateStats.size(); i++) {
            ipw.println(aggregateStats.keyAt(i));
            ipw.print(aggregateStats.keyAt(i));
            ipw.println(":");
            ipw.increaseIndent();
            ArrayMap<String, LocationEventLog.AggregateStats> providerStats =
                    aggregateStats.valueAt(i);
+9 −1
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class LocationEventLog extends LocalEventLog {
        if (Build.IS_DEBUGGABLE || D) {
            addLogEvent(EVENT_PROVIDER_DELIVER_LOCATION, provider, numLocations, identity);
        }
        getAggregateStats(provider, identity.getPackageName()).markLocationDelivered();
    }

    /** Logs that the location power save mode has changed. */
@@ -397,6 +398,8 @@ public class LocationEventLog extends LocalEventLog {
        private int mActiveRequestCount;
        @GuardedBy("this")
        private int mForegroundRequestCount;
        @GuardedBy("this")
        private int mDeliveredLocationCount;

        @GuardedBy("this")
        private long mFastestIntervalMs = Long.MAX_VALUE;
@@ -464,6 +467,10 @@ public class LocationEventLog extends LocalEventLog {
            Preconditions.checkState(mForegroundRequestCount >= 0);
        }

        synchronized void markLocationDelivered() {
            mDeliveredLocationCount++;
        }

        public synchronized void updateTotals() {
            if (mAddedRequestCount > 0) {
                long realtimeMs = SystemClock.elapsedRealtime();
@@ -488,7 +495,8 @@ public class LocationEventLog extends LocalEventLog {
                    + intervalToString(mSlowestIntervalMs)
                    + ", total/active/foreground duration = " + formatDuration(mAddedTimeTotalMs)
                    + "/" + formatDuration(mActiveTimeTotalMs) + "/"
                    + formatDuration(mForegroundTimeTotalMs);
                    + formatDuration(mForegroundTimeTotalMs) + ", locations = "
                    + mDeliveredLocationCount;
        }

        private static String intervalToString(long intervalMs) {