From f058942060b1efdc4bed8037309f6cbfab7ffde8 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Thu, 6 Oct 2022 13:03:53 -0600 Subject: [PATCH] Update PreBootBroadcaster to use ProcessRecord. In order to receive valid "resultTo" responses, we now need to know the ProcessRecord to deliver them through, which in this case is the "system_server" process. Bug: 251486235 Test: manual Change-Id: Iaf1b2e5d6a1da5bc59e297d82d941c6d4cfe7ab3 --- .../java/com/android/server/am/PreBootBroadcaster.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/PreBootBroadcaster.java b/services/core/java/com/android/server/am/PreBootBroadcaster.java index 35f91ba1169b5..9b7c3acb71d82 100644 --- a/services/core/java/com/android/server/am/PreBootBroadcaster.java +++ b/services/core/java/com/android/server/am/PreBootBroadcaster.java @@ -57,6 +57,7 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub { private static final String TAG = "PreBootBroadcaster"; private final ActivityManagerService mService; + private final ProcessRecord mSystemApp; private final int mUserId; private final ProgressReporter mProgress; private final boolean mQuiet; @@ -69,6 +70,9 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub { public PreBootBroadcaster(ActivityManagerService service, int userId, ProgressReporter progress, boolean quiet) { mService = service; + synchronized (mService) { + mSystemApp = mService.getProcessRecordLocked("system", android.os.Process.SYSTEM_UID); + } mUserId = userId; mProgress = progress; mQuiet = quiet; @@ -123,8 +127,8 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub { TEMPORARY_ALLOWLIST_TYPE_FOREGROUND_SERVICE_ALLOWED, REASON_PRE_BOOT_COMPLETED, ""); synchronized (mService) { - mService.broadcastIntentLocked(null, null, null, mIntent, null, this, 0, null, null, - null, null, null, AppOpsManager.OP_NONE, bOptions.toBundle(), true, + mService.broadcastIntentLocked(mSystemApp, "android", null, mIntent, null, this, 0, + null, null, null, null, null, AppOpsManager.OP_NONE, bOptions.toBundle(), true, false, ActivityManagerService.MY_PID, Process.SYSTEM_UID, Binder.getCallingUid(), Binder.getCallingPid(), mUserId); }