1 /*
2  * Copyright (C) 2019 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 
17 package android.system.suspend.internal;
18 
19 
20 /**
21  * Parcelable WakelockInfo - Representation of wake lock stats.
22  *
23  * Wakelocks obtained via SystemSuspend are hereafter referred to as
24  * native wake locks.
25  *
26  * @name:               Name of wake lock (Not guaranteed to be unique).
27  * @activeCount:        Number of times the wake lock was activated.
28  * @lastChange:         Monotonic time (in ms) when the wake lock was last touched.
29  * @maxTime:            Maximum time (in ms) this wake lock has been continuously active.
30  * @totalTime:          Total time (in ms) this wake lock has been active.
31  * @isActive:           Status of wake lock.
32  * @activeTime:         Time since wake lock was activated, 0 if wake lock is not active.
33  * @isKernelWakelock:   True if kernel wake lock, false if native wake lock.
34  *
35  * The stats below are specific to NATIVE wake locks and hold no valid
36  * data in the context of kernel wake locks.
37  *
38  * @pid:                Pid of process that acquired native wake lock.
39  *
40  * The stats below are specific to KERNEL wake locks and hold no valid
41  * data in the context of native wake locks.
42  *
43  * @eventCount:         Number of signaled wakeup events.
44  * @expireCount:        Number times the wakeup source's timeout expired.
45  * @preventSuspendTime: Total time this wake lock has been preventing autosuspend.
46  * @wakeupCount:        Number of times the wakeup source might abort suspend.
47  */
48 parcelable WakeLockInfo {
49     @utf8InCpp String name;
50     long activeCount;
51     long lastChange;
52     long maxTime;
53     long totalTime;
54     boolean isActive;
55     long activeTime;
56     boolean isKernelWakelock;
57 
58     // ---- Specific to Native Wake locks ---- //
59     int pid;
60 
61     // ---- Specific to Kernel Wake locks ---- //
62     long eventCount;
63     long expireCount;
64     long preventSuspendTime;
65     long wakeupCount;
66 }
67