1 /* 2 * Copyright (C) 2024 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 com.android.ondevicepersonalization.services.data.user; 18 19 import com.google.common.util.concurrent.ListenableFuture; 20 21 /** 22 * A wrapper for the AdServicesCommonStates API. 23 */ 24 public interface AdServicesCommonStatesWrapper { 25 /** Wrapped result from AdServicesCommonStates API */ 26 class CommonStatesResult { 27 private final int mPaState; 28 private final int mMeasurementState; 29 30 /** Creates a Result */ CommonStatesResult(int paState, int measurementState)31 public CommonStatesResult(int paState, int measurementState) { 32 mPaState = paState; 33 mMeasurementState = measurementState; 34 } 35 36 /** Returns the ProtectedAudience allowed state. */ getPaState()37 public int getPaState() { 38 return mPaState; 39 } 40 41 /** Returns the Measurement allowed state. */ getMeasurementState()42 public int getMeasurementState() { 43 return mMeasurementState; 44 } 45 } 46 47 /** Returns the wrapped CommonStatesResult */ getCommonStates()48 ListenableFuture<CommonStatesResult> getCommonStates(); 49 50 /** Thrown when the AdServicesCommonManager system service is null. */ 51 class NullAdServiceCommonManagerException extends Exception {} 52 } 53