Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a01a7550 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Flag removal: MultipleAlarmNotificationsSupport" into main

parents c0d3ffdd fbd99391
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -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
+12 −35
Original line number Diff line number Diff line
@@ -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;
@@ -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) {
@@ -191,11 +180,9 @@ public class BackgroundUserSoundNotifier {
                    }
                    activityManager.switchUser(userId);
                }
                if (Flags.multipleAlarmNotificationsSupport()) {

                mNotificationClientUids.remove(clientUid);
                } else {
                    mNotificationClientUid = -1;
                }

            }
        };

@@ -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()),
@@ -285,11 +269,8 @@ public class BackgroundUserSoundNotifier {
            }
            dismissNotification(notificationClientUid);

            if (Flags.multipleAlarmNotificationsSupport()) {
            mNotificationClientUids.remove(notificationClientUid);
            } else {
                mNotificationClientUid = -1;
            }

        }
    }

@@ -371,10 +352,6 @@ public class BackgroundUserSoundNotifier {
    }

    private boolean isNotificationShown(int notificationClientUid) {
        if (Flags.multipleAlarmNotificationsSupport()) {
        return mNotificationClientUids.contains(notificationClientUid);
        } else {
            return mNotificationClientUid != -1;
        }
    }
}
+2 −9
Original line number Diff line number Diff line
@@ -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;
@@ -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);

@@ -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());
@@ -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 {