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 17 package com.android.adservices.service.ui.ux.collection; 18 19 import android.os.Build; 20 21 import androidx.annotation.RequiresApi; 22 23 import com.android.adservices.service.ui.enrollment.collection.BetaUxEnrollmentChannelCollection; 24 import com.android.adservices.service.ui.enrollment.collection.GaUxEnrollmentChannelCollection; 25 import com.android.adservices.service.ui.enrollment.collection.PrivacySandboxEnrollmentChannelCollection; 26 import com.android.adservices.service.ui.enrollment.collection.U18UxEnrollmentChannelCollection; 27 import com.android.adservices.service.ui.ux.base.PrivacySandboxUx; 28 import com.android.adservices.service.ui.ux.impl.BetaUx; 29 import com.android.adservices.service.ui.ux.impl.GaUx; 30 import com.android.adservices.service.ui.ux.impl.U18Ux; 31 import com.android.adservices.service.ui.ux.impl.UnsupportedUx; 32 33 /** Collection of privacy sandbox UXs, ordered by their priority. */ 34 @RequiresApi(Build.VERSION_CODES.S) 35 public enum PrivacySandboxUxCollection { 36 UNSUPPORTED_UX( 37 /* priority= */ 0, 38 new UnsupportedUx(), 39 new PrivacySandboxEnrollmentChannelCollection[0]), 40 41 U18_UX(/* priority= */ 1, new U18Ux(), U18UxEnrollmentChannelCollection.values()), 42 43 GA_UX(/* priority= */ 3, new GaUx(), GaUxEnrollmentChannelCollection.values()), 44 45 BETA_UX(/* priority= */ 4, new BetaUx(), BetaUxEnrollmentChannelCollection.values()); 46 47 private final int mPriority; 48 private final PrivacySandboxUx mUx; 49 private final PrivacySandboxEnrollmentChannelCollection[] mEcc; 50 PrivacySandboxUxCollection( int priority, PrivacySandboxUx ux, PrivacySandboxEnrollmentChannelCollection[] ecc)51 PrivacySandboxUxCollection( 52 int priority, PrivacySandboxUx ux, PrivacySandboxEnrollmentChannelCollection[] ecc) { 53 mPriority = priority; 54 mUx = ux; 55 mEcc = ecc; 56 } 57 getPriority()58 public int getPriority() { 59 return mPriority; 60 } 61 getUx()62 public PrivacySandboxUx getUx() { 63 return mUx; 64 } 65 getEnrollmentChannelCollection()66 public PrivacySandboxEnrollmentChannelCollection[] getEnrollmentChannelCollection() { 67 return mEcc; 68 } 69 } 70