Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -274,6 +274,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G MetricsLogger.action(mContext, MetricsEvent.ACTION_SAVE_IMPORTANCE, MetricsLogger.action(mContext, MetricsEvent.ACTION_SAVE_IMPORTANCE, selectedImportance - mStartingUserImportance); selectedImportance - mStartingUserImportance); mSingleNotificationChannel.setImportance(selectedImportance); mSingleNotificationChannel.setImportance(selectedImportance); mSingleNotificationChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE); try { try { mINotificationManager.updateNotificationChannelForPackage( mINotificationManager.updateNotificationChannelForPackage( mPkg, mAppUid, mSingleNotificationChannel); mPkg, mAppUid, mSingleNotificationChannel); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.SysuiTestCase; import org.junit.Before; import org.junit.Before; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -585,11 +586,16 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.getImportance(), mSbn, null, null, null, mNotificationChannel.getImportance(), mSbn, null, null, null, null, Collections.singleton(TEST_PACKAGE_NAME)); null, Collections.singleton(TEST_PACKAGE_NAME)); Switch enabledSwitch = (Switch) mNotificationInfo.findViewById(R.id.channel_enabled_switch); Switch enabledSwitch = mNotificationInfo.findViewById(R.id.channel_enabled_switch); enabledSwitch.setChecked(false); enabledSwitch.setChecked(false); mNotificationInfo.handleCloseControls(true); mNotificationInfo.handleCloseControls(true); ArgumentCaptor<NotificationChannel> updated = ArgumentCaptor.forClass(NotificationChannel.class); verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage( verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage( eq(TEST_PACKAGE_NAME), anyInt(), eq(mNotificationChannel)); anyString(), anyInt(), updated.capture()); assertTrue((updated.getValue().getUserLockedFields() & NotificationChannel.USER_LOCKED_IMPORTANCE) != 0); } } @Test @Test Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -274,6 +274,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G MetricsLogger.action(mContext, MetricsEvent.ACTION_SAVE_IMPORTANCE, MetricsLogger.action(mContext, MetricsEvent.ACTION_SAVE_IMPORTANCE, selectedImportance - mStartingUserImportance); selectedImportance - mStartingUserImportance); mSingleNotificationChannel.setImportance(selectedImportance); mSingleNotificationChannel.setImportance(selectedImportance); mSingleNotificationChannel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE); try { try { mINotificationManager.updateNotificationChannelForPackage( mINotificationManager.updateNotificationChannelForPackage( mPkg, mAppUid, mSingleNotificationChannel); mPkg, mAppUid, mSingleNotificationChannel); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.SysuiTestCase; import org.junit.Before; import org.junit.Before; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -585,11 +586,16 @@ public class NotificationInfoTest extends SysuiTestCase { mNotificationChannel.getImportance(), mSbn, null, null, null, mNotificationChannel.getImportance(), mSbn, null, null, null, null, Collections.singleton(TEST_PACKAGE_NAME)); null, Collections.singleton(TEST_PACKAGE_NAME)); Switch enabledSwitch = (Switch) mNotificationInfo.findViewById(R.id.channel_enabled_switch); Switch enabledSwitch = mNotificationInfo.findViewById(R.id.channel_enabled_switch); enabledSwitch.setChecked(false); enabledSwitch.setChecked(false); mNotificationInfo.handleCloseControls(true); mNotificationInfo.handleCloseControls(true); ArgumentCaptor<NotificationChannel> updated = ArgumentCaptor.forClass(NotificationChannel.class); verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage( verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage( eq(TEST_PACKAGE_NAME), anyInt(), eq(mNotificationChannel)); anyString(), anyInt(), updated.capture()); assertTrue((updated.getValue().getUserLockedFields() & NotificationChannel.USER_LOCKED_IMPORTANCE) != 0); } } @Test @Test Loading