use of android.content.SyncAdapterType in project android_packages_apps_Settings by DirtyUnicorns.
the class ChooseAccountActivity method getAuthoritiesForAccountType.
public ArrayList<String> getAuthoritiesForAccountType(String type) {
if (mAccountTypeToAuthorities == null) {
mAccountTypeToAuthorities = Maps.newHashMap();
SyncAdapterType[] syncAdapters = ContentResolver.getSyncAdapterTypesAsUser(mUserHandle.getIdentifier());
for (int i = 0, n = syncAdapters.length; i < n; i++) {
final SyncAdapterType sa = syncAdapters[i];
ArrayList<String> authorities = mAccountTypeToAuthorities.get(sa.accountType);
if (authorities == null) {
authorities = new ArrayList<String>();
mAccountTypeToAuthorities.put(sa.accountType, authorities);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "added authority " + sa.authority + " to accountType " + sa.accountType);
}
authorities.add(sa.authority);
}
}
return mAccountTypeToAuthorities.get(type);
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by DirtyUnicorns.
the class AccountSyncPreferenceControllerTest method updateSummary_adapterInvisible_shouldNotCount.
@Test
public void updateSummary_adapterInvisible_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
false, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by DirtyUnicorns.
the class AccountSyncPreferenceControllerTest method updateSummary_notSameAccountType_shouldNotCount.
@Test
public void updateSummary_notSameAccountType_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type5", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by crdroidandroid.
the class ChooseAccountActivity method getAuthoritiesForAccountType.
public ArrayList<String> getAuthoritiesForAccountType(String type) {
if (mAccountTypeToAuthorities == null) {
mAccountTypeToAuthorities = Maps.newHashMap();
SyncAdapterType[] syncAdapters = ContentResolver.getSyncAdapterTypesAsUser(mUserHandle.getIdentifier());
for (int i = 0, n = syncAdapters.length; i < n; i++) {
final SyncAdapterType sa = syncAdapters[i];
ArrayList<String> authorities = mAccountTypeToAuthorities.get(sa.accountType);
if (authorities == null) {
authorities = new ArrayList<String>();
mAccountTypeToAuthorities.put(sa.accountType, authorities);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "added authority " + sa.authority + " to accountType " + sa.accountType);
}
authorities.add(sa.authority);
}
}
return mAccountTypeToAuthorities.get(type);
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by crdroidandroid.
the class AccountSyncPreferenceControllerTest method updateSummary_notSameAccountType_shouldNotCount.
@Test
public void updateSummary_notSameAccountType_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type5", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
Aggregations