summaryrefslogtreecommitdiff
path: root/android/app/usage/AppStandby.java
blob: 6f9fc2fa5d3608ebed14b729a862de9e89560afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.usage;

import android.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Set of constants for app standby buckets and reasons. Apps will be moved into different buckets
 * that affect how frequently they can run in the background or perform other battery-consuming
 * actions. Buckets will be assigned based on how frequently or when the system thinks the user
 * is likely to use the app.
 * @hide
 */
public class AppStandby {

    /** The app was used very recently, currently in use or likely to be used very soon. */
    public static final int STANDBY_BUCKET_ACTIVE = 0;

    // Leave some gap in case we want to increase the number of buckets

    /** The app was used recently and/or likely to be used in the next few hours  */
    public static final int STANDBY_BUCKET_WORKING_SET = 3;

    // Leave some gap in case we want to increase the number of buckets

    /** The app was used in the last few days and/or likely to be used in the next few days */
    public static final int STANDBY_BUCKET_FREQUENT = 6;

    // Leave some gap in case we want to increase the number of buckets

    /** The app has not be used for several days and/or is unlikely to be used for several days */
    public static final int STANDBY_BUCKET_RARE = 9;

    // Leave some gap in case we want to increase the number of buckets

    /** The app has never been used. */
    public static final int STANDBY_BUCKET_NEVER = 12;

    /** Reason for bucketing -- default initial state */
    public static final String REASON_DEFAULT = "default";

    /** Reason for bucketing -- timeout */
    public static final String REASON_TIMEOUT = "timeout";

    /** Reason for bucketing -- usage */
    public static final String REASON_USAGE = "usage";

    /** Reason for bucketing -- forced by user / shell command */
    public static final String REASON_FORCED = "forced";

    /**
     * Reason for bucketing -- predicted. This is a prefix and the UID of the bucketeer will
     * be appended.
     */
    public static final String REASON_PREDICTED = "predicted";

    @IntDef(flag = false, value = {
            STANDBY_BUCKET_ACTIVE,
            STANDBY_BUCKET_WORKING_SET,
            STANDBY_BUCKET_FREQUENT,
            STANDBY_BUCKET_RARE,
            STANDBY_BUCKET_NEVER,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface StandbyBuckets {}
}