From b5b2dfc63dcf4287f55a97de3098d76acf18a391 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Wed, 15 Dec 2021 16:08:58 -0800 Subject: [PATCH] Exit dream on MotionEvent.ACTION_UP. Previously, DreamService would exit when any MotionEvent was detected. This led to dreams ending while the user's finger was still on the screen. This change adjusts the exit action to be on ACTION_UP to correspond with the finger lifting off the screen, matching user expectation. Bug: verified non-interactive dream exits on lifting finger. Test: 210919013 Change-Id: I767cdb179f99073c1fffc66fe492bdcbbae599c2 --- core/java/android/service/dreams/DreamService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/service/dreams/DreamService.java b/core/java/android/service/dreams/DreamService.java index 3ab6907557da4..4ae3d7de26c2a 100644 --- a/core/java/android/service/dreams/DreamService.java +++ b/core/java/android/service/dreams/DreamService.java @@ -333,7 +333,7 @@ public class DreamService extends Service implements Window.Callback { public boolean dispatchTouchEvent(MotionEvent event) { // TODO: create more flexible version of mInteractive that allows clicks // but finish()es on any other kind of activity - if (!mInteractive) { + if (!mInteractive && event.getActionMasked() == MotionEvent.ACTION_UP) { if (mDebug) Slog.v(TAG, "Waking up on touchEvent"); wakeUp(); return true;