Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05bdcba7 authored by Dil3mm4's avatar Dil3mm4 Committed by Łukasz Patron
Browse files

FODCircleView: detect touch outside and take action accordingly

FOD's view was intercepting gestures, we need to avoid that.

Test: 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.
Change-Id: Iaae1a373405735bee5526fd6c05228eddeee5211
parent b4296af9
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public class FODCircleView extends ImageView {
    private boolean mIsCircleShowing;
    private boolean mIsDreaming;
    private boolean mIsKeyguard;
    private boolean mTouchedOutside;

    private Handler mHandler;

@@ -227,11 +228,13 @@ 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");
@@ -272,6 +275,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();
@@ -346,7 +355,7 @@ public class FODCircleView extends ImageView {
    }

    public void showCircle() {
        if (mFading) return;
        if (mFading || mTouchedOutside) return;
        mIsCircleShowing = true;

        setKeepScreenOn(true);