Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit cd14be4

Browse files
committed
Fix LOS FOD revert patch once again
1 parent fb911a7 commit cd14be4

File tree

1 file changed

+89
-22
lines changed

1 file changed

+89
-22
lines changed

patches/0001-Squashed-revert-of-LOS-FOD-implementation.patch

+89-22
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ index cc03b4f816a..1db2e32b8cd 100644
278278

279279
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
280280
deleted file mode 100644
281-
index 4b2270b20ad..00000000000
281+
index 445d001d74b..00000000000
282282
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleView.java
283283
+++ /dev/null
284-
@@ -1,723 +0,0 @@
284+
@@ -1,797 +0,0 @@
285285
-/**
286286
- * Copyright (C) 2019-2020 The LineageOS Project
287287
- *
@@ -306,6 +306,7 @@ index 4b2270b20ad..00000000000
306306
-import android.app.admin.DevicePolicyManager;
307307
-import android.content.ContentResolver;
308308
-import android.content.Context;
309+
-import android.content.Intent;
309310
-import android.content.res.Configuration;
310311
-import android.content.res.Resources;
311312
-import android.database.ContentObserver;
@@ -319,9 +320,12 @@ index 4b2270b20ad..00000000000
319320
-import android.net.Uri;
320321
-import android.os.Handler;
321322
-import android.os.Looper;
323+
-import android.os.PowerManager;
322324
-import android.os.RemoteException;
325+
-import android.os.SystemClock;
323326
-import android.os.UserHandle;
324327
-import android.provider.Settings;
328+
-import android.net.Uri;
325329
-import android.view.Display;
326330
-import android.view.Gravity;
327331
-import android.view.MotionEvent;
@@ -349,6 +353,7 @@ index 4b2270b20ad..00000000000
349353
-
350354
-public class FODCircleView extends ImageView implements ConfigurationListener {
351355
- private static final int FADE_ANIM_DURATION = 125;
356+
- private static final String DOZE_INTENT = "com.android.systemui.doze.pulse";
352357
- private final String SCREEN_BRIGHTNESS = Settings.System.SCREEN_BRIGHTNESS;
353358
- private final int[][] BRIGHTNESS_ALPHA_ARRAY = {
354359
- new int[]{0, 255},
@@ -399,6 +404,14 @@ index 4b2270b20ad..00000000000
399404
- private boolean mTouchedOutside;
400405
- private boolean mIsAnimating = false;
401406
-
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+
-
402415
- private Handler mHandler;
403416
-
404417
- private final ImageView mPressedView;
@@ -416,12 +429,26 @@ index 4b2270b20ad..00000000000
416429
- return;
417430
- }
418431
-
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+
- }
420444
- }
421445
-
422446
- @Override
423447
- public void onFingerUp() {
424448
- mHandler.post(() -> hideCircle());
449+
- if (mFodGestureEnable && mPressPending) {
450+
- mPressPending = false;
451+
- }
425452
- }
426453
- };
427454
-
@@ -501,28 +528,65 @@ index 4b2270b20ad..00000000000
501528
-
502529
- @Override
503530
- public void onScreenTurnedOff() {
504-
- if (!mHideFodCircleGoingToSleep) {
531+
- mScreenTurnedOn = false;
532+
- if (mFodGestureEnable){
533+
- hideCircle();
534+
- }else if (!mHideFodCircleGoingToSleep) {
505535
- hide();
506536
- }
507537
- }
508538
-
509539
- @Override
510-
- public void onStartedWakingUp() {
511-
- if (mUpdateMonitor.isFingerprintDetectionRunning()) {
540+
- public void onScreenTurnedOn() {
541+
- if (!mFodGestureEnable && mUpdateMonitor.isFingerprintDetectionRunning()) {
512542
- show();
513543
- }
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();
514567
- }
515568
-
516569
- @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();
521573
- }
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+
- }
523586
-
524587
- private boolean mCutoutMasked;
525588
- private int mStatusbarHeight;
589+
- private FodGestureSettingsObserver mFodGestureSettingsObserver;
526590
- private class CustomSettingsObserver extends ContentObserver {
527591
- CustomSettingsObserver(Handler handler) {
528592
- super(handler);
@@ -585,6 +649,10 @@ index 4b2270b20ad..00000000000
585649
- mPaintFingerprintBackground.setColor(res.getColor(R.color.config_fodColorBackground));
586650
- mPaintFingerprintBackground.setAntiAlias(true);
587651
-
652+
- mPowerManager = context.getSystemService(PowerManager.class);
653+
- mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
654+
- FODCircleView.class.getSimpleName());
655+
-
588656
- mTargetUsesInKernelDimming = res.getBoolean(com.android.internal.R.bool.config_targetUsesInKernelDimming);
589657
-
590658
- mHideFodCircleGoingToSleep = mContext.getResources().getBoolean(
@@ -640,7 +708,13 @@ index 4b2270b20ad..00000000000
640708
-
641709
- mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class);
642710
- 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+
-
644718
- updateCutoutFlags();
645719
- Dependency.get(ConfigurationController.class).addCallback(this);
646720
- }
@@ -833,7 +907,7 @@ index 4b2270b20ad..00000000000
833907
- return;
834908
- }
835909
-
836-
- if (!mUpdateMonitor.isScreenOn()) {
910+
- if (!mFodGestureEnable && !mUpdateMonitor.isScreenOn()) {
837911
- // Keyguard is shown just after screen turning off
838912
- return;
839913
- }
@@ -1007,10 +1081,10 @@ index 4b2270b20ad..00000000000
10071081
-}
10081082
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java b/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
10091083
deleted file mode 100644
1010-
index 86baa4cab71..00000000000
1084+
index 12e4cbaf8d5..00000000000
10111085
--- a/packages/SystemUI/src/com/android/systemui/biometrics/FODCircleViewImpl.java
10121086
+++ /dev/null
1013-
@@ -1,135 +0,0 @@
1087+
@@ -1,128 +0,0 @@
10141088
-/**
10151089
- * Copyright (C) 2019 The Android Open Source Project
10161090
- *
@@ -1031,8 +1105,6 @@ index 86baa4cab71..00000000000
10311105
-
10321106
-import android.content.Context;
10331107
-import android.content.pm.PackageManager;
1034-
-import android.os.Handler;
1035-
-import android.os.Looper;
10361108
-import android.util.Slog;
10371109
-import android.view.View;
10381110
-
@@ -1057,16 +1129,13 @@ index 86baa4cab71..00000000000
10571129
- private final ArrayList<WeakReference<FODCircleViewImplCallback>>
10581130
- mCallbacks = new ArrayList<>();
10591131
- private final CommandQueue mCommandQueue;
1060-
- private Handler mHandler;
1061-
- private Runnable mHideFodViewRunnable = () -> mFodCircleView.hide();
10621132
-
10631133
- private boolean mIsFODVisible;
10641134
-
10651135
- @Inject
10661136
- public FODCircleViewImpl(Context context, CommandQueue commandQueue) {
10671137
- super(context);
10681138
- mCommandQueue = commandQueue;
1069-
- mHandler = new Handler(Looper.getMainLooper());
10701139
- }
10711140
-
10721141
- @Override
@@ -1100,7 +1169,6 @@ index 86baa4cab71..00000000000
11001169
- }
11011170
- }
11021171
- mIsFODVisible = true;
1103-
- mHandler.removeCallbacks(mHideFodViewRunnable);
11041172
- mFodCircleView.show();
11051173
- }
11061174
- }
@@ -1116,7 +1184,6 @@ index 86baa4cab71..00000000000
11161184
- }
11171185
- mIsFODVisible = false;
11181186
- mFodCircleView.hide();
1119-
- mHandler.postDelayed(mHideFodViewRunnable, 500);
11201187
- }
11211188
- }
11221189
-

0 commit comments

Comments
 (0)