diff --git a/policy/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/com/android/internal/policy/impl/KeyguardViewBase.java index f67f6a9773e4a..2b44d45b1cb35 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewBase.java @@ -142,7 +142,7 @@ public abstract class KeyguardViewBase extends FrameLayout { final int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { - case KeyEvent.KEYCODE_PLAYPAUSE: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: /* Suppress PLAYPAUSE toggle when phone is ringing or * in-call to avoid music playback */ if (mTelephonyManager == null) { @@ -154,11 +154,11 @@ public abstract class KeyguardViewBase extends FrameLayout { return true; // suppress key event } case KeyEvent.KEYCODE_HEADSETHOOK: - case KeyEvent.KEYCODE_STOP: - case KeyEvent.KEYCODE_NEXTSONG: - case KeyEvent.KEYCODE_PREVIOUSSONG: - case KeyEvent.KEYCODE_REWIND: - case KeyEvent.KEYCODE_FORWARD: { + case KeyEvent.KEYCODE_MEDIA_STOP: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + case KeyEvent.KEYCODE_MEDIA_REWIND: + case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: { Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); getContext().sendOrderedBroadcast(intent, null); @@ -190,12 +190,12 @@ public abstract class KeyguardViewBase extends FrameLayout { switch (keyCode) { 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: { + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_MEDIA_STOP: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + case KeyEvent.KEYCODE_MEDIA_REWIND: + case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: { Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); getContext().sendOrderedBroadcast(intent, null); diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java index 71acef90aa83b..a032cb1c6a63d 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -676,12 +676,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback, case KeyEvent.KEYCODE_VOLUME_DOWN: 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: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_MEDIA_STOP: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + case KeyEvent.KEYCODE_MEDIA_REWIND: + case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: case KeyEvent.KEYCODE_CAMERA: return false; } diff --git a/policy/com/android/internal/policy/impl/PhoneWindow.java b/policy/com/android/internal/policy/impl/PhoneWindow.java index 8d9a733335847..da922751b4485 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/com/android/internal/policy/impl/PhoneWindow.java @@ -1230,7 +1230,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } - case KeyEvent.KEYCODE_PLAYPAUSE: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: /* Suppress PLAYPAUSE toggle when phone is ringing or in-call * to avoid music playback */ if (mTelephonyManager == null) { @@ -1243,11 +1243,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } case KeyEvent.KEYCODE_MUTE: case KeyEvent.KEYCODE_HEADSETHOOK: - case KeyEvent.KEYCODE_STOP: - case KeyEvent.KEYCODE_NEXTSONG: - case KeyEvent.KEYCODE_PREVIOUSSONG: - case KeyEvent.KEYCODE_REWIND: - case KeyEvent.KEYCODE_FORWARD: { + case KeyEvent.KEYCODE_MEDIA_STOP: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + case KeyEvent.KEYCODE_MEDIA_REWIND: + case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: { Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); getContext().sendOrderedBroadcast(intent, null); @@ -1370,12 +1370,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } 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: { + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_MEDIA_STOP: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + case KeyEvent.KEYCODE_MEDIA_REWIND: + case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: { Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, event); getContext().sendOrderedBroadcast(intent, null); diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index bf0f81518c115..21c3267c1e91b 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -245,6 +245,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void update() { ContentResolver resolver = mContext.getContentResolver(); + boolean updateRotation = false; synchronized (mLock) { mEndcallBehavior = Settings.System.getInt(resolver, Settings.System.END_BUTTON_BEHAVIOR, DEFAULT_ENDCALL_BEHAVIOR); @@ -261,9 +262,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean hasSoftInput = imId != null && imId.length() > 0; if (mHasSoftInput != hasSoftInput) { mHasSoftInput = hasSoftInput; - updateRotation(0); + updateRotation = true; } } + if (updateRotation) { + updateRotation(0); + } } } @@ -981,6 +985,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDockBottom = mContentBottom = mCurBottom = displayHeight; mDockLayer = 0x10000000; + mTopFullscreenOpaqueWindowState = null; + mForceStatusBar = false; + // decide where the status bar goes ahead of time if (mStatusBar != null) { final Rect pf = mTmpParentFrame; @@ -1052,7 +1059,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** {@inheritDoc} */ - public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached) { + public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, + WindowState attached) { // we've already done the status bar if (win == mStatusBar) { return; @@ -1176,6 +1184,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { win.computeFrameLw(pf, df, cf, vf); + 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, false, false)) { + if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win); + mTopFullscreenOpaqueWindowState = win; + } + } + // Dock windows carve out the bottom of the screen, so normal windows // can't appear underneath them. if (attrs.type == TYPE_INPUT_METHOD && !win.getGivenInsetsPendingLw()) { @@ -1196,39 +1216,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** {@inheritDoc} */ - public void finishLayoutLw() { - } - - /** {@inheritDoc} */ - public void beginAnimationLw(int displayWidth, int displayHeight) { - mTopFullscreenOpaqueWindowState = null; - mForceStatusBar = false; - } - - /** {@inheritDoc} */ - public void animatingWindowLw(WindowState win, - WindowManager.LayoutParams attrs) { - 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; - } - } - } - - /** {@inheritDoc} */ - public boolean finishAnimationLw() { + public boolean finishLayoutLw() { boolean changed = false; boolean hiding = false; if (mStatusBar != null) { //Log.i(TAG, "force=" + mForceStatusBar // + " top=" + mTopFullscreenOpaqueWindowState); if (mForceStatusBar) { + if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar"); changed |= mStatusBar.showLw(true); } else if (mTopFullscreenOpaqueWindowState != null) { //Log.i(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw() @@ -1239,9 +1234,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean hideStatusBar = (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; if (hideStatusBar) { + if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar"); changed |= mStatusBar.hideLw(true); hiding = true; } else { + if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar"); changed |= mStatusBar.showLw(true); } } @@ -1261,6 +1258,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { return changed; } + /** {@inheritDoc} */ + public void beginAnimationLw(int displayWidth, int displayHeight) { + } + + /** {@inheritDoc} */ + public void animatingWindowLw(WindowState win, + WindowManager.LayoutParams attrs) { + } + + /** {@inheritDoc} */ + public boolean finishAnimationLw() { + return false; + } + /** {@inheritDoc} */ public boolean preprocessInputEventTq(RawInputEvent event) { switch (event.type) { @@ -1374,12 +1385,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { static boolean isMediaKey(int code) { if (code == KeyEvent.KEYCODE_HEADSETHOOK || - code == KeyEvent.KEYCODE_PLAYPAUSE || - code == KeyEvent.KEYCODE_STOP || - code == KeyEvent.KEYCODE_NEXTSONG || - code == KeyEvent.KEYCODE_PREVIOUSSONG || - code == KeyEvent.KEYCODE_PREVIOUSSONG || - code == KeyEvent.KEYCODE_FORWARD) { + code == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || + code == KeyEvent.KEYCODE_MEDIA_STOP || + code == KeyEvent.KEYCODE_MEDIA_NEXT || + code == KeyEvent.KEYCODE_MEDIA_PREVIOUS || + code == KeyEvent.KEYCODE_MEDIA_PREVIOUS || + code == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) { return true; } return false;