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.car.settings.privacy; 18 19 import android.annotation.FlaggedApi; 20 import android.car.drivingstate.CarUxRestrictions; 21 import android.content.Context; 22 23 import androidx.preference.Preference; 24 25 import com.android.car.settings.R; 26 import com.android.car.settings.common.FragmentController; 27 import com.android.car.settings.common.PreferenceController; 28 import com.android.internal.camera.flags.Flags; 29 30 /** 31 * Displays a list of apps which are required with their privacy policy and a 32 * link to their camera permission settings. 33 */ 34 @FlaggedApi(Flags.FLAG_CAMERA_PRIVACY_ALLOWLIST) 35 public final class CameraRequiredAppsHeaderPreferenceController 36 extends PreferenceController<Preference> { 37 CameraRequiredAppsHeaderPreferenceController( Context context, String preferenceKey, FragmentController fragmentController, CarUxRestrictions uxRestrictions)38 public CameraRequiredAppsHeaderPreferenceController( 39 Context context, 40 String preferenceKey, 41 FragmentController fragmentController, 42 CarUxRestrictions uxRestrictions) { 43 super(context, preferenceKey, fragmentController, uxRestrictions); 44 } 45 46 @Override getPreferenceType()47 protected Class<Preference> getPreferenceType() { 48 return Preference.class; 49 } 50 51 @Override getDefaultAvailabilityStatus()52 protected int getDefaultAvailabilityStatus() { 53 boolean showRequiredAppsToggle = getContext().getResources() 54 .getBoolean(R.bool.config_show_camera_required_apps_toggle); 55 return !showRequiredAppsToggle ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; 56 } 57 } 58