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

Commit 85a47b30 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Do not wake the device if an activity starts while dozing." into tm-dev...

Merge "Do not wake the device if an activity starts while dozing." into tm-dev am: e2f44dc7 am: 9677b9c9 am: d0684cbb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18344926



Change-Id: I0000910c3883d6379ad9a5adac3ebbfc0c105d9d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2b00d686 d0684cbb
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -124,8 +124,10 @@ public final class DreamManagerService extends SystemService {
                    final boolean activityAllowed = activityType == ACTIVITY_TYPE_HOME
                            || activityType == ACTIVITY_TYPE_DREAM
                            || activityType == ACTIVITY_TYPE_ASSISTANT;
                    if (mCurrentDreamToken != null && !mCurrentDreamIsWaking && !activityAllowed) {
                        stopDreamInternal(false, "activity starting: " + activityInfo.name);
                    if (mCurrentDreamToken != null && !mCurrentDreamIsWaking
                            && !mCurrentDreamIsDozing && !activityAllowed) {
                        requestAwakenInternal(
                                "stopping dream due to activity start: " + activityInfo.name);
                    }
                }
            };
@@ -229,13 +231,13 @@ public final class DreamManagerService extends SystemService {
        mPowerManager.nap(time);
    }

    private void requestAwakenInternal() {
    private void requestAwakenInternal(String reason) {
        // Treat an explicit request to awaken as user activity so that the
        // device doesn't immediately go to sleep if the timeout expired,
        // for example when being undocked.
        long time = SystemClock.uptimeMillis();
        mPowerManager.userActivity(time, false /*noChangeLights*/);
        stopDreamInternal(false /*immediate*/, "request awaken");
        stopDreamInternal(false /*immediate*/, reason);
    }

    private void finishSelfInternal(IBinder token, boolean immediate) {
@@ -715,7 +717,7 @@ public final class DreamManagerService extends SystemService {

            final long ident = Binder.clearCallingIdentity();
            try {
                requestAwakenInternal();
                requestAwakenInternal("request awaken");
            } finally {
                Binder.restoreCallingIdentity(ident);
            }