Class ShadowProcess

    • Constructor Detail

      • ShadowProcess

        public ShadowProcess()
    • Method Detail

      • killProcess

        @Implementation
        protected static final void killProcess​(int pid)
        Stores requests for killing processes. Processe that were requested to be killed can be retrieved by calling wasKilled(int). Use clearKilledProcesses() to clear the list.
      • myUid

        @Implementation
        protected static final int myUid()
        Returns the identifier of this process's uid. Unlike Android UIDs are randomly initialized to prevent tests from depending on any given value. Tests should access the current process UID via Process.myUid(). You can override this value by calling setUid(int).
      • setThreadPriority

        @Implementation
        protected static final void setThreadPriority​(int priority)
        Stores priority for the current thread, but doesn't actually change it to not mess up with test runner. Unlike real implementation does not throw any exceptions.
      • setThreadPriority

        @Implementation
        protected static final void setThreadPriority​(int tid,
                                                      int priority)
        Stores priority for the given thread, but doesn't actually change it to not mess up with test runner. Unlike real implementation does not throw any exceptions.
        Parameters:
        tid - The identifier of the thread. If equals zero, the identifier of the calling thread will be used.
        priority - The priority to be set for the thread. The range of values accepted is specified by Process.setThreadPriority(int, int), which is [-20,19].
      • getThreadPriority

        @Implementation
        protected static final int getThreadPriority​(int tid)
        Returns priority stored for the given thread.
        Parameters:
        tid - The identifier of the thread. If equals zero, the identifier of the calling thread will be used.
      • clearKilledProcesses

        public static void clearKilledProcesses()
      • setUid

        public static void setUid​(int uid)
        Sets the identifier of this process.
      • setPid

        public static void setPid​(int pid)
        Sets the identifier of this process.
      • reset

        @Resetter
        public static void reset()
      • wasKilled

        public static boolean wasKilled​(int pid)
        Gets an indication of whether or not a process was killed (using killProcess(int)).