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

Commit 8e12f525 authored by lbill's avatar lbill
Browse files

Add Null check FingerprintSettings#updateAddPreference()

When fingerprint finish enrollment, user click Done
The flow would be:
-> wm_finish_activity
-> relaunch_resume_activity
-> wm_on_destroy_called
-> wm_on_create_called
-> wm_on_start_called
-> wm_on_activity_result_called
   In U, we need to add NPE check when updateAddPreference()
   earlier then addFingerprintItemPreferences()
-> wm_on_resume_called

Bug: 275519315
Test: manual enroll SFPS, in FingerprintEnrollEnrolling,
      rotate device, then complete the enrollment
      verify the flow never crash and user can see enrolled
      fingerprint in FingerprintSettings

Change-Id: Ia262741aeceeb36eefd159ad2ca1c9fa0e061d54
parent ebb97daa
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -593,10 +593,16 @@ public class FingerprintSettings extends SubSettings {
        }

        private void updateAddPreference() {
            if (getActivity() == null) return; // Activity went away
            if (getActivity() == null) {
                return; // Activity went away
            }

            final Preference addPreference = findPreference(KEY_FINGERPRINT_ADD);

            if (addPreference == null) {
                return; // b/275519315 Skip if updateAddPreference() invoke before addPreference()
            }

            /* Disable preference if too many fingerprints added */
            final int max = getContext().getResources().getInteger(
                    com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);