Class ShadowActivityManager


  • @Implements(android.app.ActivityManager.class)
    public class ShadowActivityManager
    extends java.lang.Object
    • Constructor Detail

      • ShadowActivityManager

        public ShadowActivityManager()
    • Method Detail

      • getMemoryClass

        @Implementation
        protected int getMemoryClass()
      • isUserAMonkey

        @Implementation
        protected static boolean isUserAMonkey()
      • getCurrentUser

        @Implementation(minSdk=17)
        @HiddenApi
        protected static int getCurrentUser()
      • getRunningTasks

        @Implementation
        protected java.util.List<android.app.ActivityManager.RunningTaskInfo> getRunningTasks​(int maxNum)
      • getAppTasks

        @Implementation(minSdk=21)
        protected java.util.List<android.app.ActivityManager.AppTask> getAppTasks()
        For tests, returns the list of ActivityManager.AppTask set using setAppTasks(List). Returns empty list if nothing is set.
        Returns:
        List of current AppTask.
        See Also:
        setAppTasks(List)
      • getRunningServices

        @Implementation
        protected java.util.List<android.app.ActivityManager.RunningServiceInfo> getRunningServices​(int maxNum)
      • getRunningAppProcesses

        @Implementation
        protected java.util.List<android.app.ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
      • switchUser

        @HiddenApi
        @Implementation(minSdk=17)
        protected boolean switchUser​(int userid)
      • switchUser

        @Implementation(minSdk=29)
        protected boolean switchUser​(android.os.UserHandle userHandle)
      • killBackgroundProcesses

        @Implementation
        protected void killBackgroundProcesses​(java.lang.String packageName)
      • getMemoryInfo

        @Implementation
        protected void getMemoryInfo​(android.app.ActivityManager.MemoryInfo outInfo)
      • getDeviceConfigurationInfo

        @Implementation
        protected android.content.pm.ConfigurationInfo getDeviceConfigurationInfo()
      • setTasks

        public void setTasks​(java.util.List<android.app.ActivityManager.RunningTaskInfo> tasks)
        Parameters:
        tasks - List of running tasks.
      • setAppTasks

        public void setAppTasks​(java.util.List<android.app.ActivityManager.AppTask> appTasks)
        Sets the values to be returned by getAppTasks().
        Parameters:
        tasks - List of app tasks.
        See Also:
        getAppTasks()
      • setServices

        public void setServices​(java.util.List<android.app.ActivityManager.RunningServiceInfo> services)
        Parameters:
        services - List of running services.
      • setProcesses

        public void setProcesses​(java.util.List<android.app.ActivityManager.RunningAppProcessInfo> processes)
        Parameters:
        processes - List of running processes.
      • getBackgroundPackage

        public java.lang.String 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

        public void setMemoryInfo​(android.app.ActivityManager.MemoryInfo memoryInfo)
        Parameters:
        memoryInfo - Set the application's memory info.
      • getService

        @Implementation(minSdk=26)
        protected static android.app.IActivityManager getService()
      • isLowRamDevice

        @Implementation(minSdk=19)
        protected boolean isLowRamDevice()
      • setIsLowRamDevice

        public void setIsLowRamDevice​(boolean isLowRamDevice)
        Override the return value of isLowRamDevice().
      • getLockTaskModeState

        @Implementation(minSdk=23)
        protected int getLockTaskModeState()
      • isInLockTaskMode

        @Implementation(minSdk=21)
        protected boolean isInLockTaskMode()
      • setLockTaskModeState

        public void setLockTaskModeState​(int lockTaskModeState)
        Sets lock task mode state to be reported by ActivityManager.getLockTaskModeState(), but has no effect otherwise.
      • reset

        @Resetter
        public static void reset()
      • isBackgroundRestricted

        @Implementation(minSdk=28)
        protected boolean isBackgroundRestricted()
        Returns the background restricion state set by setBackgroundRestricted(boolean).
      • setBackgroundRestricted

        public void setBackgroundRestricted​(boolean isBackgroundRestricted)
        Sets the background restriction state reported by ActivityManager.isBackgroundRestricted(), but has no effect otherwise.