@Implements(android.os.Process.class) public class ShadowProcess extends Object
| Constructor | Description |
|---|---|
ShadowProcess() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
clearKilledProcesses() |
|
protected static int |
getThreadPriority(int tid) |
Returns priority stored for the given thread.
|
protected static void |
killProcess(int pid) |
Stores requests for killing processes.
|
protected static int |
myPid() |
|
protected static int |
myTid() |
Returns the identifier (
Thread.getId()) of the current thread (Thread.currentThread()). |
protected static int |
myUid() |
Returns the identifier of this process's uid.
|
static void |
reset() |
|
static void |
setPid(int pid) |
Sets the identifier of this process.
|
protected static void |
setThreadPriority(int priority) |
Stores priority for the current thread, but doesn't actually change it to not mess up with test
runner.
|
protected static 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.
|
static void |
setUid(int uid) |
Sets the identifier of this process.
|
static boolean |
wasKilled(int pid) |
Gets an indication of whether or not a process was killed (using
killProcess(int)). |
@Implementation protected static final void killProcess(int pid)
wasKilled(int). Use clearKilledProcesses() to clear the
list.@Implementation protected static final int myPid()
@Implementation protected static final int myUid()
Process.myUid(). You can override this value by calling setUid(int).@Implementation protected static final int myTid()
Thread.getId()) of the current thread (Thread.currentThread()).@Implementation protected static final void setThreadPriority(int priority)
@Implementation protected static final void setThreadPriority(int tid, int priority)
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].@Implementation protected static final int getThreadPriority(int tid)
tid - The identifier of the thread. If equals zero, the identifier of the calling thread
will be used.public static void clearKilledProcesses()
public static void setUid(int uid)
public static void setPid(int pid)
@Resetter public static void reset()
public static boolean wasKilled(int pid)
killProcess(int)).