Add a flag for moving UdfpsEnroll* from SystemUI to settings.
- Adds SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS flag to guard the change.
- Remove the black fp drawable in udfps_fpm_other_view.xml
- Uses UdfpsFpmOtherViewController when the flag is enabled, so that SystemUI doesn't show anything for settings enrollment.
Turn this flag on via adb:
adb shell setprop sys.fflag.override.settings_show_udfps_enroll_in_settings true
Test: manually tested on device
Bug: 260617060
Change-Id: I1842c4351041fdabc16bde9d5d5a708efb258cb2
diff --git a/packages/SystemUI/ktfmt_includes.txt b/packages/SystemUI/ktfmt_includes.txt
index 7243ca4..b530dd5 100644
--- a/packages/SystemUI/ktfmt_includes.txt
+++ b/packages/SystemUI/ktfmt_includes.txt
@@ -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
diff --git a/packages/SystemUI/res/layout/udfps_fpm_other_view.xml b/packages/SystemUI/res/layout/udfps_fpm_empty_view.xml
similarity index 75%
rename from packages/SystemUI/res/layout/udfps_fpm_other_view.xml
rename to packages/SystemUI/res/layout/udfps_fpm_empty_view.xml
index 6ecbb47..de43a5e 100644
--- a/packages/SystemUI/res/layout/udfps_fpm_other_view.xml
+++ b/packages/SystemUI/res/layout/udfps_fpm_empty_view.xml
@@ -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>
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
index a3c4985..1b6c8c6 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt
@@ -33,6 +33,7 @@
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 @@
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 @@
}
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,
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyView.kt
similarity index 72%
rename from packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt
rename to packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyView.kt
index 4d6da8f..e8f041e 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyView.kt
@@ -17,24 +17,19 @@
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
}
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyViewController.kt
similarity index 82%
rename from packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherViewController.kt
rename to packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyViewController.kt
index 7c23278..d122d64 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmEmptyViewController.kt
@@ -21,18 +21,17 @@
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,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt
index c6fa983..7c9d22f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt
@@ -124,8 +124,8 @@
.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)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
index 83a6db0..d7b7a7d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java
@@ -190,7 +190,7 @@
@Mock
private UdfpsBpView mBpView;
@Mock
- private UdfpsFpmOtherView mFpmOtherView;
+ private UdfpsFpmEmptyView mFpmEmptyView;
@Mock
private UdfpsKeyguardView mKeyguardView;
private final UdfpsAnimationViewController mUdfpsKeyguardViewController =
@@ -240,8 +240,8 @@
.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(