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 17 package com.android.systemui.car.systembar; 18 19 import static android.hardware.SensorPrivacyManager.Sensors.MICROPHONE; 20 21 import android.content.Context; 22 import android.hardware.SensorPrivacyManager; 23 24 import androidx.annotation.IdRes; 25 26 import com.android.systemui.R; 27 import com.android.systemui.dagger.SysUISingleton; 28 import com.android.systemui.privacy.PrivacyItemController; 29 import com.android.systemui.privacy.PrivacyType; 30 import com.android.systemui.settings.UserTracker; 31 32 import javax.inject.Inject; 33 34 /** Controls a Mic Privacy Chip view in system icons. */ 35 @SysUISingleton 36 public class MicPrivacyChipViewController extends PrivacyChipViewController { 37 38 @Inject MicPrivacyChipViewController(Context context, PrivacyItemController privacyItemController, SensorPrivacyManager sensorPrivacyManager, UserTracker userTracker)39 public MicPrivacyChipViewController(Context context, 40 PrivacyItemController privacyItemController, 41 SensorPrivacyManager sensorPrivacyManager, 42 UserTracker userTracker) { 43 super(context, privacyItemController, sensorPrivacyManager, userTracker); 44 } 45 46 @Override getChipSensor()47 protected @SensorPrivacyManager.Sensors.Sensor int getChipSensor() { 48 return MICROPHONE; 49 } 50 51 @Override getChipPrivacyType()52 protected PrivacyType getChipPrivacyType() { 53 return PrivacyType.TYPE_MICROPHONE; 54 } 55 56 @Override getChipResourceId()57 protected @IdRes int getChipResourceId() { 58 return R.id.mic_privacy_chip; 59 } 60 } 61