use of android.app.ActivityManager.AppTask in project AndroidChromium by JackyAndroid.
the class MultiWindowUtils method isActivityTaskInRecents.
/**
* @param className The class name of the Activity to look for in Android recents
* @param context The current Context, used to retrieve the ActivityManager system service.
* @return True if the Activity still has a task in Android recents, regardless of whether
* the Activity has been destroyed.
*/
@TargetApi(Build.VERSION_CODES.M)
private boolean isActivityTaskInRecents(String className, Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<AppTask> appTasks = activityManager.getAppTasks();
for (AppTask task : appTasks) {
if (task.getTaskInfo() == null || task.getTaskInfo().baseActivity == null)
continue;
String baseActivity = task.getTaskInfo().baseActivity.getClassName();
if (TextUtils.equals(baseActivity, className))
return true;
}
return false;
}
use of android.app.ActivityManager.AppTask in project platform_packages_apps_Settings by BlissRoms.
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();
}
}
use of android.app.ActivityManager.AppTask in project robolectric by robolectric.
the class ShadowAppTaskTest method finishAndRemoveTask_marksTaskFinished.
@Test
public void finishAndRemoveTask_marksTaskFinished() {
final AppTask appTask = ShadowAppTask.newInstance();
appTask.finishAndRemoveTask();
assertThat(shadowOf(appTask).isFinishedAndRemoved()).isTrue();
}
use of android.app.ActivityManager.AppTask in project robolectric by robolectric.
the class ShadowAppTaskTest method moveToFront_movesTaskToFront.
@Test
public void moveToFront_movesTaskToFront() {
final AppTask appTask = ShadowAppTask.newInstance();
appTask.moveToFront();
assertThat(shadowOf(appTask).hasMovedToFront()).isTrue();
}
use of android.app.ActivityManager.AppTask in project robolectric by robolectric.
the class ShadowAppTaskTest method getTaskInfo_returnsCorrectValue.
@Test
public void getTaskInfo_returnsCorrectValue() {
final AppTask appTask = ShadowAppTask.newInstance();
final RecentTaskInfo recentTaskInfo = new RecentTaskInfo();
recentTaskInfo.description = "com.google.test";
shadowOf(appTask).setTaskInfo(recentTaskInfo);
assertThat(appTask.getTaskInfo()).isSameInstanceAs(recentTaskInfo);
}
Aggregations