diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-03 20:47:52 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-03 20:47:52 +0000 |
commit | b2df8b308af8a5ccb1222f60f1ef57803153a084 (patch) | |
tree | ab8bb36e5cf7545e74a7d33161f621299a672831 /java/com/android/dialer/precall/impl/PreferredAccountUtil.java | |
parent | 15fd7535818344e905745b390a1b4098ca4d2cf1 (diff) | |
parent | b3b437048465ab8da902fb9107c883331481da2c (diff) |
Merge "Only consider writable accounts for preferred SIM"
Diffstat (limited to 'java/com/android/dialer/precall/impl/PreferredAccountUtil.java')
-rw-r--r-- | java/com/android/dialer/precall/impl/PreferredAccountUtil.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/java/com/android/dialer/precall/impl/PreferredAccountUtil.java b/java/com/android/dialer/precall/impl/PreferredAccountUtil.java index a41cb6e78..650588829 100644 --- a/java/com/android/dialer/precall/impl/PreferredAccountUtil.java +++ b/java/com/android/dialer/precall/impl/PreferredAccountUtil.java @@ -30,7 +30,9 @@ import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.configprovider.ConfigProviderComponent; import com.google.common.base.Optional; +import com.google.common.collect.ImmutableSet; /** * Utilities for looking up and validating preferred {@link PhoneAccountHandle}. Contacts should @@ -91,4 +93,24 @@ public class PreferredAccountUtil { } return false; } + + /** + * Return a set of {@link android.accounts.Account#type} that is known to have writable contacts. + * This is a light weight implementation of {@link + * com.android.contacts.common.model.AccountTypeManager#getAccountTypes(boolean)}. External + * accounts are not supported. + */ + public static ImmutableSet<String> getValidAccountTypes(Context context) { + return ImmutableSet.copyOf( + ConfigProviderComponent.get(context) + .getConfigProvider() + .getString( + "preferred_sim_valid_account_types", + "com.google;" + + "com.osp.app.signin;" + + "com.android.exchange;" + + "com.google.android.exchange;" + + "com.google.android.gm.exchange") + .split(";")); + } } |