From b73435cdedb03bbe03ccb3de3a51313d06ede09c Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 8 May 2017 12:43:16 -0700 Subject: [PATCH] Don't bring up backup agents in secondary app processes When an app needs to be launched to make its agent available, we were taking action in response to the first 'attach' operation we got from any process running as the right uid. This turns out to be fraught; it's possible that some other secondary-process component launch was racing with the agent bringup request, such that the attach callback arrives from that secondary app process instead of the main process. *That,* in turn, can be fatal if it turns out to be an isolated process or similarly incapable host environment for the agent. So now we make sure it's actually the process we're waiting for when deciding to instantiate the agent there. Bug 38123540 Test: manual Change-Id: I01648027d104cc93fe0ec9227ebab85ad3d83c88 --- .../core/java/com/android/server/am/ActivityManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 268adc5ebfe1d..b5f8a092f805e 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -6945,7 +6945,7 @@ public class ActivityManagerService extends IActivityManager.Stub } // Check whether the next backup agent is in this process... - if (!badApp && mBackupTarget != null && mBackupTarget.appInfo.uid == app.uid) { + if (!badApp && mBackupTarget != null && mBackupTarget.app == app) { if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "New app is backup target, launching agent for " + app); notifyPackageUse(mBackupTarget.appInfo.packageName,