Created
November 30, 2020 17:04
-
-
Save Dil3mm4/904b2c5bcf039281dfac454a02cf710b 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 bc68ef6273307143a78788c068af1adde6fbc9d3 Mon Sep 17 00:00:00 2001 | |
From: Dil3mm4 <[email protected]> | |
Date: Mon, 30 Nov 2020 16:38:58 +0000 | |
Subject: [PATCH] FODCircleView: change window type based on foreground status | |
To avoid clashes with other UI elements once a third party app (or Settings) request biometric unlocks, we need to change the window type accordingly. | |
Tests: | |
- open third party app that requests biometric (or Settings enrollment fragment), expand qs, observe FOD is in background | |
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
index bee67dea7c33..726bd13273ab 100644 | |
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java | |
@@ -187,6 +187,7 @@ public class FODCircleView extends ImageView { | |
show(); | |
} | |
} | |
+ | |
}; | |
public FODCircleView(Context context) { | |
@@ -264,6 +265,26 @@ public class FODCircleView extends ImageView { | |
mUpdateMonitor.registerCallback(mMonitorCallback); | |
} | |
+ public void changeWindowType(boolean isKeyguard) { | |
+ // we want to change window type only if it doesn't match what we excpect else we return | |
+ | |
+ if (isKeyguard && mParams.type == WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG) return; | |
+ if (!isKeyguard && mParams.type == WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG) return; | |
+ | |
+ mWindowManager.removeView(this); | |
+ mParams.type = !isKeyguard ? WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG : WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; | |
+ mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | | |
+ 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 | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; | |
+ | |
+ mParams.setTitle("Fingerprint on display"); | |
+ mPressedParams.setTitle("Fingerprint on display.touched"); | |
+ mWindowManager.addView(this, mParams); | |
+ } | |
+ | |
@Override | |
protected void onDraw(Canvas canvas) { | |
if (!mIsCircleShowing) { | |
@@ -404,11 +425,13 @@ public class FODCircleView extends ImageView { | |
if (mIsKeyguard && !mIsBiometricRunning) { | |
return; | |
} | |
- | |
updatePosition(); | |
- | |
setVisibility(View.VISIBLE); | |
- animate().withStartAction(() -> mFading = true) | |
+ animate() | |
+ .withStartAction(() -> { | |
+ mFading = true; | |
+ changeWindowType(mIsKeyguard || mIsDreaming ? true : false); | |
+ }) | |
.alpha(mIsDreaming ? 0.5f : 1.0f) | |
.setDuration(FADE_ANIM_DURATION) | |
.withEndAction(() -> mFading = false) | |
@@ -423,6 +446,8 @@ public class FODCircleView extends ImageView { | |
.withEndAction(() -> { | |
setVisibility(View.GONE); | |
mFading = false; | |
+ if (mIsKeyguard) | |
+ changeWindowType(true); | |
}) | |
.start(); | |
hideCircle(); | |
-- | |
2.20.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment