summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-06-24 13:20:51 -0700
committerDianne Hackborn <hackbod@google.com>2012-06-25 14:27:41 -0700
commit42e620caf0407f1b5e02935ac4323742c65459fd (patch)
tree950736ba92c530521a1a1f417db42be759a6a0b3 /policy
parente9b4b3e94d396d176338c62f8c9f4c183b340f9b (diff)
downloadframeworks_base-42e620caf0407f1b5e02935ac4323742c65459fd.zip
frameworks_base-42e620caf0407f1b5e02935ac4323742c65459fd.tar.gz
frameworks_base-42e620caf0407f1b5e02935ac4323742c65459fd.tar.bz2
Fix issue #6381224: Initial emulator boot fails and shows a blank black screen.
Make sure that all cases where we remove an activity from the history stack, we call resumeTopActivityLocked() to cause the home activity to be launched if the stack is now empty. Also fixed a problem where some timeouts would not be removed when destroying an activity, and a race condition in boot that would cause the PhoneWindowManager to initially start out with the home key not working. Bug: 6381224 Change-Id: If046bb01aed624b0d9ee3bbaaba68ed6b98fd1d0
Diffstat (limited to 'policy')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java63
1 files changed, 45 insertions, 18 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 756a3df..6b24da3 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -279,6 +279,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
WindowManagerFuncs mWindowManagerFuncs;
LocalPowerManager mPowerManager;
IStatusBarService mStatusBarService;
+ final Object mServiceAquireLock = new Object();
Vibrator mVibrator; // Vibrator for giving feedback of orientation changes
SearchManager mSearchManager;
@@ -597,6 +598,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
MyOrientationListener mOrientationListener;
+ IStatusBarService getStatusBarService() {
+ synchronized (mServiceAquireLock) {
+ if (mStatusBarService == null) {
+ mStatusBarService = IStatusBarService.Stub.asInterface(
+ ServiceManager.getService("statusbar"));
+ }
+ return mStatusBarService;
+ }
+ }
+
/*
* We always let the sensor be switched on by default except when
* the user has explicitly disabled sensor based rotation or when the
@@ -790,9 +801,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS);
} else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
try {
- mStatusBarService.toggleRecentApps();
+ IStatusBarService statusbar = getStatusBarService();
+ if (statusbar != null) {
+ statusbar.toggleRecentApps();
+ }
} catch (RemoteException e) {
Slog.e(TAG, "RemoteException when showing recent apps", e);
+ // re-acquire status bar service next time it is needed.
+ mStatusBarService = null;
}
}
}
@@ -1751,9 +1767,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mHomeLongPressed = false;
if (!homeWasLongPressed) {
try {
- mStatusBarService.cancelPreloadRecentApps();
+ IStatusBarService statusbar = getStatusBarService();
+ if (statusbar != null) {
+ statusbar.cancelPreloadRecentApps();
+ }
} catch (RemoteException e) {
Slog.e(TAG, "RemoteException when showing recent apps", e);
+ // re-acquire status bar service next time it is needed.
+ mStatusBarService = null;
}
mHomePressed = false;
@@ -1804,9 +1825,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (down) {
if (!mHomePressed && mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
try {
- mStatusBarService.preloadRecentApps();
+ IStatusBarService statusbar = getStatusBarService();
+ if (statusbar != null) {
+ statusbar.preloadRecentApps();
+ }
} catch (RemoteException e) {
Slog.e(TAG, "RemoteException when preloading recent apps", e);
+ // re-acquire status bar service next time it is needed.
+ mStatusBarService = null;
}
}
if (repeatCount == 0) {
@@ -2901,10 +2927,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
changes |= FINISH_LAYOUT_REDO_LAYOUT;
mHandler.post(new Runnable() { public void run() {
- if (mStatusBarService != null) {
- try {
- mStatusBarService.collapse();
- } catch (RemoteException ex) {}
+ try {
+ IStatusBarService statusbar = getStatusBarService();
+ if (statusbar != null) {
+ statusbar.collapse();
+ }
+ } catch (RemoteException ex) {
+ // re-acquire status bar service next time it is needed.
+ mStatusBarService = null;
}
}});
} else if (DEBUG_LAYOUT) {
@@ -4342,18 +4372,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mFocusedApp = mFocusedWindow.getAppToken();
mHandler.post(new Runnable() {
public void run() {
- if (mStatusBarService == null) {
- mStatusBarService = IStatusBarService.Stub.asInterface(
- ServiceManager.getService("statusbar"));
- }
- if (mStatusBarService != null) {
- try {
- mStatusBarService.setSystemUiVisibility(visibility, 0xffffffff);
- mStatusBarService.topAppWindowChanged(needsMenu);
- } catch (RemoteException e) {
- // not much to be done
- mStatusBarService = null;
+ try {
+ IStatusBarService statusbar = getStatusBarService();
+ if (statusbar != null) {
+ statusbar.setSystemUiVisibility(visibility, 0xffffffff);
+ statusbar.topAppWindowChanged(needsMenu);
}
+ } catch (RemoteException e) {
+ // re-acquire status bar service next time it is needed.
+ mStatusBarService = null;
}
}
});