private RunningTaskInfo createRunningTaskInfo() { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ShadowActivityManager shadowAm = Robolectric.shadowOf(am); RunningTaskInfo info = new RunningTaskInfo(); shadowAm.setTasks(Arrays.asList(info)); return info; }
private void createRunningAppProcessInfo(int pid) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ShadowActivityManager shadowAm = Robolectric.shadowOf(am); RunningAppProcessInfo proc = new RunningAppProcessInfo(); proc.importance = RunningAppProcessInfo.IMPORTANCE_FOREGROUND; proc.pid = pid; shadowAm.setProcesses(Arrays.asList(proc)); }
public static ShadowActivityManager shadowOf(ActivityManager instance) { return (ShadowActivityManager) shadowOf_(instance); }