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.privacy; 18 19 import android.content.Context; 20 import android.util.AttributeSet; 21 22 import androidx.annotation.DrawableRes; 23 import androidx.annotation.NonNull; 24 import androidx.annotation.Nullable; 25 26 import com.android.systemui.R; 27 28 /** Car optimized Camera Privacy Chip View that is shown when camera is being used. */ 29 public class CameraPrivacyChip extends PrivacyChip { 30 31 private static final String SENSOR_NAME = "camera"; 32 private static final String SENSOR_NAME_WITH_FIRST_LETTER_CAPITALIZED = "Camera"; 33 CameraPrivacyChip(@onNull Context context)34 public CameraPrivacyChip(@NonNull Context context) { 35 this(context, /* attrs= */ null); 36 } 37 CameraPrivacyChip(@onNull Context context, @Nullable AttributeSet attrs)38 public CameraPrivacyChip(@NonNull Context context, @Nullable AttributeSet attrs) { 39 this(context, attrs, /* defStyleAttrs= */ 0); 40 } 41 CameraPrivacyChip(@onNull Context context, @Nullable AttributeSet attrs, int defStyleAttrs)42 public CameraPrivacyChip(@NonNull Context context, 43 @Nullable AttributeSet attrs, int defStyleAttrs) { 44 super(context, attrs, defStyleAttrs); 45 } 46 47 @Override getLightMutedIconResourceId()48 protected @DrawableRes int getLightMutedIconResourceId() { 49 return R.drawable.ic_camera_off_light; 50 } 51 52 @Override getDarkMutedIconResourceId()53 protected @DrawableRes int getDarkMutedIconResourceId() { 54 return R.drawable.ic_camera_off_dark; 55 } 56 57 @Override getLightIconResourceId()58 protected @DrawableRes int getLightIconResourceId() { 59 return R.drawable.ic_camera_light; 60 } 61 62 @Override getDarkIconResourceId()63 protected @DrawableRes int getDarkIconResourceId() { 64 return R.drawable.ic_camera_dark; 65 } 66 67 @Override getSensorName()68 protected String getSensorName() { 69 return SENSOR_NAME; 70 } 71 72 @Override getSensorNameWithFirstLetterCapitalized()73 protected String getSensorNameWithFirstLetterCapitalized() { 74 return SENSOR_NAME_WITH_FIRST_LETTER_CAPITALIZED; 75 } 76 } 77