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 package com.android.adservices.ui.settings.activities; 17 18 import android.os.Build; 19 import android.os.Bundle; 20 21 import androidx.annotation.RequiresApi; 22 import androidx.lifecycle.ViewModelProvider; 23 24 import com.android.adservices.api.R; 25 import com.android.adservices.ui.settings.delegates.BlockedAppsActionDelegate; 26 import com.android.adservices.ui.settings.fragments.AdServicesSettingsBlockedAppsFragment; 27 import com.android.adservices.ui.settings.viewmodels.BlockedAppsViewModel; 28 29 /** 30 * Android application activity for controlling applications which are blocked from interacting with 31 * FLEDGE (Remarketing) APIs. 32 */ 33 // TODO(b/269798827): Enable for R. 34 @RequiresApi(Build.VERSION_CODES.S) 35 public class BlockedAppsActivity extends AdServicesBaseActivity { 36 private BlockedAppsActionDelegate mActionDelegate; 37 38 /** @return the action delegate for the activity. */ getActionDelegate()39 public BlockedAppsActionDelegate getActionDelegate() { 40 return mActionDelegate; 41 } 42 43 @Override onCreate(Bundle savedInstanceState)44 protected void onCreate(Bundle savedInstanceState) { 45 super.onCreate(savedInstanceState); 46 setContentView(R.layout.adservices_settings_main_activity); 47 getSupportFragmentManager() 48 .beginTransaction() 49 .replace( 50 R.id.fragment_container_view, 51 AdServicesSettingsBlockedAppsFragment.class, 52 null) 53 .setReorderingAllowed(true) 54 .commit(); 55 initActionDelegate(); 56 } 57 58 @Override initBeta()59 public void initBeta() {} 60 61 @Override initGA()62 public void initGA() {} 63 64 @Override initU18()65 public void initU18() {} 66 initActionDelegate()67 private void initActionDelegate() { 68 mActionDelegate = 69 new BlockedAppsActionDelegate( 70 this, new ViewModelProvider(this).get(BlockedAppsViewModel.class)); 71 } 72 } 73