diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
commit | 70c30865d2afe9d238150cc9a2d227bdbe2e9452 (patch) | |
tree | 4399080b4004f896176e7a865a5a10cf088cdeac | |
parent | 81c00b1e2afcc7bfc562b96e6d65fc1237ad7d02 (diff) |
base: Squashed revert of udfps changes
These will need to be reimplemented after QPR2 merge.
Revert "udfps: Trigger onFingerDown with regular action down events too"
This reverts commit afc0cd1f0ff9ee00ad17b99bcbeda54bcbb7c251.
Revert "udfps: Change window type to TYPE_DISPLAY_OVERLAY"
This reverts commit 436f61e35620afee50261246dd3467be250a1b0f.
Revert "udfps: Implement default udfps hbm provider"
This reverts commit 9ad560175ea4891c399ffe6f5f77de189a700c50.
Revert "udfps: Make pressed udfp view configurable"
This reverts commit 194bbfcacd21e2ed50f48f9afa8f19c21b969778.
Revert "udfps: Restore illumination dot for global hbm"
This reverts commit 169780b2d87ade137eed130d30b3dc19ebe27045.
Change-Id: I005a9a30d205392ce61e89965cc93821acb4cb3a
11 files changed, 8 insertions, 253 deletions
diff --git a/packages/SystemUI/proguard.flags b/packages/SystemUI/proguard.flags index c6cfe5fdd35d..e74b6c78ec80 100644 --- a/packages/SystemUI/proguard.flags +++ b/packages/SystemUI/proguard.flags @@ -10,9 +10,6 @@ -keep class com.android.systemui.tv.TvSystemUIFactory -keep class * extends com.android.systemui.CoreStartable -keep class * implements com.android.systemui.CoreStartable$Injector --keep class * implements com.android.systemui.biometrics.UdfpsHbmProvider { - public <init>(...); -} -keepclasseswithmembers class * { public <init>(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 Binary files differdeleted file mode 100644 index 4102e28c1300..000000000000 --- a/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png +++ /dev/null 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/ice_config.xml b/packages/SystemUI/res/values/ice_config.xml index 5dd02170ff9c..c13dda7076a9 100644 --- a/packages/SystemUI/res/values/ice_config.xml +++ b/packages/SystemUI/res/values/ice_config.xml @@ -14,12 +14,6 @@ limitations under the License. --> <resources> - <!-- Color of the UDFPS pressed view --> - <color name="config_udfpsColor">#ffffffff</color> - - <!-- Udfps HBM provider class name --> - <string name="config_udfpsHbmProviderComponent">com.android.systemui.biometrics.DummyUdfpsHbmProvider</string> - <!-- Allow devices override audio panel location to the left side --> <bool name="config_audioPanelOnLeftSide">false</bool> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index c498e2abc675..6da2f50aac27 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -729,7 +729,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/DummyUdfpsHbmProvider.kt b/packages/SystemUI/src/com/android/systemui/biometrics/DummyUdfpsHbmProvider.kt deleted file mode 100644 index ab0cc33f1714..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(halControlsIllumination: Boolean, 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 52bf47bed8a0..6e2dcae4728e 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -444,12 +444,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(requestId, (int) event.getRawX(), (int) event.getRawY(), - (int) event.getTouchMinor(idx), (int) event.getTouchMajor(idx)); handled = true; mAcquiredReceived = false; } @@ -598,7 +593,7 @@ public class UdfpsController implements DozeReceiver { @NonNull VibratorHelper vibrator, @NonNull UdfpsHapticsSimulator udfpsHapticsSimulator, @NonNull UdfpsShell udfpsShell, - @NonNull UdfpsHbmProvider hbmProvider, + @NonNull Optional<UdfpsHbmProvider> hbmProvider, @NonNull KeyguardStateController keyguardStateController, @NonNull DisplayManager displayManager, @Main Handler mainHandler, @@ -630,7 +625,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; mConfigurationController = configurationController; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt index baa448814d30..ec720579fbee 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt @@ -94,7 +94,7 @@ class UdfpsControllerOverlay( 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 71e33a699934..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 onIlluminatedRunnable a runnable that should be run after GHBM is enabled. - */ - void enableGhbm(@NonNull Surface surface, @Nullable Runnable onIlluminatedRunnable); - } - - @NonNull private final SurfaceHolder mHolder; - @NonNull private final Paint mSensorPaint; - - @Nullable private GhbmIlluminationListener mGhbmIlluminationListener; - @Nullable private Runnable mOnIlluminatedRunnable; - 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(mOnIlluminatedRunnable); - mOnIlluminatedRunnable = 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 onIlluminatedRunnable) { - if (mGhbmIlluminationListener == null) { - Log.e(TAG, "startIllumination | mGhbmIlluminationListener is null"); - return; - } - - if (mHasValidSurface) { - doIlluminate(onIlluminatedRunnable); - } else { - mAwaitingSurfaceToStartIllumination = true; - mOnIlluminatedRunnable = onIlluminatedRunnable; - } - } - - private void doIlluminate(@Nullable Runnable onIlluminatedRunnable) { - if (mGhbmIlluminationListener == null) { - Log.e(TAG, "doIlluminate | mGhbmIlluminationListener is null"); - return; - } - - mGhbmIlluminationListener.enableGhbm(mHolder.getSurface(), onIlluminatedRunnable); - } - - /** - * 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 5f0c53c9b7bb..245c2252d57b 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsView.kt @@ -24,7 +24,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,9 +60,6 @@ class UdfpsView( com.android.internal.R.integer.config_udfps_illumination_transition_ms ).toLong() - // Only used for UdfpsHbmTypes.GLOBAL_HBM. - private var ghbmView: UdfpsSurfaceView? = null - /** View controller (can be different for enrollment, BiometricPrompt, Keyguard, etc.). */ var animationViewController: UdfpsAnimationViewController<*>? = null @@ -93,10 +89,6 @@ class UdfpsView( return (animationViewController == null || !animationViewController!!.shouldPauseAuth()) } - override fun onFinishInflate() { - ghbmView = findViewById(R.id.hbm_view) - } - override fun dozeTimeTick() { animationViewController?.dozeTimeTick() } @@ -161,25 +153,13 @@ class UdfpsView( override fun startIllumination(onIlluminatedRunnable: Runnable?) { isIlluminationRequested = true animationViewController?.onIlluminationStarting() - val gView = ghbmView - if (gView != null) { - gView.setGhbmIlluminationListener(this::doIlluminate) - gView.visibility = VISIBLE - gView.startGhbmIllumination(onIlluminatedRunnable) - } else { - doIlluminate(null /* surface */, onIlluminatedRunnable) - } + doIlluminate(onIlluminatedRunnable) } - private fun doIlluminate(surface: Surface?, onIlluminatedRunnable: Runnable?) { - if (ghbmView != null && surface == null) { - Log.e(TAG, "doIlluminate | surface must be non-null for GHBM") - } - + private fun doIlluminate(onIlluminatedRunnable: Runnable?) { // TODO(b/231335067): enableHbm with halControlsIllumination=true shouldn't make sense. // This only makes sense now because vendor code may rely on the side effects of enableHbm. hbmProvider?.enableHbm(halControlsIllumination) { - ghbmView?.drawIlluminationDot(sensorRect) if (onIlluminatedRunnable != null) { if (halControlsIllumination) { onIlluminatedRunnable.run() @@ -197,10 +177,6 @@ class UdfpsView( override fun stopIllumination() { isIlluminationRequested = false animationViewController?.onIlluminationStopped() - ghbmView?.let { view -> - view.setGhbmIlluminationListener(null) - view.visibility = INVISIBLE - } hbmProvider?.disableHbm(null /* onHbmDisabled */) } } diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index e462f0e0f466..366ef2651a92 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -89,7 +89,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 com.android.wm.shell.dagger.DynamicOverride; @@ -189,17 +188,8 @@ public abstract class SystemUIModule { @BindsOptionalOf abstract CentralSurfaces optionalCentralSurfaces(); - @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(); @BindsOptionalOf abstract AlternateUdfpsTouchProvider optionalUdfpsTouchProvider(); |