diff options
| author | 2016-06-09 16:15:27 -0700 | |
|---|---|---|
| committer | 2016-06-09 16:38:51 -0700 | |
| commit | d25944e120aa9029aa6b5cb89f5f08fd95afdbbc (patch) | |
| tree | a981dfd503a13a453e5ef22b5b8d6002019e2b6d | |
| parent | c0b602c441337f9597959a02262de525b1793a94 (diff) | |
Use user id 0 to get missing appId for debugger
When forceStopPackageLocked is used to kill existing app process for
relaunching with debugger, user id could be -1 and getPackageUid will
already return -1. This results in killPackageProcessesLocked() not
able to find and kill the app, and wait for debugger will.
This also revert commit 55c9d739 (ag/969408) which tried to fix the
same problem but got it wrong. It's valid to -D when the process is
already running, as we're supposed to kill it. The really problem is
that the killing fails because of bad appId.
bug: 28980761
Change-Id: Ibebdcc26865464216a1f4b6773e540921cdad7d2
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 16 |
2 files changed, 2 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 9229b28e6cb7..08114d5f9b33 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -6036,7 +6036,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (appId < 0 && packageName != null) { try { appId = UserHandle.getAppId(AppGlobals.getPackageManager() - .getPackageUid(packageName, MATCH_DEBUG_TRIAGED_MISSING, userId)); + .getPackageUid(packageName, MATCH_DEBUG_TRIAGED_MISSING, 0)); } catch (RemoteException e) { } } diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 0e4c9a4d9773..52c002d4cc5a 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1097,21 +1097,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // Don't debug things in the system process if (!aInfo.processName.equals("system")) { if ((startFlags & ActivityManager.START_FLAG_DEBUG) != 0) { - final ProcessRecord app = mService.getProcessRecordLocked( - aInfo.processName, aInfo.applicationInfo.uid, true); - // If the process already started, we can't wait for debugger and shouldn't - // modify the debug settings. - // For non-persistent debug, normally we set the debug app here, and restores - // to the original at attachApplication time. However, if the app process - // already exists, we won't get another attachApplication, and the debug setting - // never gets restored. Furthermore, if we get two such calls back-to-back, - // both mOrigDebugApp and mDebugApp will become the same app, and it won't be - // cleared even if we get attachApplication after the app process is killed. - if (app == null || app.thread == null) { - mService.setDebugApp(aInfo.processName, true, false); - } else { - Slog.w(TAG, "Ignoring waitForDebugger because process already exists"); - } + mService.setDebugApp(aInfo.processName, true, false); } if ((startFlags & ActivityManager.START_FLAG_NATIVE_DEBUGGING) != 0) { |