Merge "Fix NPE crashes during UDFPS BiometricPrompt" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c8f4f70efd
22
packages/SystemUI/res/layout/udfps_animation_view_bp.xml
Normal file
22
packages/SystemUI/res/layout/udfps_animation_view_bp.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<com.android.systemui.biometrics.UdfpsAnimationViewBp
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/udfps_animation_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</com.android.systemui.biometrics.UdfpsAnimationViewBp>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user