Rename broadcast constants

Test: runtest systemui-notification, cts verifier
Change-Id: I41812e7fa0ae532fbdff5c5ba88887d1b1187b79
Fixes: 72762612
This commit is contained in:
Julia Reynolds
2018-02-05 10:02:30 -05:00
parent 066b551e89
commit 44ff7c9585
4 changed files with 28 additions and 20 deletions

View File

@@ -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

View File

@@ -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 =

View File

@@ -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())

View File

@@ -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));
}