DO NOT MERGE Revert "Handle dream restart" am: 36acacd2a0

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

Change-Id: I29ef4ed54ec68aa90d197af9b074b28ede5cfcd1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Bryce Lee
2023-02-22 19:36:56 +00:00
committed by Automerger Merge Worker

View File

@@ -42,7 +42,6 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
/**
* Internal controller for starting and stopping the current dream and managing related state.
@@ -120,20 +119,10 @@ final class DreamController {
+ ", isPreviewMode=" + isPreviewMode + ", canDoze=" + canDoze
+ ", userId=" + userId + ", reason='" + reason + "'");
final DreamRecord oldDream = mCurrentDream;
mCurrentDream = new DreamRecord(token, name, isPreviewMode, canDoze, userId, wakeLock);
if (oldDream != null) {
if (!oldDream.mWakingGently) {
// We will stop these previous dreams once the new dream is started.
mPreviousDreams.add(oldDream);
} else if (Objects.equals(oldDream.mName, mCurrentDream.mName)) {
// We are attempting to start a dream that is currently waking up gently.
// Let's silently stop the old instance here to clear the dream state.
// This should happen after the new mCurrentDream is set to avoid announcing
// a "dream stopped" state.
stopDreamInstance(/* immediately */ true, "restarting same dream", oldDream);
}
if (mCurrentDream != null) {
mPreviousDreams.add(mCurrentDream);
}
mCurrentDream = new DreamRecord(token, name, isPreviewMode, canDoze, userId, wakeLock);
mCurrentDream.mDreamStartTime = SystemClock.elapsedRealtime();
MetricsLogger.visible(mContext,