Loading proto/src/system_messages.proto +8 −0 Original line number Original line Diff line number Diff line Loading @@ -268,6 +268,14 @@ message SystemMessage { // Package: android // Package: android NOTE_NAS_UPGRADE = 64; 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 // ADD_NEW_IDS_ABOVE_THIS_LINE // Legacy IDs with arbitrary values appear below // Legacy IDs with arbitrary values appear below // Legacy IDs existed as stable non-conflicting constants prior to the O release // Legacy IDs existed as stable non-conflicting constants prior to the O release Loading services/core/java/com/android/server/SensorPrivacyService.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -122,6 +122,7 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.R; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.os.BackgroundThread; import com.android.internal.os.BackgroundThread; import com.android.internal.util.DumpUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.FunctionalUtils; import com.android.internal.util.FunctionalUtils; Loading Loading @@ -608,6 +609,7 @@ public final class SensorPrivacyService extends SystemService { @NonNull String packageName, int sensor) { @NonNull String packageName, int sensor) { int iconRes; int iconRes; int messageRes; int messageRes; int notificationId; CharSequence packageLabel; CharSequence packageLabel; try { try { Loading @@ -622,9 +624,11 @@ public final class SensorPrivacyService extends SystemService { if (sensor == MICROPHONE) { if (sensor == MICROPHONE) { iconRes = R.drawable.ic_mic_blocked; iconRes = R.drawable.ic_mic_blocked; messageRes = R.string.sensor_privacy_start_use_mic_notification_content_title; messageRes = R.string.sensor_privacy_start_use_mic_notification_content_title; notificationId = SystemMessage.NOTE_UNBLOCK_MIC_TOGGLE; } else { } else { iconRes = R.drawable.ic_camera_blocked; iconRes = R.drawable.ic_camera_blocked; messageRes = R.string.sensor_privacy_start_use_camera_notification_content_title; messageRes = R.string.sensor_privacy_start_use_camera_notification_content_title; notificationId = SystemMessage.NOTE_UNBLOCK_CAM_TOGGLE; } } NotificationManager notificationManager = NotificationManager notificationManager = Loading @@ -641,7 +645,7 @@ public final class SensorPrivacyService extends SystemService { notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel); Icon icon = Icon.createWithResource(getUiContext().getResources(), iconRes); Icon icon = Icon.createWithResource(getUiContext().getResources(), iconRes); notificationManager.notify(sensor, notificationManager.notify(notificationId, new Notification.Builder(mContext, SENSOR_PRIVACY_CHANNEL_ID) new Notification.Builder(mContext, SENSOR_PRIVACY_CHANNEL_ID) .setContentTitle(getUiContext().getString(messageRes)) .setContentTitle(getUiContext().getString(messageRes)) .setContentText(Html.fromHtml(getUiContext().getString( .setContentText(Html.fromHtml(getUiContext().getString( Loading Loading
proto/src/system_messages.proto +8 −0 Original line number Original line Diff line number Diff line Loading @@ -268,6 +268,14 @@ message SystemMessage { // Package: android // Package: android NOTE_NAS_UPGRADE = 64; 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 // ADD_NEW_IDS_ABOVE_THIS_LINE // Legacy IDs with arbitrary values appear below // Legacy IDs with arbitrary values appear below // Legacy IDs existed as stable non-conflicting constants prior to the O release // Legacy IDs existed as stable non-conflicting constants prior to the O release Loading
services/core/java/com/android/server/SensorPrivacyService.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -122,6 +122,7 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.R; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.messages.nano.SystemMessageProto.SystemMessage; import com.android.internal.os.BackgroundThread; import com.android.internal.os.BackgroundThread; import com.android.internal.util.DumpUtils; import com.android.internal.util.DumpUtils; import com.android.internal.util.FunctionalUtils; import com.android.internal.util.FunctionalUtils; Loading Loading @@ -608,6 +609,7 @@ public final class SensorPrivacyService extends SystemService { @NonNull String packageName, int sensor) { @NonNull String packageName, int sensor) { int iconRes; int iconRes; int messageRes; int messageRes; int notificationId; CharSequence packageLabel; CharSequence packageLabel; try { try { Loading @@ -622,9 +624,11 @@ public final class SensorPrivacyService extends SystemService { if (sensor == MICROPHONE) { if (sensor == MICROPHONE) { iconRes = R.drawable.ic_mic_blocked; iconRes = R.drawable.ic_mic_blocked; messageRes = R.string.sensor_privacy_start_use_mic_notification_content_title; messageRes = R.string.sensor_privacy_start_use_mic_notification_content_title; notificationId = SystemMessage.NOTE_UNBLOCK_MIC_TOGGLE; } else { } else { iconRes = R.drawable.ic_camera_blocked; iconRes = R.drawable.ic_camera_blocked; messageRes = R.string.sensor_privacy_start_use_camera_notification_content_title; messageRes = R.string.sensor_privacy_start_use_camera_notification_content_title; notificationId = SystemMessage.NOTE_UNBLOCK_CAM_TOGGLE; } } NotificationManager notificationManager = NotificationManager notificationManager = Loading @@ -641,7 +645,7 @@ public final class SensorPrivacyService extends SystemService { notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel); Icon icon = Icon.createWithResource(getUiContext().getResources(), iconRes); Icon icon = Icon.createWithResource(getUiContext().getResources(), iconRes); notificationManager.notify(sensor, notificationManager.notify(notificationId, new Notification.Builder(mContext, SENSOR_PRIVACY_CHANNEL_ID) new Notification.Builder(mContext, SENSOR_PRIVACY_CHANNEL_ID) .setContentTitle(getUiContext().getString(messageRes)) .setContentTitle(getUiContext().getString(messageRes)) .setContentText(Html.fromHtml(getUiContext().getString( .setContentText(Html.fromHtml(getUiContext().getString( Loading