Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +13 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.android.systemui.statusbar.notification.row.NotificationConver import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_HOME; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_MUTE; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_SNOOZE; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_UNBUBBLE; import static java.lang.annotation.RetentionPolicy.SOURCE; Loading Loading @@ -121,7 +122,7 @@ public class NotificationConversationInfo extends LinearLayout implements boolean mSkipPost = false; private OnClickListener mOnBubbleClick = v -> { mSelectedAction = ACTION_BUBBLE; mSelectedAction = mStartedAsBubble ? ACTION_UNBUBBLE : ACTION_BUBBLE; if (mStartedAsBubble) { mBubbleController.onUserDemotedBubbleFromNotification(mEntry); } else { Loading Loading @@ -586,6 +587,7 @@ public class NotificationConversationInfo extends LinearLayout implements static final int ACTION_SNOOZE = 3; static final int ACTION_MUTE = 4; static final int ACTION_DEMOTE = 5; static final int ACTION_UNBUBBLE = 6; private final INotificationManager mINotificationManager; private final String mAppPkg; Loading @@ -606,9 +608,17 @@ public class NotificationConversationInfo extends LinearLayout implements @Override public void run() { try { boolean channelSettingChanged = mAction != ACTION_HOME && mAction != ACTION_SNOOZE; switch (mAction) { case ACTION_BUBBLE: mChannelToUpdate.setAllowBubbles(!mChannelToUpdate.canBubble()); case ACTION_UNBUBBLE: boolean canBubble = mAction == ACTION_BUBBLE; if (mChannelToUpdate.canBubble() != canBubble) { channelSettingChanged = true; mChannelToUpdate.setAllowBubbles(canBubble); } else { channelSettingChanged = false; } break; case ACTION_FAVORITE: // TODO: extend beyond DND Loading @@ -629,7 +639,7 @@ public class NotificationConversationInfo extends LinearLayout implements } if (mAction != ACTION_HOME && mAction != ACTION_SNOOZE) { if (channelSettingChanged) { mINotificationManager.updateNotificationChannelForPackage( mAppPkg, mAppUid, mChannelToUpdate); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ import android.service.notification.StatusBarNotification; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; Loading Loading @@ -600,6 +599,34 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertFalse(captor.getValue().canBubble()); } @Test public void testBubble_noChannelChange() throws Exception { mNotificationInfo.bindNotification( mShortcutManager, mLauncherApps, mMockPackageManager, mMockINotificationManager, mVisualStabilityManager, TEST_PACKAGE_NAME, mNotificationChannel, mBubbleEntry, null, null, null, true); assertFalse(mBubbleEntry.isBubble()); assertTrue(mNotificationChannel.canBubble()); // Promote it mNotificationInfo.findViewById(R.id.bubble).performClick(); mTestableLooper.processAllMessages(); verify(mBubbleController, times(1)).onUserCreatedBubbleFromNotification(mBubbleEntry); verify(mMockINotificationManager, never()).updateNotificationChannelForPackage( anyString(), anyInt(), any()); } @Test public void testFavorite_favorite() throws Exception { mNotificationInfo.bindNotification( Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +13 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.android.systemui.statusbar.notification.row.NotificationConver import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_HOME; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_MUTE; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_SNOOZE; import static com.android.systemui.statusbar.notification.row.NotificationConversationInfo.UpdateChannelRunnable.ACTION_UNBUBBLE; import static java.lang.annotation.RetentionPolicy.SOURCE; Loading Loading @@ -121,7 +122,7 @@ public class NotificationConversationInfo extends LinearLayout implements boolean mSkipPost = false; private OnClickListener mOnBubbleClick = v -> { mSelectedAction = ACTION_BUBBLE; mSelectedAction = mStartedAsBubble ? ACTION_UNBUBBLE : ACTION_BUBBLE; if (mStartedAsBubble) { mBubbleController.onUserDemotedBubbleFromNotification(mEntry); } else { Loading Loading @@ -586,6 +587,7 @@ public class NotificationConversationInfo extends LinearLayout implements static final int ACTION_SNOOZE = 3; static final int ACTION_MUTE = 4; static final int ACTION_DEMOTE = 5; static final int ACTION_UNBUBBLE = 6; private final INotificationManager mINotificationManager; private final String mAppPkg; Loading @@ -606,9 +608,17 @@ public class NotificationConversationInfo extends LinearLayout implements @Override public void run() { try { boolean channelSettingChanged = mAction != ACTION_HOME && mAction != ACTION_SNOOZE; switch (mAction) { case ACTION_BUBBLE: mChannelToUpdate.setAllowBubbles(!mChannelToUpdate.canBubble()); case ACTION_UNBUBBLE: boolean canBubble = mAction == ACTION_BUBBLE; if (mChannelToUpdate.canBubble() != canBubble) { channelSettingChanged = true; mChannelToUpdate.setAllowBubbles(canBubble); } else { channelSettingChanged = false; } break; case ACTION_FAVORITE: // TODO: extend beyond DND Loading @@ -629,7 +639,7 @@ public class NotificationConversationInfo extends LinearLayout implements } if (mAction != ACTION_HOME && mAction != ACTION_SNOOZE) { if (channelSettingChanged) { mINotificationManager.updateNotificationChannelForPackage( mAppPkg, mAppUid, mChannelToUpdate); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ import android.service.notification.StatusBarNotification; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; Loading Loading @@ -600,6 +599,34 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertFalse(captor.getValue().canBubble()); } @Test public void testBubble_noChannelChange() throws Exception { mNotificationInfo.bindNotification( mShortcutManager, mLauncherApps, mMockPackageManager, mMockINotificationManager, mVisualStabilityManager, TEST_PACKAGE_NAME, mNotificationChannel, mBubbleEntry, null, null, null, true); assertFalse(mBubbleEntry.isBubble()); assertTrue(mNotificationChannel.canBubble()); // Promote it mNotificationInfo.findViewById(R.id.bubble).performClick(); mTestableLooper.processAllMessages(); verify(mBubbleController, times(1)).onUserCreatedBubbleFromNotification(mBubbleEntry); verify(mMockINotificationManager, never()).updateNotificationChannelForPackage( anyString(), anyInt(), any()); } @Test public void testFavorite_favorite() throws Exception { mNotificationInfo.bindNotification( Loading