@@ -278,10 +278,10 @@ index cc03b4f816a..1db2e32b8cd 100644
278
278
279
279
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
280
280
deleted file mode 100644
281
- index 4b2270b20ad ..00000000000
281
+ index 445d001d74b ..00000000000
282
282
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
283
283
+++ /dev/null
284
- @@ -1,723 +0,0 @@
284
+ @@ -1,797 +0,0 @@
285
285
- /**
286
286
- * Copyright (C) 2019-2020 The LineageOS Project
287
287
- *
@@ -306,6 +306,7 @@ index 4b2270b20ad..00000000000
306
306
- import android.app.admin.DevicePolicyManager;
307
307
- import android.content.ContentResolver;
308
308
- import android.content.Context;
309
+ - import android.content.Intent;
309
310
- import android.content.res.Configuration;
310
311
- import android.content.res.Resources;
311
312
- import android.database.ContentObserver;
@@ -319,9 +320,12 @@ index 4b2270b20ad..00000000000
319
320
- import android.net.Uri;
320
321
- import android.os.Handler;
321
322
- import android.os.Looper;
323
+ - import android.os.PowerManager;
322
324
- import android.os.RemoteException;
325
+ - import android.os.SystemClock;
323
326
- import android.os.UserHandle;
324
327
- import android.provider.Settings;
328
+ - import android.net.Uri;
325
329
- import android.view.Display;
326
330
- import android.view.Gravity;
327
331
- import android.view.MotionEvent;
@@ -349,6 +353,7 @@ index 4b2270b20ad..00000000000
349
353
-
350
354
- public class FODCircleView extends ImageView implements ConfigurationListener {
351
355
- private static final int FADE_ANIM_DURATION = 125;
356
+ - private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
352
357
- private final String SCREEN_BRIGHTNESS = Settings.System.SCREEN_BRIGHTNESS;
353
358
- private final int[][] BRIGHTNESS_ALPHA_ARRAY = {
354
359
- new int[]{0, 255},
@@ -399,6 +404,14 @@ index 4b2270b20ad..00000000000
399
404
- private boolean mTouchedOutside;
400
405
- private boolean mIsAnimating = false;
401
406
-
407
+ - private boolean mDozeEnabled;
408
+ - private boolean mFodGestureEnable;
409
+ - private boolean mPressPending;
410
+ - private boolean mScreenTurnedOn;
411
+ -
412
+ - private PowerManager mPowerManager;
413
+ - private PowerManager.WakeLock mWakeLock;
414
+ -
402
415
- private Handler mHandler;
403
416
-
404
417
- private final ImageView mPressedView;
@@ -416,12 +429,26 @@ index 4b2270b20ad..00000000000
416
429
- return;
417
430
- }
418
431
-
419
- - mHandler.post(() -> showCircle());
432
+ - if (mFodGestureEnable && !mScreenTurnedOn) {
433
+ - if (mDozeEnabled) {
434
+ - mHandler.post(() -> mContext.sendBroadcast(new Intent(DOZE_INTENT)));
435
+ - } else {
436
+ - mWakeLock.acquire(3000);
437
+ - mHandler.post(() -> mPowerManager.wakeUp(SystemClock.uptimeMillis(),
438
+ - PowerManager.WAKE_REASON_GESTURE, FODCircleView.class.getSimpleName()));
439
+ - }
440
+ - mPressPending = true;
441
+ - } else {
442
+ - mHandler.post(() -> showCircle());
443
+ - }
420
444
- }
421
445
-
422
446
- @Override
423
447
- public void onFingerUp() {
424
448
- mHandler.post(() -> hideCircle());
449
+ - if (mFodGestureEnable && mPressPending) {
450
+ - mPressPending = false;
451
+ - }
425
452
- }
426
453
- };
427
454
-
@@ -501,28 +528,65 @@ index 4b2270b20ad..00000000000
501
528
-
502
529
- @Override
503
530
- public void onScreenTurnedOff() {
504
- - if (!mHideFodCircleGoingToSleep) {
531
+ - mScreenTurnedOn = false;
532
+ - if (mFodGestureEnable){
533
+ - hideCircle();
534
+ - }else if (!mHideFodCircleGoingToSleep) {
505
535
- hide();
506
536
- }
507
537
- }
508
538
-
509
539
- @Override
510
- - public void onStartedWakingUp () {
511
- - if (mUpdateMonitor.isFingerprintDetectionRunning()) {
540
+ - public void onScreenTurnedOn () {
541
+ - if (!mFodGestureEnable && mUpdateMonitor.isFingerprintDetectionRunning()) {
512
542
- show();
513
543
- }
544
+ - if (mFodGestureEnable && mPressPending) {
545
+ - mHandler.post(() -> showCircle());
546
+ - mPressPending = false;
547
+ - }
548
+ - mScreenTurnedOn = true;
549
+ - }
550
+ - };
551
+ -
552
+ - private class FodGestureSettingsObserver extends ContentObserver {
553
+ - FodGestureSettingsObserver(Context context, Handler handler) {
554
+ - super(handler);
555
+ - }
556
+ -
557
+ - void registerListener() {
558
+ - mContext.getContentResolver().registerContentObserver(
559
+ - Settings.Secure.getUriFor(
560
+ - Settings.Secure.DOZE_ENABLED),
561
+ - false, this, UserHandle.USER_ALL);
562
+ - mContext.getContentResolver().registerContentObserver(
563
+ - Settings.System.getUriFor(
564
+ - Settings.System.FOD_GESTURE),
565
+ - false, this, UserHandle.USER_ALL);
566
+ - updateSettings();
514
567
- }
515
568
-
516
569
- @Override
517
- - public void onScreenTurnedOn() {
518
- - if (mUpdateMonitor.isFingerprintDetectionRunning()) {
519
- - show();
520
- - }
570
+ - public void onChange(boolean selfChange, Uri uri) {
571
+ - super.onChange(selfChange, uri);
572
+ - updateSettings();
521
573
- }
522
- - };
574
+ -
575
+ - public void updateSettings() {
576
+ - mDozeEnabled = Settings.Secure.getIntForUser(
577
+ - mContext.getContentResolver(),
578
+ - Settings.Secure.DOZE_ENABLED, 1,
579
+ - UserHandle.USER_CURRENT) == 1;
580
+ - mFodGestureEnable = Settings.System.getIntForUser(
581
+ - mContext.getContentResolver(),
582
+ - Settings.System.FOD_GESTURE, 1,
583
+ - UserHandle.USER_CURRENT) == 1;
584
+ - }
585
+ - }
523
586
-
524
587
- private boolean mCutoutMasked;
525
588
- private int mStatusbarHeight;
589
+ - private FodGestureSettingsObserver mFodGestureSettingsObserver;
526
590
- private class CustomSettingsObserver extends ContentObserver {
527
591
- CustomSettingsObserver(Handler handler) {
528
592
- super(handler);
@@ -585,6 +649,10 @@ index 4b2270b20ad..00000000000
585
649
- mPaintFingerprintBackground.setColor(res.getColor(R.color.config_fodColorBackground));
586
650
- mPaintFingerprintBackground.setAntiAlias(true);
587
651
-
652
+ - mPowerManager = context.getSystemService(PowerManager.class);
653
+ - mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
654
+ - FODCircleView.class.getSimpleName());
655
+ -
588
656
- mTargetUsesInKernelDimming = res.getBoolean(com.android.internal.R.bool.config_targetUsesInKernelDimming);
589
657
-
590
658
- mHideFodCircleGoingToSleep = mContext.getResources().getBoolean(
@@ -640,7 +708,13 @@ index 4b2270b20ad..00000000000
640
708
-
641
709
- mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
642
710
- mUpdateMonitor.registerCallback(mMonitorCallback);
643
- -
711
+ -
712
+ - if (context.getResources().getBoolean(
713
+ - com.android.internal.R.bool.config_supportsScreenOffInDisplayFingerprint)){
714
+ - mFodGestureSettingsObserver = new FodGestureSettingsObserver(context, mHandler);
715
+ - mFodGestureSettingsObserver.registerListener();
716
+ - }
717
+ -
644
718
- updateCutoutFlags();
645
719
- Dependency.get(ConfigurationController.class).addCallback(this);
646
720
- }
@@ -833,7 +907,7 @@ index 4b2270b20ad..00000000000
833
907
- return;
834
908
- }
835
909
-
836
- - if (!mUpdateMonitor.isScreenOn()) {
910
+ - if (!mFodGestureEnable && ! mUpdateMonitor.isScreenOn()) {
837
911
- // Keyguard is shown just after screen turning off
838
912
- return;
839
913
- }
@@ -1007,10 +1081,10 @@ index 4b2270b20ad..00000000000
1007
1081
- }
1008
1082
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
1009
1083
deleted file mode 100644
1010
- index 86baa4cab71 ..00000000000
1084
+ index 12e4cbaf8d5 ..00000000000
1011
1085
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
1012
1086
+++ /dev/null
1013
- @@ -1,135 +0,0 @@
1087
+ @@ -1,128 +0,0 @@
1014
1088
- /**
1015
1089
- * Copyright (C) 2019 The Android Open Source Project
1016
1090
- *
@@ -1031,8 +1105,6 @@ index 86baa4cab71..00000000000
1031
1105
-
1032
1106
- import android.content.Context;
1033
1107
- import android.content.pm.PackageManager;
1034
- - import android.os.Handler;
1035
- - import android.os.Looper;
1036
1108
- import android.util.Slog;
1037
1109
- import android.view.View;
1038
1110
-
@@ -1057,16 +1129,13 @@ index 86baa4cab71..00000000000
1057
1129
- private final ArrayList<WeakReference<FODCircleViewImplCallback>>
1058
1130
- mCallbacks = new ArrayList<>();
1059
1131
- private final CommandQueue mCommandQueue;
1060
- - private Handler mHandler;
1061
- - private Runnable mHideFodViewRunnable = () -> mFodCircleView.hide();
1062
1132
-
1063
1133
- private boolean mIsFODVisible;
1064
1134
-
1065
1135
- @Inject
1066
1136
- public FODCircleViewImpl(Context context, CommandQueue commandQueue) {
1067
1137
- super(context);
1068
1138
- mCommandQueue = commandQueue;
1069
- - mHandler = new Handler(Looper.getMainLooper());
1070
1139
- }
1071
1140
-
1072
1141
- @Override
@@ -1100,7 +1169,6 @@ index 86baa4cab71..00000000000
1100
1169
- }
1101
1170
- }
1102
1171
- mIsFODVisible = true;
1103
- - mHandler.removeCallbacks(mHideFodViewRunnable);
1104
1172
- mFodCircleView.show();
1105
1173
- }
1106
1174
- }
@@ -1116,7 +1184,6 @@ index 86baa4cab71..00000000000
1116
1184
- }
1117
1185
- mIsFODVisible = false;
1118
1186
- mFodCircleView.hide();
1119
- - mHandler.postDelayed(mHideFodViewRunnable, 500);
1120
1187
- }
1121
1188
- }
1122
1189
-
0 commit comments