@Implements(value=android.app.ActivityManager.class, looseSignatures=true) public class ShadowActivityManager extends Object
ActivityManager
Constructor | 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()
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)
setProcesses(java.util.List<android.app.ActivityManager.RunningAppProcessInfo>)
.@HiddenApi @Implementation(minSdk=17) protected boolean switchUser(int userid)
@Implementation(minSdk=29) protected boolean switchUser(UserHandle userHandle)
@Implementation protected void killBackgroundProcesses(String packageName)
@Implementation protected void getMemoryInfo(ActivityManager.MemoryInfo outInfo)
@Implementation protected ConfigurationInfo getDeviceConfigurationInfo()
public void setDeviceConfigurationInfo(ConfigurationInfo configurationInfo)
ConfigurationInfo
returned by ActivityManager.getDeviceConfigurationInfo()
, but has no effect otherwise.public void setTasks(List<ActivityManager.RunningTaskInfo> tasks)
tasks
- List of running tasks.public void setAppTasks(List<ActivityManager.AppTask> appTasks)
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)
@Implementation(minSdk=23) protected int getLockTaskModeState()
@Implementation(minSdk=21) protected boolean isInLockTaskMode()
public void setLockTaskModeState(int lockTaskModeState)
ActivityManager.getLockTaskModeState()
, but
has no effect otherwise.@Resetter public static void reset()
@Implementation(minSdk=28) protected boolean isBackgroundRestricted()
setBackgroundRestricted(boolean)
.public void setBackgroundRestricted(boolean isBackgroundRestricted)
ActivityManager.isBackgroundRestricted()
, but has no effect otherwise.@Implementation(minSdk=30) protected Object getHistoricalProcessExitReasons(Object packageName, Object pid, Object maxNum)
ApplicationExitInfo
added by addApplicationExitInfo(java.lang.String, int, int, int)
.
packageName
is ignored.public void addApplicationExitInfo(String processName, int pid, int reason, int status)
ApplicationExitInfo
with the given information@Implementation protected boolean clearApplicationUserData(String packageName, IPackageDataObserver observer)
public boolean isApplicationUserDataCleared()
ActivityManager.clearApplicationUserData()
.