NotificationUiAdjustmentTest: Mark unaudited PendingIntents with FLAG_MUTABLE_UNAUDITED

These PIs need an explicit mutability flag. This temporay flag is being
used to mark these points in code and should be replaced ASAP.
See go/immutable-pendingintents for more context.

Bug: 160794467
Test: TH
Exempt-From-Owner-Approval: noop change
Change-Id: Ieb6745feef0efe07143803bfb75bb83972df74e2
This commit is contained in:
Ashwini Oruganti
2020-12-05 21:45:07 -08:00
parent 24e5b93cc2
commit 689345798a

View File

@@ -39,8 +39,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentLength() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
Notification.Action action =
createActionBuilder("first", R.drawable.ic_corp_icon, pendingIntent).build();
assertThat(NotificationUiAdjustment.needReinflate(
@@ -51,8 +54,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentLabels() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
Notification.Action firstAction =
createActionBuilder("first", R.drawable.ic_corp_icon, pendingIntent).build();
Notification.Action secondAction =
@@ -66,8 +72,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentIcons() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
Notification.Action firstAction =
createActionBuilder("same", R.drawable.ic_corp_icon, pendingIntent).build();
Notification.Action secondAction =
@@ -82,10 +91,14 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentPendingIntent() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent firstPendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_VIEW), 0);
PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_VIEW),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
PendingIntent secondPendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_PROCESS_TEXT), 0);
PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_PROCESS_TEXT),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
Notification.Action firstAction =
createActionBuilder("same", R.drawable.ic_corp_icon, firstPendingIntent)
.build();
@@ -101,8 +114,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentChoices() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
RemoteInput firstRemoteInput =
createRemoteInput("same", "same", new CharSequence[] {"first"});
@@ -126,8 +142,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_differentRemoteInputLabel() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
RemoteInput firstRemoteInput =
createRemoteInput("same", "first", new CharSequence[] {"same"});
@@ -151,8 +170,11 @@ public class NotificationUiAdjustmentTest extends SysuiTestCase {
@Test
public void needReinflate_negative() {
// TODO(b/174258598) Please replace FLAG_MUTABLE_UNAUDITED below
// with either FLAG_IMMUTABLE (recommended) or FLAG_MUTABLE.
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(), 0);
PendingIntent.getActivity(mContext, 0, new Intent(),
PendingIntent.FLAG_MUTABLE_UNAUDITED);
RemoteInput firstRemoteInput =
createRemoteInput("same", "same", new CharSequence[] {"same"});
RemoteInput secondRemoteInput =