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

Commit 8b367774 authored by Grace Cheng's avatar Grace Cheng Committed by Android (Google) Code Review
Browse files

Merge "Prevent NPE on deleting fingerprint in Settings" into udc-dev

parents 83c04b32 ec1bd37d
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -283,7 +283,9 @@ public class FingerprintSettings extends SubSettings {
                    case MSG_REFRESH_FINGERPRINT_TEMPLATES:
                        removeFingerprintPreference(msg.arg1);
                        updateAddPreference();
                        if (isSfps()) {
                            updateFingerprintUnlockCategoryVisibility();
                        }
                        updatePreferences();
                        break;
                    case MSG_FINGER_AUTH_SUCCESS:
@@ -494,11 +496,15 @@ public class FingerprintSettings extends SubSettings {
        }

        private boolean isSfps() {
            mFingerprintManager = Utils.getFingerprintManagerOrNull(getActivity());
            if (mFingerprintManager != null) {
                mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
                for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
                    if (prop.isAnySidefpsType()) {
                        return true;
                    }
                }
            }
            return false;
        }

@@ -838,6 +844,7 @@ public class FingerprintSettings extends SubSettings {

        private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
            final List<AbstractPreferenceController> controllers = new ArrayList<>();
            if (isSfps()) {
                mFingerprintUnlockCategoryPreferenceController =
                    new FingerprintUnlockCategoryController(
                        context,
@@ -850,6 +857,7 @@ public class FingerprintSettings extends SubSettings {
                        );
                controllers.add(mFingerprintUnlockCategoryPreferenceController);
                controllers.add(mRequireScreenOnToAuthPreferenceController);
            }
            return controllers;
        }