summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Silva <lusilva@google.com> 2024-03-28 16:03:14 -0400
committer Lucas Silva <lusilva@google.com> 2024-03-28 16:03:14 -0400
commit4bff841da56be654126de1358fa2b51cbb73ea7e (patch)
tree1c53c1b2de3746e0387fd474b84ec5a710cca4dc
parent2c765457b0ffac5e2a41613ea10357d4f28f2b13 (diff)
Fix DreamService race condition with overlay
When the service is finished, there is a race condition which exists if an overlay connection is active. This causes the finish call to become async, and therefore some of the internal state of the dream might change by the time finish runs. This is causing the cleanup logic in DreamController to be skipped, which is not correctly sending the DREAMING_STOPPED broadcast. Bug: 329305299 Test: atest android.service.dreams.cts.DreamServiceTest#testDreamServiceOnDestroyCallback Flag: NA Change-Id: I3c439938106e57c963889fa2281398acb5a1fac2
-rw-r--r--core/java/android/service/dreams/DreamService.java2
1 files changed, 0 insertions, 2 deletions
diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java
index eee466883db1..e3adec4a57ed 100644
--- a/core/java/android/service/dreams/DreamService.java
+++ b/core/java/android/service/dreams/DreamService.java
@@ -1032,12 +1032,10 @@ public class DreamService extends Service implements Window.Callback {
overlay.endDream();
mOverlayConnection.unbind();
mOverlayConnection = null;
- finish();
} catch (RemoteException e) {
Log.e(mTag, "could not inform overlay of dream end:" + e);
}
});
- return;
}
if (mDebug) Slog.v(mTag, "finish(): mFinished=" + mFinished);