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

Commit 64769aae authored by Joy Babafemi's avatar Joy Babafemi Committed by Android (Google) Code Review
Browse files

Merge "Credential Manager Settings Improvement Bug fixes" into main

parents 968807c3 d3807e55
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.credentials.CredentialManager;
import android.os.UserHandle;
@@ -89,7 +90,8 @@ public class AccountDashboardFragment extends DashboardFragment {
                    forceUpdatePreferences();
                }
            };
            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
            cmpp.init(this, getFragmentManager(), getIntent(), delegate,
                    /*isWorkProfile=*/false, /*isPrivateSpace=*/ false);
        } else {
            getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
        }
@@ -98,7 +100,8 @@ public class AccountDashboardFragment extends DashboardFragment {
    @Override
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        buildAutofillPreferenceControllers(context, controllers);
        buildAutofillPreferenceControllers(context, controllers,
                /*isWorkProfile=*/false, /*isPrivateSpace=*/ false);
        final String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
        buildAccountPreferenceControllers(context, this /* parent */, authorities, controllers);
        return controllers;
@@ -110,9 +113,13 @@ public class AccountDashboardFragment extends DashboardFragment {
    }

    static void buildAutofillPreferenceControllers(
            Context context, List<AbstractPreferenceController> controllers) {
            Context context,
            List<AbstractPreferenceController> controllers,
            boolean isWorkProfile,
            boolean isPrivateSpace) {
        if (CredentialManager.isServiceEnabled(context)) {
            controllers.add(new DefaultCombinedPreferenceController(context));
            controllers.add(new DefaultCombinedPreferenceController(
                    context, isWorkProfile, isPrivateSpace));
            controllers.add(new DefaultWorkCombinedPreferenceController(context));
            controllers.add(new DefaultPrivateCombinedPreferenceController(context));
        } else {
@@ -162,7 +169,7 @@ public class AccountDashboardFragment extends DashboardFragment {
                    final List<AbstractPreferenceController> controllers = new ArrayList<>();
                    buildAccountPreferenceControllers(
                            context, null /* parent */, null /* authorities*/, controllers);
                    buildAutofillPreferenceControllers(context, controllers);
                    buildAutofillPreferenceControllers(context, controllers, false, false);
                    return controllers;
                }

+4 −2
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ public class AccountPersonalDashboardFragment extends DashboardFragment {
                    forceUpdatePreferences();
                }
            };
            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
            cmpp.init(this, getFragmentManager(),
                    getIntent(), delegate, /*isWorkProfile=*/false, /*isPrivateSpace=*/ false);
        } else {
            getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
        }
@@ -87,7 +88,8 @@ public class AccountPersonalDashboardFragment extends DashboardFragment {
    @Override
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        buildAutofillPreferenceControllers(context, controllers);
        buildAutofillPreferenceControllers(
                context, controllers, /*isWorkProfile=*/ false, /*isPrivateSpace=*/ false);
        final String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
        buildAccountPreferenceControllers(context, this /* parent */, authorities, controllers);
        return controllers;
+0 −9
Original line number Diff line number Diff line
@@ -194,9 +194,6 @@ public class AccountPreferenceController extends AbstractPreferenceController

    @Override
    public void updateDynamicRawDataToIndex(List<SearchIndexableRaw> rawData) {
        if (!isAvailable()) {
            return;
        }
        final Resources res = mContext.getResources();
        final String screenTitle = res.getString(R.string.account_settings_title);

@@ -288,12 +285,6 @@ public class AccountPreferenceController extends AbstractPreferenceController
    }

    private void updateUi() {
        if (!isAvailable()) {
            // This should not happen
            Log.e(TAG, "We should not be showing settings for a managed profile");
            return;
        }

        for (int i = 0, size = mProfiles.size(); i < size; i++) {
            mProfiles.valueAt(i).pendingRemoval = true;
        }
+4 −2
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ public class AccountPrivateDashboardFragment extends DashboardFragment {
                            forceUpdatePreferences();
                        }
                    };
            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
            cmpp.init(this, getFragmentManager(), getIntent(),
                    delegate, /*isWorkProfile=*/false, /*isPrivateSpace=*/true);
        } else {
            getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
        }
@@ -86,7 +87,8 @@ public class AccountPrivateDashboardFragment extends DashboardFragment {
    @Override
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        buildAutofillPreferenceControllers(context, controllers);
        buildAutofillPreferenceControllers(
                context, controllers, /*isWorkProfile=*/ false, /*isPrivateSpace=*/ true);
        final String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
        buildAccountPreferenceControllers(context, authorities, controllers);
        return controllers;
+4 −2
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
                    forceUpdatePreferences();
                }
            };
            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/true);
            cmpp.init(this, getFragmentManager(), getIntent(),
                    delegate, /*isWorkProfile=*/true, /*isPrivateSpace=*/false);
        } else {
            getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
        }
@@ -87,7 +88,8 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
    @Override
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
        final List<AbstractPreferenceController> controllers = new ArrayList<>();
        buildAutofillPreferenceControllers(context, controllers);
        buildAutofillPreferenceControllers(
                context, controllers, /*isWorkProfile=*/ true, /*isPrivateSpace=*/ false);
        final String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
        buildAccountPreferenceControllers(context, this /* parent */, authorities, controllers);
        return controllers;
Loading