Loading core/java/android/content/pm/multiuser.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -67,16 +67,6 @@ flag { bug: "365748524" } flag { name: "multiple_alarm_notifications_support" namespace: "multiuser" description: "Implement handling of multiple simultaneous alarms/timers on bg users" bug: "367615180" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "enable_biometrics_to_unlock_private_space" is_exported: true Loading services/core/java/com/android/server/pm/BackgroundUserSoundNotifier.java +12 −35 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.media.AudioFocusInfo; import android.media.AudioManager; import android.media.AudioPlaybackConfiguration; import android.media.audiopolicy.AudioPolicy; import android.multiuser.Flags; import android.os.Looper; import android.os.RemoteException; import android.os.UserHandle; Loading Loading @@ -156,22 +155,12 @@ public class BackgroundUserSoundNotifier { @SuppressLint("MissingPermission") @Override public void onReceive(Context context, Intent intent) { if (Flags.multipleAlarmNotificationsSupport()) { if (!intent.hasExtra(EXTRA_NOTIFICATION_CLIENT_UID)) { return; } } else { if (mNotificationClientUid == -1) { return; } } int clientUid; if (Flags.multipleAlarmNotificationsSupport()) { clientUid = intent.getIntExtra(EXTRA_NOTIFICATION_CLIENT_UID, -1); } else { clientUid = mNotificationClientUid; } int clientUid = intent.getIntExtra(EXTRA_NOTIFICATION_CLIENT_UID, -1); dismissNotification(clientUid); if (DEBUG) { Loading @@ -191,11 +180,9 @@ public class BackgroundUserSoundNotifier { } activityManager.switchUser(userId); } if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.remove(clientUid); } else { mNotificationClientUid = -1; } } }; Loading Loading @@ -255,11 +242,8 @@ public class BackgroundUserSoundNotifier { + ", displaying notification for current user " + foregroundContext.getUserId()); } if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.add(afi.getClientUid()); } else { mNotificationClientUid = afi.getClientUid(); } mNotificationManager.notifyAsUser(LOG_TAG, afi.getClientUid(), createNotification(userInfo.name, foregroundContext, afi.getClientUid()), Loading @@ -285,11 +269,8 @@ public class BackgroundUserSoundNotifier { } dismissNotification(notificationClientUid); if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.remove(notificationClientUid); } else { mNotificationClientUid = -1; } } } Loading Loading @@ -371,10 +352,6 @@ public class BackgroundUserSoundNotifier { } private boolean isNotificationShown(int notificationClientUid) { if (Flags.multipleAlarmNotificationsSupport()) { return mNotificationClientUids.contains(notificationClientUid); } else { return mNotificationClientUid != -1; } } } services/tests/mockingservicestests/src/com/android/server/pm/BackgroundUserSoundNotifierTest.java +2 −9 Original line number Diff line number Diff line Loading @@ -41,12 +41,10 @@ import android.media.AudioManager; import android.media.AudioPlaybackConfiguration; import android.media.PlayerProxy; import android.media.audiopolicy.AudioPolicy; import android.multiuser.Flags; import android.os.Build; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.ArraySet; Loading Loading @@ -151,11 +149,8 @@ public class BackgroundUserSoundNotifierTest { final int fgUserId = mSpiedContext.getUserId(); int bgUserId = fgUserId + 1; int bgUserUid = bgUserId * 100000; if (Flags.multipleAlarmNotificationsSupport()) { mBackgroundUserSoundNotifier.mNotificationClientUids.add(bgUserUid); } else { mBackgroundUserSoundNotifier.mNotificationClientUid = bgUserUid; } AudioManager mockAudioManager = mock(AudioManager.class); when(mSpiedContext.getSystemService(AudioManager.class)).thenReturn(mockAudioManager); Loading Loading @@ -277,7 +272,6 @@ public class BackgroundUserSoundNotifierTest { notification.actions[0].title); } @RequiresFlagsEnabled({Flags.FLAG_MULTIPLE_ALARM_NOTIFICATIONS_SUPPORT}) @Test public void testMultipleAlarmsSameUid_OneNotificationCreated() throws RemoteException { assumeTrue(UserManager.supportsMultipleUsers()); Loading Loading @@ -308,7 +302,6 @@ public class BackgroundUserSoundNotifierTest { eq(UserHandle.of(fgUserId))); } @RequiresFlagsEnabled({Flags.FLAG_MULTIPLE_ALARM_NOTIFICATIONS_SUPPORT}) @Test public void testMultipleAlarmsDifferentUsers_multipleNotificationsCreated() throws RemoteException { Loading Loading
core/java/android/content/pm/multiuser.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -67,16 +67,6 @@ flag { bug: "365748524" } flag { name: "multiple_alarm_notifications_support" namespace: "multiuser" description: "Implement handling of multiple simultaneous alarms/timers on bg users" bug: "367615180" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "enable_biometrics_to_unlock_private_space" is_exported: true Loading
services/core/java/com/android/server/pm/BackgroundUserSoundNotifier.java +12 −35 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.media.AudioFocusInfo; import android.media.AudioManager; import android.media.AudioPlaybackConfiguration; import android.media.audiopolicy.AudioPolicy; import android.multiuser.Flags; import android.os.Looper; import android.os.RemoteException; import android.os.UserHandle; Loading Loading @@ -156,22 +155,12 @@ public class BackgroundUserSoundNotifier { @SuppressLint("MissingPermission") @Override public void onReceive(Context context, Intent intent) { if (Flags.multipleAlarmNotificationsSupport()) { if (!intent.hasExtra(EXTRA_NOTIFICATION_CLIENT_UID)) { return; } } else { if (mNotificationClientUid == -1) { return; } } int clientUid; if (Flags.multipleAlarmNotificationsSupport()) { clientUid = intent.getIntExtra(EXTRA_NOTIFICATION_CLIENT_UID, -1); } else { clientUid = mNotificationClientUid; } int clientUid = intent.getIntExtra(EXTRA_NOTIFICATION_CLIENT_UID, -1); dismissNotification(clientUid); if (DEBUG) { Loading @@ -191,11 +180,9 @@ public class BackgroundUserSoundNotifier { } activityManager.switchUser(userId); } if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.remove(clientUid); } else { mNotificationClientUid = -1; } } }; Loading Loading @@ -255,11 +242,8 @@ public class BackgroundUserSoundNotifier { + ", displaying notification for current user " + foregroundContext.getUserId()); } if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.add(afi.getClientUid()); } else { mNotificationClientUid = afi.getClientUid(); } mNotificationManager.notifyAsUser(LOG_TAG, afi.getClientUid(), createNotification(userInfo.name, foregroundContext, afi.getClientUid()), Loading @@ -285,11 +269,8 @@ public class BackgroundUserSoundNotifier { } dismissNotification(notificationClientUid); if (Flags.multipleAlarmNotificationsSupport()) { mNotificationClientUids.remove(notificationClientUid); } else { mNotificationClientUid = -1; } } } Loading Loading @@ -371,10 +352,6 @@ public class BackgroundUserSoundNotifier { } private boolean isNotificationShown(int notificationClientUid) { if (Flags.multipleAlarmNotificationsSupport()) { return mNotificationClientUids.contains(notificationClientUid); } else { return mNotificationClientUid != -1; } } }
services/tests/mockingservicestests/src/com/android/server/pm/BackgroundUserSoundNotifierTest.java +2 −9 Original line number Diff line number Diff line Loading @@ -41,12 +41,10 @@ import android.media.AudioManager; import android.media.AudioPlaybackConfiguration; import android.media.PlayerProxy; import android.media.audiopolicy.AudioPolicy; import android.multiuser.Flags; import android.os.Build; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.ArraySet; Loading Loading @@ -151,11 +149,8 @@ public class BackgroundUserSoundNotifierTest { final int fgUserId = mSpiedContext.getUserId(); int bgUserId = fgUserId + 1; int bgUserUid = bgUserId * 100000; if (Flags.multipleAlarmNotificationsSupport()) { mBackgroundUserSoundNotifier.mNotificationClientUids.add(bgUserUid); } else { mBackgroundUserSoundNotifier.mNotificationClientUid = bgUserUid; } AudioManager mockAudioManager = mock(AudioManager.class); when(mSpiedContext.getSystemService(AudioManager.class)).thenReturn(mockAudioManager); Loading Loading @@ -277,7 +272,6 @@ public class BackgroundUserSoundNotifierTest { notification.actions[0].title); } @RequiresFlagsEnabled({Flags.FLAG_MULTIPLE_ALARM_NOTIFICATIONS_SUPPORT}) @Test public void testMultipleAlarmsSameUid_OneNotificationCreated() throws RemoteException { assumeTrue(UserManager.supportsMultipleUsers()); Loading Loading @@ -308,7 +302,6 @@ public class BackgroundUserSoundNotifierTest { eq(UserHandle.of(fgUserId))); } @RequiresFlagsEnabled({Flags.FLAG_MULTIPLE_ALARM_NOTIFICATIONS_SUPPORT}) @Test public void testMultipleAlarmsDifferentUsers_multipleNotificationsCreated() throws RemoteException { Loading