From e1e5e408a44f3dd7783f4795acdfb20646e8e605 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Fri, 20 Feb 2009 07:38:32 -0800 Subject: [PATCH] auto import from //branches/cupcake/...@132569 --- .../policy/impl/KeyguardViewBase.java | 1 + .../policy/impl/KeyguardViewManager.java | 5 +- .../policy/impl/KeyguardViewMediator.java | 1 + .../internal/policy/impl/PhoneWindow.java | 13 ++--- .../policy/impl/PhoneWindowManager.java | 50 +++++++++++-------- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/com/android/internal/policy/impl/KeyguardViewBase.java index 5a3ebdee1be49..a565808e76c9b 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewBase.java @@ -167,6 +167,7 @@ public abstract class KeyguardViewBase extends FrameLayout { } } else if (event.getAction() == KeyEvent.ACTION_UP) { switch (keyCode) { + case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_PLAYPAUSE: case KeyEvent.KEYCODE_STOP: diff --git a/policy/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/com/android/internal/policy/impl/KeyguardViewManager.java index 567c9122e3803..297d62f4a4bf8 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewManager.java @@ -100,10 +100,9 @@ public class KeyguardViewManager implements KeyguardWindowController { mKeyguardHost = new KeyguardViewHost(mContext, mCallback); final int stretch = ViewGroup.LayoutParams.FILL_PARENT; - int flags = WindowManager.LayoutParams.FLAG_DITHER + int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN /*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN - | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ - | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN; + | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ; if (!mNeedsInput) { flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java index 2431ffe8075da..e7366c2a72d6c 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -641,6 +641,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: + case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_PLAYPAUSE: case KeyEvent.KEYCODE_STOP: diff --git a/policy/com/android/internal/policy/impl/PhoneWindow.java b/policy/com/android/internal/policy/impl/PhoneWindow.java index 4ae74004cac0d..9fa59e48f9a99 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/com/android/internal/policy/impl/PhoneWindow.java @@ -1163,12 +1163,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return true; } - case KeyEvent.KEYCODE_HEADSETHOOK: - case KeyEvent.KEYCODE_PLAYPAUSE: - case KeyEvent.KEYCODE_STOP: - case KeyEvent.KEYCODE_NEXTSONG: - case KeyEvent.KEYCODE_PREVIOUSSONG: - case KeyEvent.KEYCODE_REWIND: + case KeyEvent.KEYCODE_MUTE: + case KeyEvent.KEYCODE_HEADSETHOOK: + case KeyEvent.KEYCODE_PLAYPAUSE: + case KeyEvent.KEYCODE_STOP: + case KeyEvent.KEYCODE_NEXTSONG: + case KeyEvent.KEYCODE_PREVIOUSSONG: + case KeyEvent.KEYCODE_REWIND: case KeyEvent.KEYCODE_FORWARD: { Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 7b1819df3d73f..0fa8ff57f9d30 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -344,6 +344,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { * screen turning on and current app has nosensor based orientation, do nothing */ void updateOrientationListener() { + if (!mOrientationListener.canDetectOrientation()) { + // If sensor is turned off or nonexistent for some reason + return; + } //Could have been invoked due to screen turning on or off or //change of the currently visible window's orientation if(localLOGV) Log.i(TAG, "Screen status="+mScreenOn+ @@ -1206,15 +1210,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void animatingWindowLw(WindowState win, WindowManager.LayoutParams attrs) { - if (mTopFullscreenOpaqueWindowState == null - && attrs.type >= FIRST_APPLICATION_WINDOW - && attrs.type <= LAST_APPLICATION_WINDOW - && win.fillsScreenLw(mW, mH, true) - && win.isVisibleLw()) { - mTopFullscreenOpaqueWindowState = win; - } else if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0 - && win.isVisibleLw()) { - mForceStatusBar = true; + if (win.isVisibleLw()) { + if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) { + mForceStatusBar = true; + } else if (mTopFullscreenOpaqueWindowState == null + && attrs.type >= FIRST_APPLICATION_WINDOW + && attrs.type <= LAST_APPLICATION_WINDOW + && win.fillsScreenLw(mW, mH, true, false) + && win.isVisibleLw()) { + mTopFullscreenOpaqueWindowState = win; + } } } @@ -1222,21 +1227,26 @@ public class PhoneWindowManager implements WindowManagerPolicy { public boolean finishAnimationLw() { boolean changed = false; if (mStatusBar != null) { + //Log.i(TAG, "force=" + mForceStatusBar + // + " top=" + mTopFullscreenOpaqueWindowState); if (mForceStatusBar) { changed |= mStatusBar.showLw(true); } else if (mTopFullscreenOpaqueWindowState != null) { - WindowManager.LayoutParams lp = - mTopFullscreenOpaqueWindowState.getAttrs(); - boolean hideStatusBar = - (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; - if (hideStatusBar) { - changed |= mStatusBar.hideLw(true); - } else { - changed |= mStatusBar.showLw(true); - } - } + //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) { + changed |= mStatusBar.hideLw(true); + } else { + changed |= mStatusBar.showLw(true); + } + } } - return changed; + return changed; } /** {@inheritDoc} */