@@ -280,10 +280,10 @@ index cc03b4f816a..1db2e32b8cd 100644
280
280
281
281
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
282
282
deleted file mode 100644
283
- index 506a25fcc08 ..00000000000
283
+ index 7e7c85578fc ..00000000000
284
284
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
285
285
+++ /dev/null
286
- @@ -1,760 +0,0 @@
286
+ @@ -1,834 +0,0 @@
287
287
- /**
288
288
- * Copyright (C) 2019-2020 The LineageOS Project
289
289
- *
@@ -308,6 +308,7 @@ index 506a25fcc08..00000000000
308
308
- import android.app.admin.DevicePolicyManager;
309
309
- import android.content.ContentResolver;
310
310
- import android.content.Context;
311
+ - import android.content.Intent;
311
312
- import android.content.res.Configuration;
312
313
- import android.content.res.Resources;
313
314
- import android.database.ContentObserver;
@@ -321,11 +322,14 @@ index 506a25fcc08..00000000000
321
322
- import android.net.Uri;
322
323
- import android.os.Handler;
323
324
- import android.os.Looper;
325
+ - import android.os.PowerManager;
324
326
- import android.os.RemoteException;
327
+ - import android.os.SystemClock;
325
328
- import android.os.UserHandle;
326
329
- import android.pocket.IPocketCallback;
327
330
- import android.pocket.PocketManager;
328
331
- import android.provider.Settings;
332
+ - import android.net.Uri;
329
333
- import android.view.Display;
330
334
- import android.view.Gravity;
331
335
- import android.view.MotionEvent;
@@ -353,6 +357,7 @@ index 506a25fcc08..00000000000
353
357
-
354
358
- public class FODCircleView extends ImageView implements ConfigurationListener {
355
359
- private static final int FADE_ANIM_DURATION = 125;
360
+ - private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
356
361
- private final String SCREEN_BRIGHTNESS = Settings.System.SCREEN_BRIGHTNESS;
357
362
- private final int[][] BRIGHTNESS_ALPHA_ARRAY = {
358
363
- new int[]{0, 255},
@@ -403,6 +408,14 @@ index 506a25fcc08..00000000000
403
408
- private boolean mTouchedOutside;
404
409
- private boolean mIsAnimating = false;
405
410
-
411
+ - private boolean mDozeEnabled;
412
+ - private boolean mFodGestureEnable;
413
+ - private boolean mPressPending;
414
+ - private boolean mScreenTurnedOn;
415
+ -
416
+ - private PowerManager mPowerManager;
417
+ - private PowerManager.WakeLock mWakeLock;
418
+ -
406
419
- private Handler mHandler;
407
420
-
408
421
- private final ImageView mPressedView;
@@ -420,12 +433,26 @@ index 506a25fcc08..00000000000
420
433
- return;
421
434
- }
422
435
-
423
- - mHandler.post(() -> showCircle());
436
+ - if (mFodGestureEnable && !mScreenTurnedOn) {
437
+ - if (mDozeEnabled) {
438
+ - mHandler.post(() -> mContext.sendBroadcast(new Intent(DOZE_INTENT)));
439
+ - } else {
440
+ - mWakeLock.acquire(3000);
441
+ - mHandler.post(() -> mPowerManager.wakeUp(SystemClock.uptimeMillis(),
442
+ - PowerManager.WAKE_REASON_GESTURE, FODCircleView.class.getSimpleName()));
443
+ - }
444
+ - mPressPending = true;
445
+ - } else {
446
+ - mHandler.post(() -> showCircle());
447
+ - }
424
448
- }
425
449
-
426
450
- @Override
427
451
- public void onFingerUp() {
428
452
- mHandler.post(() -> hideCircle());
453
+ - if (mFodGestureEnable && mPressPending) {
454
+ - mPressPending = false;
455
+ - }
429
456
- }
430
457
- };
431
458
-
@@ -506,25 +533,61 @@ index 506a25fcc08..00000000000
506
533
-
507
534
- @Override
508
535
- public void onScreenTurnedOff() {
509
- - if (!mHideFodCircleGoingToSleep) {
536
+ - mScreenTurnedOn = false;
537
+ - if (mFodGestureEnable){
538
+ - hideCircle();
539
+ - }else if (!mHideFodCircleGoingToSleep) {
510
540
- hide();
511
541
- }
512
542
- }
513
543
-
514
544
- @Override
515
- - public void onStartedWakingUp () {
516
- - if (mUpdateMonitor.isFingerprintDetectionRunning()) {
545
+ - public void onScreenTurnedOn () {
546
+ - if (!mFodGestureEnable && mUpdateMonitor.isFingerprintDetectionRunning()) {
517
547
- show();
518
548
- }
549
+ - if (mFodGestureEnable && mPressPending) {
550
+ - mHandler.post(() -> showCircle());
551
+ - mPressPending = false;
552
+ - }
553
+ - mScreenTurnedOn = true;
554
+ - }
555
+ - };
556
+ -
557
+ - private class FodGestureSettingsObserver extends ContentObserver {
558
+ - FodGestureSettingsObserver(Context context, Handler handler) {
559
+ - super(handler);
560
+ - }
561
+ -
562
+ - void registerListener() {
563
+ - mContext.getContentResolver().registerContentObserver(
564
+ - Settings.Secure.getUriFor(
565
+ - Settings.Secure.DOZE_ENABLED),
566
+ - false, this, UserHandle.USER_ALL);
567
+ - mContext.getContentResolver().registerContentObserver(
568
+ - Settings.System.getUriFor(
569
+ - Settings.System.FOD_GESTURE),
570
+ - false, this, UserHandle.USER_ALL);
571
+ - updateSettings();
519
572
- }
520
573
-
521
574
- @Override
522
- - public void onScreenTurnedOn() {
523
- - if (mUpdateMonitor.isFingerprintDetectionRunning()) {
524
- - show();
525
- - }
575
+ - public void onChange(boolean selfChange, Uri uri) {
576
+ - super.onChange(selfChange, uri);
577
+ - updateSettings();
526
578
- }
527
- - };
579
+ -
580
+ - public void updateSettings() {
581
+ - mDozeEnabled = Settings.Secure.getIntForUser(
582
+ - mContext.getContentResolver(),
583
+ - Settings.Secure.DOZE_ENABLED, 1,
584
+ - UserHandle.USER_CURRENT) == 1;
585
+ - mFodGestureEnable = Settings.System.getIntForUser(
586
+ - mContext.getContentResolver(),
587
+ - Settings.System.FOD_GESTURE, 1,
588
+ - UserHandle.USER_CURRENT) == 1;
589
+ - }
590
+ - }
528
591
-
529
592
- private void handlePocketManagerCallback(boolean keyguardShowing){
530
593
- if (!keyguardShowing){
@@ -542,6 +605,7 @@ index 506a25fcc08..00000000000
542
605
-
543
606
- private boolean mCutoutMasked;
544
607
- private int mStatusbarHeight;
608
+ - private FodGestureSettingsObserver mFodGestureSettingsObserver;
545
609
- private class CustomSettingsObserver extends ContentObserver {
546
610
- CustomSettingsObserver(Handler handler) {
547
611
- super(handler);
@@ -621,6 +685,10 @@ index 506a25fcc08..00000000000
621
685
- mPaintFingerprintBackground.setColor(res.getColor(R.color.config_fodColorBackground));
622
686
- mPaintFingerprintBackground.setAntiAlias(true);
623
687
-
688
+ - mPowerManager = context.getSystemService(PowerManager.class);
689
+ - mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
690
+ - FODCircleView.class.getSimpleName());
691
+ -
624
692
- mTargetUsesInKernelDimming = res.getBoolean(com.android.internal.R.bool.config_targetUsesInKernelDimming);
625
693
-
626
694
- mHideFodCircleGoingToSleep = mContext.getResources().getBoolean(
@@ -676,7 +744,13 @@ index 506a25fcc08..00000000000
676
744
-
677
745
- mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
678
746
- mUpdateMonitor.registerCallback(mMonitorCallback);
679
- -
747
+ -
748
+ - if (context.getResources().getBoolean(
749
+ - com.android.internal.R.bool.config_supportsScreenOffInDisplayFingerprint)){
750
+ - mFodGestureSettingsObserver = new FodGestureSettingsObserver(context, mHandler);
751
+ - mFodGestureSettingsObserver.registerListener();
752
+ - }
753
+ -
680
754
- updateCutoutFlags();
681
755
- Dependency.get(ConfigurationController.class).addCallback(this);
682
756
-
@@ -872,7 +946,7 @@ index 506a25fcc08..00000000000
872
946
- return;
873
947
- }
874
948
-
875
- - if (!mUpdateMonitor.isScreenOn()) {
949
+ - if (!mFodGestureEnable && ! mUpdateMonitor.isScreenOn()) {
876
950
- // Keyguard is shown just after screen turning off
877
951
- return;
878
952
- }
@@ -1046,10 +1120,10 @@ index 506a25fcc08..00000000000
1046
1120
- }
1047
1121
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
1048
1122
deleted file mode 100644
1049
- index 86baa4cab71 ..00000000000
1123
+ index 12e4cbaf8d5 ..00000000000
1050
1124
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
1051
1125
+++ /dev/null
1052
- @@ -1,135 +0,0 @@
1126
+ @@ -1,128 +0,0 @@
1053
1127
- /**
1054
1128
- * Copyright (C) 2019 The Android Open Source Project
1055
1129
- *
@@ -1070,8 +1144,6 @@ index 86baa4cab71..00000000000
1070
1144
-
1071
1145
- import android.content.Context;
1072
1146
- import android.content.pm.PackageManager;
1073
- - import android.os.Handler;
1074
- - import android.os.Looper;
1075
1147
- import android.util.Slog;
1076
1148
- import android.view.View;
1077
1149
-
@@ -1096,16 +1168,13 @@ index 86baa4cab71..00000000000
1096
1168
- private final ArrayList<WeakReference<FODCircleViewImplCallback>>
1097
1169
- mCallbacks = new ArrayList<>();
1098
1170
- private final CommandQueue mCommandQueue;
1099
- - private Handler mHandler;
1100
- - private Runnable mHideFodViewRunnable = () -> mFodCircleView.hide();
1101
1171
-
1102
1172
- private boolean mIsFODVisible;
1103
1173
-
1104
1174
- @Inject
1105
1175
- public FODCircleViewImpl(Context context, CommandQueue commandQueue) {
1106
1176
- super(context);
1107
1177
- mCommandQueue = commandQueue;
1108
- - mHandler = new Handler(Looper.getMainLooper());
1109
1178
- }
1110
1179
-
1111
1180
- @Override
@@ -1139,7 +1208,6 @@ index 86baa4cab71..00000000000
1139
1208
- }
1140
1209
- }
1141
1210
- mIsFODVisible = true;
1142
- - mHandler.removeCallbacks(mHideFodViewRunnable);
1143
1211
- mFodCircleView.show();
1144
1212
- }
1145
1213
- }
@@ -1155,7 +1223,6 @@ index 86baa4cab71..00000000000
1155
1223
- }
1156
1224
- mIsFODVisible = false;
1157
1225
- mFodCircleView.hide();
1158
- - mHandler.postDelayed(mHideFodViewRunnable, 500);
1159
1226
- }
1160
1227
- }
1161
1228
-
0 commit comments