From 0ef5fe793afdf7128618f4b5a286572fbc449c48 Mon Sep 17 00:00:00 2001 From: Andy CrossGate Yan Date: Sun, 13 Mar 2022 09:51:36 +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 "UdfpsController: Call onFingerDown on action down events" - Revert "udfps: Allow to configure hbm overlay type" - Revert "udfps: Implement default udfps hbm provider" - Revert "udfps: Change window type to TYPE_DISPLAY_OVERLAY" - Revert "udfps: Make pressed udfp view configurable" --- packages/SystemUI/proguard.flags | 3 -- .../res/drawable-nodpi/udfps_icon_pressed.png | Bin 108 -> 0 bytes .../SystemUI/res/values/lineage_config.xml | 12 ------- .../biometrics/AuthContainerView.java | 2 +- .../biometrics/DummyUdfpsHbmProvider.kt | 32 ------------------ .../systemui/biometrics/UdfpsController.java | 11 ++---- .../systemui/biometrics/UdfpsSurfaceView.java | 16 +-------- .../systemui/biometrics/UdfpsView.java | 7 ++-- .../systemui/dagger/SystemUIModule.java | 14 ++------ 9 files changed, 10 insertions(+), 87 deletions(-) delete mode 100644 packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png delete mode 100644 packages/SystemUI/src/com/android/systemui/biometrics/DummyUdfpsHbmProvider.kt diff --git a/packages/SystemUI/proguard.flags b/packages/SystemUI/proguard.flags index 8cb2580aa210..61147281da6f 100644 --- a/packages/SystemUI/proguard.flags +++ b/packages/SystemUI/proguard.flags @@ -24,9 +24,6 @@ -keep class com.android.systemui.tv.TvSystemUIFactory -keep class * extends com.android.systemui.SystemUI -keep class * implements com.android.systemui.SystemUI$Injector --keep class * implements com.android.systemui.biometrics.UdfpsHbmProvider { - public (...); -} -keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); 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!{^cTTbP0l+XkK D@OB!I diff --git a/packages/SystemUI/res/values/lineage_config.xml b/packages/SystemUI/res/values/lineage_config.xml index 6c92a4fb2a3c..910a55d0f347 100644 --- a/packages/SystemUI/res/values/lineage_config.xml +++ b/packages/SystemUI/res/values/lineage_config.xml @@ -25,18 +25,6 @@ causes a poor experience. --> true - - #ffffffff - - - 1 - - - com.android.systemui.biometrics.DummyUdfpsHbmProvider - false diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index fb5a948c6716..fd37b3509a4e 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -793,7 +793,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_SUB_PANEL, windowFlags, PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/DummyUdfpsHbmProvider.kt b/packages/SystemUI/src/com/android/systemui/biometrics/DummyUdfpsHbmProvider.kt deleted file mode 100644 index a1ec9c2bb76e..000000000000 --- a/packages/SystemUI/src/com/android/systemui/biometrics/DummyUdfpsHbmProvider.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2022 The LineageOS 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.content.Context -import android.view.Surface - -class DummyUdfpsHbmProvider constructor( - private val context: Context -): UdfpsHbmProvider { - override fun enableHbm(hbmType: Int, surface: Surface?, onHbmEnabled: Runnable?) { - onHbmEnabled?.run() - } - - override fun disableHbm(onHbmDisabled: Runnable?) { - onHbmDisabled?.run() - } -} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 8533f356d67a..250c16c81eac 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -426,12 +426,7 @@ public class UdfpsController implements DozeReceiver { // We need to persist its ID to track it during ACTION_MOVE that could include // data for many other pointers because of multi-touch support. mActivePointerId = event.getPointerId(0); - final int idx = mActivePointerId == -1 - ? event.getPointerId(0) - : event.findPointerIndex(mActivePointerId); mVelocityTracker.addMovement(event); - onFingerDown((int) event.getRawX(), (int) event.getRawY(), - (int) event.getTouchMinor(idx), (int) event.getTouchMajor(idx)); handled = true; } if ((withinSensorArea || fromUdfpsView) && shouldTryToDismissKeyguard()) { @@ -577,7 +572,7 @@ public class UdfpsController implements DozeReceiver { @NonNull ScreenLifecycle screenLifecycle, @Nullable Vibrator vibrator, @NonNull UdfpsHapticsSimulator udfpsHapticsSimulator, - @NonNull UdfpsHbmProvider hbmProvider, + @NonNull Optional hbmProvider, @NonNull KeyguardStateController keyguardStateController, @NonNull KeyguardBypassController keyguardBypassController, @NonNull DisplayManager displayManager, @@ -606,7 +601,7 @@ public class UdfpsController implements DozeReceiver { mPowerManager = powerManager; mAccessibilityManager = accessibilityManager; mLockscreenShadeTransitionController = lockscreenShadeTransitionController; - mHbmProvider = hbmProvider; + mHbmProvider = hbmProvider.orElse(null); screenLifecycle.addObserver(mScreenObserver); mScreenOn = screenLifecycle.getScreenState() == ScreenLifecycle.SCREEN_ON; mKeyguardBypassController = keyguardBypassController; @@ -628,7 +623,7 @@ public class UdfpsController implements DozeReceiver { }); mCoreLayoutParams = new WindowManager.LayoutParams( - WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY, + WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, 0 /* flags set in computeLayoutParams() */, PixelFormat.TRANSLUCENT); mCoreLayoutParams.setTitle(TAG); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java index 71e33a699934..77fad35d32d4 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java @@ -19,7 +19,6 @@ 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; @@ -30,8 +29,6 @@ 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. */ @@ -57,8 +54,6 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb boolean mAwaitingSurfaceToStartIllumination; boolean mHasValidSurface; - private Drawable mUdfpsIconPressed; - public UdfpsSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); @@ -74,10 +69,8 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb mSensorPaint = new Paint(0 /* flags */); mSensorPaint.setAntiAlias(true); - mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor)); + mSensorPaint.setARGB(255, 255, 255, 255); mSensorPaint.setStyle(Paint.Style.FILL); - - mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed); } @Override public void surfaceCreated(SurfaceHolder holder) { @@ -141,13 +134,6 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb 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. diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.java index e4cbb527d338..30e5aed2f8d8 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.java @@ -51,6 +51,7 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin private static final String SETTING_HBM_TYPE = "com.android.systemui.biometrics.UdfpsSurfaceView.hbmType"; + private static final @HbmType int DEFAULT_HBM_TYPE = UdfpsHbmTypes.LOCAL_HBM; private static final int DEBUG_TEXT_SIZE_PX = 32; @@ -98,11 +99,9 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin if (Build.IS_ENG || Build.IS_USERDEBUG) { mHbmType = Settings.Secure.getIntForUser(mContext.getContentResolver(), - SETTING_HBM_TYPE, - mContext.getResources().getInteger(R.integer.config_udfpsHbmType), - UserHandle.USER_CURRENT); + SETTING_HBM_TYPE, DEFAULT_HBM_TYPE, UserHandle.USER_CURRENT); } else { - mHbmType = mContext.getResources().getInteger(R.integer.config_udfpsHbmType); + mHbmType = DEFAULT_HBM_TYPE; } } diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index 8adaa98e1a13..12786f278a16 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -83,7 +83,6 @@ import com.android.systemui.util.time.SystemClock; import com.android.systemui.util.time.SystemClockImpl; import com.android.systemui.wallet.dagger.WalletModule; import com.android.systemui.wmshell.BubblesManager; -import com.android.systemui.R; import com.android.wm.shell.bubbles.Bubbles; import java.util.Optional; @@ -176,17 +175,8 @@ public abstract class SystemUIModule { @BindsOptionalOf abstract StatusBar optionalStatusBar(); - @Provides - static UdfpsHbmProvider getUdfpsHbmProvider(Context context) { - String className = context.getString(R.string.config_udfpsHbmProviderComponent); - try { - Class clazz = context.getClassLoader().loadClass(className); - return (UdfpsHbmProvider) clazz.getDeclaredConstructor( - new Class[] { Context.class }).newInstance(context); - } catch (Throwable t) { - throw new RuntimeException("Error loading UdfpsHbmProvider " + className, t); - } - } + @BindsOptionalOf + abstract UdfpsHbmProvider optionalUdfpsHbmProvider(); @SysUISingleton @Binds -- 2.25.1