summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2011-04-29 10:23:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-04-29 10:23:35 -0700
commit52749c0b1117a05a9c853b7d54f69a281f69cf3c (patch)
treebaa2aa72da2a45c4d651d35c1a6e01ebac9cccc7
parente321d06430304fa93282c765aa6070c908121a16 (diff)
parent03daee6380772b0ab167a7b28e37d7a21ec89c86 (diff)
downloadframeworks_base-52749c0b1117a05a9c853b7d54f69a281f69cf3c.zip
frameworks_base-52749c0b1117a05a9c853b7d54f69a281f69cf3c.tar.gz
frameworks_base-52749c0b1117a05a9c853b7d54f69a281f69cf3c.tar.bz2
am 03daee63: Merge "frameworks/base: acquire lock on am only when needed"
* commit '03daee6380772b0ab167a7b28e37d7a21ec89c86': frameworks/base: acquire lock on am only when needed
-rw-r--r--[-rwxr-xr-x]services/java/com/android/server/am/ActivityManagerService.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 883fdda..d24ce7e 100755..100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -6734,18 +6734,25 @@ public final class ActivityManagerService extends ActivityManagerNative
* to append various headers to the dropbox log text.
*/
private void appendDropBoxProcessHeaders(ProcessRecord process, StringBuilder sb) {
+ // Watchdog thread ends up invoking this function (with
+ // a null ProcessRecord) to add the stack file to dropbox.
+ // Do not acquire a lock on this (am) in such cases, as it
+ // could cause a potential deadlock, if and when watchdog
+ // is invoked due to unavailability of lock on am and it
+ // would prevent watchdog from killing system_server.
+ if (process == null) {
+ sb.append("Process: system_server\n");
+ return;
+ }
// Note: ProcessRecord 'process' is guarded by the service
// instance. (notably process.pkgList, which could otherwise change
// concurrently during execution of this method)
synchronized (this) {
- if (process == null || process.pid == MY_PID) {
+ if (process.pid == MY_PID) {
sb.append("Process: system_server\n");
} else {
sb.append("Process: ").append(process.processName).append("\n");
}
- if (process == null) {
- return;
- }
int flags = process.info.flags;
IPackageManager pm = AppGlobals.getPackageManager();
sb.append("Flags: 0x").append(Integer.toString(flags, 16)).append("\n");