1 /*
2  * Copyright 2021 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 androidx.core.content;
18 
19 /**
20  * Shared constants related to Unused App Restrictions
21  * (e.g. Permission Revocation, App Hibernation).
22  */
23 public final class UnusedAppRestrictionsConstants {
UnusedAppRestrictionsConstants()24     private UnusedAppRestrictionsConstants() {
25         /* Hide constructor */
26     }
27 
28     /**
29      * The status of Unused App Restrictions could not be retrieved from this app.
30      *
31      * Note: check the logs for the reason (e.g. if the app's target SDK version < 30 or the user
32      * is in locked device boot mode).
33      */
34     public static final int ERROR = 0;
35 
36     /** There are no available Unused App Restrictions for this app. */
37     public static final int FEATURE_NOT_AVAILABLE = 1;
38 
39     /**
40      * Any available Unused App Restrictions on the device are disabled for this app.
41      *
42      * In other words, this app is exempt from having its permissions automatically removed
43      * or being hibernated.
44      */
45     public static final int DISABLED = 2;
46 
47     /**
48      * Unused App Restrictions introduced by Android API 30, and since made available on earlier
49      * (API 23-29) devices are enabled for this app:
50      * <a href="https://developer.android.com/training/permissions/requesting#auto-reset-permissions-unused-apps"
51      * >permission auto-reset</a>.
52      *
53      * Note: This value is only used on API 29 or earlier devices.
54      */
55     public static final int API_30_BACKPORT = 3;
56 
57     /**
58      * Unused App Restrictions introduced by Android API 30 are enabled for this app:
59      * <a href="https://developer.android.com/training/permissions/requesting#auto-reset-permissions-unused-apps"
60      * >permission auto-reset</a>.
61      *
62      * Note: This value is only used on API 30 or later devices.
63      */
64     public static final int API_30 = 4;
65 
66     /**
67      * Unused App Restrictions introduced by Android API 31 are enabled for this app:
68      * <a href="https://developer.android.com/training/permissions/requesting#auto-reset-permissions-unused-apps"
69      * >permission auto-reset</a> and
70      * <a href="https://developer.android.com/about/versions/12/behavior-changes-12#app-hibernation"
71      * >app hibernation</a>.
72      *
73      * Note: This value is only used on API 31 or later devices.
74      */
75     public static final int API_31 = 5;
76 }
77