summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Severson <evanseverson@google.com>2021-07-08 13:27:35 -0700
committerEvan Severson <evanseverson@google.com>2021-07-08 13:53:36 -0700
commit093638b97794c66cf81ba388b5b0ec154059f898 (patch)
tree68604bc4743e94aaa50b07cd541b4b4606933f1a
parent576c548b3ccc278fccb43e8fab58265d38ebff0c (diff)
Add unique notification ids for mic/cam toggles
Test: Build and try notifications Fixes: 192059115 Change-Id: I328ef6b1649b8930df4ed81393a0352317d360da
-rw-r--r--proto/src/system_messages.proto8
-rw-r--r--services/core/java/com/android/server/SensorPrivacyService.java6
2 files changed, 13 insertions, 1 deletions
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index a48f76ea1ca3..3047c9042848 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -268,6 +268,14 @@ message SystemMessage {
// Package: android
NOTE_NAS_UPGRADE = 64;
+ // Notify the user to unblock the microphone global toggle
+ // Package: android
+ NOTE_UNBLOCK_MIC_TOGGLE = 65;
+
+ // Notify the user to unblock the camera global toggle
+ // Package: android
+ NOTE_UNBLOCK_CAM_TOGGLE = 66;
+
// ADD_NEW_IDS_ABOVE_THIS_LINE
// Legacy IDs with arbitrary values appear below
// Legacy IDs existed as stable non-conflicting constants prior to the O release
diff --git a/services/core/java/com/android/server/SensorPrivacyService.java b/services/core/java/com/android/server/SensorPrivacyService.java
index 4f3a38b6cdca..ee1d6077cd5d 100644
--- a/services/core/java/com/android/server/SensorPrivacyService.java
+++ b/services/core/java/com/android/server/SensorPrivacyService.java
@@ -121,6 +121,7 @@ import android.util.proto.ProtoOutputStream;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FunctionalUtils;
@@ -576,6 +577,7 @@ public final class SensorPrivacyService extends SystemService {
@NonNull String packageName, int sensor) {
int iconRes;
int messageRes;
+ int notificationId;
CharSequence packageLabel;
try {
@@ -590,9 +592,11 @@ public final class SensorPrivacyService extends SystemService {
if (sensor == MICROPHONE) {
iconRes = R.drawable.ic_mic_blocked;
messageRes = R.string.sensor_privacy_start_use_mic_notification_content_title;
+ notificationId = SystemMessage.NOTE_UNBLOCK_MIC_TOGGLE;
} else {
iconRes = R.drawable.ic_camera_blocked;
messageRes = R.string.sensor_privacy_start_use_camera_notification_content_title;
+ notificationId = SystemMessage.NOTE_UNBLOCK_CAM_TOGGLE;
}
NotificationManager notificationManager =
@@ -609,7 +613,7 @@ public final class SensorPrivacyService extends SystemService {
notificationManager.createNotificationChannel(channel);
Icon icon = Icon.createWithResource(getUiContext().getResources(), iconRes);
- notificationManager.notify(sensor,
+ notificationManager.notify(notificationId,
new Notification.Builder(mContext, SENSOR_PRIVACY_CHANNEL_ID)
.setContentTitle(getUiContext().getString(messageRes))
.setContentText(Html.fromHtml(getUiContext().getString(