apex/jobscheduler/service/java/com/android/server/deviceidle/DeviceIdleConstraintTracker.java
raw symbols SCIP| 1 | /* |
| 2 | * Copyright (C) 2018 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 com.android.server.deviceidle; |
| 18 | |
| 19 | /** |
| 20 | * Current state of an {@link IDeviceIdleConstraint}. |
| 21 | * |
| 22 | * If the current doze state is between leastActive and mostActive, then startMonitoring() will |
| 23 | * be the most recent call. Otherwise, stopMonitoring() is the most recent call. |
| 24 | */ |
| 25 | public class DeviceIdleConstraintTracker { |
| 26 | |
| 27 | /** |
| 28 | * Appears in "dumpsys deviceidle". |
| 29 | */ |
| 30 | public final String name; |
| 31 | |
| 32 | /** |
| 33 | * Whenever a constraint is active, it will keep the device at or above |
| 34 | * minState (provided the rule is currently in effect). |
| 35 | * |
| 36 | */ |
| 37 | public final int minState; |
| 38 | |
| 39 | /** |
| 40 | * Whether this constraint currently prevents going below {@link #minState}. |
| 41 | * |
| 42 | * When the state is set to exactly minState, active is automatically |
| 43 | * overwritten with {@code true}. |
| 44 | */ |
| 45 | public boolean active = false; |
| 46 | |
| 47 | /** |
| 48 | * Internal tracking for whether the {@link IDeviceIdleConstraint} on the other |
| 49 | * side has been told it needs to send updates. |
| 50 | */ |
| 51 | public boolean monitoring = false; |
| 52 | |
| 53 | public DeviceIdleConstraintTracker(final String name, int minState) { |
| 54 | this.name = name; |
| 55 | this.minState = minState; |
| 56 | } |
| 57 | } |