diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-12-21 12:16:51 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-12-21 15:31:05 -0800 |
commit | 0874372554523a02c3a210fca46107fc4b2c6bef (patch) | |
tree | 36d16415577c02d8077df912d9311fddbfeea630 /policy/com | |
parent | c0888c34bca73b9dcf0e885656b282ad60dc10ef (diff) | |
download | frameworks_base-0874372554523a02c3a210fca46107fc4b2c6bef.zip frameworks_base-0874372554523a02c3a210fca46107fc4b2c6bef.tar.gz frameworks_base-0874372554523a02c3a210fca46107fc4b2c6bef.tar.bz2 |
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.
Diffstat (limited to 'policy/com')
-rwxr-xr-x | policy/com/android/internal/policy/impl/PhoneWindowManager.java | 46 |
1 files changed, 43 insertions, 3 deletions
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.view.animation.AnimationUtils; 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mSafeMode; WindowState mStatusBar = null; + final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>(); WindowState mKeyguard = null; KeyguardViewMediator mKeyguardMediator; GlobalActions mGlobalActions; @@ -881,6 +884,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else if (mKeyguard == win) { mKeyguard = null; + } else { + mStatusBarPanels.remove(win); } } @@ -1436,7 +1444,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { }); } } 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** {@inheritDoc} */ + public boolean isScreenOn() { + return mScreenOn; + } + + /** {@inheritDoc} */ public void enableKeyguard(boolean enabled) { mKeyguardMediator.setKeyguardEnabled(enabled); } |