From c23bc8f1b2b03d9265d9e9859d9bb98bc0119476 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Tue, 19 Jan 2021 10:24:05 +0000 Subject: Use crashing process' UID and PID, rather than Binder caller. Binder.callingUid() works for Java crashes as the caller is the crashing app itself. However, in the case of native crashes, it is not, resulting in UID = 1000, which is not at all helpful. Test: atest Change-Id: Ife1645af03108ca3ee72e6fc5faa4319eb8917e8 Bug: 177898567 --- services/core/java/com/android/server/am/ActivityManagerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index b587f1b2599d..92d2005d74d9 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -7609,10 +7609,10 @@ public class ActivityManagerService extends IActivityManager.Stub crashInfo.throwLineNumber); FrameworkStatsLog.write(FrameworkStatsLog.APP_CRASH_OCCURRED, - Binder.getCallingUid(), + (r != null) ? r.uid : -1, eventType, processName, - Binder.getCallingPid(), + (r != null) ? r.pid : -1, (r != null && r.info != null) ? r.info.packageName : "", (r != null && r.info != null) ? (r.info.isInstantApp() ? FrameworkStatsLog.APP_CRASH_OCCURRED__IS_INSTANT_APP__TRUE -- cgit v1.2.3-59-g8ed1b