Created
November 27, 2020 23:04
-
-
Save Dil3mm4/10fda4e92bfdc00cee5a51612abce385 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1877cf6473366e84c5b4846b882368bb9fa74be6 Mon Sep 17 00:00:00 2001 | |
From: Dil3mm4 <[email protected]> | |
Date: Fri, 27 Nov 2020 23:00:01 +0000 | |
Subject: [PATCH] FODCircleView: detect touch outside and take action | |
accordingly | |
FOD's view was intercepting gestures, we need to avoid that. | |
Tests: | |
- enable gesture navigation, open a third party-app that asks for biometric, swipe to recents (or home), ensure FOD doesn't intercept touch and swipe action reaches a successful ending. | |
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
index 234a0019666b..eb3b9f8ea241 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
@@ -80,6 +80,7 @@ public class FODCircleView extends ImageView { | |
private boolean mIsCircleShowing; | |
private boolean mIsDreaming; | |
private boolean mIsKeyguard; | |
+ private boolean mTouchedOutside; | |
private Handler mHandler; | |
@@ -234,11 +235,11 @@ public class FODCircleView extends ImageView { | |
mParams.packageName = "android"; | |
mParams.type = WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY; | |
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | | |
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; | |
+ WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; | |
mParams.gravity = Gravity.TOP | Gravity.LEFT; | |
mPressedParams.copyFrom(mParams); | |
- mPressedParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND; | |
+ mPressedParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; | |
mParams.setTitle("Fingerprint on display"); | |
mPressedParams.setTitle("Fingerprint on display.touched"); | |
@@ -279,6 +280,12 @@ public class FODCircleView extends ImageView { | |
float y = event.getAxisValue(MotionEvent.AXIS_Y); | |
boolean newIsInside = (x > 0 && x < mSize) && (y > 0 && y < mSize); | |
+ mTouchedOutside = false; | |
+ | |
+ if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { | |
+ mTouchedOutside = true; | |
+ return true; | |
+ } | |
if (event.getAction() == MotionEvent.ACTION_DOWN && newIsInside) { | |
showCircle(); | |
@@ -353,7 +360,7 @@ public class FODCircleView extends ImageView { | |
} | |
public void showCircle() { | |
- if (mFading) return; | |
+ if (mFading || mTouchedOutside) return; | |
mIsCircleShowing = true; | |
setKeepScreenOn(true); | |
-- | |
2.20.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment