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

Commit 30e132e8 authored by zilong's avatar zilong Committed by Linux Build Service Account
Browse files

Settings : Hide the accounts which added as the Local account.

There are some accounts created as the local accounts, for example the
Phone local account. These accounts will be created when phone boot,
and the user couldn't add or delete them.

Hide these local accounts in the Settings.

Change-Id: Id8a64d4dc2d90e1aed8e0c63bd04efe7e97d7d45
CRs-Fixed: 980321
parent c220619e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1078,4 +1078,11 @@
        <item>45502</item>
        <item>45507</item>
    </string-array>

    <!-- Defined the hide accounts' type -->
    <string-array name="hide_account_list">
        <item>com.qualcomm.qti.RIDL</item>
        <item>com.android.localphone</item>
        <item>com.android.sim</item>
    </string-array>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -236,6 +236,10 @@ public class MasterClear extends OptionsMenuFragment {

            for (int i = 0; i < N; i++) {
                Account account = accounts[i];
                if (!Utils.showAccount(context, account.type)) {
                    // If needn't to show the account, skip this account.
                    continue;
                }
                AuthenticatorDescription desc = null;
                for (int j = 0; j < M; j++) {
                    if (account.type.equals(descs[j].type)) {
+13 −0
Original line number Diff line number Diff line
@@ -788,6 +788,19 @@ public final class Utils extends com.android.settingslib.Utils {
        return tm.getSimCount() > 1;
    }

    /**
     * Returns if need show the account with the given account type.
     */
    public static boolean showAccount(Context context, String accountType) {
        String[] hideAccounts = context.getResources().getStringArray(R.array.hide_account_list);
        if (hideAccounts == null || hideAccounts.length == 0) return true;

        for (String account : hideAccounts) {
            if (account.equals(accountType)) return false;
        }
        return true;
    }

    /**
     * Returns elapsed time for the given millis, in the following format:
     * 2d 5h 40m 29s
+2 −1
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ abstract class AccountPreferenceBase extends SettingsPreferenceFragment
            AuthenticatorDescription desc = null;
            try {
                desc = mAuthenticatorHelper.getAccountTypeDescription(accountType);
                if (desc != null && desc.accountPreferencesId != 0) {
                if (desc != null && desc.accountPreferencesId != 0
                        && Utils.showAccount(getActivity(), accountType)) {
                    // Load the context of the target package, then apply the
                    // base Settings theme (no references to local resources)
                    // and create a context theme wrapper so that we get the
+4 −0
Original line number Diff line number Diff line
@@ -431,6 +431,10 @@ public class AccountSettings extends SettingsPreferenceFragment

        for (int i = 0; i < accountTypes.length; i++) {
            final String accountType = accountTypes[i];
            if (!Utils.showAccount(getActivity(), accountType)) {
                // If needn't to show the account, skip this account.
                continue;
            }
            // Skip showing any account that does not have any of the requested authorities
            if (!accountTypeHasAnyRequestedAuthorities(helper, accountType)) {
                continue;
Loading