1 /*
2  * Copyright (C) 2021 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.systemui.car.privacy;
17 
18 import android.content.Context;
19 
20 import androidx.annotation.DrawableRes;
21 
22 import com.android.car.qc.provider.BaseLocalQCProvider;
23 import com.android.systemui.R;
24 import com.android.systemui.car.systembar.MicPrivacyChipViewController;
25 
26 import javax.inject.Inject;
27 
28 /**
29  * A {@link BaseLocalQCProvider} that builds the microphone privacy panel.
30  */
31 public class MicQcPanel extends SensorQcPanel {
32 
33     private static final String SENSOR_NAME = "microphone";
34     private static final String SENSOR_SHORT_NAME = "mic";
35     private static final String SENSOR_NAME_WITH_FIRST_LETTER_CAPITALIZED = "Microphone";
36 
37     @Inject
MicQcPanel(Context context, MicPrivacyChipViewController micPrivacyChipViewController, MicPrivacyElementsProviderImpl micPrivacyElementsProvider)38     public MicQcPanel(Context context,
39             MicPrivacyChipViewController micPrivacyChipViewController,
40             MicPrivacyElementsProviderImpl micPrivacyElementsProvider) {
41         super(context, micPrivacyChipViewController, micPrivacyElementsProvider);
42     }
43 
44     @Override
getSensorShortName()45     protected String getSensorShortName() {
46         return SENSOR_SHORT_NAME;
47     }
48 
49     @Override
getSensorName()50     protected String getSensorName() {
51         return SENSOR_NAME;
52     }
53 
54     @Override
getSensorNameWithFirstLetterCapitalized()55     protected String getSensorNameWithFirstLetterCapitalized() {
56         return SENSOR_NAME_WITH_FIRST_LETTER_CAPITALIZED;
57     }
58 
59     @Override
getSensorOnIconResourceId()60     protected @DrawableRes int getSensorOnIconResourceId() {
61         return R.drawable.ic_mic_light;
62     }
63 
64     @Override
getSensorOffIconResourceId()65     protected @DrawableRes int getSensorOffIconResourceId() {
66         return R.drawable.ic_mic_off_light;
67     }
68 }
69