Don't perform app transition if app is not currently visible.
Tell the window manager if we are not visible due to the lock screen
or status bar.
diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
index 1dcec65..d692a1d 100755
--- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -100,6 +100,8 @@
import android.media.IAudioService;
import android.media.AudioManager;
+import java.util.ArrayList;
+
/**
* WindowManagerPolicy implementation for the Android phone UI. This
* introduces a new method suffix, Lp, for an internal lock of the
@@ -181,6 +183,7 @@
boolean mSafeMode;
WindowState mStatusBar = null;
+ final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>();
WindowState mKeyguard = null;
KeyguardViewMediator mKeyguardMediator;
GlobalActions mGlobalActions;
@@ -881,6 +884,9 @@
}
mStatusBar = win;
break;
+ case TYPE_STATUS_BAR_PANEL:
+ mStatusBarPanels.add(win);
+ break;
case TYPE_KEYGUARD:
if (mKeyguard != null) {
return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
@@ -898,6 +904,8 @@
}
else if (mKeyguard == win) {
mKeyguard = null;
+ } else {
+ mStatusBarPanels.remove(win);
}
}
@@ -1436,7 +1444,7 @@
if (mKeyguard != null) {
if (localLOGV) Log.v(TAG, "finishLayoutLw::mHideKeyguard="+mHideLockScreen);
if (mDismissKeyguard && !mKeyguardMediator.isSecure()) {
- if (mKeyguard.hideLw(false)) {
+ if (mKeyguard.hideLw(true)) {
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
| FINISH_LAYOUT_REDO_WALLPAPER;
@@ -1449,14 +1457,14 @@
});
}
} else if (mHideLockScreen) {
- if (mKeyguard.hideLw(false)) {
+ if (mKeyguard.hideLw(true)) {
mKeyguardMediator.setHidden(true);
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
| FINISH_LAYOUT_REDO_WALLPAPER;
}
} else {
- if (mKeyguard.showLw(false)) {
+ if (mKeyguard.showLw(true)) {
mKeyguardMediator.setHidden(false);
changes |= FINISH_LAYOUT_REDO_LAYOUT
| FINISH_LAYOUT_REDO_CONFIG
@@ -1493,6 +1501,33 @@
return false;
}
+ public boolean allowAppAnimationsLw() {
+ if (mKeyguard != null && mKeyguard.isVisibleLw()) {
+ // If keyguard is currently visible, no reason to animate
+ // behind it.
+ return false;
+ }
+ if (mStatusBar != null && mStatusBar.isVisibleLw()) {
+ Rect rect = new Rect(mStatusBar.getShownFrameLw());
+ for (int i=mStatusBarPanels.size()-1; i>=0; i--) {
+ WindowState w = mStatusBarPanels.get(i);
+ if (w.isVisibleLw()) {
+ rect.union(w.getShownFrameLw());
+ }
+ }
+ final int insetw = mW/10;
+ final int inseth = mH/10;
+ if (rect.contains(insetw, inseth, mW-insetw, mH-inseth)) {
+ // All of the status bar windows put together cover the
+ // screen, so the app can't be seen. (Note this test doesn't
+ // work if the rects of these windows are at off offsets or
+ // sizes, causing gaps in the rect union we have computed.)
+ return false;
+ }
+ }
+ return true;
+ }
+
/** {@inheritDoc} */
public boolean preprocessInputEventTq(RawInputEvent event) {
switch (event.type) {
@@ -1925,6 +1960,11 @@
}
/** {@inheritDoc} */
+ public boolean isScreenOn() {
+ return mScreenOn;
+ }
+
+ /** {@inheritDoc} */
public void enableKeyguard(boolean enabled) {
mKeyguardMediator.setKeyguardEnabled(enabled);
}