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

Commit e513c711 authored by Becca Hughes's avatar Becca Hughes
Browse files

Hide enable dialog and prefix pref wrongly enabled

Test: ondevice
Bug: 281329396
Bug: 280905737
Change-Id: I82652a2520a2f9ca9bc7f8f78cf020bef7af0b15
parent 9c67ee1e
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -528,16 +528,24 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
                    boolean isChecked = pref.isChecked();

                    if (isChecked) {
                        // Since we are enabling it we should confirm the user decision with a
                        // dialog box.
                        NewProviderConfirmationDialogFragment fragment =
                                newNewProviderConfirmationDialogFragment(
                                        packageName, title, /* setActivityResult= */ false);
                        if (togglePackageNameEnabled(packageName)) {
                            // Enable all prefs.
                            if (mPrefs.containsKey(packageName)) {
                                mPrefs.get(packageName).setChecked(true);
                            }
                        } else {
                            // Since we failed to show toggle the switch back to off.
                            pref.setChecked(false);

                            // Show the error if too many enabled.
                            final DialogFragment fragment = newErrorDialogFragment();

                            if (fragment == null || mFragmentManager == null) {
                                return true;
                            }

                        fragment.show(mFragmentManager, NewProviderConfirmationDialogFragment.TAG);
                            fragment.show(mFragmentManager, ErrorDialogFragment.TAG);
                        }

                        return true;
                    } else {