1 /*
2  * Copyright (C) 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 android.app.time;
18 
19 import android.annotation.IntDef;
20 import android.annotation.SystemApi;
21 
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 
25 /**
26  * A capability is the ability for the user to configure something or perform an action. This
27  * information is exposed so that system apps like SettingsUI can be dynamic, rather than
28  * hard-coding knowledge of when configuration or actions are applicable / available to the user.
29  *
30  * <p>Capabilities have states that users cannot change directly. They may influence some
31  * capabilities indirectly by agreeing to certain device-wide behaviors such as location sharing, or
32  * by changing the configuration. See the {@code CAPABILITY_} constants for details.
33  *
34  * <p>Actions have associated methods, see the documentation for each action for details.
35  *
36  * <p>Note: Capabilities are independent of app permissions required to call the associated APIs.
37  *
38  * @hide
39  */
40 @SystemApi
41 public final class Capabilities {
42 
43     /** @hide */
44     @IntDef({ CAPABILITY_NOT_SUPPORTED, CAPABILITY_NOT_ALLOWED, CAPABILITY_NOT_APPLICABLE,
45             CAPABILITY_POSSESSED })
46     @Retention(RetentionPolicy.SOURCE)
47     public @interface CapabilityState {}
48 
49     /**
50      * Indicates that a capability is not supported on this device, e.g. because of form factor or
51      * hardware. The associated UI should usually not be shown to the user.
52      */
53     public static final int CAPABILITY_NOT_SUPPORTED = 10;
54 
55     /**
56      * Indicates that a capability is supported on this device, but not allowed for the user, e.g.
57      * if the capability relates to the ability to modify settings the user is not able to.
58      * This could be because of the user's type (e.g. maybe it applies to the primary user only) or
59      * device policy. Depending on the capability, this could mean the associated UI
60      * should be hidden, or displayed but disabled.
61      */
62     public static final int CAPABILITY_NOT_ALLOWED = 20;
63 
64     /**
65      * Indicates that a capability is possessed but not currently applicable, e.g. if the
66      * capability relates to the ability to modify settings, the user has the ability to modify
67      * it, but it is currently rendered irrelevant by other settings or other device state (flags,
68      * resource config, etc.). The associated UI may be hidden, disabled, or left visible (but
69      * ineffective) depending on requirements.
70      */
71     public static final int CAPABILITY_NOT_APPLICABLE = 30;
72 
73     /** Indicates that a capability is possessed by the user. */
74     public static final int CAPABILITY_POSSESSED = 40;
75 
Capabilities()76     private Capabilities() {}
77 
78 }
79