logd: uidToName add dex2oat UID
(cherry pick from commit 023f51f360472f6bb9bad495e55cdb32b5411bc5)
- When searching for uidToName from /data/system/packages.list
one must search for the uid % AID_USER;
- If uid % AID_USER is greater than AID_SHARED_GID_START - AID_APP,
then subract it and try again to pick up uidToName.
Change-Id: I24df42957ff7e746fffa5d39484637b1b726b9c0
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 10f7255..2eab4dd 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -131,7 +131,11 @@
}
// Parse /data/system/packages.list
- char *name = android::uidToName(uid);
+ uid_t userId = uid % AID_USER;
+ char *name = android::uidToName(userId);
+ if (!name && (userId > (AID_SHARED_GID_START - AID_APP))) {
+ name = android::uidToName(userId - (AID_SHARED_GID_START - AID_APP));
+ }
if (name) {
return name;
}
@@ -149,7 +153,8 @@
name = strdup(n);
} else if (strcmp(name, n)) {
free(name);
- return NULL;
+ name = NULL;
+ break;
}
}
}