From cde9e891137ca97eb993bf8f18b868b15fa125c0 Mon Sep 17 00:00:00 2001 From: Achim Thesmann Date: Fri, 21 Apr 2023 08:48:18 -0700 Subject: [PATCH] Add real calling package name to log. To identyify the sender app that needs to be fixed we need the real calling package, not the calling package. Test: atest BackgroundActivityLaunchTest Change-Id: I7c970d8d43e5e980e95f290cf2bdf1bab4020472 Bug: 236231785 --- .../android/server/wm/BackgroundActivityStartController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/wm/BackgroundActivityStartController.java b/services/core/java/com/android/server/wm/BackgroundActivityStartController.java index e447049a7362e..1a3d6730fe203 100644 --- a/services/core/java/com/android/server/wm/BackgroundActivityStartController.java +++ b/services/core/java/com/android/server/wm/BackgroundActivityStartController.java @@ -452,6 +452,9 @@ public class BackgroundActivityStartController { // If we are here, it means all exemptions not based on PI sender failed, so we'll block // unless resultIfPiSenderAllowsBal is an allow and the PI sender allows BAL + String realCallingPackage = callingUid == realCallingUid ? callingPackage : + mService.mContext.getPackageManager().getNameForUid(realCallingUid); + String stateDumpLog = " [callingPackage: " + callingPackage + "; callingUid: " + callingUid + "; appSwitchState: " + appSwitchState @@ -460,6 +463,7 @@ public class BackgroundActivityStartController { ActivityManager.class, "PROCESS_STATE_", callingUidProcState) + "; isCallingUidPersistentSystemProcess: " + isCallingUidPersistentSystemProcess + "; balAllowedByPiSender: " + balAllowedByPiSender + + "; realCallingPackage: " + realCallingPackage + "; realCallingUid: " + realCallingUid + "; realCallingUidHasAnyVisibleWindow: " + realCallingUidHasAnyVisibleWindow + "; realCallingUidProcState: " + DebugUtils.valueToString(