Add handling for account tiles for specific account type.
- List individual account instead of account type under User & account screen. - Add handling to move account tiles with specific account type from top level account dashboard to inside the corresponding account preference. - Rename settings.accounts.AccountPreference to settings.accounts.AccountTypePreference to make it less confused with settings.AccountPreference Bug: 31801423 Test: make RunSettingsRoboTests Change-Id: Iebe70a3c4230e8d979344f142a5c2a60945e552e
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import com.android.settings.AccessiblePreferenceCategory;
|
||||
import com.android.settingslib.RestrictedLockUtils;
|
||||
import com.android.settingslib.RestrictedPreference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AccountRestrictionHelper {
|
||||
|
||||
@@ -55,4 +56,22 @@ public class AccountRestrictionHelper {
|
||||
return new AccessiblePreferenceCategory(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the account should be shown based on the required authorities for the account type
|
||||
* @param authorities given authority that is passed as activity extra
|
||||
* @param auths list of authorities for particular account type
|
||||
* @return true if the activity has the required authority to show the account
|
||||
*/
|
||||
public static boolean showAccount(String[] authorities, ArrayList<String> auths) {
|
||||
boolean showAccount = true;
|
||||
if (authorities != null && auths != null) {
|
||||
showAccount = false;
|
||||
for (String requestedAuthority : authorities) {
|
||||
if (auths.contains(requestedAuthority)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return showAccount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user