lineage_patches_unified/patches_treble_prerequisite/frameworks_base/0001-Squashed-revert-of-LOS-UDFPS-changes.patch
2023-03-25 11:06:31 +00:00

327 lines
13 KiB
Diff

From feb3f559b2157de9ca06438038114aedb2cc604e Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <GeForce8800Ultra@gmail.com>
Date: Thu, 23 Mar 2023 15:28:42 +0000
Subject: [PATCH 1/2] Squashed revert of LOS UDFPS changes
Way less than FOD, but reverting them nonetheless to keep in line with PHH AOSP
- Revert "fixup! udfps: Restore illumination dot for global hbm"
- Revert "udfps: Make pressed udfp view configurable"
- Revert "udfps: Restore illumination dot for global hbm"
- Revert "udfps: Change window type to TYPE_DISPLAY_OVERLAY"
---
.../res/drawable-nodpi/udfps_icon_pressed.png | Bin 108 -> 0 bytes
packages/SystemUI/res/layout/udfps_view.xml | 6 -
.../SystemUI/res/values/lineage_config.xml | 3 -
.../biometrics/AuthContainerView.java | 2 +-
.../biometrics/UdfpsControllerOverlay.kt | 2 +-
.../systemui/biometrics/UdfpsSurfaceView.java | 159 ------------------
.../android/systemui/biometrics/UdfpsView.kt | 31 +---
7 files changed, 3 insertions(+), 200 deletions(-)
delete mode 100644 packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
delete mode 100644 packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
diff --git a/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
deleted file mode 100644
index 4102e28c1300b49323b50625d8cfaa73b006561f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 108
zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k8}bl$r9IylHmNblJdl&R0hYC{G?O`
z&)mfH)S%SFl*+=BsWw1Ge4Z|jAr-fh5*U~o7?>FtSQ!{^cTT<plwt66^>bP0l+XkK
D@OB!I
diff --git a/packages/SystemUI/res/layout/udfps_view.xml b/packages/SystemUI/res/layout/udfps_view.xml
index 0fcbfa161ddf..257d238f5c54 100644
--- a/packages/SystemUI/res/layout/udfps_view.xml
+++ b/packages/SystemUI/res/layout/udfps_view.xml
@@ -28,10 +28,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
- <com.android.systemui.biometrics.UdfpsSurfaceView
- android:id="@+id/hbm_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:visibility="invisible"/>
-
</com.android.systemui.biometrics.UdfpsView>
diff --git a/packages/SystemUI/res/values/lineage_config.xml b/packages/SystemUI/res/values/lineage_config.xml
index 3b61502f551c..c7a73b79a5ec 100644
--- a/packages/SystemUI/res/values/lineage_config.xml
+++ b/packages/SystemUI/res/values/lineage_config.xml
@@ -19,9 +19,6 @@
<integer name="config_maxVisibleNotificationIcons">4</integer>
<integer name="config_maxVisibleNotificationIconsOnLock">3</integer>
- <!-- Color of the UDFPS pressed view -->
- <color name="config_udfpsColor">#ffffffff</color>
-
<!-- Doze: does the double tap sensor need a proximity check? -->
<bool name="doze_double_tap_proximity_check">false</bool>
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
index 699be662dd54..68e1f72d042a 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java
@@ -847,7 +847,7 @@ public class AuthContainerView extends LinearLayout
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
- WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY,
+ WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL,
windowFlags,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
index 6d1e958e21ad..8db4927ee059 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
@@ -109,7 +109,7 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
private var overlayTouchListener: TouchExplorationStateChangeListener? = null
private val coreLayoutParams = WindowManager.LayoutParams(
- WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY,
+ WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG,
0 /* flags set in computeLayoutParams() */,
PixelFormat.TRANSLUCENT
).apply {
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
deleted file mode 100644
index 2488132b508b..000000000000
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.biometrics;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.RectF;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-
-import com.android.systemui.R;
-
-/**
- * Surface View for providing the Global High-Brightness Mode (GHBM) illumination for UDFPS.
- */
-public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
- private static final String TAG = "UdfpsSurfaceView";
-
- /**
- * Notifies {@link UdfpsView} when to enable GHBM illumination.
- */
- interface GhbmIlluminationListener {
- /**
- * @param surface the surface for which GHBM should be enabled.
- * @param onDisplayConfigured a runnable that should be run after GHBM is enabled.
- */
- void enableGhbm(@NonNull Surface surface, @Nullable Runnable onDisplayConfigured);
- }
-
- @NonNull private final SurfaceHolder mHolder;
- @NonNull private final Paint mSensorPaint;
-
- @Nullable private GhbmIlluminationListener mGhbmIlluminationListener;
- @Nullable private Runnable mOnDisplayConfigured;
- boolean mAwaitingSurfaceToStartIllumination;
- boolean mHasValidSurface;
-
- private Drawable mUdfpsIconPressed;
-
- public UdfpsSurfaceView(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- // Make this SurfaceView draw on top of everything else in this window. This allows us to
- // 1) Always show the HBM circle on top of everything else, and
- // 2) Properly composite this view with any other animations in the same window no matter
- // what contents are added in which order to this view hierarchy.
- setZOrderOnTop(true);
-
- mHolder = getHolder();
- mHolder.addCallback(this);
- mHolder.setFormat(PixelFormat.RGBA_8888);
-
- mSensorPaint = new Paint(0 /* flags */);
- mSensorPaint.setAntiAlias(true);
- mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor));
- mSensorPaint.setStyle(Paint.Style.FILL);
-
- mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed);
- }
-
- @Override public void surfaceCreated(SurfaceHolder holder) {
- mHasValidSurface = true;
- if (mAwaitingSurfaceToStartIllumination) {
- doIlluminate(mOnDisplayConfigured);
- mOnDisplayConfigured = null;
- mAwaitingSurfaceToStartIllumination = false;
- }
- }
-
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- // Unused.
- }
-
- @Override public void surfaceDestroyed(SurfaceHolder holder) {
- mHasValidSurface = false;
- }
-
- void setGhbmIlluminationListener(@Nullable GhbmIlluminationListener listener) {
- mGhbmIlluminationListener = listener;
- }
-
- /**
- * Note: there is no corresponding method to stop GHBM illumination. It is expected that
- * {@link UdfpsView} will hide this view, which would destroy the surface and remove the
- * illumination dot.
- */
- void startGhbmIllumination(@Nullable Runnable onDisplayConfigured) {
- if (mGhbmIlluminationListener == null) {
- Log.e(TAG, "startIllumination | mGhbmIlluminationListener is null");
- return;
- }
-
- if (mHasValidSurface) {
- doIlluminate(onDisplayConfigured);
- } else {
- mAwaitingSurfaceToStartIllumination = true;
- mOnDisplayConfigured = onDisplayConfigured;
- }
- }
-
- private void doIlluminate(@Nullable Runnable onDisplayConfigured) {
- if (mGhbmIlluminationListener == null) {
- Log.e(TAG, "doIlluminate | mGhbmIlluminationListener is null");
- return;
- }
-
- mGhbmIlluminationListener.enableGhbm(mHolder.getSurface(), onDisplayConfigured);
- }
-
- /**
- * Immediately draws the illumination dot on this SurfaceView's surface.
- */
- void drawIlluminationDot(@NonNull RectF sensorRect) {
- if (!mHasValidSurface) {
- Log.e(TAG, "drawIlluminationDot | the surface is destroyed or was never created.");
- return;
- }
- Canvas canvas = null;
- try {
- canvas = mHolder.lockCanvas();
- mUdfpsIconPressed.setBounds(
- Math.round(sensorRect.left),
- Math.round(sensorRect.top),
- Math.round(sensorRect.right),
- Math.round(sensorRect.bottom)
- );
- mUdfpsIconPressed.draw(canvas);
- canvas.drawOval(sensorRect, mSensorPaint);
- } finally {
- // Make sure the surface is never left in a bad state.
- if (canvas != null) {
- mHolder.unlockCanvasAndPost(canvas);
- }
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
index 97590822a3fb..4a8877edfa53 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt
@@ -25,7 +25,6 @@ import android.graphics.RectF
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
-import android.view.Surface
import android.widget.FrameLayout
import com.android.systemui.R
import com.android.systemui.doze.DozeReceiver
@@ -61,8 +60,6 @@ class UdfpsView(
a.getFloat(R.styleable.UdfpsView_sensorTouchAreaCoefficient, 0f)
}
- private var ghbmView: UdfpsSurfaceView? = null
-
/** View controller (can be different for enrollment, BiometricPrompt, Keyguard, etc.). */
var animationViewController: UdfpsAnimationViewController<*>? = null
@@ -89,10 +86,6 @@ class UdfpsView(
return (animationViewController == null || !animationViewController!!.shouldPauseAuth())
}
- override fun onFinishInflate() {
- ghbmView = findViewById(R.id.hbm_view)
- }
-
override fun dozeTimeTick() {
animationViewController?.dozeTimeTick()
}
@@ -160,34 +153,12 @@ class UdfpsView(
fun configureDisplay(onDisplayConfigured: Runnable) {
isDisplayConfigured = true
animationViewController?.onDisplayConfiguring()
- val gView = ghbmView
- if (gView != null) {
- gView.setGhbmIlluminationListener(this::doIlluminate)
- gView.visibility = VISIBLE
- gView.startGhbmIllumination(onDisplayConfigured)
- } else {
- doIlluminate(null /* surface */, onDisplayConfigured)
- }
- }
-
- private fun doIlluminate(surface: Surface?, onDisplayConfigured: Runnable?) {
- if (ghbmView != null && surface == null) {
- Log.e(TAG, "doIlluminate | surface must be non-null for GHBM")
- }
-
- mUdfpsDisplayMode?.enable {
- onDisplayConfigured?.run()
- ghbmView?.drawIlluminationDot(RectF(sensorRect))
- }
+ mUdfpsDisplayMode?.enable(onDisplayConfigured)
}
fun unconfigureDisplay() {
isDisplayConfigured = false
animationViewController?.onDisplayUnconfigured()
- ghbmView?.let { view ->
- view.setGhbmIlluminationListener(null)
- view.visibility = INVISIBLE
- }
mUdfpsDisplayMode?.disable(null /* onDisabled */)
}
}
--
2.34.1