Loading services/core/java/com/android/server/notification/NotificationManagerService.java +14 −10 Original line number Diff line number Diff line Loading @@ -2657,6 +2657,9 @@ public class NotificationManagerService extends SystemService { } private void sendAppBlockStateChangedBroadcast(String pkg, int uid, boolean blocked) { // From Android T, revoking the notification permission will cause the app to be killed. // delay this broadcast so it doesn't race with that process death mHandler.postDelayed(() -> { try { getContext().sendBroadcastAsUser( new Intent(ACTION_APP_BLOCK_STATE_CHANGED) Loading @@ -2667,6 +2670,7 @@ public class NotificationManagerService extends SystemService { } catch (SecurityException e) { Slog.w(TAG, "Can't notify app about app block change", e); } }, 500); } @Override Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -2701,6 +2701,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { // should trigger a broadcast mBinderService.setNotificationsEnabledForPackage(PKG, 0, true); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading Loading @@ -2728,6 +2730,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { // should trigger a broadcast mBinderService.setNotificationsEnabledForPackage(PKG, 0, true); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mAppOpsManager.checkOpNoThrow(anyInt(), eq(mUid), eq(PKG))).thenReturn(MODE_IGNORED); mService.mAppOpsCallback.opChanged(0, mUid, PKG); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading @@ -616,6 +618,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mAppOpsManager.checkOpNoThrow(anyInt(), eq(mUid), eq(PKG))).thenReturn(MODE_ALLOWED); mService.mAppOpsCallback.opChanged(0, mUid, PKG); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +14 −10 Original line number Diff line number Diff line Loading @@ -2657,6 +2657,9 @@ public class NotificationManagerService extends SystemService { } private void sendAppBlockStateChangedBroadcast(String pkg, int uid, boolean blocked) { // From Android T, revoking the notification permission will cause the app to be killed. // delay this broadcast so it doesn't race with that process death mHandler.postDelayed(() -> { try { getContext().sendBroadcastAsUser( new Intent(ACTION_APP_BLOCK_STATE_CHANGED) Loading @@ -2667,6 +2670,7 @@ public class NotificationManagerService extends SystemService { } catch (SecurityException e) { Slog.w(TAG, "Can't notify app about app block change", e); } }, 500); } @Override Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -2701,6 +2701,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { // should trigger a broadcast mBinderService.setNotificationsEnabledForPackage(PKG, 0, true); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading Loading @@ -2728,6 +2730,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { // should trigger a broadcast mBinderService.setNotificationsEnabledForPackage(PKG, 0, true); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -601,6 +601,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mAppOpsManager.checkOpNoThrow(anyInt(), eq(mUid), eq(PKG))).thenReturn(MODE_IGNORED); mService.mAppOpsCallback.opChanged(0, mUid, PKG); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading @@ -616,6 +618,8 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { when(mAppOpsManager.checkOpNoThrow(anyInt(), eq(mUid), eq(PKG))).thenReturn(MODE_ALLOWED); mService.mAppOpsCallback.opChanged(0, mUid, PKG); Thread.sleep(500); waitForIdle(); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(1)).sendBroadcastAsUser(captor.capture(), any(), eq(null)); Loading