Java Code Examples for android.content.ContentResolver#SYNC_EXEMPTION_NONE
The following examples show how to use
android.content.ContentResolver#SYNC_EXEMPTION_NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@SyncExemption private int getSyncExemptionAndCleanUpExtrasForCaller(int callingUid, Bundle extras) { if (extras != null) { final int exemption = extras.getInt(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG, -1); // Need to remove the virtual extra. extras.remove(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG); if (exemption != -1) { return exemption; } } final ActivityManagerInternal ami = LocalServices.getService(ActivityManagerInternal.class); final int procState = (ami != null) ? ami.getUidProcessState(callingUid) : ActivityManager.PROCESS_STATE_NONEXISTENT; if (procState <= ActivityManager.PROCESS_STATE_TOP) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET_WITH_TEMP; } if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET; } return ContentResolver.SYNC_EXEMPTION_NONE; }
Example 2
Source File: ContentService.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
@SyncExemption private int getSyncExemptionAndCleanUpExtrasForCaller(int callingUid, Bundle extras) { if (extras != null) { final int exemption = extras.getInt(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG, -1); // Need to remove the virtual extra. extras.remove(ContentResolver.SYNC_VIRTUAL_EXTRAS_EXEMPTION_FLAG); if (exemption != -1) { return exemption; } } final ActivityManagerInternal ami = LocalServices.getService(ActivityManagerInternal.class); if (ami == null) { return ContentResolver.SYNC_EXEMPTION_NONE; } final int procState = ami.getUidProcessState(callingUid); final boolean isUidActive = ami.isUidActive(callingUid); // Providers bound by a TOP app will get PROCESS_STATE_BOUND_TOP, so include those as well if (procState <= ActivityManager.PROCESS_STATE_TOP || procState == ActivityManager.PROCESS_STATE_BOUND_TOP) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET_WITH_TEMP; } if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND || isUidActive) { return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET; } return ContentResolver.SYNC_EXEMPTION_NONE; }
Example 3
Source File: SyncOperation.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public SyncOperation createOneTimeSyncOperation() { if (!isPeriodic) { return null; } SyncOperation op = new SyncOperation(target, owningUid, owningPackage, reason, syncSource, new Bundle(extras), allowParallelSyncs, false, jobId /* sourcePeriodicId */, periodMillis, flexMillis, ContentResolver.SYNC_EXEMPTION_NONE); return op; }
Example 4
Source File: SyncOperation.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public SyncOperation(SyncOperation op, long periodMillis, long flexMillis) { this(op.target, op.owningUid, op.owningPackage, op.reason, op.syncSource, new Bundle(op.extras), op.allowParallelSyncs, op.isPeriodic, op.sourcePeriodicId, periodMillis, flexMillis, ContentResolver.SYNC_EXEMPTION_NONE); }
Example 5
Source File: SyncOperation.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
String dump(PackageManager pm, boolean shorter, SyncAdapterStateFetcher appStates, boolean logSafe) { StringBuilder sb = new StringBuilder(); sb.append("JobId=").append(jobId) .append(" ") .append(logSafe ? "***" : target.account.name) .append("/") .append(target.account.type) .append(" u") .append(target.userId) .append(" [") .append(target.provider) .append("] "); sb.append(SyncStorageEngine.SOURCES[syncSource]); if (expectedRuntime != 0) { sb.append(" ExpectedIn="); SyncManager.formatDurationHMS(sb, (expectedRuntime - SystemClock.elapsedRealtime())); } if (extras.getBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false)) { sb.append(" EXPEDITED"); } switch (syncExemptionFlag) { case ContentResolver.SYNC_EXEMPTION_NONE: break; case ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET: sb.append(" STANDBY-EXEMPTED"); break; case ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET_WITH_TEMP: sb.append(" STANDBY-EXEMPTED(TOP)"); break; default: sb.append(" ExemptionFlag=" + syncExemptionFlag); break; } sb.append(" Reason="); sb.append(reasonToString(pm, reason)); if (isPeriodic) { sb.append(" (period="); SyncManager.formatDurationHMS(sb, periodMillis); sb.append(" flex="); SyncManager.formatDurationHMS(sb, flexMillis); sb.append(")"); } if (retries > 0) { sb.append(" Retries="); sb.append(retries); } if (!shorter) { sb.append(" Owner={"); UserHandle.formatUid(sb, owningUid); sb.append(" "); sb.append(owningPackage); if (appStates != null) { sb.append(" ["); sb.append(appStates.getStandbyBucket( UserHandle.getUserId(owningUid), owningPackage)); sb.append("]"); if (appStates.isAppActive(owningUid)) { sb.append(" [ACTIVE]"); } } sb.append("}"); if (!extras.keySet().isEmpty()) { sb.append(" "); extrasToStringBuilder(extras, sb); } } return sb.toString(); }
Example 6
Source File: SyncOperation.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
boolean isAppStandbyExempted() { return syncExemptionFlag != ContentResolver.SYNC_EXEMPTION_NONE; }