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

Commit 9fb0077a authored by Tetiana Meronyk's avatar Tetiana Meronyk Committed by Android (Google) Code Review
Browse files

Merge "Move UserWakeupStore initialization to happen before it is used" into main

parents fabec0c5 fef14575
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1795,6 +1795,10 @@ public class AlarmManagerService extends SystemService {

        mUseFrozenStateToDropListenerAlarms = Flags.useFrozenStateToDropListenerAlarms();
        mStartUserBeforeScheduledAlarms = Flags.startUserBeforeScheduledAlarms();
        if (mStartUserBeforeScheduledAlarms) {
            mUserWakeupStore = new UserWakeupStore();
            mUserWakeupStore.init();
        }
        if (mUseFrozenStateToDropListenerAlarms) {
            final ActivityManager.UidFrozenStateChangedCallback callback = (uids, frozenStates) -> {
                final int size = frozenStates.length;
@@ -1913,10 +1917,6 @@ public class AlarmManagerService extends SystemService {
                Slog.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
            }
        }
        if (mStartUserBeforeScheduledAlarms) {
            mUserWakeupStore = new UserWakeupStore();
            mUserWakeupStore.init();
        }
        publishLocalService(AlarmManagerInternal.class, new LocalService());
        publishBinderService(Context.ALARM_SERVICE, mService);
    }
@@ -3863,7 +3863,7 @@ public class AlarmManagerService extends SystemService {
        long nextNonWakeup = 0;
        if (mAlarmStore.size() > 0) {
            long firstWakeup = mAlarmStore.getNextWakeupDeliveryTime();
            if (mStartUserBeforeScheduledAlarms) {
            if (mStartUserBeforeScheduledAlarms && mUserWakeupStore != null) {
                final long firstUserWakeup = mUserWakeupStore.getNextWakeupTime();
                if (firstUserWakeup >= 0 && firstUserWakeup < firstWakeup) {
                    firstWakeup = firstUserWakeup;