diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java index 8c29fb50f00a9..54ed0d9cd8ce8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java @@ -333,6 +333,7 @@ public class NotificationData { mGroupManager.onEntryUpdated(entry, oldSbn); } entry.populateFromRanking(mTmpRanking); + entry.setIsHighPriority(isHighPriority(entry.notification)); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java index ee551ee96e7be..2e93c38227375 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java @@ -153,6 +153,12 @@ public final class NotificationEntry { */ private boolean mUserDismissedBubble; + /** + * Whether this notification is shown to the user as a high priority notification: visible on + * the lock screen/status bar and in the top section in the shade. + */ + private boolean mHighPriority; + public NotificationEntry(StatusBarNotification n) { this(n, null); } @@ -191,6 +197,14 @@ public final class NotificationEntry { return interruption; } + public boolean isHighPriority() { + return mHighPriority; + } + + public void setIsHighPriority(boolean highPriority) { + this.mHighPriority = highPriority; + } + public void setIsBubble(boolean bubbleable) { mIsBubble = bubbleable; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index 5e9f20795272b..cb1384cacec8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -300,7 +300,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx row.getIsNonblockable(), isForBlockingHelper, row.getEntry().userSentiment == USER_SENTIMENT_NEGATIVE, - row.getEntry().importance); + row.getEntry().importance, + row.getEntry().isHighPriority()); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java index 5253e38fd6758..2a9a815e12d15 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java @@ -21,7 +21,6 @@ import static android.app.NotificationManager.IMPORTANCE_HIGH; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_MIN; import static android.app.NotificationManager.IMPORTANCE_NONE; -import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -97,8 +96,12 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private int mNumUniqueChannelsInRow; private NotificationChannel mSingleNotificationChannel; private int mStartingChannelImportance; - private int mStartingChannelOrNotificationImportance; - private int mChosenImportance; + private boolean mWasShownHighPriority; + /** + * The last importance level chosen by the user. Null if the user has not chosen an importance + * level; non-null once the user takes an action which indicates an explicit preference. + */ + @Nullable private Integer mChosenImportance; private boolean mIsSingleDefaultChannel; private boolean mIsNonblockable; private StatusBarNotification mSbn; @@ -195,13 +198,14 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G final OnAppSettingsClickListener onAppSettingsClick, boolean isDeviceProvisioned, boolean isNonblockable, - int importance) + int importance, + boolean wasShownHighPriority) throws RemoteException { bindNotification(pm, iNotificationManager, pkg, notificationChannel, numUniqueChannelsInRow, sbn, checkSaveListener, onSettingsClick, onAppSettingsClick, isDeviceProvisioned, isNonblockable, false /* isBlockingHelper */, false /* isUserSentimentNegative */, - importance); + importance, wasShownHighPriority); } public void bindNotification( @@ -218,7 +222,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G boolean isNonblockable, boolean isForBlockingHelper, boolean isUserSentimentNegative, - int importance) + int importance, + boolean wasShownHighPriority) throws RemoteException { mINotificationManager = iNotificationManager; mMetricsLogger = Dependency.get(MetricsLogger.class); @@ -231,10 +236,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G mCheckSaveListener = checkSaveListener; mOnSettingsClickListener = onSettingsClick; mSingleNotificationChannel = notificationChannel; - int channelImportance = mSingleNotificationChannel.getImportance(); - mStartingChannelImportance = mChosenImportance = channelImportance; - mStartingChannelOrNotificationImportance = - channelImportance == IMPORTANCE_UNSPECIFIED ? importance : channelImportance; + mStartingChannelImportance = mSingleNotificationChannel.getImportance(); + mWasShownHighPriority = wasShownHighPriority; mNegativeUserSentiment = isUserSentimentNegative; mIsNonblockable = isNonblockable; mIsForeground = @@ -400,19 +403,27 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G * @return new LogMaker */ private LogMaker importanceChangeLogMaker() { + Integer chosenImportance = + mChosenImportance != null ? mChosenImportance : mStartingChannelImportance; return new LogMaker(MetricsEvent.ACTION_SAVE_IMPORTANCE) .setType(MetricsEvent.TYPE_ACTION) - .setSubtype(mChosenImportance - mStartingChannelImportance); + .setSubtype(chosenImportance - mStartingChannelImportance); } private boolean hasImportanceChanged() { return mSingleNotificationChannel != null - && mStartingChannelImportance != mChosenImportance; + && mChosenImportance != null + && (mStartingChannelImportance != mChosenImportance + || (mWasShownHighPriority && mChosenImportance < IMPORTANCE_DEFAULT) + || (!mWasShownHighPriority && mChosenImportance >= IMPORTANCE_DEFAULT)); } private void saveImportance() { if (!mIsNonblockable || mExitReason != NotificationCounters.BLOCKING_HELPER_STOP_NOTIFICATIONS) { + if (mChosenImportance == null) { + mChosenImportance = mStartingChannelImportance; + } updateImportance(); } } @@ -421,12 +432,15 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G * Commits the updated importance values on the background thread. */ private void updateImportance() { - mMetricsLogger.write(importanceChangeLogMaker()); + if (mChosenImportance != null) { + mMetricsLogger.write(importanceChangeLogMaker()); - Handler bgHandler = new Handler(Dependency.get(Dependency.BG_LOOPER)); - bgHandler.post(new UpdateImportanceRunnable(mINotificationManager, mPackageName, mAppUid, - mNumUniqueChannelsInRow == 1 ? mSingleNotificationChannel : null, - mStartingChannelImportance, mChosenImportance)); + Handler bgHandler = new Handler(Dependency.get(Dependency.BG_LOOPER)); + bgHandler.post( + new UpdateImportanceRunnable(mINotificationManager, mPackageName, mAppUid, + mNumUniqueChannelsInRow == 1 ? mSingleNotificationChannel : null, + mStartingChannelImportance, mChosenImportance)); + } } private void bindButtons() { @@ -444,11 +458,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G TextView silent = findViewById(R.id.int_silent); TextView alert = findViewById(R.id.int_alert); - boolean isCurrentlyAlerting = - mStartingChannelOrNotificationImportance >= IMPORTANCE_DEFAULT; - block.setOnClickListener(mOnStopOrMinimizeNotifications); - if (isCurrentlyAlerting) { + if (mWasShownHighPriority) { silent.setOnClickListener(mOnToggleSilent); silent.setText(R.string.inline_silent_button_silent); alert.setOnClickListener(mOnKeepShowing); @@ -517,7 +528,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G break; case ACTION_TOGGLE_SILENT: mExitReason = NotificationCounters.BLOCKING_HELPER_TOGGLE_SILENT; - if (mStartingChannelOrNotificationImportance >= IMPORTANCE_DEFAULT) { + if (mWasShownHighPriority) { mChosenImportance = IMPORTANCE_LOW; confirmationText.setText(R.string.notification_channel_silenced); } else { @@ -584,9 +595,8 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G @Override public void onFinishedClosing() { - mStartingChannelImportance = mChosenImportance; - if (mChosenImportance != IMPORTANCE_UNSPECIFIED) { - mStartingChannelOrNotificationImportance = mChosenImportance; + if (mChosenImportance != null) { + mStartingChannelImportance = mChosenImportance; } mExitReason = NotificationCounters.BLOCKING_HELPER_DISMISSED; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java index eafaba8370e4c..d83a158b319f5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java @@ -23,7 +23,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.Nullable; import android.app.Notification; -import android.app.NotificationManager; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; @@ -254,12 +253,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl } mAppOpsItem = createAppOpsItem(mContext); if (NotificationUtils.useNewInterruptionModel(mContext)) { - int channelImportance = mParent.getEntry().channel.getImportance(); - int effectiveImportance = - channelImportance == NotificationManager.IMPORTANCE_UNSPECIFIED - ? mParent.getEntry().importance : channelImportance; - mInfoItem = createInfoItem(mContext, - effectiveImportance < NotificationManager.IMPORTANCE_DEFAULT); + mInfoItem = createInfoItem(mContext, !mParent.getEntry().isHighPriority()); } else { mInfoItem = createInfoItem(mContext); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 8d57ea5d8ed69..63b34d185c8d0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -2613,8 +2613,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd View child = getChildAt(i); if (child.getVisibility() != View.GONE && child instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) child; - if (!mEntryManager.getNotificationData().isHighPriority( - row.getStatusBarNotification())) { + if (!row.getEntry().isHighPriority()) { break; } else { lastChildBeforeGap = row; @@ -2632,8 +2631,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd View child = getChildAt(i); if (child.getVisibility() != View.GONE && child instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) child; - if (!mEntryManager.getNotificationData().isHighPriority( - row.getStatusBarNotification())) { + if (!row.getEntry().isHighPriority()) { return row; } } @@ -5772,11 +5770,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd currentIndex++; boolean beforeSpeedBump; if (mLowPriorityBeforeSpeedBump) { - beforeSpeedBump = !mEntryManager.getNotificationData().isAmbient( - row.getStatusBarNotification().getKey()); + beforeSpeedBump = !row.getEntry().ambient; } else { - beforeSpeedBump = mEntryManager.getNotificationData().isHighPriority( - row.getStatusBarNotification()); + beforeSpeedBump = row.getEntry().isHighPriority(); } if (beforeSpeedBump) { speedBumpIndex = currentIndex; @@ -5800,8 +5796,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd continue; } ExpandableNotificationRow row = (ExpandableNotificationRow) view; - if (!mEntryManager.getNotificationData().isHighPriority( - row.getStatusBarNotification())) { + if (!row.getEntry().isHighPriority()) { if (currentIndex > 0) { gapIndex = currentIndex; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index 077fcda70f0c5..e86996a81bcd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -194,8 +194,7 @@ public class NotificationIconAreaController implements DarkReceiver, if (mEntryManager.getNotificationData().isAmbient(entry.key) && !showAmbient) { return false; } - if (!showLowPriority - && !mEntryManager.getNotificationData().isHighPriority(entry.notification)) { + if (!showLowPriority && !entry.isHighPriority()) { return false; } if (!entry.isTopLevelChild()) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java index 40d2da9a77290..fdc9e0c4d7e46 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.java @@ -354,7 +354,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase { eq(false), eq(true) /* isForBlockingHelper */, eq(true) /* isUserSentimentNegative */, - eq(0)); + eq(0), + eq(false) /* wasShownHighPriority */); } @Test @@ -382,16 +383,18 @@ public class NotificationGutsManagerTest extends SysuiTestCase { eq(false), eq(false) /* isForBlockingHelper */, eq(true) /* isUserSentimentNegative */, - eq(0)); + eq(0), + eq(false) /* wasShownHighPriority */); } @Test - public void testInitializeNotificationInfoView_importance() throws Exception { + public void testInitializeNotificationInfoView_highPriority() throws Exception { NotificationInfo notificationInfoView = mock(NotificationInfo.class); ExpandableNotificationRow row = spy(mHelper.createRow()); row.setBlockingHelperShowing(true); row.getEntry().userSentiment = USER_SENTIMENT_NEGATIVE; row.getEntry().importance = IMPORTANCE_DEFAULT; + row.getEntry().setIsHighPriority(true); when(row.getIsNonblockable()).thenReturn(false); StatusBarNotification statusBarNotification = row.getStatusBarNotification(); @@ -411,7 +414,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase { eq(false), eq(true) /* isForBlockingHelper */, eq(true) /* isUserSentimentNegative */, - eq(IMPORTANCE_DEFAULT)); + eq(IMPORTANCE_DEFAULT), + eq(true) /* wasShownHighPriority */); } @Test @@ -440,7 +444,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase { eq(false), eq(false) /* isForBlockingHelper */, eq(true) /* isUserSentimentNegative */, - eq(0)); + eq(0), + eq(false) /* wasShownHighPriority */); } @Test @@ -468,7 +473,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase { eq(false), eq(true) /* isForBlockingHelper */, eq(true) /* isUserSentimentNegative */, - eq(0)); + eq(0), + eq(false) /* wasShownHighPriority */); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java index f6791dd5778cd..08955e3c4d5a5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java @@ -210,7 +210,7 @@ public class NotificationInfoTest extends SysuiTestCase { when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name"); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView textView = mNotificationInfo.findViewById(R.id.pkgname); assertTrue(textView.getText().toString().contains("App Name")); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); @@ -223,7 +223,7 @@ public class NotificationInfoTest extends SysuiTestCase { .thenReturn(iconDrawable); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final ImageView iconView = mNotificationInfo.findViewById(R.id.pkgicon); assertEquals(iconDrawable, iconView.getDrawable()); } @@ -232,7 +232,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_noDelegate() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name); assertEquals(GONE, nameView.getVisibility()); final TextView dividerView = mNotificationInfo.findViewById(R.id.pkg_divider); @@ -251,7 +251,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name); assertEquals(VISIBLE, nameView.getVisibility()); assertTrue(nameView.getText().toString().contains("Other")); @@ -263,7 +263,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_GroupNameHiddenIfNoGroup() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView groupNameView = mNotificationInfo.findViewById(R.id.group_name); assertEquals(GONE, groupNameView.getVisibility()); final TextView groupDividerView = mNotificationInfo.findViewById(R.id.pkg_group_divider); @@ -280,7 +280,7 @@ public class NotificationInfoTest extends SysuiTestCase { .thenReturn(notificationChannelGroup); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView groupNameView = mNotificationInfo.findViewById(R.id.group_name); assertEquals(View.VISIBLE, groupNameView.getVisibility()); assertEquals("Test Group Name", groupNameView.getText()); @@ -292,7 +292,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_SetsTextChannelName() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(TEST_CHANNEL_NAME, textView.getText()); } @@ -301,7 +301,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_DefaultChannelDoesNotUseChannelName() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mDefaultNotificationChannel, 1, mSbn, null, null, null, true, - false, IMPORTANCE_DEFAULT); + false, IMPORTANCE_DEFAULT, true); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(GONE, textView.getVisibility()); } @@ -314,7 +314,7 @@ public class NotificationInfoTest extends SysuiTestCase { eq(TEST_PACKAGE_NAME), eq(TEST_UID), anyBoolean())).thenReturn(10); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mDefaultNotificationChannel, 1, mSbn, null, null, null, true, - false, IMPORTANCE_DEFAULT); + false, IMPORTANCE_DEFAULT, true); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(VISIBLE, textView.getVisibility()); } @@ -323,7 +323,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_UnblockablePackageUsesChannelName() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(VISIBLE, textView.getVisibility()); } @@ -332,7 +332,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_BlockButton() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final View block = mNotificationInfo.findViewById(R.id.int_block); final View minimize = mNotificationInfo.findViewById(R.id.block_or_minimize); assertEquals(VISIBLE, block.getVisibility()); @@ -343,7 +343,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_BlockButton_BlockHelper() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - true /* isBlockingHelper */, false, IMPORTANCE_DEFAULT); + true /* isBlockingHelper */, false, IMPORTANCE_DEFAULT, true); final View block = mNotificationInfo.findViewById(R.id.block); final View interruptivenessSettings = mNotificationInfo.findViewById( R.id.interruptiveness_settings); @@ -356,7 +356,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView silent = mNotificationInfo.findViewById(R.id.int_silent); assertEquals(VISIBLE, silent.getVisibility()); assertEquals( @@ -368,7 +368,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_LOW); + IMPORTANCE_LOW, false); final TextView silent = mNotificationInfo.findViewById(R.id.int_silent); assertEquals(VISIBLE, silent.getVisibility()); assertEquals( @@ -381,7 +381,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_LOW); + IMPORTANCE_LOW, false); final TextView alert = mNotificationInfo.findViewById(R.id.int_alert); assertEquals(VISIBLE, alert.getVisibility()); assertEquals( @@ -393,7 +393,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView alert = mNotificationInfo.findViewById(R.id.int_alert); assertEquals(VISIBLE, alert.getVisibility()); assertEquals( @@ -405,7 +405,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView silent = mNotificationInfo.findViewById(R.id.int_silent); final TextView alert = mNotificationInfo.findViewById(R.id.int_alert); assertEquals(VISIBLE, silent.getVisibility()); @@ -421,7 +421,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_LOW); + IMPORTANCE_LOW, false); final TextView silent = mNotificationInfo.findViewById(R.id.int_silent); final TextView alert = mNotificationInfo.findViewById(R.id.int_alert); assertEquals(VISIBLE, silent.getVisibility()); @@ -437,7 +437,7 @@ public class NotificationInfoTest extends SysuiTestCase { mSbn.getNotification().flags = Notification.FLAG_FOREGROUND_SERVICE; mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final View block = mNotificationInfo.findViewById(R.id.block); final View interruptivenessSettings = mNotificationInfo.findViewById( R.id.interruptiveness_settings); @@ -455,7 +455,7 @@ public class NotificationInfoTest extends SysuiTestCase { (View v, NotificationChannel c, int appUid) -> { assertEquals(mNotificationChannel, c); latch.countDown(); - }, null, true, false, IMPORTANCE_DEFAULT); + }, null, true, false, IMPORTANCE_DEFAULT, true); final View settingsButton = mNotificationInfo.findViewById(R.id.info); settingsButton.performClick(); @@ -467,7 +467,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final View settingsButton = mNotificationInfo.findViewById(R.id.info); assertTrue(settingsButton.getVisibility() != View.VISIBLE); } @@ -479,7 +479,7 @@ public class NotificationInfoTest extends SysuiTestCase { TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, (View v, NotificationChannel c, int appUid) -> { assertEquals(mNotificationChannel, c); - }, null, false, false, IMPORTANCE_DEFAULT); + }, null, false, false, IMPORTANCE_DEFAULT, true); final View settingsButton = mNotificationInfo.findViewById(R.id.info); assertTrue(settingsButton.getVisibility() != View.VISIBLE); } @@ -488,11 +488,11 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_SettingsButtonReappearsAfterSecondBind() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, (View v, NotificationChannel c, int appUid) -> { - }, null, true, false, IMPORTANCE_DEFAULT); + }, null, true, false, IMPORTANCE_DEFAULT, true); final View settingsButton = mNotificationInfo.findViewById(R.id.info); assertEquals(View.VISIBLE, settingsButton.getVisibility()); } @@ -501,7 +501,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testLogBlockingHelperCounter_logGutsViewDisplayed() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.logBlockingHelperCounter("HowCanNotifsBeRealIfAppsArent"); verify(mMetricsLogger).write(argThat(logMaker -> logMaker.getType() == MetricsEvent.NOTIFICATION_BLOCKING_HELPER @@ -513,7 +513,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testLogBlockingHelperCounter_logsForBlockingHelper() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, false, true, - true, true, IMPORTANCE_DEFAULT); + true, true, IMPORTANCE_DEFAULT, true); mNotificationInfo.logBlockingHelperCounter("HowCanNotifsBeRealIfAppsArent"); verify(mMetricsLogger).count(eq("HowCanNotifsBeRealIfAppsArent"), eq(1)); } @@ -526,7 +526,7 @@ public class NotificationInfoTest extends SysuiTestCase { (View v, NotificationChannel c, int appUid) -> { assertEquals(null, c); latch.countDown(); - }, null, true, true, IMPORTANCE_DEFAULT); + }, null, true, true, IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.info).performClick(); // Verify that listener was triggered. @@ -539,7 +539,7 @@ public class NotificationInfoTest extends SysuiTestCase { throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, MULTIPLE_CHANNEL_COUNT, mSbn, null, null, - null, true, true, IMPORTANCE_DEFAULT); + null, true, true, IMPORTANCE_DEFAULT, true); final TextView channelNameView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(GONE, channelNameView.getVisibility()); @@ -550,7 +550,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testStopInvisibleIfBundleFromDifferentChannels() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, MULTIPLE_CHANNEL_COUNT, mSbn, null, null, - null, true, true, IMPORTANCE_DEFAULT); + null, true, true, IMPORTANCE_DEFAULT, true); final TextView blockView = mNotificationInfo.findViewById(R.id.block); assertEquals(GONE, blockView.getVisibility()); } @@ -559,7 +559,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testbindNotification_BlockingHelper() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, false, false, - true, true, IMPORTANCE_DEFAULT); + true, true, IMPORTANCE_DEFAULT, true); final TextView view = mNotificationInfo.findViewById(R.id.block_prompt); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.inline_blocking_helper), view.getText()); @@ -569,7 +569,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testbindNotification_UnblockableTextVisibleWhenAppUnblockable() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); final TextView view = mNotificationInfo.findViewById(R.id.block_prompt); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.notification_unblockable_desc), @@ -580,7 +580,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_DoesNotUpdateNotificationChannel() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mTestableLooper.processAllMessages(); verify(mMockINotificationManager, never()).updateNotificationChannelForPackage( anyString(), eq(TEST_UID), any()); @@ -591,7 +591,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); mTestableLooper.processAllMessages(); @@ -605,7 +605,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); mTestableLooper.processAllMessages(); @@ -619,7 +619,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.int_silent).performClick(); mTestableLooper.processAllMessages(); @@ -633,7 +633,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_alert).performClick(); mTestableLooper.processAllMessages(); @@ -647,7 +647,7 @@ public class NotificationInfoTest extends SysuiTestCase { int originalImportance = mNotificationChannel.getImportance(); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.handleCloseControls(true, false); mTestableLooper.processAllMessages(); @@ -662,7 +662,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.handleCloseControls(true, false); @@ -680,7 +680,7 @@ public class NotificationInfoTest extends SysuiTestCase { TEST_PACKAGE_NAME, mNotificationChannel /* notificationChannel */, 10 /* numUniqueChannelsInRow */, mSbn, null /* checkSaveListener */, null /* onSettingsClick */, null /* onAppSettingsClick */ , - true, false /* isNonblockable */, IMPORTANCE_DEFAULT + true, false /* isNonblockable */, IMPORTANCE_DEFAULT, false ); mNotificationInfo.findViewById(R.id.int_block).performClick(); @@ -702,7 +702,7 @@ public class NotificationInfoTest extends SysuiTestCase { TEST_PACKAGE_NAME, mNotificationChannel /* notificationChannel */, 10 /* numUniqueChannelsInRow */, mSbn, null /* checkSaveListener */, null /* onSettingsClick */, null /* onAppSettingsClick */, - true, false /* isNonblockable */, IMPORTANCE_DEFAULT + true, false /* isNonblockable */, IMPORTANCE_DEFAULT, false ); mNotificationInfo.findViewById(R.id.int_block).performClick(); @@ -724,7 +724,7 @@ public class NotificationInfoTest extends SysuiTestCase { null /* onSettingsClick */, null /* onAppSettingsClick */ , true /* provisioned */, false /* isNonblockable */, true /* isForBlockingHelper */, - true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT); + true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT, true); NotificationGuts guts = spy(new NotificationGuts(mContext, null)); when(guts.getWindowToken()).thenReturn(mock(IBinder.class)); @@ -752,7 +752,7 @@ public class NotificationInfoTest extends SysuiTestCase { 10 /* numUniqueChannelsInRow */, mSbn, listener /* checkSaveListener */, null /* onSettingsClick */, null /* onAppSettingsClick */ , true /* provisioned */, false /* isNonblockable */, true /* isForBlockingHelper */, - true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT); + true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT, true); NotificationGuts guts = spy(new NotificationGuts(mContext, null)); when(guts.getWindowToken()).thenReturn(mock(IBinder.class)); @@ -781,7 +781,7 @@ public class NotificationInfoTest extends SysuiTestCase { null /* onSettingsClick */, null /* onAppSettingsClick */ , false /* isNonblockable */, true /* isForBlockingHelper */, true, true /* isUserSentimentNegative */, /* isNoisy */ - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.handleCloseControls(true /* save */, false /* force */); @@ -800,7 +800,7 @@ public class NotificationInfoTest extends SysuiTestCase { null /* onSettingsClick */, null /* onAppSettingsClick */, true /* provisioned */, false /* isNonblockable */, true /* isForBlockingHelper */, - true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT); + true /* isUserSentimentNegative */, IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.block).performClick(); mTestableLooper.processAllMessages(); @@ -823,7 +823,7 @@ public class NotificationInfoTest extends SysuiTestCase { true /* isForBlockingHelper */, true, false /* isUserSentimentNegative */, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); NotificationGuts guts = mock(NotificationGuts.class); doCallRealMethod().when(guts).closeControls(anyInt(), anyInt(), anyBoolean(), anyBoolean()); mNotificationInfo.setGutsParent(guts); @@ -838,7 +838,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.block).performClick(); waitForUndoButton(); @@ -852,7 +852,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); @@ -888,7 +888,8 @@ public class NotificationInfoTest extends SysuiTestCase { false /* isNonblockable */, true /* isForBlockingHelper */, true /* isUserSentimentNegative */, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, + false); mNotificationInfo.findViewById(R.id.block).performClick(); waitForUndoButton(); @@ -913,7 +914,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); waitForUndoButton(); @@ -928,7 +929,7 @@ public class NotificationInfoTest extends SysuiTestCase { mSbn.getNotification().flags = Notification.FLAG_FOREGROUND_SERVICE; mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); waitForUndoButton(); @@ -949,7 +950,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.handleCloseControls(true, false); @@ -967,7 +968,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); @@ -988,7 +989,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); waitForUndoButton(); @@ -1006,7 +1007,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.int_silent).performClick(); waitForUndoButton(); @@ -1027,7 +1028,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_alert).performClick(); waitForUndoButton(); @@ -1049,7 +1050,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.int_silent).performClick(); waitForUndoButton(); @@ -1071,7 +1072,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_LOW); + IMPORTANCE_LOW, false); mNotificationInfo.findViewById(R.id.int_alert).performClick(); waitForUndoButton(); @@ -1092,7 +1093,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); waitForUndoButton(); @@ -1108,7 +1109,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); @@ -1125,7 +1126,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, (Runnable saveImportance, StatusBarNotification sbn) -> { - }, null, null, true, true, IMPORTANCE_DEFAULT); + }, null, null, true, true, IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); mTestableLooper.processAllMessages(); @@ -1143,7 +1144,7 @@ public class NotificationInfoTest extends SysuiTestCase { TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, (Runnable saveImportance, StatusBarNotification sbn) -> { saveImportance.run(); - }, null, null, true, false, IMPORTANCE_DEFAULT + }, null, null, true, false, IMPORTANCE_DEFAULT, false ); mNotificationInfo.findViewById(R.id.int_block).performClick(); @@ -1170,7 +1171,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, true, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.minimize).performClick(); waitForUndoButton(); @@ -1183,7 +1184,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); @@ -1196,7 +1197,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, true); mNotificationInfo.findViewById(R.id.int_silent).performClick(); waitForUndoButton(); @@ -1210,7 +1211,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_alert).performClick(); waitForUndoButton(); @@ -1224,7 +1225,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); @@ -1236,7 +1237,7 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.setImportance(IMPORTANCE_LOW); mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false, - IMPORTANCE_DEFAULT); + IMPORTANCE_DEFAULT, false); mNotificationInfo.findViewById(R.id.int_block).performClick(); waitForUndoButton(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 736f3840b91a6..ae70b01cd35c7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -352,7 +352,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { RETURNS_DEEP_STUBS); String key = Integer.toString(i); when(row.getStatusBarNotification().getKey()).thenReturn(key); - when(mNotificationData.isHighPriority(row.getStatusBarNotification())).thenReturn(true); + when(row.getEntry().isHighPriority()).thenReturn(true); when(mStackScroller.getChildAt(i)).thenReturn(row); } @@ -368,8 +368,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { RETURNS_DEEP_STUBS); String key = Integer.toString(i); when(row.getStatusBarNotification().getKey()).thenReturn(key); - when(mNotificationData.isHighPriority(row.getStatusBarNotification())) - .thenReturn(false); + when(row.getEntry().isHighPriority()).thenReturn(false); when(mStackScroller.getChildAt(i)).thenReturn(row); } @@ -385,8 +384,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { RETURNS_DEEP_STUBS); String key = Integer.toString(i); when(row.getStatusBarNotification().getKey()).thenReturn(key); - when(mNotificationData.isHighPriority(row.getStatusBarNotification())) - .thenReturn(i < 3); + when(row.getEntry().isHighPriority()).thenReturn(i < 3); when(mStackScroller.getChildAt(i)).thenReturn(row); }