Log when app move to foreground or background.
Together with screen state change, we will have appusage info.
Test: manually test on device
Change-Id: Ie9cfe0376cf0d6339be5e8e96f7b360c3f0771d6
diff --git a/cmds/statsd/src/stats_events.proto b/cmds/statsd/src/stats_events.proto
index 5ce7c70..e4e18de 100644
--- a/cmds/statsd/src/stats_events.proto
+++ b/cmds/statsd/src/stats_events.proto
@@ -71,6 +71,7 @@
PhoneSignalStrengthChanged phone_signal_strength_changed = 40;
SettingChanged setting_changed = 41;
KernelWakelockPulled kernel_wakelock_pulled = 42;
+ ActivityForegroundStateChanged activity_foreground_state_changed = 43;
// TODO: Reorder the numbering so that the most frequent occur events occur in the first 15.
}
}
@@ -693,3 +694,20 @@
optional int64 total_time = 3;
optional string name = 4;
}
+
+/*
+ * Logs activity going to foreground or background
+ *
+ * Logged from:
+ * frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
+ */
+message ActivityForegroundStateChanged {
+ enum Activity {
+ MOVE_TO_BACKGROUND = 0;
+ MOVE_TO_FOREGROUND = 1;
+ }
+ optional int32 uid = 1;
+ optional string pkg_name = 2;
+ optional string class_name = 3;
+ optional Activity activity = 4;
+}