summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-06-09 07:28:50 -0700
committerAndroid Code Review <code-review@android.com>2010-06-09 07:28:50 -0700
commitcd5529a9c72998a0b2e66ea41d3c9afca9c90552 (patch)
treece3d6e4ce62839d59b03c29419cf4cb163ca2b37 /services
parent32d0d8fcc880c8cc8c1516d12bb921eed7e4c852 (diff)
parent8a9e7a1f9490dc0c103c82fac74087459ddf4c16 (diff)
downloadframeworks_base-cd5529a9c72998a0b2e66ea41d3c9afca9c90552.zip
frameworks_base-cd5529a9c72998a0b2e66ea41d3c9afca9c90552.tar.gz
frameworks_base-cd5529a9c72998a0b2e66ea41d3c9afca9c90552.tar.bz2
Merge "Fix for deadlock between StatusBarService and NotificationManagerService"
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/status/StatusBarService.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index 34921d6..9ccd38b 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -552,15 +552,17 @@ public class StatusBarService extends IStatusBar.Stub
doRevealAnimation();
return;
}
+ boolean expand = false;
+ boolean doExpand = false;
+ boolean doDisable = false;
+ int disableWhat = 0;
+
synchronized (mQueue) {
boolean wasExpanded = mExpanded;
// for each one in the queue, find all of the ones with the same key
// and collapse that down into a final op and/or call to setVisibility, etc
- boolean expand = wasExpanded;
- boolean doExpand = false;
- boolean doDisable = false;
- int disableWhat = 0;
+ expand = wasExpanded;
int N = mQueue.size();
while (N > 0) {
PendingOp op = mQueue.get(0);
@@ -634,18 +636,21 @@ public class StatusBarService extends IStatusBar.Stub
if (mQueue.size() != 0) {
throw new RuntimeException("Assertion failed: mQueue.size=" + mQueue.size());
}
- if (doExpand) {
- // this is last so that we capture all of the pending changes before doing it
- if (expand) {
- animateExpand();
- } else {
- animateCollapse();
- }
- }
- if (doDisable) {
- performDisableActions(disableWhat);
+ }
+ // This must be done outside the synchronized block above to prevent a deadlock where
+ // we call into the NotificationManagerService and it is in turn attempting to post a
+ // message to our queue.
+ if (doExpand) {
+ // this is last so that we capture all of the pending changes before doing it
+ if (expand) {
+ animateExpand();
+ } else {
+ animateCollapse();
}
}
+ if (doDisable) {
+ performDisableActions(disableWhat);
+ }
}
}