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

Commit 04e5b90e authored by Tetiana Meronyk's avatar Tetiana Meronyk
Browse files

Enable user of UserWakeupStore only on devices that support multiuser.

Since devices that do not support multiuser do not have secondary users, there is no need to store wakeups on them.

Bug: 352696527
Test: atest AlarmManagerServiceTest
Flag: com.android.server.alarm.start_user_before_scheduled_alarms
Change-Id: Id1b7d4ae514de42c21e1fdee670d36a88dbeae3d
parent ca869aaa
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ import android.os.SystemProperties;
import android.os.ThreadLocalWorkSource;
import android.os.ThreadLocalWorkSource;
import android.os.Trace;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
import android.os.WorkSource;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Settings;
@@ -1794,7 +1795,8 @@ public class AlarmManagerService extends SystemService {
        mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
        mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);


        mUseFrozenStateToDropListenerAlarms = Flags.useFrozenStateToDropListenerAlarms();
        mUseFrozenStateToDropListenerAlarms = Flags.useFrozenStateToDropListenerAlarms();
        mStartUserBeforeScheduledAlarms = Flags.startUserBeforeScheduledAlarms();
        mStartUserBeforeScheduledAlarms = Flags.startUserBeforeScheduledAlarms()
                && UserManager.supportsMultipleUsers();
        if (mStartUserBeforeScheduledAlarms) {
        if (mStartUserBeforeScheduledAlarms) {
            mUserWakeupStore = new UserWakeupStore();
            mUserWakeupStore = new UserWakeupStore();
            mUserWakeupStore.init();
            mUserWakeupStore.init();
@@ -3015,7 +3017,7 @@ public class AlarmManagerService extends SystemService {
                    mUseFrozenStateToDropListenerAlarms);
                    mUseFrozenStateToDropListenerAlarms);
            pw.println();
            pw.println();
            pw.print(Flags.FLAG_START_USER_BEFORE_SCHEDULED_ALARMS,
            pw.print(Flags.FLAG_START_USER_BEFORE_SCHEDULED_ALARMS,
                    mStartUserBeforeScheduledAlarms);
                    Flags.startUserBeforeScheduledAlarms());
            pw.decreaseIndent();
            pw.decreaseIndent();
            pw.println();
            pw.println();
            pw.println();
            pw.println();