@Implements(value=android.os.Process.class) public class ShadowProcess extends java.lang.Object
Constructor and Description |
---|
ShadowProcess() |
Modifier and Type | Method and Description |
---|---|
protected static int |
getThreadPriority(int tid)
Returns priority stored for the given thread.
|
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.
|
@Implementation protected static final int myPid()
@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)
.
@Implementation protected static final int myTid()
Returns the identifier (Thread.getId()
) of the current thread (Thread.currentThread()
).
@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.
@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.
tid
- The identifier of the thread. If equals zero, the identifier of the calling thread will be used.@Implementation protected static final int getThreadPriority(int tid)
Returns priority stored for the given thread.
tid
- The identifier of the thread. If equals zero, the identifier of the calling thread will be used.public static void setUid(int uid)
Sets the identifier of this process.
public static void setPid(int pid)
Sets the identifier of this process.
@Resetter public static void reset()