Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a811dd67 authored by Joshua McCloskey's avatar Joshua McCloskey
Browse files

UDFPS Enrollment refactor (2/N)

This commit is focused on UI. The guided enrollment, lottie, text
and progress bar should all be working according to the previous
experience.

Test: atest
Bug: 297082837
Change-Id: I9b414053f5eaf7b2bc164dacdddc96ed44fec6cb
parent e2099b7f
Loading
Loading
Loading
Loading
+61 −40
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 The Android Open Source Project
  ~ Copyright (C) 2024 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.
@@ -15,56 +15,77 @@
  ~ limitations under the License.
  -->

<com.google.android.setupdesign.GlifLayout
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/setup_wizard_layout"
    style="?attr/fingerprint_layout_theme"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    android:orientation="vertical">

    <LinearLayout
        style="@style/SudContentFrame"
    <!-- This is used to grab style attributes and apply them
    to this layout -->
    <com.google.android.setupdesign.GlifLayout
        android:id="@+id/dummy_glif_layout"
        style="?attr/fingerprint_layout_theme"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:visibility="gone"
        />

    <ImageView
        android:id="@+id/sud_layout_icon"
        style="@style/SudGlifIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="fitStart"
        android:src="@drawable/ic_lock" />

    <TextView
        android:id="@+id/title"
        style="@style/SudGlifHeaderTitle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:orientation="vertical">
        android:layout_height="80dp"
        android:ellipsize="end"
        android:lines="2"
        />

        <LinearLayout
    <TextView
        android:id="@+id/description"
        style="@style/SudDescription.Glif"
        android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="center|bottom"
            android:orientation="vertical">
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:lines="3"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        />

            <FrameLayout
                android:id="@+id/layout_container"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:layout_gravity="center_horizontal|bottom"
                android:clipChildren="false"
                android:clipToPadding="false"
                tools:ignore="Suspicious0dp">

                <!-- Animation res MUST be set in code -->
    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/illustration_lottie"
                    android:layout_width="200dp"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:clipChildren="false"
        android:clipToPadding="false"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:scaleType="centerInside"
        app:lottie_autoPlay="true"
        app:lottie_loop="true"
        app:lottie_speed=".85" />

    <FrameLayout
        android:id="@+id/layout_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal|bottom"
        android:clipToPadding="false"
        >

        <include layout="@layout/fingerprint_v2_udfps_enroll_view" />
    </FrameLayout>
        </LinearLayout>
    </LinearLayout>


</com.google.android.setupdesign.GlifLayout>
</LinearLayout>
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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.settings.biometrics.fingerprint2.ui.enrollment.modules.enrolling.udfps.ui.widget.UdfpsEnrollViewV2
    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"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/udfps_enroll_animation_fp_progress_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

    <ImageView
        android:id="@+id/udfps_enroll_animation_fp_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</com.android.settings.biometrics.fingerprint2.ui.enrollment.modules.enrolling.udfps.ui.widget.UdfpsEnrollViewV2>
 No newline at end of file
+25 −20
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.transform
import kotlinx.coroutines.withContext

/**
@@ -50,7 +51,7 @@ class FingerprintSensorRepositoryImpl(
  activityScope: CoroutineScope,
) : FingerprintSensorRepository {

  override val fingerprintSensor: Flow<FingerprintSensor> =
  private val fingerprintPropsInternal: Flow<FingerprintSensorPropertiesInternal> =
    callbackFlow {
        val callback =
          object : IFingerprintAuthenticatorsRegisteredCallback.Stub() {
@@ -60,7 +61,7 @@ class FingerprintSensorRepositoryImpl(
              if (sensors.isEmpty()) {
                trySend(DEFAULT_PROPS)
              } else {
                trySend(sensors[0].toFingerprintSensor())
                trySend(sensors[0])
              }
            }
          }
@@ -71,6 +72,11 @@ class FingerprintSensorRepositoryImpl(
      }
      .stateIn(activityScope, started = SharingStarted.Eagerly, initialValue = DEFAULT_PROPS)

  override val fingerprintSensor: Flow<FingerprintSensor> =
    fingerprintPropsInternal.transform {
      emit(it.toFingerprintSensor())
    }

  companion object {
    private const val TAG = "FingerprintSensorRepoImpl"

@@ -85,6 +91,5 @@ class FingerprintSensorRepositoryImpl(
        true /* resetLockoutRequiresHardwareAuthToken */,
        listOf<SensorLocationInternal>(SensorLocationInternal.DEFAULT),
      )
                .toFingerprintSensor()
  }
}
+2 −0
Original line number Diff line number Diff line
@@ -20,10 +20,12 @@ import android.content.Context
import android.content.Intent
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricFingerprintConstants
import android.hardware.biometrics.SensorLocationInternal
import android.hardware.fingerprint.FingerprintEnrollOptions;
import android.hardware.fingerprint.FingerprintManager
import android.hardware.fingerprint.FingerprintManager.GenerateChallengeCallback
import android.hardware.fingerprint.FingerprintManager.RemovalCallback
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
import android.os.CancellationSignal
import android.util.Log
import com.android.settings.biometrics.GatekeeperPasswordProvider
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.biometrics.fingerprint2.lib.domain.interactor

import android.hardware.fingerprint.FingerprintSensorPropertiesInternal
import com.android.settings.biometrics.fingerprint2.lib.model.EnrollReason
import com.android.settings.biometrics.fingerprint2.lib.model.FingerEnrollState
import com.android.settings.biometrics.fingerprint2.lib.model.FingerprintAuthAttemptModel
Loading