Instead of using -1 for pid and uid in the simulator, and then having to special-case the simulator case all over the framework, just use getuid and getpid, and intercept those in the simulator wrapper.
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp index c3889e9..c371a23 100644 --- a/IPCThreadState.cpp +++ b/IPCThreadState.cpp
@@ -366,13 +366,8 @@ void IPCThreadState::clearCaller() { - if (mProcess->supportsProcesses()) { - mCallingPid = getpid(); - mCallingUid = getuid(); - } else { - mCallingPid = -1; - mCallingUid = -1; - } + mCallingPid = getpid(); + mCallingUid = getuid(); } void IPCThreadState::flushCommands()