1 /*
2  * Copyright (C) 2022 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.adservices.common;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.SystemApi;
21 
22 import com.android.adservices.flags.Flags;
23 
24 /** Permissions used by the AdServices APIs. */
25 public class AdServicesPermissions {
AdServicesPermissions()26     private AdServicesPermissions() {}
27 
28     /** This permission needs to be declared by the caller of Topics APIs. */
29     public static final String ACCESS_ADSERVICES_TOPICS =
30             "android.permission.ACCESS_ADSERVICES_TOPICS";
31 
32     /** This permission needs to be declared by the caller of Attribution APIs. */
33     public static final String ACCESS_ADSERVICES_ATTRIBUTION =
34             "android.permission.ACCESS_ADSERVICES_ATTRIBUTION";
35 
36     /** This permission needs to be declared by the caller of Custom Audiences APIs. */
37     public static final String ACCESS_ADSERVICES_CUSTOM_AUDIENCE =
38             "android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE";
39 
40     /** This permission needs to be declared by the caller of Protected Signals APIs. */
41     @FlaggedApi(Flags.FLAG_PROTECTED_SIGNALS_ENABLED)
42     public static final String ACCESS_ADSERVICES_PROTECTED_SIGNALS =
43             "android.permission.ACCESS_ADSERVICES_PROTECTED_SIGNALS";
44 
45     /** This permission needs to be declared by the caller of Protected Signals APIs. */
46     @SuppressWarnings("FlaggedApi") // aconfig not available on this branch
47     @FlaggedApi(Flags.FLAG_PROTECTED_SIGNALS_ENABLED)
48     public static final String ACCESS_ADSERVICES_AD_SELECTION =
49             "android.permission.ACCESS_ADSERVICES_AD_SELECTION";
50 
51     /** This permission needs to be declared by the caller of Advertising ID APIs. */
52     public static final String ACCESS_ADSERVICES_AD_ID =
53             "android.permission.ACCESS_ADSERVICES_AD_ID";
54 
55     /**
56      * This is a signature permission that needs to be declared by the AdServices apk to access API
57      * for AdID provided by another provider service. The signature permission is required to make
58      * sure that only AdServices is permitted to access this api.
59      *
60      * @hide
61      */
62     @SystemApi
63     public static final String ACCESS_PRIVILEGED_AD_ID =
64             "android.permission.ACCESS_PRIVILEGED_AD_ID";
65 
66     /**
67      * This is a signature permission needs to be declared by the AdServices apk to access API for
68      * AppSetId provided by another provider service. The signature permission is required to make
69      * sure that only AdServices is permitted to access this api.
70      *
71      * @hide
72      */
73     @SystemApi
74     public static final String ACCESS_PRIVILEGED_APP_SET_ID =
75             "android.permission.ACCESS_PRIVILEGED_APP_SET_ID";
76 
77     /**
78      * The permission that lets it modify AdService's enablement state modification API.
79      *
80      * @hide
81      */
82     @SystemApi
83     public static final String MODIFY_ADSERVICES_STATE =
84             "android.permission.MODIFY_ADSERVICES_STATE";
85 
86     /**
87      * The permission that lets it modify AdService's enablement state modification API on S-.
88      *
89      * @hide
90      */
91     @SystemApi
92     public static final String MODIFY_ADSERVICES_STATE_COMPAT =
93             "android.permission.MODIFY_ADSERVICES_STATE_COMPAT";
94 
95     /**
96      * The permission that lets it access AdService's enablement state modification API.
97      *
98      * @hide
99      */
100     @SystemApi
101     public static final String ACCESS_ADSERVICES_STATE =
102             "android.permission.ACCESS_ADSERVICES_STATE";
103 
104     /**
105      * The permission that lets it access AdService's enablement state modification API on S-.
106      *
107      * @hide
108      */
109     @SystemApi
110     public static final String ACCESS_ADSERVICES_STATE_COMPAT =
111             "android.permission.ACCESS_ADSERVICES_STATE_COMPAT";
112 
113     /**
114      * The permission needed to call AdServicesManager APIs
115      *
116      * @hide
117      */
118     public static final String ACCESS_ADSERVICES_MANAGER =
119             "android.permission.ACCESS_ADSERVICES_MANAGER";
120 
121     /**
122      * This is a signature permission needs to be declared by the AdServices apk to access API for
123      * AdServices Cobalt upload service provided by another provider service. The signature
124      * permission is required to make sure that only AdServices is permitted to access this api.
125      *
126      * @hide
127      */
128     @SystemApi
129     public static final String ACCESS_PRIVILEGED_ADSERVICES_COBALT_UPLOAD =
130             "android.permission.ACCESS_PRIVILEGED_AD_SERVICES_COBALT_UPLOAD";
131 
132     /**
133      * The permission that allows calling updating AdId Cache API via Common Service.
134      *
135      * @hide
136      */
137     @SystemApi
138     @FlaggedApi(Flags.FLAG_AD_ID_CACHE_ENABLED)
139     public static final String UPDATE_PRIVILEGED_AD_ID =
140             "android.permission.UPDATE_PRIVILEGED_AD_ID";
141 
142     /**
143      * The permission that allows calling updating AdId Cache API via Common Service on S-.
144      *
145      * @hide
146      */
147     @SystemApi
148     @FlaggedApi(Flags.FLAG_AD_ID_CACHE_ENABLED)
149     public static final String UPDATE_PRIVILEGED_AD_ID_COMPAT =
150             "android.permission.UPDATE_PRIVILEGED_AD_ID_COMPAT";
151 }
152