am bc91c5f8: Merge "Report the user id of every app to ddms." into jb-mr1-dev
* commit 'bc91c5f8b175c20f7e63ee245bd70c7e7bba2ba5': Report the user id of every app to ddms.
This commit is contained in:
@@ -4066,7 +4066,8 @@ public final class ActivityThread {
|
||||
|
||||
// send up app name; do this *before* waiting for debugger
|
||||
Process.setArgV0(data.processName);
|
||||
android.ddm.DdmHandleAppName.setAppName(data.processName);
|
||||
android.ddm.DdmHandleAppName.setAppName(data.processName,
|
||||
UserHandle.myUserId());
|
||||
|
||||
if (data.persistent) {
|
||||
// Persistent processes on low-memory devices do not get to
|
||||
@@ -4792,7 +4793,8 @@ public final class ActivityThread {
|
||||
ensureJitEnabled();
|
||||
}
|
||||
});
|
||||
android.ddm.DdmHandleAppName.setAppName("<pre-initialized>");
|
||||
android.ddm.DdmHandleAppName.setAppName("<pre-initialized>",
|
||||
UserHandle.myUserId());
|
||||
RuntimeInit.setApplicationObject(mAppThread.asBinder());
|
||||
IActivityManager mgr = ActivityManagerNative.getDefault();
|
||||
try {
|
||||
@@ -4803,7 +4805,8 @@ public final class ActivityThread {
|
||||
} else {
|
||||
// Don't set application object here -- if the system crashes,
|
||||
// we can't display an alert, we just want to die die die.
|
||||
android.ddm.DdmHandleAppName.setAppName("system_process");
|
||||
android.ddm.DdmHandleAppName.setAppName("system_process",
|
||||
UserHandle.myUserId());
|
||||
try {
|
||||
mInstrumentation = new Instrumentation();
|
||||
ContextImpl context = new ContextImpl();
|
||||
|
||||
@@ -69,14 +69,14 @@ public class DdmHandleAppName extends ChunkHandler {
|
||||
* before or after DDMS connects. For the latter we need to send up
|
||||
* an APNM message.
|
||||
*/
|
||||
public static void setAppName(String name) {
|
||||
public static void setAppName(String name, int userId) {
|
||||
if (name == null || name.length() == 0)
|
||||
return;
|
||||
|
||||
mAppName = name;
|
||||
|
||||
// if DDMS is already connected, send the app name up
|
||||
sendAPNM(name);
|
||||
sendAPNM(name, userId);
|
||||
}
|
||||
|
||||
public static String getAppName() {
|
||||
@@ -86,14 +86,18 @@ public class DdmHandleAppName extends ChunkHandler {
|
||||
/*
|
||||
* Send an APNM (APplication NaMe) chunk.
|
||||
*/
|
||||
private static void sendAPNM(String appName) {
|
||||
private static void sendAPNM(String appName, int userId) {
|
||||
if (false)
|
||||
Log.v("ddm", "Sending app name");
|
||||
|
||||
ByteBuffer out = ByteBuffer.allocate(4 + appName.length()*2);
|
||||
ByteBuffer out = ByteBuffer.allocate(
|
||||
4 /* appName's length */
|
||||
+ appName.length()*2 /* appName */
|
||||
+ 4 /* userId */);
|
||||
out.order(ChunkHandler.CHUNK_ORDER);
|
||||
out.putInt(appName.length());
|
||||
putString(out, appName);
|
||||
out.putInt(userId);
|
||||
|
||||
Chunk chunk = new Chunk(CHUNK_APNM, out);
|
||||
DdmServer.sendChunk(chunk);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.apache.harmony.dalvik.ddmc.ChunkHandler;
|
||||
import org.apache.harmony.dalvik.ddmc.DdmServer;
|
||||
import android.util.Log;
|
||||
import android.os.Debug;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -119,7 +120,7 @@ public class DdmHandleHello extends ChunkHandler {
|
||||
// appName = "unknown";
|
||||
String appName = DdmHandleAppName.getAppName();
|
||||
|
||||
ByteBuffer out = ByteBuffer.allocate(16
|
||||
ByteBuffer out = ByteBuffer.allocate(20
|
||||
+ vmIdent.length()*2 + appName.length()*2);
|
||||
out.order(ChunkHandler.CHUNK_ORDER);
|
||||
out.putInt(DdmServer.CLIENT_PROTOCOL_VERSION);
|
||||
@@ -128,6 +129,7 @@ public class DdmHandleHello extends ChunkHandler {
|
||||
out.putInt(appName.length());
|
||||
putString(out, vmIdent);
|
||||
putString(out, appName);
|
||||
out.putInt(UserHandle.myUserId());
|
||||
|
||||
Chunk reply = new Chunk(CHUNK_HELO, out);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user