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

Commit 67fb3ca9 authored by Adam Bookatz's avatar Adam Bookatz Committed by Android (Google) Code Review
Browse files

Merge "Statsd atom: Wifi on (enabled) and running"

parents f98c2c41 da1798c8
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ message Atom {
        DocsUIRootVisitedReported docs_ui_root_visited = 110;
        DocsUIStartupMsReported docs_ui_startup_ms = 111;
        DocsUIUserActionReported docs_ui_user_action_reported = 112;
        WifiEnabledStateChanged wifi_enabled_state_changed = 113;
        WifiRunningStateChanged wifi_running_state_changed = 114;
    }

    // Pulled events will start at field 10000.
@@ -870,6 +872,37 @@ message KernelWakeupReported {
    optional int64 duration_micros = 2;
}

/**
 * Logs when Wifi is toggled on/off.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message WifiEnabledStateChanged {
    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 1;
}

/**
 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
 * TODO: Include support for Hotspot.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message WifiRunningStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;
}

/**
 * Logs wifi locks held by an app.
 *
+13 −0
Original line number Diff line number Diff line
@@ -724,6 +724,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        synchronized (mStats) {
            mStats.noteWifiOnLocked();
        }
        StatsLog.write(StatsLog.WIFI_ENABLED_STATE_CHANGED,
                StatsLog.WIFI_ENABLED_STATE_CHANGED__STATE__ON);
    }

    public void noteWifiOff() {
@@ -731,6 +733,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        synchronized (mStats) {
            mStats.noteWifiOffLocked();
        }
        StatsLog.write(StatsLog.WIFI_ENABLED_STATE_CHANGED,
                StatsLog.WIFI_ENABLED_STATE_CHANGED__STATE__OFF);
    }

    public void noteStartAudio(int uid) {
@@ -865,6 +869,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        synchronized (mStats) {
            mStats.noteWifiRunningLocked(ws);
        }
        // TODO: Log WIFI_RUNNING_STATE_CHANGED in a better spot to include Hotspot too.
        StatsLog.write(StatsLog.WIFI_RUNNING_STATE_CHANGED,
                ws, StatsLog.WIFI_RUNNING_STATE_CHANGED__STATE__ON);
    }

    public void noteWifiRunningChanged(WorkSource oldWs, WorkSource newWs) {
@@ -872,6 +879,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        synchronized (mStats) {
            mStats.noteWifiRunningChangedLocked(oldWs, newWs);
        }
        StatsLog.write(StatsLog.WIFI_RUNNING_STATE_CHANGED,
                newWs, StatsLog.WIFI_RUNNING_STATE_CHANGED__STATE__ON);
        StatsLog.write(StatsLog.WIFI_RUNNING_STATE_CHANGED,
                oldWs, StatsLog.WIFI_RUNNING_STATE_CHANGED__STATE__OFF);
    }

    public void noteWifiStopped(WorkSource ws) {
@@ -879,6 +890,8 @@ public final class BatteryStatsService extends IBatteryStats.Stub
        synchronized (mStats) {
            mStats.noteWifiStoppedLocked(ws);
        }
        StatsLog.write(StatsLog.WIFI_RUNNING_STATE_CHANGED,
                ws, StatsLog.WIFI_RUNNING_STATE_CHANGED__STATE__OFF);
    }

    public void noteWifiState(int wifiState, String accessPoint) {