From e02042e3add032fd303b15a2d08ff8c8d6612565 Mon Sep 17 00:00:00 2001 From: Angela Wang Date: Thu, 2 Mar 2023 09:05:59 +0000 Subject: [PATCH] Specifies RECEIVER_NOT_EXPORTED for FlashNotificationsController broadcast receiver After changing Flash Notifications preview broadcasts to be protected, there is no need to specify RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED for the receiver. These flags are only required for runtime receivers that listen to non-system broadcast(s). However, if a receiver is registered for only system broadcasts along with the RECEIVER_NOT_EXPORTED flag, the platform will honor this flag, and only root or system UIDs will be able to send the system broadcast(s) to this receiver. Since Flash Notifications preview can only be triggered by settings app for now, changing the receiver flag to RECEIVER_NOT_EXPORTED can best avoid this receiver from potential vulnerabilities. See go/receiver-flag-enforcement-design. Bug: 266775677 Test: uses go/abtd to run com.google.android.projection.gearhead.test.functional#CarAppTest-searchTemplate Change-Id: I3f819d8c5bee9d96c97799e80548cccbcca32fe8 --- .../server/accessibility/FlashNotificationsController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java index 86b5a12f3c47a..e79c1e811b9dc 100644 --- a/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java +++ b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java @@ -254,7 +254,7 @@ class FlashNotificationsController { broadcastFilter.addAction(ACTION_FLASH_NOTIFICATION_STOP_PREVIEW); mFlashBroadcastReceiver = new FlashBroadcastReceiver(); mContext.registerReceiver( - mFlashBroadcastReceiver, broadcastFilter, Context.RECEIVER_EXPORTED); + mFlashBroadcastReceiver, broadcastFilter, Context.RECEIVER_NOT_EXPORTED); final PowerManager powerManager = mContext.getSystemService(PowerManager.class); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_TAG);