diff options
author | Joe Onorato <joeo@google.com> | 2010-09-10 10:30:46 -0400 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-09-12 13:25:06 -0400 |
commit | 9305647eb61bb60a1f42481a0c0d208dc9bbe965 (patch) | |
tree | e778597b64e7f72131ffcdcbdc18ac9311b4c525 /policy/src | |
parent | 5af8c63e487841db70314d7d512e6bafddcbb149 (diff) | |
download | frameworks_base-9305647eb61bb60a1f42481a0c0d208dc9bbe965.zip frameworks_base-9305647eb61bb60a1f42481a0c0d208dc9bbe965.tar.gz frameworks_base-9305647eb61bb60a1f42481a0c0d208dc9bbe965.tar.bz2 |
Plumb lights out mode through from the window manager to the status bar running in the system ui process.
Lights out mode itself isn't implemented.
Change-Id: Ieeef0eb9ae5be23000f770e74e8ee66472f4c673
Diffstat (limited to 'policy/src')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 6e5db2b..7009c65 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -177,6 +177,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Context mContext; IWindowManager mWindowManager; LocalPowerManager mPowerManager; + IStatusBarService mStatusBarService; Vibrator mVibrator; // Vibrator for giving feedback of orientation changes // Vibrator pattern for haptic feedback of a long press. @@ -263,6 +264,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final Rect mTmpVisibleFrame = new Rect(); WindowState mTopFullscreenOpaqueWindowState; + boolean mTopIsFullscreen; boolean mForceStatusBar; boolean mHideLockScreen; boolean mDismissKeyguard; @@ -1555,8 +1557,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public int finishAnimationLw() { int changes = 0; - - boolean hiding = false; + + boolean topIsFullscreen = false; if (mStatusBar != null) { if (localLOGV) Log.i(TAG, "force=" + mForceStatusBar + " top=" + mTopFullscreenOpaqueWindowState); @@ -1564,18 +1566,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar"); if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT; } else if (mTopFullscreenOpaqueWindowState != null) { - //Log.i(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw() - // + " shown frame: " + mTopFullscreenOpaqueWindowState.getShownFrameLw()); - //Log.i(TAG, "attr: " + mTopFullscreenOpaqueWindowState.getAttrs()); - WindowManager.LayoutParams lp = - mTopFullscreenOpaqueWindowState.getAttrs(); - boolean hideStatusBar = - (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; - if (hideStatusBar) { + final WindowManager.LayoutParams lp = mTopFullscreenOpaqueWindowState.getAttrs(); + if (localLOGV) { + Log.d(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw() + + " shown frame: " + mTopFullscreenOpaqueWindowState.getShownFrameLw()); + Log.d(TAG, "attr: " + mTopFullscreenOpaqueWindowState.getAttrs() + + " lp.flags=0x" + Integer.toHexString(lp.flags)); + } + topIsFullscreen = (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; + // The subtle difference between the window for mTopFullscreenOpaqueWindowState + // and mTopIsFullscreen is that that mTopIsFullscreen is set only if the window + // has the FLAG_FULLSCREEN set. Not sure if there is another way that to be the + // case though. + if (topIsFullscreen) { if (mStatusBarCanHide) { if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar"); if (mStatusBar.hideLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT; - hiding = true; } else if (localLOGV) { Log.v(TAG, "Preventing status bar from hiding by policy"); } @@ -1586,21 +1592,36 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - if (changes != 0 && hiding) { - IStatusBarService sbs = IStatusBarService.Stub.asInterface(ServiceManager.getService("statusbar")); - if (sbs != null) { - try { - // Make sure the window shade is hidden. - sbs.collapse(); - } catch (RemoteException e) { - } - } + if (topIsFullscreen != mTopIsFullscreen) { + final boolean topIsFullscreenF = topIsFullscreen; + mTopIsFullscreen = topIsFullscreen; + mHandler.post(new Runnable() { + public void run() { + if (mStatusBarService == null) { + // This is the one that can not go away, but it doesn't come up + // before the window manager does, so don't fail if it doesn't + // exist. This works as long as no fullscreen windows come up + // before the status bar service does. + mStatusBarService = IStatusBarService.Stub.asInterface( + ServiceManager.getService("statusbar")); + } + final IStatusBarService sbs = mStatusBarService; + if (mStatusBarService != null) { + try { + sbs.setActiveWindowIsFullscreen(topIsFullscreenF); + } catch (RemoteException e) { + // This should be impossible because we're in the same process. + mStatusBarService = null; + } + } + } + }); } // Hide the key guard if a visible window explicitly specifies that it wants to be displayed // when the screen is locked if (mKeyguard != null) { - if (localLOGV) Log.v(TAG, "finishLayoutLw::mHideKeyguard="+mHideLockScreen); + if (localLOGV) Log.v(TAG, "finishAnimationLw::mHideKeyguard="+mHideLockScreen); if (mDismissKeyguard && !mKeyguardMediator.isSecure()) { if (mKeyguard.hideLw(true)) { changes |= FINISH_LAYOUT_REDO_LAYOUT |