fingerprint: Rework enrollment screen
This is based on the following changes, adapted to Android 12
considering the fact that AOSP now supports FOD as well as
fingerprint sensors embedded in the power button:
Author: d34d <clark@cyngn.com>
Date: 2016-06-23 11:21:45 -0700
fingerprint: Allow devices to configure sensor location
The text for enrolling a fingerprint always assumes the sensor is
located on the back. This patch adds a config integer that defines
where the sensor is located on the device.
0 = back
1 = front
2 = left side
3 = right side
This patch also adds a new drawable that shows the front of the device
when applicable.
Change-Id: Ia8f5f8ff4ba4d13d35aed3052f60ff665dd4f294
TICKET: CYNGNOS-3089
Author: Paul Keith <javelinanddart@gmail.com>
Date: 2018-01-26 22:23:03 +0100
FingerprintEnrollFindSensor: Don't overlay front for side sensors
* Both the base image and the base image + overlay are equally nonsense
for devices with a side fingerprint scanner, but for those that overlay
a custom fingerprint enrollment graphic, this image overlay wreaks havoc
* Only set this overlay to be visible if the sensor is on the front, to
allow devices with side sensors to only overlay the base image
Change-Id: I7cbcea4830d4526cf9f7d139e7f84f21117fa9c4
Author: Michael W <baddaemon87@gmail.com>
Date: Thu Jan 17 21:44:28 2019 +0100
Settings: Make find fingerprint look great again
* The current logic places the animation based on the size of
the whole overlay instead of the image, which is a fixed-size png
* Get the size of the image instead and place the dot relative to it
* Also use "wrap_content" and add a padding to the top so the
distance to the text is a fixed thing, not depending on how
much space relative to the wanted space it actually takes
* Preview: https://imgur.com/a/XanJ2aP
Change-Id: I2bd08cee1abd1c6bad78ca1efc2189e573ded3cc
Author: LuK1337 <priv.luk@gmail.com>
Date: Sat Dec 15 17:11:41 2018 +0100
fingerprint: Remove unnecessary spacing in enroll layout
* This makes it look ugly on 480 dpi devices.
Change-Id: Ia1bbd443063a125878dddd12e5c6a816d289fb82
Author: Bruno Martins <bgcngm@gmail.com>
Date: Thu Mar 17 10:30:41 2022 +0000
FingerprintEnrollEnrolling: Set proper dialog message when user touches fp icon
Change-Id: Iafd86e636b0c54bbddcf26d153cc671259391259
Author: Michael Bestas <mkbestas@lineageos.org>
Date: Tue Dec 6 20:40:45 2022 +0200
Use AOSP string for side fps enrollment
Change-Id: I9267b6a75716f45044f4d7a51650ca4f928b104e
Author: Bruno Martins <bgcngm@gmail.com>
Date: Tue Apr 18 16:16:34 2023 +0100
FingerprintEnroll: Add config for dedicated side mounted fps
Google likes to assume that there only exists devices with
fingerprint sensor embedded in the power button, but that's
not always true. Since specific enrollment messages were added
just for those devices, we need to address our own usecase.
Change-Id: I56a7d7fe0374fe5a1fce5e24bdbb265cb5edc246
Change-Id: If372ef50c4a719e89a4e80cc20e3eb445af61bc6
This commit is contained in:
parent
5680f3f9dd
commit
72e64a7fd4
9 changed files with 97 additions and 12 deletions
BIN
res/drawable-nodpi/fingerprint_sensor_location_front_overlay.png
Normal file
BIN
res/drawable-nodpi/fingerprint_sensor_location_front_overlay.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
|
|
@ -29,11 +29,6 @@
|
|||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<include
|
||||
layout="@layout/fingerprint_enroll_find_sensor_graphic"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -17,17 +17,27 @@
|
|||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/fingerprint_find_sensor_graphic_size"
|
||||
android:layout_height="@dimen/fingerprint_find_sensor_graphic_size">
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/fingerprint_find_sensor_padding_top">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fingerprint_sensor_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/security_settings_fingerprint_enroll_find_sensor_content_description"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/fingerprint_sensor_location" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fingerprint_sensor_location_front_overlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/security_settings_fingerprint_enroll_find_sensor_content_description"
|
||||
android:src="@drawable/fingerprint_sensor_location_front_overlay"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.android.settings.biometrics.fingerprint.FingerprintLocationAnimationView
|
||||
android:id="@+id/fingerprint_sensor_location_animation"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2021 The LineageOS Project
|
||||
Copyright (C) 2017-2023 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.
|
||||
|
|
@ -60,6 +60,28 @@
|
|||
<!-- Whether the dots will be drawn when using the lockscreen pattern -->
|
||||
<string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>
|
||||
|
||||
<!-- Message shown in fingerprint enrollment dialog to locate the sensor -->
|
||||
<string name="fingerprint_enroll_find_sensor_message_front" product="tablet">Locate the fingerprint sensor on the front of your tablet.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_front" product="device">Locate the fingerprint sensor on the front of your device.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_front" product="default">Locate the fingerprint sensor on the front of your phone.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_rear" product="tablet">Locate the fingerprint sensor on the back of your tablet.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_rear" product="device">Locate the fingerprint sensor on the back of your device.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_rear" product="default">Locate the fingerprint sensor on the back of your phone.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_side" product="tablet">Locate the fingerprint sensor on the side of your tablet.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_side" product="device">Locate the fingerprint sensor on the side of your device.</string>
|
||||
<string name="fingerprint_enroll_find_sensor_message_side" product="default">Locate the fingerprint sensor on the side of your phone.</string>
|
||||
|
||||
<!-- Message shown when user touches the icon on the screen, instead of the real fingerprint sensor -->
|
||||
<string name="fingerprint_enroll_touch_dialog_message_front" product="tablet">Touch the sensor on the front of your tablet.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_front" product="device">Touch the sensor on the front of your device.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_front" product="default">Touch the sensor on the front of your phone.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_rear" product="tablet">Touch the sensor on the back of your tablet.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_rear" product="device">Touch the sensor on the back of your device.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_rear" product="default">Touch the sensor on the back of your phone.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_side" product="tablet">Touch the sensor on the side of your tablet.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_side" product="device">Touch the sensor on the side of your device.</string>
|
||||
<string name="fingerprint_enroll_touch_dialog_message_side" product="default">Touch the sensor on the side of your phone.</string>
|
||||
|
||||
<!-- Navigation bar hint -->
|
||||
<string name="show_navbar_hint_title">Navigation hint</string>
|
||||
<string name="show_navbar_hint_summary">Show navigation hint bar at the bottom of the screen</string>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Indicates whether device has a front facing fingerprint sensor (not udfps). -->
|
||||
<bool name="config_is_front_facing_fps" translatable="false">false</bool>
|
||||
|
||||
<!-- Indicates whether device has a side mounted fingerprint sensor,
|
||||
but a dedicated one, i.e. not embedded in the power button. -->
|
||||
<bool name="config_is_side_fps" translatable="false">false</bool>
|
||||
|
||||
<string-array name="config_ignored_backup_transports" translatable="false">
|
||||
<item>com.android.localtransport/.LocalTransport</item>
|
||||
</string-array>
|
||||
|
|
|
|||
21
res/values/lineage_dimens.xml
Normal file
21
res/values/lineage_dimens.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Fingerprint -->
|
||||
<dimen name="fingerprint_find_sensor_padding_top">16dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1189,10 +1189,19 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final boolean isFrontFacingFps = getResources().getBoolean(
|
||||
R.bool.config_is_front_facing_fps);
|
||||
final boolean isSideMountedFps = getResources().getBoolean(
|
||||
R.bool.config_is_side_fps);
|
||||
final String fpsLocation = getString(isSideMountedFps
|
||||
? R.string.fingerprint_enroll_touch_dialog_message_side : isFrontFacingFps
|
||||
? R.string.fingerprint_enroll_touch_dialog_message_front
|
||||
: R.string.fingerprint_enroll_touch_dialog_message_rear);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),
|
||||
R.style.Theme_AlertDialog);
|
||||
builder.setTitle(R.string.security_settings_fingerprint_enroll_touch_dialog_title)
|
||||
.setMessage(R.string.security_settings_fingerprint_enroll_touch_dialog_message)
|
||||
.setMessage(fpsLocation)
|
||||
.setPositiveButton(R.string.security_settings_fingerprint_enroll_dialog_ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -122,8 +122,23 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||
mIsReverseDefaultRotation = getApplicationContext().getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_reverseDefaultRotation);
|
||||
} else {
|
||||
// Remaining usecases can be either front facing fps or dedicated
|
||||
// side mounted fps (not embedded in the power button)
|
||||
final boolean isFrontFacingFps = getResources().getBoolean(
|
||||
R.bool.config_is_front_facing_fps);
|
||||
final boolean isSideMountedFps = getResources().getBoolean(
|
||||
R.bool.config_is_side_fps);
|
||||
final String fpsLocation = getString(isSideMountedFps
|
||||
? R.string.fingerprint_enroll_find_sensor_message_side : isFrontFacingFps
|
||||
? R.string.fingerprint_enroll_find_sensor_message_front
|
||||
: R.string.fingerprint_enroll_find_sensor_message_rear);
|
||||
|
||||
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
||||
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
|
||||
setDescriptionText(fpsLocation);
|
||||
if (isFrontFacingFps) {
|
||||
findViewById(R.id.fingerprint_sensor_location_front_overlay)
|
||||
.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
if (savedInstanceState != null) {
|
||||
mNextClicked = savedInstanceState.getBoolean(SAVED_STATE_IS_NEXT_CLICKED, mNextClicked);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import android.util.AttributeSet;
|
|||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ public class FingerprintLocationAnimationView extends View implements
|
|||
private float mPulseRadius;
|
||||
private ValueAnimator mRadiusAnimator;
|
||||
private ValueAnimator mAlphaAnimator;
|
||||
private ImageView mOverlayImage;
|
||||
|
||||
public FingerprintLocationAnimationView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
|
@ -93,7 +95,11 @@ public class FingerprintLocationAnimationView extends View implements
|
|||
}
|
||||
|
||||
private float getCenterY() {
|
||||
return getHeight() * mFractionCenterY;
|
||||
if (mOverlayImage == null) {
|
||||
mOverlayImage = (ImageView) getRootView().findViewById(
|
||||
R.id.fingerprint_sensor_location);
|
||||
}
|
||||
return mOverlayImage.getHeight() * mFractionCenterY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue