Search in sources :

Example 1 with IAppTask

use of android.app.IAppTask in project platform_frameworks_base by android.

the class ActivityManagerService method getAppTasks.

// =========================================================
// TASK MANAGEMENT
// =========================================================
@Override
public List<IAppTask> getAppTasks(String callingPackage) {
    int callingUid = Binder.getCallingUid();
    long ident = Binder.clearCallingIdentity();
    synchronized (this) {
        ArrayList<IAppTask> list = new ArrayList<IAppTask>();
        try {
            if (DEBUG_ALL)
                Slog.v(TAG, "getAppTasks");
            final int N = mRecentTasks.size();
            for (int i = 0; i < N; i++) {
                TaskRecord tr = mRecentTasks.get(i);
                // that will limit to the correct security sandbox.
                if (tr.effectiveUid != callingUid) {
                    continue;
                }
                Intent intent = tr.getBaseIntent();
                if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
                    continue;
                }
                ActivityManager.RecentTaskInfo taskInfo = createRecentTaskInfoFromTaskRecord(tr);
                AppTaskImpl taskImpl = new AppTaskImpl(taskInfo.persistentId, callingUid);
                list.add(taskImpl);
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
        return list;
    }
}
Also used : IAppTask(android.app.IAppTask) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) ActivityManager(android.app.ActivityManager) Point(android.graphics.Point)

Example 2 with IAppTask

use of android.app.IAppTask in project android_frameworks_base by DirtyUnicorns.

the class ActivityManagerService method getAppTasks.

// =========================================================
// TASK MANAGEMENT
// =========================================================
@Override
public List<IAppTask> getAppTasks(String callingPackage) {
    int callingUid = Binder.getCallingUid();
    long ident = Binder.clearCallingIdentity();
    synchronized (this) {
        ArrayList<IAppTask> list = new ArrayList<IAppTask>();
        try {
            if (DEBUG_ALL)
                Slog.v(TAG, "getAppTasks");
            final int N = mRecentTasks.size();
            for (int i = 0; i < N; i++) {
                TaskRecord tr = mRecentTasks.get(i);
                // that will limit to the correct security sandbox.
                if (tr.effectiveUid != callingUid) {
                    continue;
                }
                Intent intent = tr.getBaseIntent();
                if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
                    continue;
                }
                ActivityManager.RecentTaskInfo taskInfo = createRecentTaskInfoFromTaskRecord(tr);
                AppTaskImpl taskImpl = new AppTaskImpl(taskInfo.persistentId, callingUid);
                list.add(taskImpl);
            }
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
        return list;
    }
}
Also used : IAppTask(android.app.IAppTask) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) ActivityManager(android.app.ActivityManager) Point(android.graphics.Point)

Aggregations

ActivityManager (android.app.ActivityManager)2 IAppTask (android.app.IAppTask)2 PendingIntent (android.app.PendingIntent)2 Intent (android.content.Intent)2 Point (android.graphics.Point)2 ArrayList (java.util.ArrayList)2