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.customaudience;
18 
19 import android.adservices.common.AdSelectionSignals;
20 import android.adservices.common.AdTechIdentifier;
21 import android.adservices.customaudience.CustomAudience;
22 import android.adservices.customaudience.CustomAudienceOverrideCallback;
23 import android.adservices.customaudience.FetchAndJoinCustomAudienceCallback;
24 import android.adservices.customaudience.FetchAndJoinCustomAudienceInput;
25 import android.adservices.customaudience.ICustomAudienceCallback;
26 import android.adservices.customaudience.ScheduleCustomAudienceUpdateInput;
27 import android.adservices.customaudience.ScheduleCustomAudienceUpdateCallback;
28 
29 import android.net.Uri;
30 
31 /**
32  * Custom audience service.
33  *
34  * @hide
35  */
36 interface ICustomAudienceService {
joinCustomAudience(in CustomAudience customAudience, in String ownerPackageName, in ICustomAudienceCallback callback)37     void joinCustomAudience(in CustomAudience customAudience, in String ownerPackageName,
38             in ICustomAudienceCallback callback);
fetchAndJoinCustomAudience(in FetchAndJoinCustomAudienceInput input, in FetchAndJoinCustomAudienceCallback callback)39     void fetchAndJoinCustomAudience(in FetchAndJoinCustomAudienceInput input,
40             in FetchAndJoinCustomAudienceCallback callback);
leaveCustomAudience(in String ownerPackageName, in AdTechIdentifier buyer, in String name, in ICustomAudienceCallback callback)41     void leaveCustomAudience(in String ownerPackageName, in AdTechIdentifier buyer, in String name,
42             in ICustomAudienceCallback callback);
scheduleCustomAudienceUpdate(in ScheduleCustomAudienceUpdateInput input, in ScheduleCustomAudienceUpdateCallback callback)43     void scheduleCustomAudienceUpdate(in ScheduleCustomAudienceUpdateInput input,
44             in ScheduleCustomAudienceUpdateCallback callback);
45 
46     /**
47      * Configures PP api to avoid fetching the biddingLogicJS and trustedBiddingData from a server
48      * and instead use the content provided in {@code biddingLogicJS} and {@code trustedBiddingData}
49      * for the CA identified by {@code ownerPackageName}, {@code buyer}, {@code name}
50      *
51      * The call will throw a SecurityException if:
52      * the API hasn't been enabled by developer options or by an adb command
53      * or if the calling application manifest is not setting Android:debuggable to true.
54      * or if the CA hasn't been created by the same app doing invoking this API.
55      *
56      * The call will fail silently if the CustomAudience has been created by a different app.
57      */
overrideCustomAudienceRemoteInfo(in String ownerPackageName, in AdTechIdentifier buyer, in String name, in String biddingLogicJS, in long biddingLogicJsVersion, in AdSelectionSignals trustedBiddingData, in CustomAudienceOverrideCallback callback)58     void overrideCustomAudienceRemoteInfo(in String ownerPackageName, in AdTechIdentifier buyer,
59             in String name, in String biddingLogicJS, in long biddingLogicJsVersion,
60             in AdSelectionSignals trustedBiddingData, in CustomAudienceOverrideCallback callback);
61 
62     /**
63      * Deletes any override created by calling
64      * {@code overrideCustomAudienceRemoteInfo} for the CA identified by
65      * {@code ownerPackageName} {@code buyer}, {@code name}.
66      *
67      * The call will throw a SecurityException if:
68      * the API hasn't been enabled by developer options or by an adb command
69      * or if the calling application manifest is not setting Android:debuggable to true.
70      *
71      * The call will fail silently if the CustomAudience has been created by a different app.
72      */
removeCustomAudienceRemoteInfoOverride(in String ownerPackageName, in AdTechIdentifier buyer, in String name, in CustomAudienceOverrideCallback callback)73     void removeCustomAudienceRemoteInfoOverride(in String ownerPackageName,
74             in AdTechIdentifier buyer, in String name, in CustomAudienceOverrideCallback callback);
75 
76     /**
77      * Deletes any override created by calling
78      * {@code overrideCustomAudienceRemoteInfo} from this application.
79      *
80      * The call will throw a SecurityException if the API hasn't been enabled
81      * by developer options or by an adb command and if the calling
82      * application manifest is not setting Android:debuggable to true.
83      */
resetAllCustomAudienceOverrides(in CustomAudienceOverrideCallback callback)84     void resetAllCustomAudienceOverrides(in CustomAudienceOverrideCallback callback);
85 }
86