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.ondevicepersonalization; 18 19 import static android.adservices.ondevicepersonalization.OnDevicePersonalizationPermissions.MODIFY_ONDEVICEPERSONALIZATION_STATE; 20 21 import android.annotation.CallbackExecutor; 22 import android.annotation.NonNull; 23 import android.annotation.RequiresPermission; 24 import android.annotation.SystemApi; 25 import android.content.Context; 26 import android.os.OutcomeReceiver; 27 28 import java.util.concurrent.Executor; 29 30 /** 31 * OnDevicePersonalizationConfigManager provides system APIs 32 * for privileged APKs to control OnDevicePersonalization's enablement status. 33 * 34 * @hide 35 */ 36 @SystemApi 37 public class OnDevicePersonalizationConfigManager { 38 /** @hide */ 39 public static final String ON_DEVICE_PERSONALIZATION_CONFIG_SERVICE = 40 "on_device_personalization_config_service"; 41 42 /** @hide */ OnDevicePersonalizationConfigManager(@onNull Context context)43 public OnDevicePersonalizationConfigManager(@NonNull Context context) {} 44 45 /** 46 * Deprecated. This API is a no-op. ODP automatically determines whether personalization 47 * should be enabled using 48 * {@link android.adservices.common.AdServicesCommonManager}. 49 */ 50 @RequiresPermission(MODIFY_ONDEVICEPERSONALIZATION_STATE) setPersonalizationEnabled(boolean enabled, @NonNull @CallbackExecutor Executor executor, @NonNull OutcomeReceiver<Void, Exception> receiver)51 public void setPersonalizationEnabled(boolean enabled, 52 @NonNull @CallbackExecutor Executor executor, 53 @NonNull OutcomeReceiver<Void, Exception> receiver) { 54 executor.execute(() -> receiver.onResult(null)); 55 } 56 } 57