diff --git a/packages/SystemUI/res/layout/udfps_animation_view_bp.xml b/packages/SystemUI/res/layout/udfps_animation_view_bp.xml new file mode 100644 index 0000000000000..0cfbf2e61dd12 --- /dev/null +++ b/packages/SystemUI/res/layout/udfps_animation_view_bp.xml @@ -0,0 +1,22 @@ + + + + diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java index f4dd181eb329d..6666c8dda5272 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java @@ -62,7 +62,10 @@ public abstract class UdfpsAnimationView extends FrameLayout implements DozeRece @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - getUdfpsAnimation().onDestroy(); + + if (getUdfpsAnimation() != null) { + getUdfpsAnimation().onDestroy(); + } } private int expansionToAlpha(float expansion) { @@ -78,11 +81,19 @@ public abstract class UdfpsAnimationView extends FrameLayout implements DozeRece } void onIlluminationStarting() { + if (getUdfpsAnimation() == null) { + return; + } + getUdfpsAnimation().setIlluminationShowing(true); postInvalidate(); } void onIlluminationStopped() { + if (getUdfpsAnimation() == null) { + return; + } + getUdfpsAnimation().setIlluminationShowing(false); postInvalidate(); } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewBp.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewBp.java new file mode 100644 index 0000000000000..515b442b61f64 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewBp.java @@ -0,0 +1,42 @@ +/* + * 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.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.Nullable; + +/** + * Class that coordinates non-HBM animations during BiometricPrompt. + * + * Note that {@link AuthBiometricUdfpsView} also shows UDFPS animations. At some point we should + * de-dupe this if necessary. This will probably happen once the top-level TODO in UdfpsController + * is completed (inflate operation-specific views, instead of inflating generic udfps_view and + * adding operation-specific animations to it). + */ +public class UdfpsAnimationViewBp extends UdfpsAnimationView { + public UdfpsAnimationViewBp(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + @Nullable + @Override + protected UdfpsAnimation getUdfpsAnimation() { + return null; + } +} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index c2efeeecd06c8..0f603e37d9847 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -361,23 +361,29 @@ public class UdfpsController implements DozeReceiver, HbmCallback { switch (reason) { case IUdfpsOverlayController.REASON_ENROLL_FIND_SENSOR: case IUdfpsOverlayController.REASON_ENROLL_ENROLLING: { - final UdfpsAnimationViewEnroll animation = (UdfpsAnimationViewEnroll) + final UdfpsAnimationViewEnroll view = (UdfpsAnimationViewEnroll) inflater.inflate(R.layout.udfps_animation_view_enroll, null, false); - animation.setEnrollHelper(mEnrollHelper); - return animation; + view.setEnrollHelper(mEnrollHelper); + return view; + } + + case IUdfpsOverlayController.REASON_AUTH_BP: { + final UdfpsAnimationViewBp view = (UdfpsAnimationViewBp) + inflater.inflate(R.layout.udfps_animation_view_bp, null, false); + return view; } case IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD: { - final UdfpsAnimationViewKeyguard animation = (UdfpsAnimationViewKeyguard) + final UdfpsAnimationViewKeyguard view = (UdfpsAnimationViewKeyguard) inflater.inflate(R.layout.udfps_animation_view_keyguard, null, false); - animation.setStatusBarStateController(mStatusBarStateController); - return animation; + view.setStatusBarStateController(mStatusBarStateController); + return view; } case IUdfpsOverlayController.REASON_AUTH_FPM_OTHER: { - final UdfpsAnimationViewFpmOther animation = (UdfpsAnimationViewFpmOther) + final UdfpsAnimationViewFpmOther view = (UdfpsAnimationViewFpmOther) inflater.inflate(R.layout.udfps_animation_view_fpm_other, null, false); - return animation; + return view; } default: