• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 package com.android.adservices.service.ui.ux.impl;
17 
18 import static com.android.adservices.service.FlagsConstants.KEY_ADSERVICES_ENABLED;
19 
20 import android.content.Context;
21 import android.os.Build;
22 
23 import androidx.annotation.RequiresApi;
24 
25 import com.android.adservices.service.consent.ConsentManager;
26 import com.android.adservices.service.ui.data.UxStatesManager;
27 import com.android.adservices.service.ui.enrollment.base.PrivacySandboxEnrollmentChannel;
28 import com.android.adservices.service.ui.ux.base.PrivacySandboxUx;
29 
30 import com.google.errorprone.annotations.Immutable;
31 
32 // TO-DO(b/284177542): Implement revoke consent logic for Unsupported UX.
33 
34 /** Unsupported UX class that ensures no privacy sandbox features are available. */
35 @RequiresApi(Build.VERSION_CODES.S)
36 @Immutable
37 public class UnsupportedUx implements PrivacySandboxUx {
38 
39     /** Whether a user should not be eligible for any privacy sandbox UX. */
isEligible(ConsentManager consentManager, UxStatesManager uxStatesManager)40     public boolean isEligible(ConsentManager consentManager, UxStatesManager uxStatesManager) {
41         return !uxStatesManager.getFlag(KEY_ADSERVICES_ENABLED)
42                 || !consentManager.isEntryPointEnabled();
43     }
44 
45     /** No enrollment should happen for unsupported UX users. */
handleEnrollment( PrivacySandboxEnrollmentChannel enrollmentChannel, Context context, ConsentManager consentManager)46     public void handleEnrollment(
47             PrivacySandboxEnrollmentChannel enrollmentChannel,
48             Context context,
49             ConsentManager consentManager) {}
50 }
51