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

Commit 851a35ab authored by Christopher Tate's avatar Christopher Tate
Browse files

Fix 'jobscheduler run' shell command

Tidying up the locking + deferred-work shape of the job scheduler's
internal flow inadvertently meant that we were now trying to bind to
a job service while under the shell user's uid when the relevant
shell command was used to kick off the job.  Now we don't do that.

Bug 37744607
Test: manual

Change-Id: Ia4b83f83f9fbd2e5678eaa279f1d86206fb05023
parent 38439169
Loading
Loading
Loading
Loading
+42 −37
Original line number Original line Diff line number Diff line
@@ -109,6 +109,8 @@ public class JobSchedulerShellCommand extends ShellCommand {
        final String pkgName = getNextArgRequired();
        final String pkgName = getNextArgRequired();
        final int jobId = Integer.parseInt(getNextArgRequired());
        final int jobId = Integer.parseInt(getNextArgRequired());


        final long ident = Binder.clearCallingIdentity();
        try {
            int ret = mInternal.executeRunCommand(pkgName, userId, jobId, force);
            int ret = mInternal.executeRunCommand(pkgName, userId, jobId, force);
            switch (ret) {
            switch (ret) {
                case CMD_ERR_NO_PACKAGE:
                case CMD_ERR_NO_PACKAGE:
@@ -147,6 +149,9 @@ public class JobSchedulerShellCommand extends ShellCommand {
                    break;
                    break;
            }
            }
            return ret;
            return ret;
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }
    }


    private int runMonitorBattery(PrintWriter pw) throws Exception {
    private int runMonitorBattery(PrintWriter pw) throws Exception {