Java Code Examples for android.app.job.JobWorkItem#getGrants()

The following examples show how to use android.app.job.JobWorkItem#getGrants() . 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: JobStatus.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void dumpJobWorkItem(PrintWriter pw, String prefix, JobWorkItem work, int index) {
    pw.print(prefix); pw.print("  #"); pw.print(index); pw.print(": #");
    pw.print(work.getWorkId()); pw.print(" "); pw.print(work.getDeliveryCount());
    pw.print("x "); pw.println(work.getIntent());
    if (work.getGrants() != null) {
        pw.print(prefix); pw.println("  URI grants:");
        ((GrantedUriPermissions)work.getGrants()).dump(pw, prefix + "    ");
    }
}
 
Example 2
Source File: JobStatus.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void dumpJobWorkItem(ProtoOutputStream proto, long fieldId, JobWorkItem work) {
    final long token = proto.start(fieldId);

    proto.write(JobStatusDumpProto.JobWorkItem.WORK_ID, work.getWorkId());
    proto.write(JobStatusDumpProto.JobWorkItem.DELIVERY_COUNT, work.getDeliveryCount());
    if (work.getIntent() != null) {
        work.getIntent().writeToProto(proto, JobStatusDumpProto.JobWorkItem.INTENT);
    }
    Object grants = work.getGrants();
    if (grants != null) {
        ((GrantedUriPermissions) grants).dump(proto, JobStatusDumpProto.JobWorkItem.URI_GRANTS);
    }

    proto.end(token);
}
 
Example 3
Source File: JobStatus.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static void ungrantWorkItem(IActivityManager am, JobWorkItem work) {
    if (work.getGrants() != null) {
        ((GrantedUriPermissions)work.getGrants()).revoke(am);
    }
}