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
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 1b120c1..e78fa63 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-     Copyright (C) 2017-2022 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.
@@ -102,6 +102,9 @@
     <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>
diff --git a/res/values/lineage_config.xml b/res/values/lineage_config.xml
index 5abcab9..3fc6576 100644
--- a/res/values/lineage_config.xml
+++ b/res/values/lineage_config.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-     Copyright (C) 2020-2022 The LineageOS Project
+     Copyright (C) 2020-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.
@@ -18,6 +18,10 @@
     <!-- 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>
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index 95672ee..22bf7a2 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -156,7 +156,6 @@
     private FingerprintManager mFingerprintManager;
     private boolean mCanAssumeUdfps;
     private boolean mCanAssumeSfps;
-    private static boolean sCanAssumeSfps;
     @Nullable private ProgressBar mProgressBar;
     private ObjectAnimator mProgressAnim;
     private TextView mErrorText;
@@ -235,7 +234,6 @@
                 mFingerprintManager.getSensorPropertiesInternal();
         mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType();
         mCanAssumeSfps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType();
-        sCanAssumeSfps = mCanAssumeSfps;
 
         mAccessibilityManager = getSystemService(AccessibilityManager.class);
         mIsAccessibilityEnabled = mAccessibilityManager.isEnabled();
@@ -1090,7 +1088,9 @@
         public Dialog onCreateDialog(Bundle savedInstanceState) {
             final boolean isFrontFacingFps = getResources().getBoolean(
                     R.bool.config_is_front_facing_fps);
-            final String fpsLocation = getString(sCanAssumeSfps
+            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);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
index 2304fcc..a346431 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFindSensor.java
@@ -124,9 +124,14 @@
             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 String fpsLocation = getString(isFrontFacingFps
+            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);