use of android.content.SyncAdapterType in project android_packages_apps_Settings by SudaMod.
the class AccountSyncPreferenceControllerTest method updateSummary_syncDisabled_shouldNotCount.
@Test
public void updateSummary_syncDisabled_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
ShadowContentResolver.setSyncAutomatically("authority", false);
ShadowContentResolver.setMasterSyncAutomatically(3, true);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project VirtualXposed by android-hacker.
the class VContentService method parseSyncAdapterType.
private SyncAdapterType parseSyncAdapterType(Resources res, AttributeSet set) {
TypedArray obtainAttributes = res.obtainAttributes(set, R_Hide.styleable.SyncAdapter.get());
try {
String contentAuthority = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_contentAuthority.get());
String accountType = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_accountType.get());
if (contentAuthority == null || accountType == null) {
obtainAttributes.recycle();
return null;
}
boolean userVisible = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_userVisible.get(), true);
boolean supportsUploading = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_supportsUploading.get(), true);
boolean isAlwaysSyncable = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_isAlwaysSyncable.get(), true);
boolean allowParallelSyncs = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_allowParallelSyncs.get(), true);
String settingsActivity = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_settingsActivity.get());
SyncAdapterType type;
if (SyncAdapterTypeN.ctor != null) {
type = SyncAdapterTypeN.ctor.newInstance(contentAuthority, accountType, userVisible, supportsUploading, isAlwaysSyncable, allowParallelSyncs, settingsActivity, null);
obtainAttributes.recycle();
return type;
}
type = mirror.android.content.SyncAdapterType.ctor.newInstance(contentAuthority, accountType, userVisible, supportsUploading, isAlwaysSyncable, allowParallelSyncs, settingsActivity);
obtainAttributes.recycle();
return type;
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
use of android.content.SyncAdapterType in project VirtualXposed by android-hacker.
the class VContentService method generateServicesMap.
private void generateServicesMap(List<ResolveInfo> services, Map<String, SyncAdapterInfo> map, RegisteredServicesParser accountParser) {
for (ResolveInfo info : services) {
XmlResourceParser parser = accountParser.getParser(mContext, info.serviceInfo, "android.content.SyncAdapter");
if (parser != null) {
try {
AttributeSet attributeSet = Xml.asAttributeSet(parser);
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
// Nothing to do
}
if ("sync-adapter".equals(parser.getName())) {
SyncAdapterType adapterType = parseSyncAdapterType(accountParser.getResources(mContext, info.serviceInfo.applicationInfo), attributeSet);
if (adapterType != null) {
String key = adapterType.accountType + "/" + adapterType.authority;
map.put(key, new SyncAdapterInfo(adapterType, info.serviceInfo));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by DirtyUnicorns.
the class AccountSyncPreferenceControllerTest method updateSummary_syncEnabled_shouldCount.
@Test
public void updateSummary_syncEnabled_shouldCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* 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_on));
}
use of android.content.SyncAdapterType in project android_packages_apps_Settings by DirtyUnicorns.
the class AccountSyncPreferenceControllerTest method updateSummary_syncDisabled_shouldNotCount.
@Test
public void updateSummary_syncDisabled_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
ShadowContentResolver.setSyncAutomatically("authority", false);
ShadowContentResolver.setMasterSyncAutomatically(3, true);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
Aggregations