Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ LOCAL_SRC_FILES += \ core/java/android/app/IActivityController.aidl \ core/java/android/app/IActivityPendingResult.aidl \ core/java/android/app/IAlarmManager.aidl \ core/java/android/app/IAppTask.aidl \ core/java/android/app/IBackupAgent.aidl \ core/java/android/app/IInstrumentationWatcher.aidl \ core/java/android/app/INotificationManager.aidl \ Loading api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -3403,6 +3403,7 @@ package android.app { public class ActivityManager { method public boolean clearApplicationUserData(); method public void dumpPackageState(java.io.FileDescriptor, java.lang.String); method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks(); method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo(); method public int getLargeMemoryClass(); method public int getLauncherLargeIconDensity(); Loading Loading @@ -3431,6 +3432,11 @@ package android.app { field public static final int RECENT_WITH_EXCLUDED = 1; // 0x1 } public static class ActivityManager.AppTask { method public void finishAndRemoveTask(); method public android.app.ActivityManager.RecentTaskInfo getTaskInfo(); } public static class ActivityManager.MemoryInfo implements android.os.Parcelable { ctor public ActivityManager.MemoryInfo(); method public int describeContents(); core/java/android/app/ActivityManager.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 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; parcelable ActivityManager.RecentTaskInfo; core/java/android/app/ActivityManager.java +63 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.util.Slog; import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -474,7 +475,7 @@ public class ActivityManager { } /** * Information you can set and retrieve about the current activity within Recents. * Information you can set and retrieve about the current activity within the recent task list. */ public static class RecentsActivityValues implements Parcelable { public CharSequence label; Loading Loading @@ -880,6 +881,28 @@ public class ActivityManager { } } /** * Get the list of tasks associated with the calling application. * * @return The list of tasks associated with the application making this call. * @throws SecurityException */ public List<ActivityManager.AppTask> getAppTasks() { ArrayList<AppTask> tasks = new ArrayList<AppTask>(); List<IAppTask> appTasks; try { appTasks = ActivityManagerNative.getDefault().getAppTasks(); } catch (RemoteException e) { // System dead, we will be dead too soon! return null; } int numAppTasks = appTasks.size(); for (int i = 0; i < numAppTasks; i++) { tasks.add(new AppTask(appTasks.get(i))); } return tasks; } /** * Return a list of the tasks that are currently running, with * the most recent being first and older ones after in order. Note that Loading Loading @@ -2382,4 +2405,42 @@ public class ActivityManager { return false; } } /** * The AppTask allows you to manage your own application's tasks. * See {@link android.app.ActivityManager#getAppTasks()} */ public static class AppTask { private IAppTask mAppTaskImpl; /** @hide */ public AppTask(IAppTask task) { mAppTaskImpl = task; } /** * Finishes all activities in this task and removes it from the recent tasks list. */ public void finishAndRemoveTask() { try { mAppTaskImpl.finishAndRemoveTask(); } catch (RemoteException e) { Slog.e(TAG, "Invalid AppTask", e); } } /** * Get the RecentTaskInfo associated with this task. * * @return The RecentTaskInfo for this task, or null if the task no longer exists. */ public RecentTaskInfo getTaskInfo() { try { return mAppTaskImpl.getTaskInfo(); } catch (RemoteException e) { Slog.e(TAG, "Invalid AppTask", e); return null; } } } } core/java/android/app/ActivityManagerNative.java +35 −1 Original line number Diff line number Diff line Loading @@ -506,6 +506,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_APP_TASKS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); List<IAppTask> list = getAppTasks(); reply.writeNoException(); int N = list != null ? list.size() : -1; reply.writeInt(N); int i; for (i=0; i<N; i++) { IAppTask task = list.get(i); reply.writeStrongBinder(task.asBinder()); } return true; } case GET_TASKS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int maxNum = data.readInt(); Loading Loading @@ -2683,6 +2697,26 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } public List<IAppTask> getAppTasks() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0); reply.readException(); ArrayList<IAppTask> list = null; int N = reply.readInt(); if (N >= 0) { list = new ArrayList<IAppTask>(); while (N > 0) { IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder()); list.add(task); N--; } } data.recycle(); reply.recycle(); return list; } public List getTasks(int maxNum, int flags) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ LOCAL_SRC_FILES += \ core/java/android/app/IActivityController.aidl \ core/java/android/app/IActivityPendingResult.aidl \ core/java/android/app/IAlarmManager.aidl \ core/java/android/app/IAppTask.aidl \ core/java/android/app/IBackupAgent.aidl \ core/java/android/app/IInstrumentationWatcher.aidl \ core/java/android/app/INotificationManager.aidl \ Loading
api/current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -3403,6 +3403,7 @@ package android.app { public class ActivityManager { method public boolean clearApplicationUserData(); method public void dumpPackageState(java.io.FileDescriptor, java.lang.String); method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks(); method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo(); method public int getLargeMemoryClass(); method public int getLauncherLargeIconDensity(); Loading Loading @@ -3431,6 +3432,11 @@ package android.app { field public static final int RECENT_WITH_EXCLUDED = 1; // 0x1 } public static class ActivityManager.AppTask { method public void finishAndRemoveTask(); method public android.app.ActivityManager.RecentTaskInfo getTaskInfo(); } public static class ActivityManager.MemoryInfo implements android.os.Parcelable { ctor public ActivityManager.MemoryInfo(); method public int describeContents();
core/java/android/app/ActivityManager.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /** * Copyright (c) 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; parcelable ActivityManager.RecentTaskInfo;
core/java/android/app/ActivityManager.java +63 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.util.Slog; import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -474,7 +475,7 @@ public class ActivityManager { } /** * Information you can set and retrieve about the current activity within Recents. * Information you can set and retrieve about the current activity within the recent task list. */ public static class RecentsActivityValues implements Parcelable { public CharSequence label; Loading Loading @@ -880,6 +881,28 @@ public class ActivityManager { } } /** * Get the list of tasks associated with the calling application. * * @return The list of tasks associated with the application making this call. * @throws SecurityException */ public List<ActivityManager.AppTask> getAppTasks() { ArrayList<AppTask> tasks = new ArrayList<AppTask>(); List<IAppTask> appTasks; try { appTasks = ActivityManagerNative.getDefault().getAppTasks(); } catch (RemoteException e) { // System dead, we will be dead too soon! return null; } int numAppTasks = appTasks.size(); for (int i = 0; i < numAppTasks; i++) { tasks.add(new AppTask(appTasks.get(i))); } return tasks; } /** * Return a list of the tasks that are currently running, with * the most recent being first and older ones after in order. Note that Loading Loading @@ -2382,4 +2405,42 @@ public class ActivityManager { return false; } } /** * The AppTask allows you to manage your own application's tasks. * See {@link android.app.ActivityManager#getAppTasks()} */ public static class AppTask { private IAppTask mAppTaskImpl; /** @hide */ public AppTask(IAppTask task) { mAppTaskImpl = task; } /** * Finishes all activities in this task and removes it from the recent tasks list. */ public void finishAndRemoveTask() { try { mAppTaskImpl.finishAndRemoveTask(); } catch (RemoteException e) { Slog.e(TAG, "Invalid AppTask", e); } } /** * Get the RecentTaskInfo associated with this task. * * @return The RecentTaskInfo for this task, or null if the task no longer exists. */ public RecentTaskInfo getTaskInfo() { try { return mAppTaskImpl.getTaskInfo(); } catch (RemoteException e) { Slog.e(TAG, "Invalid AppTask", e); return null; } } } }
core/java/android/app/ActivityManagerNative.java +35 −1 Original line number Diff line number Diff line Loading @@ -506,6 +506,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } case GET_APP_TASKS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); List<IAppTask> list = getAppTasks(); reply.writeNoException(); int N = list != null ? list.size() : -1; reply.writeInt(N); int i; for (i=0; i<N; i++) { IAppTask task = list.get(i); reply.writeStrongBinder(task.asBinder()); } return true; } case GET_TASKS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int maxNum = data.readInt(); Loading Loading @@ -2683,6 +2697,26 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } public List<IAppTask> getAppTasks() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0); reply.readException(); ArrayList<IAppTask> list = null; int N = reply.readInt(); if (N >= 0) { list = new ArrayList<IAppTask>(); while (N > 0) { IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder()); list.add(task); N--; } } data.recycle(); reply.recycle(); return list; } public List getTasks(int maxNum, int flags) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading