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

Commit 6e31c5c8 authored by Matthew Williams's avatar Matthew Williams
Browse files

TaskManager API first pass.

This is a very barebones first pass, meant to ensure we're all on the
same page, and also get feedback.

Change-Id: I7d5492dc5aafbe583f7c2d97ebf1444b6d2e068a
parent 03fee276
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ LOCAL_SRC_FILES += \
	core/java/android/app/ISearchManagerCallback.aidl \
	core/java/android/app/IServiceConnection.aidl \
	core/java/android/app/IStopUserCallback.aidl \
        core/java/android/app/task/ITaskCallback.aidl \
        core/java/android/app/task/ITaskService.aidl \
	core/java/android/app/IThumbnailReceiver.aidl \
	core/java/android/app/IThumbnailRetriever.aidl \
	core/java/android/app/ITransientNotification.aidl \
+69 −0
Original line number Diff line number Diff line
@@ -5074,6 +5074,26 @@ package android.app.maintenance {
}
package android.app.task {
  public class TaskParams implements android.os.Parcelable {
    method public int describeContents();
    method public int getTaskId();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  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, android.os.Bundle);
    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";
  }
}
package android.appwidget {
  public class AppWidgetHost {
@@ -7431,6 +7451,55 @@ package android.content {
    method public abstract void onStatusChanged(int);
  }
  public class Task implements android.os.Parcelable {
    method public int describeContents();
    method public int getBackoffPolicy();
    method public android.os.Bundle getExtras();
    method public long getInitialBackoffMillis();
    method public long getIntervalMillis();
    method public long getMaxExecutionDelayMillis();
    method public long getMinLatencyMillis();
    method public int getNetworkCapabilities();
    method public java.lang.String getServiceClassName();
    method public int getTaskId();
    method public boolean isPeriodic();
    method public boolean isRequireCharging();
    method public boolean isRequireDeviceIdle();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public static abstract interface Task.BackoffPolicy {
    field public static final int EXPONENTIAL = 1; // 0x1
    field public static final int LINEAR = 0; // 0x0
  }
  public final class Task.Builder {
    ctor public Task.Builder(int, java.lang.Class<android.app.task.TaskService>);
    method public android.content.Task build();
    method public android.content.Task.Builder setBackoffCriteria(long, int);
    method public android.content.Task.Builder setExtras(android.os.Bundle);
    method public android.content.Task.Builder setMinimumLatency(long);
    method public android.content.Task.Builder setOverrideDeadline(long);
    method public android.content.Task.Builder setPeriodic(long);
    method public android.content.Task.Builder setRequiredNetworkCapabilities(int);
    method public android.content.Task.Builder setRequiresCharging(boolean);
    method public android.content.Task.Builder setRequiresDeviceIdle(boolean);
  }
  public static abstract interface Task.NetworkType {
    field public static final int ANY = 0; // 0x0
    field public static final int UNMETERED = 1; // 0x1
  }
  public abstract class TaskManager {
    ctor public TaskManager();
    method public abstract void cancel(int);
    method public abstract void cancelAll();
    method public abstract java.util.List<android.content.Task> getAllPendingTasks();
    method public abstract int schedule(android.content.Task);
  }
  public class UriMatcher {
    ctor public UriMatcher(int);
    method public void addURI(java.lang.String, java.lang.String, int);
+52 −0
Original line number Diff line number Diff line
/**
 * Copyright 2014, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.task;

import android.app.task.ITaskService;
import android.app.task.TaskParams;

/**
 * The server side of the TaskManager IPC protocols.  The app-side implementation
 * invokes on this interface to indicate completion of the (asynchronous) instructions
 * issued by the server.
 *
 * In all cases, the 'who' parameter is the caller's service binder, used to track
 * which Task Service instance is reporting.
 *
 * {@hide}
 */
interface ITaskCallback {
    /**
     * Immediate callback to the system after sending a start signal, used to quickly detect ANR.
     *
     * @param taskId Unique integer used to identify this task.
     */
    void acknowledgeStartMessage(int taskId);
    /**
     * Immediate callback to the system after sending a stop signal, used to quickly detect ANR.
     *
     * @param taskId Unique integer used to identify this task.
     */
    void acknowledgeStopMessage(int taskId);
    /*
     * Tell the task manager that the client is done with its execution, so that it can go on to
     * the next one and stop attributing wakelock time to us etc.
     *
     * @param taskId Unique integer used to identify this task.
     */
    void taskFinished(int taskId, boolean taskFailed);
}
+35 −0
Original line number Diff line number Diff line
/**
 * Copyright 2014, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.task;

import android.app.task.ITaskCallback;
import android.app.task.TaskParams;

import android.os.Bundle;

/**
 * Interface that the framework uses to communicate with application code
 * that implements a TaskService.  End user code does not implement this interface directly;
 * instead, the app's idle service implementation will extend android.app.maintenance.IdleService.
 * {@hide}
 */
oneway interface ITaskService {
    /** Begin execution of application's task. */
    void startTask(in TaskParams taskParams);
    /** Stop execution of application's task. */
    void stopTask(in TaskParams taskParams);
}
+19 −0
Original line number Diff line number Diff line
/**
 * Copyright 2014, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.task;

parcelable TaskParams;
 No newline at end of file
Loading