Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3245017b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Using ParceledListSlice to send large lists over Binder." into qt-dev

parents 9e6b293c d1f4b90e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class JobSchedulerImpl extends JobScheduler {
    @Override
    public List<JobInfo> getAllPendingJobs() {
        try {
            return mBinder.getAllPendingJobs();
            return mBinder.getAllPendingJobs().getList();
        } catch (RemoteException e) {
            return null;
        }
@@ -110,7 +110,7 @@ public class JobSchedulerImpl extends JobScheduler {
    @Override
    public List<JobSnapshot> getAllJobSnapshots() {
        try {
            return mBinder.getAllJobSnapshots();
            return mBinder.getAllJobSnapshots().getList();
        } catch (RemoteException e) {
            return null;
        }
+3 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app.job;
import android.app.job.JobInfo;
import android.app.job.JobSnapshot;
import android.app.job.JobWorkItem;
import android.content.pm.ParceledListSlice;

 /**
  * IPC interface that supports the app-facing {@link #JobScheduler} api.
@@ -30,8 +31,8 @@ interface IJobScheduler {
    int scheduleAsPackage(in JobInfo job, String packageName, int userId, String tag);
    void cancel(int jobId);
    void cancelAll();
    List<JobInfo> getAllPendingJobs();
    ParceledListSlice getAllPendingJobs();
    JobInfo getPendingJob(int jobId);
    List<JobInfo> getStartedJobs();
    List<JobSnapshot> getAllJobSnapshots();
    ParceledListSlice getAllJobSnapshots();
}
+5 −4
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManagerInternal;
import android.content.pm.ParceledListSlice;
import android.content.pm.ServiceInfo;
import android.database.ContentObserver;
import android.net.Uri;
@@ -2764,12 +2765,12 @@ public class JobSchedulerService extends com.android.server.SystemService
        }

        @Override
        public List<JobInfo> getAllPendingJobs() throws RemoteException {
        public ParceledListSlice<JobInfo> getAllPendingJobs() throws RemoteException {
            final int uid = Binder.getCallingUid();

            long ident = Binder.clearCallingIdentity();
            try {
                return JobSchedulerService.this.getPendingJobs(uid);
                return new ParceledListSlice<>(JobSchedulerService.this.getPendingJobs(uid));
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
@@ -2905,7 +2906,7 @@ public class JobSchedulerService extends com.android.server.SystemService
         * <p class="note">This is a slow operation, so it should be called sparingly.
         */
        @Override
        public List<JobSnapshot> getAllJobSnapshots() {
        public ParceledListSlice<JobSnapshot> getAllJobSnapshots() {
            final int uid = Binder.getCallingUid();
            if (uid != Process.SYSTEM_UID) {
                throw new SecurityException(
@@ -2916,7 +2917,7 @@ public class JobSchedulerService extends com.android.server.SystemService
                mJobs.forEachJob((job) -> snapshots.add(
                        new JobSnapshot(job.getJob(), job.getSatisfiedConstraintFlags(),
                                isReadyToBeExecutedLocked(job))));
                return snapshots;
                return new ParceledListSlice<>(snapshots);
            }
        }
    };