本文整理汇总了Java中android.content.SyncInfo类的典型用法代码示例。如果您正苦于以下问题:Java SyncInfo类的具体用法?Java SyncInfo怎么用?Java SyncInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyncInfo类属于android.content包,在下文中一共展示了SyncInfo类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSyncActive
import android.content.SyncInfo; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private static boolean isSyncActive(Account account, String authority) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
for (SyncInfo syncInfo : ContentResolver.getCurrentSyncs()) {
if (syncInfo.account.equals(account) && syncInfo.authority.equals(authority)) {
return true;
}
}
return false;
} else {
SyncInfo currentSync = ContentResolver.getCurrentSync();
return currentSync != null && currentSync.account.equals(account) && currentSync.authority.equals(authority);
}
}
示例2: isSyncActive
import android.content.SyncInfo; //导入依赖的package包/类
public static boolean isSyncActive(Account account, String authority) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return isSyncActiveHoneycomb(account, authority);
} else {
SyncInfo currentSync = ContentResolver.getCurrentSync();
return currentSync != null && currentSync.account.equals(account) && currentSync.authority.equals(authority);
}
}
示例3: isSyncActiveHoneycomb
import android.content.SyncInfo; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static boolean isSyncActiveHoneycomb(Account account, String authority) {
for (SyncInfo syncInfo : ContentResolver.getCurrentSyncs()) {
if (syncInfo.account.equals(account) && syncInfo.authority.equals(authority)) {
return true;
}
}
return false;
}
示例4: after
import android.content.SyncInfo; //导入依赖的package包/类
@Override
protected void after(XParam param) throws Throwable {
switch (mMethod) {
case getCurrentSync:
if (isRestricted(param))
param.setResult(null);
break;
case getCurrentSyncs:
if (isRestricted(param))
param.setResult(new ArrayList<SyncInfo>());
break;
case getSyncAdapterTypes:
if (isRestricted(param))
param.setResult(new SyncAdapterType[0]);
break;
case openAssetFileDescriptor:
case openFileDescriptor:
case openInputStream:
case openOutputStream:
case openTypedAssetFileDescriptor:
case openAssetFile:
case openFile:
if (param.args.length > 0 && param.args[0] instanceof Uri) {
String uri = ((Uri) param.args[0]).toString();
if (isRestrictedExtra(param, uri))
param.setThrowable(new FileNotFoundException("XPrivacy"));
}
break;
case Srv_call:
handleCallAfter(param);
break;
case query:
case Srv_query:
handleUriAfter(param);
break;
case Srv_getCurrentSyncs:
case Srv_getCurrentSyncsAsUser:
if (param.getResult() != null)
if (isRestricted(param)) {
int uid = Binder.getCallingUid();
@SuppressWarnings("unchecked")
List<SyncInfo> listSync = (List<SyncInfo>) param.getResult();
List<SyncInfo> listFiltered = new ArrayList<SyncInfo>();
for (SyncInfo sync : listSync)
if (XAccountManager.isAccountAllowed(sync.account, uid))
listFiltered.add(sync);
param.setResult(listFiltered);
}
break;
}
}
示例5: after
import android.content.SyncInfo; //导入依赖的package包/类
@Override
protected void after(XParam param) throws Throwable {
switch (mMethod) {
case getCurrentSync:
if (isRestricted(param))
param.setResult(null);
break;
case getCurrentSyncs:
if (isRestricted(param))
param.setResult(new ArrayList<SyncInfo>());
break;
case getSyncAdapterTypes:
if (isRestricted(param))
param.setResult(new SyncAdapterType[0]);
break;
case openAssetFileDescriptor:
case openFileDescriptor:
case openInputStream:
case openOutputStream:
case openTypedAssetFileDescriptor:
case openAssetFile:
case openFile:
if (param.args.length > 0 && param.args[0] instanceof Uri) {
String uri = ((Uri) param.args[0]).toString();
switch(getRestrictStateExtra(param, uri)){
case 0:
//Log.d("Smarper-Storage", "XContentResolver, " + mMethod + ": " + uri + " allowed");
break;
case 1:
if (!SmarperUtil.forbiddenPathsInitialized)
SmarperUtil.initializeForbiddenPaths();
if (uri.startsWith(SmarperUtil.moviesURI.toString()) || uri.startsWith(SmarperUtil.dcimURI.toString()) || uri.startsWith(SmarperUtil.picturesURI.toString()) || uri.startsWith(SmarperUtil.musicURI.toString())){
param.setThrowable(new FileNotFoundException("XPrivacy"));
//Log.d("Smarper-Storage", "XContentResolver, " + mMethod + ": Obfuscating " + uri);
}
else{
//
//Log.d("Smarper-Storage", "ContentResolver: " + uri + " not in public folders list, not obfuscated!");
}
break;
case 2:
param.setThrowable(new FileNotFoundException("XPrivacy"));
break;
}
}
break;
case Srv_call:
handleCallAfter(param);
break;
case query:
case Srv_query:
handleUriAfter(param);
break;
case Srv_getCurrentSyncs:
case Srv_getCurrentSyncsAsUser:
if (param.getResult() != null)
if (isRestricted(param)) {
int uid = Binder.getCallingUid();
@SuppressWarnings("unchecked")
List<SyncInfo> listSync = (List<SyncInfo>) param.getResult();
List<SyncInfo> listFiltered = new ArrayList<SyncInfo>();
for (SyncInfo sync : listSync)
if (XAccountManager.isAccountAllowed(sync.account, uid))
listFiltered.add(sync);
param.setResult(listFiltered);
}
break;
}
}
示例6: getCurrentSyncs
import android.content.SyncInfo; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static List<SyncInfo> getCurrentSyncs() {
return ContentResolver.getCurrentSyncs();
}