Merge "Add a flag for moving UdfpsEnroll* from SystemUI to settings."

This commit is contained in:
Hao Dong
2023-01-10 18:02:38 +00:00
committed by Android (Google) Code Review
9 changed files with 64 additions and 45 deletions

View File

@@ -464,6 +464,12 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
* @param remaining The number of remaining steps
*/
public void onEnrollmentProgress(int remaining) { }
/**
* Called when a fingerprint image has been acquired.
* @param isAcquiredGood whether the fingerprint image was good.
*/
public void onAcquired(boolean isAcquiredGood){ }
}
/**
@@ -1392,6 +1398,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
if (mAuthenticationCallback != null) {
mAuthenticationCallback.onAuthenticationAcquired(acquireInfo);
}
if (mEnrollmentCallback != null) {
mEnrollmentCallback.onAcquired(acquireInfo == FINGERPRINT_ACQUIRED_GOOD);
}
final String msg = getAcquiredString(mContext, acquireInfo, vendorCode);
if (msg == null) {
return;

View File

@@ -158,6 +158,14 @@ public class FeatureFlagUtils {
*/
public static final String SETTINGS_FLASH_ALERTS = "settings_flash_alerts";
/**
* Flag to disable/enable showing udfps enroll view in settings. If it's disabled, udfps enroll
* view is shown in system ui.
* @hide
*/
public static final String SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS =
"settings_show_udfps_enroll_in_settings";
private static final Map<String, String> DEFAULT_FLAGS;
static {
@@ -198,6 +206,7 @@ public class FeatureFlagUtils {
DEFAULT_FLAGS.put(SETTINGS_PREFER_ACCESSIBILITY_MENU_IN_SYSTEM, "false");
DEFAULT_FLAGS.put(SETTINGS_AUDIO_ROUTING, "false");
DEFAULT_FLAGS.put(SETTINGS_FLASH_ALERTS, "false");
DEFAULT_FLAGS.put(SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS, "false");
}
private static final Set<String> PERSISTENT_FLAGS;

View File

@@ -80,8 +80,8 @@
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDrawable.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpDrawable.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherViewController.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyView.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyViewController.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsHapticsSimulator.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayParams.kt
-packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt

View File

@@ -14,15 +14,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<com.android.systemui.biometrics.UdfpsFpmOtherView
<com.android.systemui.biometrics.UdfpsFpmEmptyView
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">
<!-- Fingerprint -->
<ImageView
android:id="@+id/udfps_fpm_other_fp_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.android.systemui.biometrics.UdfpsFpmOtherView>
</com.android.systemui.biometrics.UdfpsFpmEmptyView>

View File

@@ -33,6 +33,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback
import android.os.Build
import android.os.RemoteException
import android.provider.Settings
import android.util.FeatureFlagUtils
import android.util.Log
import android.util.RotationUtils
import android.view.LayoutInflater
@@ -232,18 +233,30 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
return when (filteredRequestReason) {
REASON_ENROLL_FIND_SENSOR,
REASON_ENROLL_ENROLLING -> {
UdfpsEnrollViewController(
view.addUdfpsView(R.layout.udfps_enroll_view) {
updateSensorLocation(sensorBounds)
},
enrollHelper ?: throw IllegalStateException("no enrollment helper"),
statusBarStateController,
shadeExpansionStateManager,
dialogManager,
dumpManager,
featureFlags,
overlayParams.scaleFactor
)
if (FeatureFlagUtils.isEnabled(context,
FeatureFlagUtils.SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS)) {
// Enroll udfps UI is handled by settings, so use empty view here
UdfpsFpmEmptyViewController(
view.addUdfpsView(R.layout.udfps_fpm_empty_view),
statusBarStateController,
shadeExpansionStateManager,
dialogManager,
dumpManager
)
} else {
UdfpsEnrollViewController(
view.addUdfpsView(R.layout.udfps_enroll_view) {
updateSensorLocation(sensorBounds)
},
enrollHelper ?: throw IllegalStateException("no enrollment helper"),
statusBarStateController,
shadeExpansionStateManager,
dialogManager,
dumpManager,
featureFlags,
overlayParams.scaleFactor
)
}
}
REASON_AUTH_KEYGUARD -> {
UdfpsKeyguardViewController(
@@ -277,8 +290,8 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
}
REASON_AUTH_OTHER,
REASON_AUTH_SETTINGS -> {
UdfpsFpmOtherViewController(
view.addUdfpsView(R.layout.udfps_fpm_other_view),
UdfpsFpmEmptyViewController(
view.addUdfpsView(R.layout.udfps_fpm_empty_view),
statusBarStateController,
shadeExpansionStateManager,
dialogManager,

View File

@@ -17,24 +17,19 @@ package com.android.systemui.biometrics
import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
import com.android.systemui.R
/**
* View corresponding with udfps_fpm_other_view.xml
* View corresponding with udfps_fpm_empty_view.xml
*
* Currently doesn't draw anything.
*/
class UdfpsFpmOtherView(
class UdfpsFpmEmptyView(
context: Context,
attrs: AttributeSet?
) : UdfpsAnimationView(context, attrs) {
// Drawable isn't ever added to the view, so we don't currently show anything
private val fingerprintDrawable: UdfpsFpDrawable = UdfpsFpDrawable(context)
private lateinit var fingerprintView: ImageView
override fun onFinishInflate() {
fingerprintView = findViewById(R.id.udfps_fpm_other_fp_view)!!
fingerprintView.setImageDrawable(fingerprintDrawable)
}
override fun getDrawable(): UdfpsDrawable = fingerprintDrawable
}

View File

@@ -21,18 +21,17 @@ import com.android.systemui.shade.ShadeExpansionStateManager
import com.android.systemui.statusbar.phone.SystemUIDialogManager
/**
* Class that coordinates non-HBM animations for non keyguard, enrollment or biometric prompt
* states.
* Class that coordinates non-HBM animations for non keyguard, or biometric prompt states.
*
* Currently only shows the fp drawable.
* Currently doesn't draw anything.
*/
class UdfpsFpmOtherViewController(
view: UdfpsFpmOtherView,
class UdfpsFpmEmptyViewController(
view: UdfpsFpmEmptyView,
statusBarStateController: StatusBarStateController,
shadeExpansionStateManager: ShadeExpansionStateManager,
systemUIDialogManager: SystemUIDialogManager,
dumpManager: DumpManager
) : UdfpsAnimationViewController<UdfpsFpmOtherView>(
) : UdfpsAnimationViewController<UdfpsFpmEmptyView>(
view,
statusBarStateController,
shadeExpansionStateManager,

View File

@@ -124,8 +124,8 @@ class UdfpsControllerOverlayTest : SysuiTestCase() {
.thenReturn(mock(UdfpsBpView::class.java))
whenever(inflater.inflate(R.layout.udfps_keyguard_view, null))
.thenReturn(mock(UdfpsKeyguardView::class.java))
whenever(inflater.inflate(R.layout.udfps_fpm_other_view, null))
.thenReturn(mock(UdfpsFpmOtherView::class.java))
whenever(inflater.inflate(R.layout.udfps_fpm_empty_view, null))
.thenReturn(mock(UdfpsFpmEmptyView::class.java))
whenever(udfpsEnrollView.context).thenReturn(context)
}

View File

@@ -190,7 +190,7 @@ public class UdfpsControllerTest extends SysuiTestCase {
@Mock
private UdfpsBpView mBpView;
@Mock
private UdfpsFpmOtherView mFpmOtherView;
private UdfpsFpmEmptyView mFpmEmptyView;
@Mock
private UdfpsKeyguardView mKeyguardView;
private final UdfpsAnimationViewController mUdfpsKeyguardViewController =
@@ -240,8 +240,8 @@ public class UdfpsControllerTest extends SysuiTestCase {
.thenReturn(mKeyguardView); // for showOverlay REASON_AUTH_FPM_KEYGUARD
when(mLayoutInflater.inflate(R.layout.udfps_bp_view, null))
.thenReturn(mBpView);
when(mLayoutInflater.inflate(R.layout.udfps_fpm_other_view, null))
.thenReturn(mFpmOtherView);
when(mLayoutInflater.inflate(R.layout.udfps_fpm_empty_view, null))
.thenReturn(mFpmEmptyView);
when(mEnrollView.getContext()).thenReturn(mContext);
when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true);
when(mSessionTracker.getSessionId(anyInt())).thenReturn(