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

Commit 71267deb authored by David Stevens's avatar David Stevens Committed by Android (Google) Code Review
Browse files

Merge "Listen for device power state for VrMode" into oc-mr1-dev

parents 61faffd7 a3d263c1
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -12463,19 +12463,14 @@ public class ActivityManagerService extends IActivityManager.Stub
    void onWakefulnessChanged(int wakefulness) {
        synchronized(this) {
            boolean wasAwake = mWakefulness == PowerManagerInternal.WAKEFULNESS_AWAKE;
            boolean isAwake = wakefulness == PowerManagerInternal.WAKEFULNESS_AWAKE;
            mWakefulness = wakefulness;
            if (wasAwake != isAwake) {
                // Also update state in a special way for running foreground services UI.
            switch (mWakefulness) {
                case PowerManagerInternal.WAKEFULNESS_ASLEEP:
                case PowerManagerInternal.WAKEFULNESS_DREAMING:
                case PowerManagerInternal.WAKEFULNESS_DOZING:
                    mServices.updateScreenStateLocked(false /* screenOn */);
                    break;
                case PowerManagerInternal.WAKEFULNESS_AWAKE:
                default:
                    mServices.updateScreenStateLocked(true /* screenOn */);
                    break;
                mServices.updateScreenStateLocked(isAwake);
                sendNotifyVrManagerOfSleepState(!isAwake);
            }
        }
    }
@@ -12511,7 +12506,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
            mStackSupervisor.applySleepTokensLocked(true /* applyToStacks */);
            if (wasSleeping) {
                sendNotifyVrManagerOfSleepState(false);
                updateOomAdjLocked();
            }
        } else if (!mSleeping && shouldSleep) {
@@ -12521,7 +12515,6 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
            mTopProcessState = ActivityManager.PROCESS_STATE_TOP_SLEEPING;
            mStackSupervisor.goingToSleepLocked();
            sendNotifyVrManagerOfSleepState(true);
            updateOomAdjLocked();
        }
    }