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

Commit 4b7a4225 authored by Kweku Adams's avatar Kweku Adams Committed by android-build-merger
Browse files

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

am: 3245017b

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


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


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


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