Search in sources :

Example 11 with AppTask

use of android.app.ActivityManager.AppTask in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockGenericTest method finishAllAppTasks.

private void finishAllAppTasks() {
    final ActivityManager activityManager = getTargetContext().getSystemService(ActivityManager.class);
    final List<AppTask> appTasks = activityManager.getAppTasks();
    for (ActivityManager.AppTask task : appTasks) {
        task.finishAndRemoveTask();
    }
}
Also used : AppTask(android.app.ActivityManager.AppTask) AppTask(android.app.ActivityManager.AppTask) ActivityManager(android.app.ActivityManager)

Example 12 with AppTask

use of android.app.ActivityManager.AppTask in project platform_frameworks_base by android.

the class LauncherActivity method findTask.

@Nullable
private Intent findTask(ActivityManager activities) {
    List<AppTask> tasks = activities.getAppTasks();
    for (AppTask task : tasks) {
        Intent intent = task.getTaskInfo().baseIntent;
        Uri uri = intent.getData();
        if (isLaunchUri(uri)) {
            return intent;
        }
    }
    return null;
}
Also used : AppTask(android.app.ActivityManager.AppTask) Intent(android.content.Intent) Uri(android.net.Uri) Nullable(android.support.annotation.Nullable)

Example 13 with AppTask

use of android.app.ActivityManager.AppTask in project android_packages_apps_Dialer by LineageOS.

the class InCallActivityCommon method setExcludeFromRecents.

public void setExcludeFromRecents(boolean exclude) {
    List<AppTask> tasks = inCallActivity.getSystemService(ActivityManager.class).getAppTasks();
    int taskId = inCallActivity.getTaskId();
    for (int i = 0; i < tasks.size(); i++) {
        ActivityManager.AppTask task = tasks.get(i);
        try {
            if (task.getTaskInfo().id == taskId) {
                task.setExcludeFromRecents(exclude);
            }
        } catch (RuntimeException e) {
            LogUtil.e("InCallActivityCommon.setExcludeFromRecents", "RuntimeException when excluding task from recents.", e);
        }
    }
}
Also used : AppTask(android.app.ActivityManager.AppTask) AppTask(android.app.ActivityManager.AppTask) ActivityManager(android.app.ActivityManager)

Example 14 with AppTask

use of android.app.ActivityManager.AppTask in project android_packages_apps_Settings by DirtyUnicorns.

the class ChooseLockGenericTest method finishAllAppTasks.

private void finishAllAppTasks() {
    final ActivityManager activityManager = getTargetContext().getSystemService(ActivityManager.class);
    final List<AppTask> appTasks = activityManager.getAppTasks();
    for (ActivityManager.AppTask task : appTasks) {
        task.finishAndRemoveTask();
    }
}
Also used : AppTask(android.app.ActivityManager.AppTask) AppTask(android.app.ActivityManager.AppTask) ActivityManager(android.app.ActivityManager)

Example 15 with AppTask

use of android.app.ActivityManager.AppTask in project AndroidChromium by JackyAndroid.

the class WebappDirectoryManager method getBaseIntentsForAllTasks.

/**
 * Returns a Set of Intents for all Chrome tasks currently known by the ActivityManager.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected Set<Intent> getBaseIntentsForAllTasks() {
    Set<Intent> baseIntents = new HashSet<Intent>();
    Context context = ContextUtils.getApplicationContext();
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (AppTask task : manager.getAppTasks()) {
        Intent intent = DocumentUtils.getBaseIntentFromTask(task);
        if (intent != null)
            baseIntents.add(intent);
    }
    return baseIntents;
}
Also used : Context(android.content.Context) AppTask(android.app.ActivityManager.AppTask) Intent(android.content.Intent) ActivityManager(android.app.ActivityManager) HashSet(java.util.HashSet) TargetApi(android.annotation.TargetApi)

Aggregations

AppTask (android.app.ActivityManager.AppTask)22 ActivityManager (android.app.ActivityManager)11 Intent (android.content.Intent)7 Test (org.junit.Test)6 Uri (android.net.Uri)5 Nullable (android.support.annotation.Nullable)5 TargetApi (android.annotation.TargetApi)3 RecentTaskInfo (android.app.ActivityManager.RecentTaskInfo)2 Context (android.content.Context)2 Activity (android.app.Activity)1 PackageManager (android.content.pm.PackageManager)1 HashSet (java.util.HashSet)1 Config (org.robolectric.annotation.Config)1