• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.os.statsd.power;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23
24option java_package = "com.android.os.power";
25option java_multiple_files = true;
26
27extend Atom {
28  optional ScreenOffReported screen_off_reported = 776 [(module) = "framework"];
29  optional ScreenTimeoutOverrideReported screen_timeout_override_reported
30      = 836 [(module) = "framework"];
31  optional ScreenInteractiveSessionReported screen_interactive_session_reported
32      = 837 [(module) = "framework"];
33  optional ScreenDimReported screen_dim_reported = 867 [(module) = "framework"];
34}
35
36/**
37 * Logs when the screen is turned off.
38 *
39 * Logged from:
40 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
41 */
42message ScreenOffReported {
43  enum Reason {
44    UNKNOWN = 0;
45    POWER_BUTTON = 1;
46    TIMEOUT = 2;
47  }
48  enum TimeoutReason {
49    UNKNOWN_REASON = 0;
50    DEFAULT = 1;
51    FACE_DOWN = 2;
52    ENCLOSED = 3;
53  }
54  optional Reason screen_off_reason = 1;
55  optional TimeoutReason timeout_reason = 2;
56  optional int64 millis_until_normal_timeout = 3;
57}
58
59/**
60 * Logs For Screen Timeout Override.
61 *
62 * Logged from:
63 *   frameworks/base/services/core/java/com/android/server/power/WakefulnessSessionObserver.java
64 */
65message ScreenTimeoutOverrideReported {
66  enum OverrideOutcome {
67    // unknown outcome
68    UNKNOWN = 0;
69    // timeout successful
70    TIMEOUT_SUCCESS = 1;
71    // timeout but user initiates screen immediately
72    TIMEOUT_USER_INITIATED_REVERT = 2;
73    // cancel the timeout because of client api call
74    CANCEL_CLIENT_API_CALL = 3;
75    // cancel the timeout because of user interaction
76    CANCEL_USER_INTERACTION = 4;
77    // cancel the timeout because of power button is triggered
78    CANCEL_POWER_BUTTON = 5;
79    // cancel the timeout because of client disconnected
80    CANCEL_CLIENT_DISCONNECTED = 6;
81    // cancel the timeout because of other than above outcomes
82    CANCEL_OTHER = 7;
83  }
84  // power group id is the superset of display_id used in PowerManagerService
85  // One power group id might have multiple displays or multiple display groups
86  optional int32 power_group_id = 1;
87  // Log the outcome this time
88  optional OverrideOutcome override_outcome = 2;
89  // Timeout that be override
90  optional int64 override_timeout_millis = 3;
91  // Timeout from setting
92  optional int64 default_timeout_millis = 4;
93}
94
95/**
96 * Logs For Screen Interactive Session.
97 *
98 * Logged from:
99 *   frameworks/base/services/core/java/com/android/server/power/WakefulnessSessionObserver.java
100 */
101message ScreenInteractiveSessionReported {
102   enum InteractiveStateOffReason {
103       UNKNOWN = 0;
104       TIMEOUT = 1;
105       POWER_BUTTON = 2;
106   }
107   enum UserActivityEvent {
108      OTHER = 0;
109      BUTTON = 1;
110      TOUCH = 2;
111      ACCESSIBILITY = 3;
112      ATTENTION = 4;
113      FACE_DOWN = 5;
114      DEVICE_STATE = 6;
115      SCREEN_TIMEOUT_OVERRIDE = 7;
116   }
117   // power group id is the superset of display_id used in PowerManagerService
118   // One power group id might have multiple displays or multiple display groups
119   optional int32 power_group_id = 1;
120   // Log the reason that interactive state off this time
121   optional InteractiveStateOffReason interactive_state_off_reason = 2;
122   // Total time for this interactive state on to off
123   optional int64 interactive_state_on_duration_millis = 3;
124   // Log the last user activity
125   optional UserActivityEvent last_user_activity_event = 4;
126   // Duration between last user activity event and interactive state off time
127   optional int64 last_user_activity_event_duration_millis = 5;
128   // Duration between override timeout and default timeout
129   optional int64 reduced_interactive_state_on_duration_millis = 6;
130}
131
132/**
133 * Logs For Screen Dim.
134 *
135 * Logged from:
136 *   frameworks/base/services/core/java/com/android/server/power/WakefulnessSessionObserver.java
137 */
138message ScreenDimReported {
139   enum PolicyReason {
140       // unknown policy reason
141       UNKNOWN = 0;
142       // screen interactive off by timeout
143       OFF_TIMEOUT = 1;
144       // screen interactive off by power button
145       OFF_POWER_BUTTON = 2;
146       // screen on because undim
147       BRIGHT_UNDIM = 3;
148       // screen on because user initiates screen immediately
149       BRIGHT_INITIATED_REVERT = 4;
150   }
151
152   // display port id can be known from display id
153   // will be different between internal display and external display
154   optional int32 physical_display_port_id = 1;
155
156   // Policy reason for studying dim
157   optional PolicyReason policy_reason = 2;
158
159   // User activity when the policy reason is tracked
160   optional ScreenInteractiveSessionReported.UserActivityEvent last_user_activity_event = 3;
161
162   // User activity duration
163   optional int32 last_user_activity_event_duration_millis = 4;
164
165   // Duration of dim
166   optional int32 dim_duration_millis = 5;
167
168   // Timeout default setting
169   optional int32 default_timeout_millis = 6;
170}
171