Package org.robolectric.shadows
Class ShadowActivityManager
java.lang.Object
org.robolectric.shadows.ShadowActivityManager
@Implements(value=android.app.ActivityManager.class, looseSignatures=true) public class ShadowActivityManager extends Object
Shadow for
ActivityManager
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadowActivityManager.ApplicationExitInfoBuilder
Builder class forApplicationExitInfo
-
Constructor Summary
Constructors Constructor Description ShadowActivityManager()
-
Method Summary
-
Constructor Details
-
ShadowActivityManager
public ShadowActivityManager()
-
-
Method Details
-
__constructor__
-
getMemoryClass
-
isUserAMonkey
-
getCurrentUser
-
getRunningTasks
-
getAppTasks
For tests, returns the list ofActivityManager.AppTask
set usingsetAppTasks(List)
. Returns empty list if nothing is set.- Returns:
- List of current AppTask.
- See Also:
setAppTasks(List)
-
getRunningServices
-
getRunningAppProcesses
-
getMyMemoryState
@Implementation protected static void getMyMemoryState(ActivityManager.RunningAppProcessInfo inState)Returns information seeded bysetProcesses(java.util.List<android.app.ActivityManager.RunningAppProcessInfo>)
. -
switchUser
-
switchUser
-
killBackgroundProcesses
-
getMemoryInfo
-
getDeviceConfigurationInfo
-
setDeviceConfigurationInfo
Sets theConfigurationInfo
returned byActivityManager.getDeviceConfigurationInfo()
, but has no effect otherwise. -
setTasks
- Parameters:
tasks
- List of running tasks.
-
setAppTasks
Sets the values to be returned bygetAppTasks()
.- Parameters:
tasks
- List of app tasks.- See Also:
getAppTasks()
-
setServices
- Parameters:
services
- List of running services.
-
setProcesses
- Parameters:
processes
- List of running processes.
-
getBackgroundPackage
- Returns:
- Get the package name of the last background processes killed.
-
setMemoryClass
public void setMemoryClass(int memoryClass)- Parameters:
memoryClass
- Set the application's memory class.
-
setMemoryInfo
- Parameters:
memoryInfo
- Set the application's memory info.
-
getService
-
isLowRamDevice
-
setIsLowRamDevice
public void setIsLowRamDevice(boolean isLowRamDevice)Override the return value of isLowRamDevice(). -
addOnUidImportanceListener
@Implementation(minSdk=26) protected void addOnUidImportanceListener(Object listener, Object importanceCutpoint) -
removeOnUidImportanceListener
-
getPackageImportance
-
getUidImportance
-
setUidImportance
public void setUidImportance(int uid, int importance) -
getLockTaskModeState
-
isInLockTaskMode
-
setLockTaskModeState
public void setLockTaskModeState(int lockTaskModeState)Sets lock task mode state to be reported byActivityManager.getLockTaskModeState()
, but has no effect otherwise. -
reset
-
isBackgroundRestricted
Returns the background restriction state set bysetBackgroundRestricted(boolean)
. -
setBackgroundRestricted
public void setBackgroundRestricted(boolean isBackgroundRestricted)Sets the background restriction state reported byActivityManager.isBackgroundRestricted()
, but has no effect otherwise. -
getHistoricalProcessExitReasons
@Implementation(minSdk=30) protected Object getHistoricalProcessExitReasons(Object packageName, Object pid, Object maxNum)Returns the matchedApplicationExitInfo
added byaddApplicationExitInfo(java.lang.String, int, int, int)
.packageName
is ignored. -
addApplicationExitInfo
@Deprecated public void addApplicationExitInfo(String processName, int pid, int reason, int status)Deprecated.Prefer using overload withShadowActivityManager.ApplicationExitInfoBuilder
Adds anApplicationExitInfo
with the given information -
addApplicationExitInfo
Adds givenApplicationExitInfo
, seeShadowActivityManager.ApplicationExitInfoBuilder
-
clearApplicationUserData
@Implementation protected boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) -
isApplicationUserDataCleared
public boolean isApplicationUserDataCleared()Returns true after clearing application user data was requested by callingActivityManager.clearApplicationUserData()
.
-