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.app.adservices;
18 
19 import android.app.adservices.consent.ConsentParcel;
20 import android.app.adservices.topics.TopicParcel;
21 
22 /**
23   * AdServices Manager Service
24   *
25   * {@hide}
26   */
27 interface IAdServicesManager {
28     /**
29      * Get Consent
30      */
getConsent(in int consentApiType)31     ConsentParcel getConsent(in int consentApiType);
32 
33     /**
34      * Set Consent
35      */
setConsent(in ConsentParcel consentParcel)36     void setConsent(in ConsentParcel consentParcel);
37 
38     /**
39      * Saves information to the storage that a deletion of measurement data occurred.
40      */
recordAdServicesDeletionOccurred(in int deletionType)41      void recordAdServicesDeletionOccurred(in int deletionType);
42 
43      /**
44       * Checks whether the module needs to handle data reconciliation after a rollback.
45       */
needsToHandleRollbackReconciliation(in int deletionType)46      boolean needsToHandleRollbackReconciliation(in int deletionType);
47 
48     /**
49      * Saves information to the storage that notification was displayed for the first time to the
50      * user.
51      */
recordNotificationDisplayed(boolean wasNotificationDisplayed)52     void recordNotificationDisplayed(boolean wasNotificationDisplayed);
53 
54     /**
55      * Returns information whether Consent Notification was displayed or not.
56      *
57      * @return true if Consent Notification was displayed, otherwise false.
58      */
wasNotificationDisplayed()59     boolean wasNotificationDisplayed();
60 
61     /**
62      * Saves information to the storage that GA UX notification was displayed for the
63      * first time to the user.
64      */
recordGaUxNotificationDisplayed(boolean wasNotificationDisplayed)65     void recordGaUxNotificationDisplayed(boolean wasNotificationDisplayed);
66 
67     /**
68      * Returns information whether GA UX Consent Notification was displayed or not.
69      *
70      * @return true if GA UX Consent Notification was displayed, otherwise false.
71      */
wasGaUxNotificationDisplayed()72     boolean wasGaUxNotificationDisplayed();
73 
74     /**
75      * Saves information to the storage that GA UX notification was displayed for the
76      * first time to the user.
77      */
recordPasNotificationDisplayed(boolean wasNotificationDisplayed)78     void recordPasNotificationDisplayed(boolean wasNotificationDisplayed);
79 
80     /**
81      * Returns information whether PAS Consent Notification was displayed or not.
82      *
83      * @return true if PAS Consent Notification was displayed, otherwise false.
84      */
wasPasNotificationDisplayed()85     boolean wasPasNotificationDisplayed();
86 
87     /**
88      * Saves information to the storage that GA UX notification was opened for the
89      * first time to the user.
90      */
recordPasNotificationOpened(boolean wasNotificationOpened)91     void recordPasNotificationOpened(boolean wasNotificationOpened);
92 
93     /**
94      * Returns information whether PAS Consent Notification was opened or not.
95      *
96      * @return true if PAS Consent Notification was opened, otherwise false.
97      */
wasPasNotificationOpened()98     boolean wasPasNotificationOpened();
99 
100     /**
101      * Saves information to the storage that user explicitly interacted with consent.
102      *
103      * Current state:
104      * <ul>
105      *    <li> -1 means no manual interaction recorded </li>
106      *    <li> 0 means no data about interaction </li>
107      *    <li> 1 means manual interaction recorded </li>
108      * </ul>
109      */
recordUserManualInteractionWithConsent(in int interactionId)110     void recordUserManualInteractionWithConsent(in int interactionId);
111 
112     /**
113      * Returns information about the user's manual interaction with consent.
114      * Current state:
115      * <ul>
116      *    <li> -1 means no manual interaction recorded </li>
117      *    <li> 0 means no data about interaction </li>
118      *    <li> 1 means manual interaction recorded </li>
119      * </ul>
120      */
getUserManualInteractionWithConsent()121     int getUserManualInteractionWithConsent();
122 
123     /**
124      * Record a blocked topic.
125      */
recordBlockedTopic(in List<TopicParcel> blockedTopicParcels)126     void recordBlockedTopic(in List<TopicParcel> blockedTopicParcels);
127 
128     /**
129      * Remove a blocked topic.
130      */
removeBlockedTopic(in TopicParcel blockedTopicParcel)131     void removeBlockedTopic(in TopicParcel blockedTopicParcel);
132 
133     /**
134      * Get all blocked topics.
135      */
retrieveAllBlockedTopics()136     List<TopicParcel> retrieveAllBlockedTopics();
137 
138     /**
139      * Clear all blocked topics.
140      */
clearAllBlockedTopics()141     void clearAllBlockedTopics();
142 
143     /**
144       * Saves the PP API default consent of a user.
145       */
recordDefaultConsent(in boolean defaultConsent)146     void recordDefaultConsent(in boolean defaultConsent);
147 
148     /**
149       * Saves the topics default consent of a user.
150       */
recordTopicsDefaultConsent(in boolean defaultConsent)151     void recordTopicsDefaultConsent(in boolean defaultConsent);
152 
153     /**
154       * Saves the FLEDGE default consent of a user.
155       */
recordFledgeDefaultConsent(in boolean defaultConsent)156     void recordFledgeDefaultConsent(in boolean defaultConsent);
157 
158     /**
159       * Saves the measurement default consent of a user.
160       */
recordMeasurementDefaultConsent(in boolean defaultConsent)161     void recordMeasurementDefaultConsent(in boolean defaultConsent);
162 
163     /**
164       * Saves the default AdId state of a user.
165       */
recordDefaultAdIdState(in boolean defaultAdIdState)166     void recordDefaultAdIdState(in boolean defaultAdIdState);
167 
168     /**
169       * Returns the PP API default consent of a user.
170       *
171       * @return true if the PP API default consent is given, false otherwise.
172       */
getDefaultConsent()173     boolean getDefaultConsent();
174 
175     /**
176       * Returns the topics default consent of a user.
177       *
178       * @return true if the topics default consent is given, false otherwise.
179       */
getTopicsDefaultConsent()180     boolean getTopicsDefaultConsent();
181 
182     /**
183       * Returns the FLEDGE default consent of a user.
184       *
185       * @return true if the FLEDGE default consent is given, false otherwise.
186       */
getFledgeDefaultConsent()187     boolean getFledgeDefaultConsent();
188 
189      /**
190        * Returns the measurement default consent of a user.
191        *
192        * @return true if the measurement default consent is given, false otherwise.
193        */
getMeasurementDefaultConsent()194      boolean getMeasurementDefaultConsent();
195 
196      /**
197        * Returns the default AdId state of a user.
198        *
199        * @return true if the default AdId state is enabled, false otherwise.
200        */
getDefaultAdIdState()201      boolean getDefaultAdIdState();
202 
getCurrentPrivacySandboxFeature()203     String getCurrentPrivacySandboxFeature();
204 
setCurrentPrivacySandboxFeature(in String featureType)205     void setCurrentPrivacySandboxFeature(in String featureType);
206 
getKnownAppsWithConsent(in List<String> installedPackages)207     List<String> getKnownAppsWithConsent(in List<String> installedPackages);
208 
getAppsWithRevokedConsent(in List<String> installedPackages)209     List<String> getAppsWithRevokedConsent(in List<String> installedPackages);
210 
setConsentForApp(in String packageName,in int packageUid,in boolean isConsentRevoked)211     void setConsentForApp(in String packageName,in int packageUid,in boolean isConsentRevoked);
212 
clearKnownAppsWithConsent()213     void clearKnownAppsWithConsent();
214 
clearAllAppConsentData()215     void clearAllAppConsentData();
216 
isConsentRevokedForApp(in String packageName,in int packageUid)217     boolean isConsentRevokedForApp(in String packageName,in int packageUid);
218 
setConsentForAppIfNew(in String packageName,in int packageUid,in boolean isConsentRevoked)219     boolean setConsentForAppIfNew(in String packageName,in int packageUid,in boolean isConsentRevoked);
220 
clearConsentForUninstalledApp(in String packageName,in int packageUid)221     void clearConsentForUninstalledApp(in String packageName,in int packageUid);
222 
223     /** Returns whether the isAdIdEnabled bit is true. */
isAdIdEnabled()224     boolean isAdIdEnabled();
225 
226     /** Saves the isAdIdEnabled bit. */
setAdIdEnabled(boolean isAdIdEnabled)227     void setAdIdEnabled(boolean isAdIdEnabled);
228 
229     /** Returns whether the isU18Account bit is true. */
isU18Account()230     boolean isU18Account();
231 
232     /** Saves the isU18Account bit. */
setU18Account(boolean isU18Account)233     void setU18Account(boolean isU18Account);
234 
235     /** Returns whether the isEntryPointEnabled bit is true. */
isEntryPointEnabled()236     boolean isEntryPointEnabled();
237 
238     /** Saves the isEntryPointEnabled bit. */
setEntryPointEnabled(boolean isEntryPointEnabled)239     void setEntryPointEnabled(boolean isEntryPointEnabled);
240 
241     /** Returns whether the isAdultAccount bit is true. */
isAdultAccount()242     boolean isAdultAccount();
243 
setAdultAccount(boolean isAdultAccount)244     void setAdultAccount(boolean isAdultAccount);
245 
246     /** Returns whether the wasU18NotificationDisplayed bit is true. */
wasU18NotificationDisplayed()247     boolean wasU18NotificationDisplayed();
248 
249     /** Saves the wasU18NotificationDisplayed bit. */
setU18NotificationDisplayed(boolean wasU18NotificationDisplayed)250     void setU18NotificationDisplayed(boolean wasU18NotificationDisplayed);
251 
252     /** Returns the current UX. */
getUx()253     String getUx();
254 
255     /** Set the current UX. */
setUx(in String ux)256     void setUx(in String ux);
257 
258     /** Returns the current enrollement channel. */
getEnrollmentChannel()259     String getEnrollmentChannel();
260 
261     /** Set the current enrollment channel. */
setEnrollmentChannel(in String enrollmentChannel)262     void setEnrollmentChannel(in String enrollmentChannel);
263 
264     /** Returns whether the isMeasurementDataReset bit is true. */
isMeasurementDataReset()265     boolean isMeasurementDataReset();
266 
267     /** Saves the isMeasurementDataReset bit. */
setMeasurementDataReset(boolean isMeasurementDataReset)268     void setMeasurementDataReset(boolean isMeasurementDataReset);
269 
270     /** Returns whether the isPaDataReset bit is true. */
isPaDataReset()271     boolean isPaDataReset();
272 
273     /** Saves the isPaDataReset bit. */
setPaDataReset(boolean isPaDataReset)274     void setPaDataReset(boolean isPaDataReset);
275 }
276