Merge "Fix race condition triggered by quick stop/start of Dream" into sc-dev
diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java
index e3eeb6c4..3a7220f7 100644
--- a/services/core/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/core/java/com/android/server/dreams/DreamManagerService.java
@@ -394,7 +394,8 @@
private void startDreamLocked(final ComponentName name,
final boolean isTest, final boolean canDoze, final int userId) {
- if (Objects.equals(mCurrentDreamName, name)
+ if (!mCurrentDreamIsWaking
+ && Objects.equals(mCurrentDreamName, name)
&& mCurrentDreamIsTest == isTest
&& mCurrentDreamCanDoze == canDoze
&& mCurrentDreamUserId == userId) {