diff options
| author | 2018-02-05 10:02:30 -0500 | |
|---|---|---|
| committer | 2018-02-05 15:05:00 +0000 | |
| commit | 44ff7c958560ca83ce03020176110aed5f8d0d71 (patch) | |
| tree | ff333a8f4513a8ac961f3b6bec4a2b762116b63b | |
| parent | 066b551e894c7bffe1f91d744f74690aafc5450a (diff) | |
Rename broadcast constants
Test: runtest systemui-notification, cts verifier
Change-Id: I41812e7fa0ae532fbdff5c5ba88887d1b1187b79
Fixes: 72762612
4 files changed, 28 insertions, 20 deletions
diff --git a/api/current.txt b/api/current.txt index d93bc41d5c32..1ffba87773ac 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5711,7 +5711,8 @@ package android.app { field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED"; field public static final java.lang.String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED"; field public static final java.lang.String EXTRA_BLOCKED_STATE = "android.app.extra.BLOCKED_STATE"; - field public static final java.lang.String EXTRA_BLOCK_STATE_CHANGED_ID = "android.app.extra.BLOCK_STATE_CHANGED_ID"; + field public static final java.lang.String EXTRA_NOTIFICATION_CHANNEL_GROUP_ID = "android.app.extra.NOTIFICATION_CHANNEL_GROUP_ID"; + field public static final java.lang.String EXTRA_NOTIFICATION_CHANNEL_ID = "android.app.extra.NOTIFICATION_CHANNEL_ID"; field public static final int IMPORTANCE_DEFAULT = 3; // 0x3 field public static final int IMPORTANCE_HIGH = 4; // 0x4 field public static final int IMPORTANCE_LOW = 2; // 0x2 diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index ae4ac3c35317..538623f26a95 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -98,7 +98,7 @@ public class NotificationManager { * This broadcast is only sent to the app whose block state has changed. * * Input: nothing - * Output: nothing + * Output: {@link #EXTRA_BLOCKED_STATE} */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_APP_BLOCK_STATE_CHANGED = @@ -113,24 +113,31 @@ public class NotificationManager { * This broadcast is only sent to the app that owns the channel that has changed. * * Input: nothing - * Output: {@link #EXTRA_BLOCK_STATE_CHANGED_ID} + * Output: {@link #EXTRA_NOTIFICATION_CHANNEL_ID} + * Output: {@link #EXTRA_BLOCKED_STATE} */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED = "android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED"; /** - * Extra for {@link #ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED} or - * {@link #ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED} containing the id of the - * object which has a new blocked state. + * Extra for {@link #ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED} containing the id of the + * {@link NotificationChannel} which has a new blocked state. * - * The value will be the {@link NotificationChannel#getId()} of the channel for - * {@link #ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED} and - * the {@link NotificationChannelGroup#getId()} of the group for - * {@link #ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED}. + * The value will be the {@link NotificationChannel#getId()} of the channel. */ - public static final String EXTRA_BLOCK_STATE_CHANGED_ID = - "android.app.extra.BLOCK_STATE_CHANGED_ID"; + public static final String EXTRA_NOTIFICATION_CHANNEL_ID = + "android.app.extra.NOTIFICATION_CHANNEL_ID"; + + /** + * Extra for {@link #ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED} containing the id + * of the {@link NotificationChannelGroup} which has a new blocked state. + * + * The value will be the {@link NotificationChannelGroup#getId()} of the group. + */ + public static final String EXTRA_NOTIFICATION_CHANNEL_GROUP_ID = + "android.app.extra.NOTIFICATION_CHANNEL_GROUP_ID"; + /** * Extra for {@link #ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED} or @@ -142,7 +149,6 @@ public class NotificationManager { */ public static final String EXTRA_BLOCKED_STATE = "android.app.extra.BLOCKED_STATE"; - /** * Intent that is broadcast when a {@link NotificationChannelGroup} is * {@link NotificationChannelGroup#isBlocked() blocked} or unblocked. @@ -150,7 +156,8 @@ public class NotificationManager { * This broadcast is only sent to the app that owns the channel group that has changed. * * Input: nothing - * Output: {@link #EXTRA_BLOCK_STATE_CHANGED_ID} + * Output: {@link #EXTRA_NOTIFICATION_CHANNEL_GROUP_ID} + * Output: {@link #EXTRA_BLOCKED_STATE} */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED = diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index b25124ac4562..e7eed03a5bde 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1593,7 +1593,7 @@ public class NotificationManagerService extends SystemService { && update.getImportance() == IMPORTANCE_NONE)) { getContext().sendBroadcastAsUser( new Intent(ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED) - .putExtra(NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID, + .putExtra(NotificationManager.EXTRA_NOTIFICATION_CHANNEL_ID, update.getId()) .putExtra(NotificationManager.EXTRA_BLOCKED_STATE, update.getImportance() == IMPORTANCE_NONE) @@ -1631,7 +1631,7 @@ public class NotificationManagerService extends SystemService { if (preUpdate.isBlocked() != update.isBlocked()) { getContext().sendBroadcastAsUser( new Intent(ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED) - .putExtra(NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID, + .putExtra(NotificationManager.EXTRA_NOTIFICATION_CHANNEL_GROUP_ID, update.getId()) .putExtra(NotificationManager.EXTRA_BLOCKED_STATE, update.isBlocked()) diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 6b6df294e47c..cd324259ce56 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -1229,7 +1229,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { captor.getValue().getAction()); assertEquals(PKG, captor.getValue().getPackage()); assertEquals(mTestNotificationChannel.getId(), captor.getValue().getStringExtra( - NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID)); + NotificationManager.EXTRA_NOTIFICATION_CHANNEL_ID)); assertTrue(captor.getValue().getBooleanExtra(EXTRA_BLOCKED_STATE, false)); } @@ -1251,7 +1251,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { captor.getValue().getAction()); assertEquals(PKG, captor.getValue().getPackage()); assertEquals(mTestNotificationChannel.getId(), captor.getValue().getStringExtra( - NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID)); + NotificationManager.EXTRA_NOTIFICATION_CHANNEL_ID)); assertFalse(captor.getValue().getBooleanExtra(EXTRA_BLOCKED_STATE, false)); } @@ -1287,7 +1287,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { captor.getValue().getAction()); assertEquals(PKG, captor.getValue().getPackage()); assertEquals(existing.getId(), captor.getValue().getStringExtra( - NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID)); + NotificationManager.EXTRA_NOTIFICATION_CHANNEL_GROUP_ID)); assertTrue(captor.getValue().getBooleanExtra(EXTRA_BLOCKED_STATE, false)); } @@ -1308,7 +1308,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { captor.getValue().getAction()); assertEquals(PKG, captor.getValue().getPackage()); assertEquals(existing.getId(), captor.getValue().getStringExtra( - NotificationManager.EXTRA_BLOCK_STATE_CHANGED_ID)); + NotificationManager.EXTRA_NOTIFICATION_CHANNEL_GROUP_ID)); assertFalse(captor.getValue().getBooleanExtra(EXTRA_BLOCKED_STATE, false)); } |