Skip to content

Commit 60cfd0d

Browse files
Dil3mm4Genkzsz11
authored andcommitted
FODCircleView: various improvements.
Added fade-out to FOD view, before going to View.GONE Tests executed: - Ensured animation executes correctly - Ensured interaction with FOD (or any other biometric method) wouldn't compromise animation execution or with FOD functionality itself - Ensured that alpha values triggered with the animation, are correct over different lockscreen states Handled more visibility cases Tests executed: - Added a Bluetooth device as Trusted Device via Smart Lock, ensured FOD wasn't visible - Used other biometric methods to unlock the device, ensured FOD wasn't visible - Enabled On-body detection, ensured FOD wasn't visible - Enabled Trusted places, ensured FOD wasn't visible - Triggered biometric failure with too many unrecognized attempts, ensured FOD wasn't visible while transitioning back and forth from AOD. - Triggered floating biometric dialog and ensured its functionality Change GlobalActionsDialog window type to TYPE_DISPLAY_OVERLAY (same as FOD view), so that whoever gets called last, will go on-top Tests executed: - On a secured lockscreen, triggered GlobalActionsDialog via power menu, ensured FOD was in foreground instead of on-top LuK1337: Solved a visibility edge case Tests executed: - On a secured lockscreen, with "double tap power button to open camera gesture" disabled, double tap the power button, ensure FOD correct visibility Change-Id: I8318ff0bd528af40c7b9d9ec028b88eb1d5e2674
1 parent 3b07778 commit 60cfd0d

2 files changed

Lines changed: 74 additions & 4 deletions

File tree

packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.graphics.Paint;
2828
import android.graphics.PixelFormat;
2929
import android.graphics.Point;
30+
import android.hardware.biometrics.BiometricSourceType;
3031
import android.os.Handler;
3132
import android.os.Looper;
3233
import android.os.PowerManager;
@@ -61,6 +62,7 @@
6162

6263
public class FODCircleView extends ImageView implements ConfigurationListener {
6364
private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
65+
private static final int FADE_ANIM_DURATION = 250;
6466

6567
private final int mPositionX;
6668
private final int mPositionY;
@@ -79,9 +81,12 @@ public class FODCircleView extends ImageView implements ConfigurationListener {
7981
private int mDreamingOffsetX;
8082
private int mDreamingOffsetY;
8183

84+
private boolean mFading;
8285
private boolean mIsBouncer;
83-
private boolean mIsDreaming;
86+
private boolean mIsBiometricRunning;
8487
private boolean mIsCircleShowing;
88+
private boolean mIsDreaming;
89+
private boolean mIsKeyguard;
8590

8691
private boolean mDozeEnabled;
8792
private boolean mFodGestureEnable;
@@ -129,11 +134,36 @@ public void onFingerUp() {
129134
private KeyguardUpdateMonitor mUpdateMonitor;
130135

131136
private KeyguardUpdateMonitorCallback mMonitorCallback = new KeyguardUpdateMonitorCallback() {
137+
@Override
138+
public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType,
139+
boolean isStrongBiometric) {
140+
// We assume that if biometricSourceType matches Fingerprint it will be
141+
// handled here, so we hide only when other biometric types authenticate
142+
if (biometricSourceType != BiometricSourceType.FINGERPRINT) {
143+
hide();
144+
}
145+
}
146+
147+
@Override
148+
public void onBiometricRunningStateChanged(boolean running,
149+
BiometricSourceType biometricSourceType) {
150+
if (biometricSourceType == BiometricSourceType.FINGERPRINT) {
151+
mIsBiometricRunning = running;
152+
}
153+
}
154+
132155
@Override
133156
public void onDreamingStateChanged(boolean dreaming) {
134157
mIsDreaming = dreaming;
135158
updateAlpha();
136159

160+
if (mIsKeyguard && mUpdateMonitor.isFingerprintDetectionRunning()) {
161+
show();
162+
updateAlpha();
163+
} else {
164+
hide();
165+
}
166+
137167
if (dreaming) {
138168
mBurnInProtectionTimer = new Timer();
139169
mBurnInProtectionTimer.schedule(new BurnInProtectionTask(), 0, 60 * 1000);
@@ -142,6 +172,16 @@ public void onDreamingStateChanged(boolean dreaming) {
142172
}
143173
}
144174

175+
@Override
176+
public void onKeyguardVisibilityChanged(boolean showing) {
177+
mIsKeyguard = showing;
178+
if (!showing) {
179+
hide();
180+
} else {
181+
updateAlpha();
182+
}
183+
}
184+
145185
@Override
146186
public void onKeyguardBouncerChanged(boolean isBouncer) {
147187
mIsBouncer = isBouncer;
@@ -170,6 +210,13 @@ public void onScreenTurnedOff() {
170210
mScreenTurnedOn = false;
171211
}
172212

213+
@Override
214+
public void onStartedWakingUp() {
215+
if (mUpdateMonitor.isFingerprintDetectionRunning()) {
216+
show();
217+
}
218+
}
219+
173220
@Override
174221
public void onScreenTurnedOn() {
175222
if (!mFodGestureEnable && mUpdateMonitor.isFingerprintDetectionRunning()) {
@@ -359,6 +406,7 @@ public IFingerprintInscreen getFingerprintInScreenDaemon() {
359406
}
360407

361408
public void dispatchPress() {
409+
if (mFading) return;
362410
IFingerprintInscreen daemon = getFingerprintInScreenDaemon();
363411
try {
364412
daemon.onPress();
@@ -395,6 +443,7 @@ public void dispatchHide() {
395443
}
396444

397445
public void showCircle() {
446+
if (mFading) return;
398447
mIsCircleShowing = true;
399448

400449
setKeepScreenOn(true);
@@ -429,14 +478,35 @@ public void show() {
429478
return;
430479
}
431480

481+
if (mUpdateMonitor.getUserCanSkipBouncer(mUpdateMonitor.getCurrentUser())) {
482+
// Ignore show calls if user can skip bouncer
483+
return;
484+
}
485+
486+
if (mIsKeyguard && !mIsBiometricRunning) {
487+
return;
488+
}
489+
432490
updatePosition();
433491

434-
dispatchShow();
435492
setVisibility(View.VISIBLE);
493+
animate().withStartAction(() -> mFading = true)
494+
.alpha(mIsDreaming ? 0.5f : 1.0f)
495+
.setDuration(FADE_ANIM_DURATION)
496+
.withEndAction(() -> mFading = false)
497+
.start();
498+
dispatchShow();
436499
}
437500

438501
public void hide() {
439-
setVisibility(View.GONE);
502+
animate().withStartAction(() -> mFading = true)
503+
.alpha(0)
504+
.setDuration(FADE_ANIM_DURATION)
505+
.withEndAction(() -> {
506+
setVisibility(View.GONE);
507+
mFading = false;
508+
})
509+
.start();
440510
hideCircle();
441511
dispatchHide();
442512
}

packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2406,7 +2406,7 @@ static final class ActionsDialog extends Dialog implements DialogInterface,
24062406
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
24072407
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
24082408
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
2409-
window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
2409+
window.setType(WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY);
24102410
window.getAttributes().setFitInsetsTypes(0 /* types */);
24112411
setTitle(R.string.global_actions);
24122412

0 commit comments

Comments
 (0)