Loading packages/SystemUI/res/layout/udfps_animation_view.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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.UdfpsAnimationView 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"/> packages/SystemUI/res/layout/udfps_surface_view.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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.UdfpsSurfaceView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/udfps_surface_view" android:layout_width="match_parent" android:layout_height="match_parent"/> packages/SystemUI/src/com/android/systemui/biometrics/HbmCallback.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * 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.view.Surface; /** * Interface for controlling the high-brightness mode (HBM). UdfpsView can use this callback to * enable the HBM while showing the fingerprint illumination, and to disable the HBM after the * illumination is no longer necessary. */ public interface HbmCallback { /** * UdfpsView will call this to enable the HBM before drawing the illumination dot. * * @param surface A valid surface for which the HBM should be enabled. */ void enableHbm(@NonNull Surface surface); /** * UdfpsView will call this to disable the HBM when the illumination is not longer needed. * * @param surface A valid surface for which the HBM should be disabled. */ void disableHbm(@NonNull Surface surface); } packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * 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.Canvas; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import com.android.systemui.doze.DozeReceiver; import com.android.systemui.statusbar.phone.ScrimController; /** * Class that coordinates non-HBM animations (such as enroll, keyguard, BiometricPrompt, * FingerprintManager). */ public class UdfpsAnimationView extends View implements DozeReceiver, ScrimController.ScrimChangedListener { private static final String TAG = "UdfpsAnimationView"; @NonNull private UdfpsView mParent; @Nullable private UdfpsAnimation mUdfpsAnimation; @NonNull private RectF mSensorRect; private int mNotificationPanelAlpha; public UdfpsAnimationView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mSensorRect = new RectF(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mUdfpsAnimation != null) { final int alpha = mParent.shouldPauseAuth() ? 255 - mNotificationPanelAlpha : 255; mUdfpsAnimation.setAlpha(alpha); mUdfpsAnimation.draw(canvas); } } void setParent(@NonNull UdfpsView parent) { mParent = parent; } void setAnimation(@Nullable UdfpsAnimation animation) { mUdfpsAnimation = animation; } void onSensorRectUpdated(@NonNull RectF sensorRect) { mSensorRect = sensorRect; if (mUdfpsAnimation != null) { mUdfpsAnimation.onSensorRectUpdated(mSensorRect); } } void updateColor() { if (mUdfpsAnimation != null) { mUdfpsAnimation.updateColor(); } } @Override public void dozeTimeTick() { if (mUdfpsAnimation instanceof DozeReceiver) { ((DozeReceiver) mUdfpsAnimation).dozeTimeTick(); } } @Override public void onAlphaChanged(float alpha) { mNotificationPanelAlpha = (int) (alpha * 255); postInvalidate(); } void onEnrollmentProgress(int remaining) { if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) { ((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentProgress(remaining); } } void onEnrollmentHelp() { if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) { ((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentHelp(); } } } packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +5 −6 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ import javax.inject.Inject; */ @SuppressWarnings("deprecation") @SysUISingleton public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { public class UdfpsController implements DozeReceiver, HbmCallback { private static final String TAG = "UdfpsController"; private static final long AOD_INTERRUPT_TIMEOUT_MILLIS = 1000; Loading Loading @@ -374,9 +374,8 @@ public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { // This method can be called from the UI thread. private void onFingerDown(int x, int y, float minor, float major) { mView.setOnIlluminatedRunnable( () -> mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major)); mView.startIllumination(); mView.startIllumination(() -> mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major)); } // This method can be called from the UI thread. Loading @@ -386,13 +385,13 @@ public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { } @Override public void enableHbm(Surface surface) { public void enableHbm(@NonNull Surface surface) { // Do nothing. This method can be implemented for devices that require the high-brightness // mode for fingerprint illumination. } @Override public void disableHbm(Surface surface) { public void disableHbm(@NonNull Surface surface) { // Do nothing. This method can be implemented for devices that require the high-brightness // mode for fingerprint illumination. } Loading Loading
packages/SystemUI/res/layout/udfps_animation_view.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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.UdfpsAnimationView 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"/>
packages/SystemUI/res/layout/udfps_surface_view.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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.UdfpsSurfaceView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/udfps_surface_view" android:layout_width="match_parent" android:layout_height="match_parent"/>
packages/SystemUI/src/com/android/systemui/biometrics/HbmCallback.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * 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.view.Surface; /** * Interface for controlling the high-brightness mode (HBM). UdfpsView can use this callback to * enable the HBM while showing the fingerprint illumination, and to disable the HBM after the * illumination is no longer necessary. */ public interface HbmCallback { /** * UdfpsView will call this to enable the HBM before drawing the illumination dot. * * @param surface A valid surface for which the HBM should be enabled. */ void enableHbm(@NonNull Surface surface); /** * UdfpsView will call this to disable the HBM when the illumination is not longer needed. * * @param surface A valid surface for which the HBM should be disabled. */ void disableHbm(@NonNull Surface surface); }
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationView.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * 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.Canvas; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import com.android.systemui.doze.DozeReceiver; import com.android.systemui.statusbar.phone.ScrimController; /** * Class that coordinates non-HBM animations (such as enroll, keyguard, BiometricPrompt, * FingerprintManager). */ public class UdfpsAnimationView extends View implements DozeReceiver, ScrimController.ScrimChangedListener { private static final String TAG = "UdfpsAnimationView"; @NonNull private UdfpsView mParent; @Nullable private UdfpsAnimation mUdfpsAnimation; @NonNull private RectF mSensorRect; private int mNotificationPanelAlpha; public UdfpsAnimationView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mSensorRect = new RectF(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mUdfpsAnimation != null) { final int alpha = mParent.shouldPauseAuth() ? 255 - mNotificationPanelAlpha : 255; mUdfpsAnimation.setAlpha(alpha); mUdfpsAnimation.draw(canvas); } } void setParent(@NonNull UdfpsView parent) { mParent = parent; } void setAnimation(@Nullable UdfpsAnimation animation) { mUdfpsAnimation = animation; } void onSensorRectUpdated(@NonNull RectF sensorRect) { mSensorRect = sensorRect; if (mUdfpsAnimation != null) { mUdfpsAnimation.onSensorRectUpdated(mSensorRect); } } void updateColor() { if (mUdfpsAnimation != null) { mUdfpsAnimation.updateColor(); } } @Override public void dozeTimeTick() { if (mUdfpsAnimation instanceof DozeReceiver) { ((DozeReceiver) mUdfpsAnimation).dozeTimeTick(); } } @Override public void onAlphaChanged(float alpha) { mNotificationPanelAlpha = (int) (alpha * 255); postInvalidate(); } void onEnrollmentProgress(int remaining) { if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) { ((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentProgress(remaining); } } void onEnrollmentHelp() { if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) { ((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentHelp(); } } }
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +5 −6 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ import javax.inject.Inject; */ @SuppressWarnings("deprecation") @SysUISingleton public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { public class UdfpsController implements DozeReceiver, HbmCallback { private static final String TAG = "UdfpsController"; private static final long AOD_INTERRUPT_TIMEOUT_MILLIS = 1000; Loading Loading @@ -374,9 +374,8 @@ public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { // This method can be called from the UI thread. private void onFingerDown(int x, int y, float minor, float major) { mView.setOnIlluminatedRunnable( () -> mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major)); mView.startIllumination(); mView.startIllumination(() -> mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major)); } // This method can be called from the UI thread. Loading @@ -386,13 +385,13 @@ public class UdfpsController implements UdfpsView.HbmCallback, DozeReceiver { } @Override public void enableHbm(Surface surface) { public void enableHbm(@NonNull Surface surface) { // Do nothing. This method can be implemented for devices that require the high-brightness // mode for fingerprint illumination. } @Override public void disableHbm(Surface surface) { public void disableHbm(@NonNull Surface surface) { // Do nothing. This method can be implemented for devices that require the high-brightness // mode for fingerprint illumination. } Loading