@Implements(value=android.app.ActivityManager.class) public class ShadowActivityManager extends Object
Constructor and Description |
---|
ShadowActivityManager() |
@Implementation protected int getMemoryClass()
@Implementation protected static boolean isUserAMonkey()
@Implementation(minSdk=17) @HiddenApi protected static int getCurrentUser()
@Implementation protected List<ActivityManager.RunningTaskInfo> getRunningTasks(int maxNum)
@Implementation(minSdk=21) protected List<ActivityManager.AppTask> getAppTasks()
For tests, returns the list of ActivityManager.AppTask
set using setAppTasks(List)
. Returns empty list if nothing is set.
setAppTasks(List)
@Implementation protected List<ActivityManager.RunningServiceInfo> getRunningServices(int maxNum)
@Implementation protected List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
@Implementation protected static void getMyMemoryState(ActivityManager.RunningAppProcessInfo inState)
Returns information seeded by setProcesses(java.util.List<android.app.ActivityManager.RunningAppProcessInfo>)
.
@HiddenApi @Implementation(minSdk=17) protected boolean switchUser(int userid)
@Implementation protected void killBackgroundProcesses(String packageName)
@Implementation protected void getMemoryInfo(ActivityManager.MemoryInfo outInfo)
@Implementation protected ConfigurationInfo getDeviceConfigurationInfo()
public void setTasks(List<ActivityManager.RunningTaskInfo> tasks)
tasks
- List of running tasks.public void setAppTasks(List<ActivityManager.AppTask> appTasks)
Sets the values to be returned by getAppTasks()
.
tasks
- List of app tasks.getAppTasks()
public void setServices(List<ActivityManager.RunningServiceInfo> services)
services
- List of running services.public void setProcesses(List<ActivityManager.RunningAppProcessInfo> processes)
processes
- List of running processes.public String getBackgroundPackage()
public void setMemoryClass(int memoryClass)
memoryClass
- Set the application’s memory class.public void setMemoryInfo(ActivityManager.MemoryInfo memoryInfo)
memoryInfo
- Set the application’s memory info.@Implementation(minSdk=26) protected static IActivityManager getService()
@Implementation(minSdk=19) protected boolean isLowRamDevice()
public void setIsLowRamDevice(boolean isLowRamDevice)
Override the return value of isLowRamDevice().
@Implementation(minSdk=23) protected int getLockTaskModeState()
@Implementation(minSdk=21) protected boolean isInLockTaskMode()
public void setLockTaskModeState(int lockTaskModeState)
Sets lock task mode state to be reported by ActivityManager.getLockTaskModeState()
, but has no effect otherwise.
@Resetter public static void reset()