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

Commit fdd92031 authored by Matthew Williams's avatar Matthew Williams
Browse files

Refactored code didn't make it into previous CL

Change-Id: I7ec93e783267d0c0fb39fbc8d0abe7270bdaea68
parent 4b291fbf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5245,7 +5245,7 @@ package android.app.task {
  public abstract class TaskService extends android.app.Service {
    ctor public TaskService();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public abstract void onStartTask(android.app.task.TaskParams);
    method public abstract boolean onStartTask(android.app.task.TaskParams);
    method public abstract boolean onStopTask(android.app.task.TaskParams);
    method public final void taskFinished(android.app.task.TaskParams, boolean);
    field public static final java.lang.String PERMISSION_BIND = "android.permission.BIND_TASK_SERVICE";
+3 −3
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ package com.android.server.task;
import com.android.server.task.controllers.TaskStatus;

/**
 * Interface through which a {@link StateController} informs the
 * {@link com.android.server.task.TaskManagerService} that there are some tasks potentially ready
 * to be run.
 * Interface through which a {@link com.android.server.task.controllers.StateController} informs
 * the {@link com.android.server.task.TaskManagerService} that there are some tasks potentially
 * ready to be run.
 */
public interface StateChangedListener {
    /**
+1 −2
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ public class TaskManagerService extends com.android.server.SystemService
     * For now this takes the task and if it's ready to run it will run it. In future we might not
     * provide the task, so that the StateChangedListener has to run through its list of tasks to
     * see which are ready. This will further decouple the controllers from the execution logic.
     * @param taskStatus The state of the task which has changed.
     */
    @Override
    public void onTaskStateChanged(TaskStatus taskStatus) {
@@ -170,7 +169,7 @@ public class TaskManagerService extends com.android.server.SystemService
    }

    @Override
    public void onClientExecutionCompleted(int serviceToken) {
    public void onAllTasksCompleted(int serviceToken) {
        
    }

+2 −2
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
     * tasks, then we do the shutdown.
     */
    private void startShutdown() {
        mCompletedListener.onClientExecutionCompleted(token);
        mCompletedListener.onAllTasksCompleted(token);
        mCallbackHandler.obtainMessage(MSG_SHUTDOWN).sendToTarget();
    }

@@ -389,7 +389,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
         * This TaskServiceContext is shutting down. Remove all the tasks from the pending queue
         * and reschedule them as if they had failed.
         * Before posting this message, caller must invoke
         * {@link com.android.server.task.TaskCompletedListener#onClientExecutionCompleted(int)}
         * {@link com.android.server.task.TaskCompletedListener#onAllTasksCompleted(int)}.
         */
        private void handleShutdownH() {
            for (int i = 0; i < mPending.size(); i++) {
+3 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class ConnectivityController extends StateController {
    }

    @Override
    public void maybeStartTrackingTask(TaskStatus taskStatus) {
    public void maybeTrackTaskState(TaskStatus taskStatus) {
        if (taskStatus.hasConnectivityConstraint() || taskStatus.hasMeteredConstraint()) {
            taskStatus.connectivityConstraintSatisfied.set(mConnectivity);
            taskStatus.meteredConstraintSatisfied.set(mMetered);
@@ -65,7 +65,7 @@ public class ConnectivityController extends StateController {
    }

    @Override
    public void maybeStopTrackingTask(TaskStatus taskStatus) {
    public void removeTaskStateIfTracked(TaskStatus taskStatus) {
        mTrackedTasks.remove(taskStatus);
    }

@@ -111,7 +111,7 @@ public class ConnectivityController extends StateController {
                    mMetered = false;
                    mConnectivity =
                            !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
                    if (isConnected) {  // No point making the call if we know there's no conn.
                    if (mConnectivity) {  // No point making the call if we know there's no conn.
                        mMetered = connManager.isActiveNetworkMetered();
                    }
                    updateTrackedTasks(userid);