From ad2973418253cf489a8f94d008ca2e82cfb6576c Mon Sep 17 00:00:00 2001 From: Karl Rosaen <> Date: Tue, 24 Mar 2009 18:55:19 -0700 Subject: [PATCH 01/10] Automated import from //branches/donutburger/...@140911,140911 --- .../android/internal/policy/impl/KeyguardViewBase.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/policy/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/com/android/internal/policy/impl/KeyguardViewBase.java index 975c820d7bca5..f67f6a9773e4a 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewBase.java @@ -22,7 +22,9 @@ import android.media.AudioManager; import android.telephony.TelephonyManager; import android.view.KeyEvent; import android.view.View; +import android.view.Gravity; import android.widget.FrameLayout; +import android.util.AttributeSet; /** * Base class for keyguard views. {@link #reset} is where you should @@ -41,6 +43,13 @@ public abstract class KeyguardViewBase extends FrameLayout { public KeyguardViewBase(Context context) { super(context); + + // drop shadow below status bar in keyguard too + mForegroundInPadding = false; + setForegroundGravity(Gravity.FILL_HORIZONTAL | Gravity.TOP); + setForeground( + context.getResources().getDrawable( + com.android.internal.R.drawable.title_bar_shadow)); } // used to inject callback From 7448901deed5885df11ffb9fdc29e5d3c07b1418 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 24 Mar 2009 20:50:09 -0700 Subject: [PATCH 02/10] Automated import from //branches/donutburger/...@141746,141746 --- .../android/internal/policy/impl/PhoneWindowManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 5ea73bde9f5c1..c6c053e0e4259 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1615,9 +1615,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void screenTurnedOff(int why) { + EventLog.writeEvent(70000, 0); + mKeyguardMediator.onScreenTurnedOff(why); synchronized (mLock) { - EventLog.writeEvent(70000, 0); - mKeyguardMediator.onScreenTurnedOff(why); mScreenOn = false; updateOrientationListenerLp(); } @@ -1625,9 +1625,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void screenTurnedOn() { + EventLog.writeEvent(70000, 1); + mKeyguardMediator.onScreenTurnedOn(); synchronized (mLock) { - EventLog.writeEvent(70000, 1); - mKeyguardMediator.onScreenTurnedOn(); mScreenOn = true; updateOrientationListenerLp(); } From a9e1b169adb1c59f0971e980ec86ea73e61ba7cb Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu <> Date: Tue, 24 Mar 2009 22:24:47 -0700 Subject: [PATCH 03/10] Automated import from //branches/donutburger/...@142291,142291 --- .../internal/policy/impl/PhoneWindowManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index c6c053e0e4259..8334a0c6e273b 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -296,13 +296,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { return false; } + /* + * We always let the sensor be switched on by default except when + * the user has explicitly disabled sensor based rotation or when the + * screen is switched off. + */ boolean needSensorRunningLp() { if (mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) { // If the application has explicitly requested to follow the // orientation, then we need to turn the sensor or. return true; } - if (mAccelerometerDefault != 0) { + if (mAccelerometerDefault == 0) { // If the setting for using the sensor by default is enabled, then // we will always leave it on. Note that the user could go to // a window that forces an orientation that does not use the @@ -311,9 +316,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // orientation for a little bit, which can cause orientation // changes to lag, so we'd like to keep it always on. (It will // still be turned off when the screen is off.) - return true; + return false; } - return false; + return true; } /* From ab1000856df7108236919ec4ab0f7ba17c445986 Mon Sep 17 00:00:00 2001 From: Karl Rosaen <> Date: Tue, 24 Mar 2009 22:35:17 -0700 Subject: [PATCH 04/10] Automated import from //branches/donutburger/...@142361,142361 --- .../policy/impl/KeyguardViewMediator.java | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java index ead1348612fb1..71acef90aa83b 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -16,11 +16,14 @@ package com.android.internal.policy.impl; +import com.android.internal.telephony.SimCard; +import com.android.internal.widget.LockPatternUtils; + import android.app.AlarmManager; import android.app.PendingIntent; import android.app.StatusBarManager; -import static android.app.StatusBarManager.DISABLE_NONE; import static android.app.StatusBarManager.DISABLE_EXPAND; +import static android.app.StatusBarManager.DISABLE_NONE; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -30,15 +33,13 @@ import android.os.LocalPowerManager; import android.os.Message; import android.os.PowerManager; import android.os.SystemClock; +import android.telephony.TelephonyManager; import android.util.Config; -import android.util.Log; import android.util.EventLog; +import android.util.Log; import android.view.KeyEvent; import android.view.WindowManagerImpl; import android.view.WindowManagerPolicy; -import com.android.internal.telephony.SimCard; -import com.android.internal.telephony.TelephonyIntents; -import com.android.internal.widget.LockPatternUtils; /** * Mediates requests related to the keyguard. This includes queries about the @@ -203,6 +204,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback, private boolean mKeyboardOpen = false; + private boolean mScreenOn = false; + /** * we send this intent when the keyguard is dismissed. */ @@ -232,8 +235,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, IntentFilter filter = new IntentFilter(); filter.addAction(DELAYED_KEYGUARD_ACTION); - filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); + filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); context.registerReceiver(mBroadCastReceiver, filter); mAlarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); @@ -274,6 +276,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ public void onScreenTurnedOff(int why) { synchronized (this) { + mScreenOn = false; if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")"); if (mExitSecureCallback != null) { @@ -310,6 +313,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ public void onScreenTurnedOn() { synchronized (this) { + mScreenOn = true; mDelayedShowingSequence++; if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence); notifyScreenOnLocked(); @@ -436,6 +440,16 @@ public class KeyguardViewMediator implements KeyguardViewCallback, // if another app is disabling us, don't show if (!mExternallyEnabled) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled"); + + // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes + // for an occasional ugly flicker in this situation: + // 1) receive a call with the screen on (no keyguard) or make a call + // 2) screen times out + // 3) user hits key to turn screen back on + // instead, we reenable the keyguard when we know the screen is off and the call + // ends (see the broadcast receiver below) + // TODO: clean this up when we have better support at the window manager level + // for apps that wish to be on top of the keyguard return; } @@ -612,6 +626,19 @@ public class KeyguardViewMediator implements KeyguardViewCallback, if (mDelayedShowingSequence == sequence) { doKeyguard(); } + } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action) + && TelephonyManager.EXTRA_STATE_IDLE.equals(intent.getStringExtra( + TelephonyManager.EXTRA_STATE)) // call ending + && !mScreenOn // screen off + && mExternallyEnabled) { // not disabled by any app + + // note: this is a way to gracefully reenable the keyguard when the call + // ends and the screen is off without always reenabling the keyguard + // each time the screen turns off while in call (and having an occasional ugly + // flicker while turning back on the screen and disabling the keyguard again). + if (DEBUG) Log.d(TAG, "screen is off and call ended, let's make sure the " + + "keyguard is showing"); + doKeyguard(); } } }; From 03759ed36d0a56ae8dbdccf8e1f6c8e3d14165b7 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Fri, 27 Mar 2009 16:04:08 -0700 Subject: [PATCH 05/10] AI 143169: am: CL 142870 Fix issue #1724917 (Applications (browser, maps, gmail) fail to retain their landscape state after coming out of sleep mode). We now rely on the listeners last known orientation, and make sure to clear it when enabling/disabling. Also do most of the work for issue #1732012 (Only show screen rotation animation when triggered by sensor). This just needs to be hooked up to the surface flinger API when that appears. Original author: hackbod Merged from: //branches/cupcake/... Automated import of CL 143169 --- .../policy/impl/PhoneWindowManager.java | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 8334a0c6e273b..d8009e778fbe6 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -166,7 +166,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { Handler mHandler; boolean mLidOpen; - int mSensorRotation = -1; boolean mScreenOn = false; boolean mOrientationSensorEnabled = false; int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; @@ -207,6 +206,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final int ENDCALL_SLEEPS = 0x2; static final int DEFAULT_ENDCALL_BEHAVIOR = ENDCALL_SLEEPS; int mEndcallBehavior; + + // Nothing to see here, move along... + int mFancyRotationAnimation; ShortcutManager mShortcutManager; PowerManager.WakeLock mBroadcastWakeLock; @@ -226,13 +228,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { Settings.System.ACCELEROMETER_ROTATION), false, this); resolver.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.DEFAULT_INPUT_METHOD), false, this); + resolver.registerContentObserver(Settings.System.getUriFor( + "fancy_rotation_anim"), false, this); update(); } @Override public void onChange(boolean selfChange) { update(); try { - mWindowManager.setRotation(USE_LAST_ROTATION, false); + mWindowManager.setRotation(USE_LAST_ROTATION, false, 1); } catch (RemoteException e) { // Ignore } @@ -243,6 +247,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { synchronized (mLock) { mEndcallBehavior = Settings.System.getInt(resolver, Settings.System.END_BUTTON_BEHAVIOR, DEFAULT_ENDCALL_BEHAVIOR); + mFancyRotationAnimation = Settings.System.getInt(resolver, + "fancy_rotation_animation", 0); int accelerometerDefault = Settings.System.getInt(resolver, Settings.System.ACCELEROMETER_ROTATION, DEFAULT_ACCELEROMETER_ROTATION); if (mAccelerometerDefault != accelerometerDefault) { @@ -254,7 +260,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean hasSoftInput = imId != null && imId.length() > 0; if (mHasSoftInput != hasSoftInput) { mHasSoftInput = hasSoftInput; - updateRotation(); + updateRotation(1); } } } @@ -268,29 +274,23 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void onOrientationChanged(int rotation) { // Send updates based on orientation value - if (rotation != mSensorRotation) { - if(localLOGV) Log.i(TAG, "onOrientationChanged, rotation changed from "+rotation+" to "+mSensorRotation); - // Update window manager. The lid rotation hasn't changed, - // but we want it to re-evaluate the final rotation in case - // it needs to call back and get the sensor orientation. - mSensorRotation = rotation; - try { - mWindowManager.setRotation(rotation, false); - } catch (RemoteException e) { - // Ignore - } + if (true) Log.i(TAG, "onOrientationChanged, rotation changed to " +rotation); + try { + mWindowManager.setRotation(rotation, false, 1); + } catch (RemoteException e) { + // Ignore } } } MyOrientationListener mOrientationListener; - boolean useSensorForOrientationLp() { - if(mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) { + boolean useSensorForOrientationLp(int appOrientation) { + if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR) { return true; } if (mAccelerometerDefault != 0 && ( - mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || - mCurrentAppOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) { + appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || + appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)) { return true; } return false; @@ -349,9 +349,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!mOrientationSensorEnabled) { mOrientationListener.enable(); if(localLOGV) Log.i(TAG, "Enabling listeners"); - // We haven't had the sensor on, so don't yet know - // the rotation. - mSensorRotation = -1; mOrientationSensorEnabled = true; } } @@ -360,7 +357,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (disable && mOrientationSensorEnabled) { mOrientationListener.disable(); if(localLOGV) Log.i(TAG, "Disabling listeners"); - mSensorRotation = -1; mOrientationSensorEnabled = false; } } @@ -1270,7 +1266,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (event.keycode == 0) { // lid changed state mLidOpen = event.value == 0; - updateRotation(); + updateRotation(0); if (keyguardIsShowingTq()) { if (mLidOpen) { // only do this if it's opening -- closing the device shouldn't turn it @@ -1700,9 +1696,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mLidOpen) { return Surface.ROTATION_90; } else { - if (useSensorForOrientationLp()) { + if (useSensorForOrientationLp(orientation)) { // If the user has enabled auto rotation by default, do it. - return mSensorRotation >= 0 ? mSensorRotation : lastRotation; + int curRotation = mOrientationListener.getCurrentRotation(); + return curRotation >= 0 ? curRotation : lastRotation; } return Surface.ROTATION_0; } @@ -1745,10 +1742,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void enableScreenAfterBoot() { readLidState(); - updateRotation(); + updateRotation(0); } - void updateRotation() { + void updateRotation(int animFlags) { mPowerManager.setKeyboardVisibility(mLidOpen); int rotation= Surface.ROTATION_0; if (mLidOpen) { @@ -1758,7 +1755,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { //if lid is closed orientation will be portrait try { //set orientation on WindowManager - mWindowManager.setRotation(rotation, true); + mWindowManager.setRotation(rotation, true, animFlags); } catch (RemoteException e) { // Ignore } From 32bc91d6f66d85137670144e1d40b069c16d3e9d Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Fri, 27 Mar 2009 16:16:03 -0700 Subject: [PATCH 06/10] AI 143173: am: CL 142879 Fix issue #1732012 (Only show screen rotation animation when triggered by sensor) -- set the new surface flag as appropriate. Original author: hackbod Merged from: //branches/cupcake/... Automated import of CL 143173 --- .../policy/impl/PhoneWindowManager.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index d8009e778fbe6..bf0f81518c115 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -236,7 +236,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void onChange(boolean selfChange) { update(); try { - mWindowManager.setRotation(USE_LAST_ROTATION, false, 1); + mWindowManager.setRotation(USE_LAST_ROTATION, false, + mFancyRotationAnimation); } catch (RemoteException e) { // Ignore } @@ -248,7 +249,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mEndcallBehavior = Settings.System.getInt(resolver, Settings.System.END_BUTTON_BEHAVIOR, DEFAULT_ENDCALL_BEHAVIOR); mFancyRotationAnimation = Settings.System.getInt(resolver, - "fancy_rotation_animation", 0); + "fancy_rotation_anim", 0) != 0 ? 0x80 : 0; int accelerometerDefault = Settings.System.getInt(resolver, Settings.System.ACCELEROMETER_ROTATION, DEFAULT_ACCELEROMETER_ROTATION); if (mAccelerometerDefault != accelerometerDefault) { @@ -260,7 +261,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean hasSoftInput = imId != null && imId.length() > 0; if (mHasSoftInput != hasSoftInput) { mHasSoftInput = hasSoftInput; - updateRotation(1); + updateRotation(0); } } } @@ -276,7 +277,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Send updates based on orientation value if (true) Log.i(TAG, "onOrientationChanged, rotation changed to " +rotation); try { - mWindowManager.setRotation(rotation, false, 1); + mWindowManager.setRotation(rotation, false, + mFancyRotationAnimation); } catch (RemoteException e) { // Ignore } @@ -1266,7 +1268,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (event.keycode == 0) { // lid changed state mLidOpen = event.value == 0; - updateRotation(0); + updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE); if (keyguardIsShowingTq()) { if (mLidOpen) { // only do this if it's opening -- closing the device shouldn't turn it @@ -1742,7 +1744,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void enableScreenAfterBoot() { readLidState(); - updateRotation(0); + updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE); } void updateRotation(int animFlags) { @@ -1755,7 +1757,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { //if lid is closed orientation will be portrait try { //set orientation on WindowManager - mWindowManager.setRotation(rotation, true, animFlags); + mWindowManager.setRotation(rotation, true, + mFancyRotationAnimation | animFlags); } catch (RemoteException e) { // Ignore } From ae585e83a796ddb691a7eb48026473edaddc775e Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Fri, 27 Mar 2009 20:56:50 -0700 Subject: [PATCH 07/10] AI 143414: am: CL 143413 Fix issue #1742588 (Crash phone while switching between keyboard settings and Gmail) Original author: hackbod Merged from: //branches/cupcake/... Automated import of CL 143414 --- .../android/internal/policy/impl/PhoneWindowManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index bf0f81518c115..cc0588d9dda9b 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); + } } } From 0ecadf71e084208a5c92420e10bdfc69b40ec160 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 31 Mar 2009 18:00:37 -0700 Subject: [PATCH 08/10] AI 143899: am: CL 143896 Fix issue #1748954 and #1737952: #1748954 (New status bar fades into all white background): FrameLayout wasn't updating its foreground drawable when its padding changed, which would happen as the status bar is shown and hidden. To fix this I also ended up fixing a problem in the view debug stuff where we couldn't get a bitmap for a view that is the full screen size because it is too big... actually I just went ahead and added another function to snapshot the view hierarchy which works a lot better for us anyway. #1737952 (Home screen icons overlap with the notification bar after exiting any camera app): Originally I punted this because it only happened in rare situations, but now that home is always portrait it happens a lot more so it is more important to fix. This involved a few things to clean up hiding/showing the status bar: - We now determine when to hide and show it during layout, which allows us to do this at the time it is actually needed rather than during animation after we can actually catch it for the initial display of a window. This required tweaking the layout API so the policy can request a second layout pass if needed. - When doing layout, we are now much more aggressive about skipping the layout of windows. Basically anything that we know will be hidden in the near future is ignored for layout, so that it doesn't glitch as it is transfered out of the screen. The theory being that it is better to leave it as it was originally placed while we are transitioning it out, than to switch it to something slightly more correct. Original author: hackbod Merged from: //branches/cupcake/... Automated import of CL 143899 --- .../policy/impl/PhoneWindowManager.java | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index cc0588d9dda9b..95dda57eb1adb 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -985,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; @@ -1056,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; @@ -1180,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()) { @@ -1200,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() @@ -1243,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); } } @@ -1265,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) { From 37c124c3fa3078af98c0ebd3e52c9a4ca477a767 Mon Sep 17 00:00:00 2001 From: Wink Saville <> Date: Thu, 2 Apr 2009 01:37:02 -0700 Subject: [PATCH 09/10] AI 144185: Integrate cdma into the main code base. Automated import of CL 144185 --- .../policy/impl/KeyguardUpdateMonitor.java | 53 ++++++++++--------- .../policy/impl/KeyguardViewMediator.java | 27 +++++----- .../policy/impl/LockPatternKeyguardView.java | 26 ++++----- .../LockPatternKeyguardViewProperties.java | 8 +-- .../internal/policy/impl/LockScreen.java | 32 +++++------ .../policy/impl/PhoneWindowManager.java | 2 + 6 files changed, 79 insertions(+), 69 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index 3a25d38d9ef6a..eb25a092b3ef9 100644 --- a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -34,7 +34,7 @@ import static android.provider.Telephony.Intents.EXTRA_SHOW_PLMN; import static android.provider.Telephony.Intents.EXTRA_SHOW_SPN; import static android.provider.Telephony.Intents.EXTRA_SPN; import static android.provider.Telephony.Intents.SPN_STRINGS_UPDATED_ACTION; -import com.android.internal.telephony.SimCard; +import com.android.internal.telephony.IccCard; import com.android.internal.telephony.TelephonyIntents; import android.util.Log; import com.android.internal.R; @@ -61,7 +61,7 @@ public class KeyguardUpdateMonitor { private final Context mContext; - private SimCard.State mSimState = SimCard.State.READY; + private IccCard.State mSimState = IccCard.State.READY; private boolean mInPortrait; private boolean mKeyboardOpen; @@ -94,38 +94,39 @@ public class KeyguardUpdateMonitor { /** - * When we receive a {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, and - * then pass a result via our handler to {@link KeyguardUpdateMonitor#handleSimStateChange}, + * When we receive a + * {@link com.android.internal.telephony.TelephonyIntents#ACTION_SIM_STATE_CHANGED} broadcast, + * and then pass a result via our handler to {@link KeyguardUpdateMonitor#handleSimStateChange}, * we need a single object to pass to the handler. This class helps decode * the intent and provide a {@link SimCard.State} result. */ private static class SimArgs { - public final SimCard.State simState; + public final IccCard.State simState; private SimArgs(Intent intent) { if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) { throw new IllegalArgumentException("only handles intent ACTION_SIM_STATE_CHANGED"); } - String stateExtra = intent.getStringExtra(SimCard.INTENT_KEY_SIM_STATE); - if (SimCard.INTENT_VALUE_SIM_ABSENT.equals(stateExtra)) { - this.simState = SimCard.State.ABSENT; - } else if (SimCard.INTENT_VALUE_SIM_READY.equals(stateExtra)) { - this.simState = SimCard.State.READY; - } else if (SimCard.INTENT_VALUE_SIM_LOCKED.equals(stateExtra)) { + String stateExtra = intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE); + if (IccCard.INTENT_VALUE_ICC_ABSENT.equals(stateExtra)) { + this.simState = IccCard.State.ABSENT; + } else if (IccCard.INTENT_VALUE_ICC_READY.equals(stateExtra)) { + this.simState = IccCard.State.READY; + } else if (IccCard.INTENT_VALUE_ICC_LOCKED.equals(stateExtra)) { final String lockedReason = intent - .getStringExtra(SimCard.INTENT_KEY_LOCKED_REASON); - if (SimCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { - this.simState = SimCard.State.PIN_REQUIRED; - } else if (SimCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { - this.simState = SimCard.State.PUK_REQUIRED; + .getStringExtra(IccCard.INTENT_KEY_LOCKED_REASON); + if (IccCard.INTENT_VALUE_LOCKED_ON_PIN.equals(lockedReason)) { + this.simState = IccCard.State.PIN_REQUIRED; + } else if (IccCard.INTENT_VALUE_LOCKED_ON_PUK.equals(lockedReason)) { + this.simState = IccCard.State.PUK_REQUIRED; } else { - this.simState = SimCard.State.UNKNOWN; + this.simState = IccCard.State.UNKNOWN; } - } else if (SimCard.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) { - this.simState = SimCard.State.NETWORK_LOCKED; + } else if (IccCard.INTENT_VALUE_LOCKED_NETWORK.equals(stateExtra)) { + this.simState = IccCard.State.NETWORK_LOCKED; } else { - this.simState = SimCard.State.UNKNOWN; + this.simState = IccCard.State.UNKNOWN; } } @@ -195,7 +196,7 @@ public class KeyguardUpdateMonitor { mKeyboardOpen = queryKeyboardOpen(); // take a guess to start - mSimState = SimCard.State.READY; + mSimState = IccCard.State.READY; mDevicePluggedIn = true; mBatteryLevel = 100; @@ -317,14 +318,14 @@ public class KeyguardUpdateMonitor { * Handle {@link #MSG_SIM_STATE_CHANGE} */ private void handleSimStateChange(SimArgs simArgs) { - final SimCard.State state = simArgs.simState; + final IccCard.State state = simArgs.simState; if (DEBUG) { Log.d(TAG, "handleSimStateChange: intentValue = " + simArgs + " " + "state resolved to " + state.toString()); } - if (state != SimCard.State.UNKNOWN && state != mSimState) { + if (state != IccCard.State.UNKNOWN && state != mSimState) { mSimState = state; for (int i = 0; i < mSimStateCallbacks.size(); i++) { mSimStateCallbacks.get(i).onSimStateChanged(state); @@ -461,7 +462,7 @@ public class KeyguardUpdateMonitor { * Callback to notify of sim state change. */ interface SimStateCallback { - void onSimStateChanged(SimCard.State simState); + void onSimStateChanged(IccCard.State simState); } /** @@ -489,7 +490,7 @@ public class KeyguardUpdateMonitor { mSimStateCallbacks.add(callback); } - public SimCard.State getSimState() { + public IccCard.State getSimState() { return mSimState; } @@ -499,7 +500,7 @@ public class KeyguardUpdateMonitor { * broadcast from the telephony code. */ public void reportSimPinUnlocked() { - mSimState = SimCard.State.READY; + mSimState = IccCard.State.READY; } public boolean isInPortrait() { diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java index 71acef90aa83b..99480e79d0f8b 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -16,7 +16,7 @@ package com.android.internal.policy.impl; -import com.android.internal.telephony.SimCard; +import com.android.internal.telephony.IccCard; import com.android.internal.widget.LockPatternUtils; import android.app.AlarmManager; @@ -41,6 +41,7 @@ import android.view.KeyEvent; import android.view.WindowManagerImpl; import android.view.WindowManagerPolicy; + /** * Mediates requests related to the keyguard. This includes queries about the * state of the keyguard, power management events that effect whether the keyguard @@ -89,7 +90,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback, private final static String TAG = "KeyguardViewMediator"; - private static final String DELAYED_KEYGUARD_ACTION = "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD"; + private static final String DELAYED_KEYGUARD_ACTION = + "com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD"; // used for handler messages private static final int TIMEOUT = 1; @@ -301,7 +303,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender); - if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + mDelayedShowingSequence); + if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = " + + mDelayedShowingSequence); } else { doKeyguard(); } @@ -461,8 +464,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback, // if the setup wizard hasn't run yet, don't show final boolean provisioned = mUpdateMonitor.isDeviceProvisioned(); - final SimCard.State state = mUpdateMonitor.getSimState(); - final boolean lockedOrMissing = state.isPinLocked() || (state == SimCard.State.ABSENT); + final IccCard.State state = mUpdateMonitor.getSimState(); + final boolean lockedOrMissing = state.isPinLocked() || (state == IccCard.State.ABSENT); if (!lockedOrMissing && !provisioned) { if (DEBUG) Log.d(TAG, "doKeyguard: not showing because device isn't provisioned" + " and the sim is not locked or missing"); @@ -576,7 +579,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } /** {@inheritDoc} */ - public void onSimStateChanged(SimCard.State simState) { + public void onSimStateChanged(IccCard.State simState) { if (DEBUG) Log.d(TAG, "onSimStateChanged: " + simState); switch (simState) { @@ -585,7 +588,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, // gone through setup wizard if (!mUpdateMonitor.isDeviceProvisioned()) { if (!isShowing()) { - if (DEBUG) Log.d(TAG, "INTENT_VALUE_SIM_ABSENT and keygaurd isn't showing, we need " + if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_ABSENT and keygaurd isn't showing, we need " + "to show the keyguard since the device isn't provisioned yet."); doKeyguard(); } else { @@ -596,7 +599,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback, case PIN_REQUIRED: case PUK_REQUIRED: if (!isShowing()) { - if (DEBUG) Log.d(TAG, "INTENT_VALUE_SIM_LOCKED and keygaurd isn't showing, we need " + if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't showing, we need " + "to show the keyguard so the user can enter their sim pin"); doKeyguard(); } else { @@ -759,10 +762,8 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ private Handler mHandler = new Handler() { @Override - public void handleMessage(Message msg) - { - switch (msg.what) - { + public void handleMessage(Message msg) { + switch (msg.what) { case TIMEOUT: handleTimeout(msg.arg1); return ; @@ -947,3 +948,5 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } } } + + diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java index cb3131d0e8b4e..1758deb4c5e4f 100644 --- a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -26,7 +26,7 @@ import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemProperties; -import com.android.internal.telephony.SimCard; +import com.android.internal.telephony.IccCard; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; @@ -142,7 +142,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private boolean stuckOnLockScreenBecauseSimMissing() { return mRequiresSim && (!mUpdateMonitor.isDeviceProvisioned()) - && (mUpdateMonitor.getSimState() == SimCard.State.ABSENT); + && (mUpdateMonitor.getSimState() == IccCard.State.ABSENT); } /** @@ -184,9 +184,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase { } public void goToUnlockScreen() { - final SimCard.State simState = mUpdateMonitor.getSimState(); + final IccCard.State simState = mUpdateMonitor.getSimState(); if (stuckOnLockScreenBecauseSimMissing() - || (simState == SimCard.State.PUK_REQUIRED)){ + || (simState == IccCard.State.PUK_REQUIRED)){ // stuck on lock screen when sim missing or puk'd return; } @@ -365,7 +365,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { public void wakeWhenReadyTq(int keyCode) { if (DEBUG) Log.d(TAG, "onWakeKey"); if (keyCode == KeyEvent.KEYCODE_MENU && isSecure() && (mMode == Mode.LockScreen) - && (mUpdateMonitor.getSimState() != SimCard.State.PUK_REQUIRED)) { + && (mUpdateMonitor.getSimState() != IccCard.State.PUK_REQUIRED)) { if (DEBUG) Log.d(TAG, "switching screens to unlock screen because wake key was MENU"); updateScreen(Mode.UnlockScreen); getCallback().pokeWakelock(); @@ -403,8 +403,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase { if (unlockMode == UnlockMode.Pattern) { return mLockPatternUtils.isLockPatternEnabled(); } else if (unlockMode == UnlockMode.SimPin) { - return mUpdateMonitor.getSimState() == SimCard.State.PIN_REQUIRED - || mUpdateMonitor.getSimState() == SimCard.State.PUK_REQUIRED; + return mUpdateMonitor.getSimState() == IccCard.State.PIN_REQUIRED + || mUpdateMonitor.getSimState() == IccCard.State.PUK_REQUIRED; } else if (unlockMode == UnlockMode.Account) { return true; } else { @@ -522,8 +522,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase { * the lock screen (lock or unlock). */ private Mode getInitialMode() { - final SimCard.State simState = mUpdateMonitor.getSimState(); - if (stuckOnLockScreenBecauseSimMissing() || (simState == SimCard.State.PUK_REQUIRED)) { + final IccCard.State simState = mUpdateMonitor.getSimState(); + if (stuckOnLockScreenBecauseSimMissing() || (simState == IccCard.State.PUK_REQUIRED)) { return Mode.LockScreen; } else if (mUpdateMonitor.isKeyboardOpen() && isSecure()) { return Mode.UnlockScreen; @@ -536,8 +536,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase { * Given the current state of things, what should the unlock screen be? */ private UnlockMode getUnlockMode() { - final SimCard.State simState = mUpdateMonitor.getSimState(); - if (simState == SimCard.State.PIN_REQUIRED || simState == SimCard.State.PUK_REQUIRED) { + final IccCard.State simState = mUpdateMonitor.getSimState(); + if (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED) { return UnlockMode.SimPin; } else { return mLockPatternUtils.isPermanentlyLocked() ? @@ -568,7 +568,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase { int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; String message = mContext.getString( R.string.lockscreen_failed_attempts_almost_glogin, - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, + LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET + - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, timeoutInSeconds); final AlertDialog dialog = new AlertDialog.Builder(mContext) @@ -637,3 +638,4 @@ public class LockPatternKeyguardView extends KeyguardViewBase { } } } + diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java index 4e0cf09c2ad0a..8a62cbd79c4fb 100644 --- a/policy/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java +++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java @@ -19,7 +19,7 @@ package com.android.internal.policy.impl; import com.android.internal.widget.LockPatternUtils; import android.content.Context; -import com.android.internal.telephony.SimCard; +import com.android.internal.telephony.IccCard; /** * Knows how to create a lock pattern keyguard view, and answer questions about @@ -59,9 +59,9 @@ public class LockPatternKeyguardViewProperties implements KeyguardViewProperties } private boolean isSimPinSecure() { - final SimCard.State simState = mUpdateMonitor.getSimState(); - return (simState == SimCard.State.PIN_REQUIRED || simState == SimCard.State.PUK_REQUIRED - || simState == SimCard.State.ABSENT); + final IccCard.State simState = mUpdateMonitor.getSimState(); + return (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED + || simState == IccCard.State.ABSENT); } } diff --git a/policy/com/android/internal/policy/impl/LockScreen.java b/policy/com/android/internal/policy/impl/LockScreen.java index 82a52f9ed9931..6d2b2a4dd97e7 100644 --- a/policy/com/android/internal/policy/impl/LockScreen.java +++ b/policy/com/android/internal/policy/impl/LockScreen.java @@ -29,7 +29,7 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import com.android.internal.telephony.SimCard; +import com.android.internal.telephony.IccCard; import java.util.Date; @@ -193,7 +193,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM final View view = mOnlyVisibleWhenSimNotOk[i]; view.setVisibility(View.GONE); } - refreshSimOkHeaders(mUpdateMonitor.getTelephonyPlmn(), mUpdateMonitor.getTelephonySpn()); + refreshSimOkHeaders(mUpdateMonitor.getTelephonyPlmn(), + mUpdateMonitor.getTelephonySpn()); refreshAlarmDisplay(); refreshBatteryDisplay(); } else { @@ -210,11 +211,11 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } private void refreshSimBadInfo() { - final SimCard.State simState = mUpdateMonitor.getSimState(); - if (simState == SimCard.State.PUK_REQUIRED) { + final IccCard.State simState = mUpdateMonitor.getSimState(); + if (simState == IccCard.State.PUK_REQUIRED) { mHeaderSimBad1.setText(R.string.lockscreen_sim_puk_locked_message); mHeaderSimBad2.setText(R.string.lockscreen_sim_puk_locked_instructions); - } else if (simState == SimCard.State.ABSENT) { + } else if (simState == IccCard.State.ABSENT) { mHeaderSimBad1.setText(R.string.lockscreen_missing_sim_message); mHeaderSimBad2.setVisibility(View.GONE); //mHeaderSimBad2.setText(R.string.lockscreen_missing_sim_instructions); @@ -226,7 +227,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM private void refreshUnlockIntructions() { if (mLockPatternUtils.isLockPatternEnabled() - || mUpdateMonitor.getSimState() == SimCard.State.PIN_REQUIRED) { + || mUpdateMonitor.getSimState() == IccCard.State.PIN_REQUIRED) { mLockInstructions.setText(R.string.lockscreen_instructions_when_pattern_enabled); } else { mLockInstructions.setText(R.string.lockscreen_instructions_when_pattern_disabled); @@ -293,8 +294,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } private void refreshSimOkHeaders(CharSequence plmn, CharSequence spn) { - final SimCard.State simState = mUpdateMonitor.getSimState(); - if (simState == SimCard.State.READY) { + final IccCard.State simState = mUpdateMonitor.getSimState(); + if (simState == IccCard.State.READY) { if (plmn != null) { mHeaderSimOk1.setVisibility(View.VISIBLE); mHeaderSimOk1.setText(plmn); @@ -308,22 +309,22 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM } else { mHeaderSimOk2.setVisibility(View.GONE); } - } else if (simState == SimCard.State.PIN_REQUIRED) { + } else if (simState == IccCard.State.PIN_REQUIRED) { mHeaderSimOk1.setVisibility(View.VISIBLE); mHeaderSimOk1.setText(R.string.lockscreen_sim_locked_message); mHeaderSimOk2.setVisibility(View.GONE); - } else if (simState == SimCard.State.ABSENT) { + } else if (simState == IccCard.State.ABSENT) { mHeaderSimOk1.setVisibility(View.VISIBLE); mHeaderSimOk1.setText(R.string.lockscreen_missing_sim_message_short); mHeaderSimOk2.setVisibility(View.GONE); - } else if (simState == SimCard.State.NETWORK_LOCKED) { + } else if (simState == IccCard.State.NETWORK_LOCKED) { mHeaderSimOk1.setVisibility(View.VISIBLE); mHeaderSimOk1.setText(R.string.lockscreen_network_locked_message); mHeaderSimOk2.setVisibility(View.GONE); } } - public void onSimStateChanged(SimCard.State simState) { + public void onSimStateChanged(IccCard.State simState) { mSimOk = isSimOk(simState); refreshViewsWRTSimOk(); } @@ -333,10 +334,10 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM * a special screen with the emergency call button and keep them from * doing anything else. */ - private boolean isSimOk(SimCard.State simState) { + private boolean isSimOk(IccCard.State simState) { boolean missingAndNotProvisioned = (!mUpdateMonitor.isDeviceProvisioned() - && simState == SimCard.State.ABSENT); - return !(missingAndNotProvisioned || simState == SimCard.State.PUK_REQUIRED); + && simState == IccCard.State.ABSENT); + return !(missingAndNotProvisioned || simState == IccCard.State.PUK_REQUIRED); } public void onOrientationChange(boolean inPortrait) { @@ -369,3 +370,4 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM mUpdateMonitor.removeCallback(this); } } + diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 95dda57eb1adb..10067bd48387e 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -285,6 +285,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mFancyRotationAnimation); } catch (RemoteException e) { // Ignore + } } } @@ -1831,3 +1832,4 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } + From 8b89d69a37bf417d14a170cfef1299c6d4987b24 Mon Sep 17 00:00:00 2001 From: Andy Stadler <> Date: Fri, 10 Apr 2009 16:24:49 -0700 Subject: [PATCH 10/10] AI 145778: Manual merge changes 145382-145384 from cupcake. Automated import of CL 145778 --- .../policy/impl/KeyguardViewBase.java | 24 +++++++++---------- .../policy/impl/KeyguardViewMediator.java | 12 +++++----- .../internal/policy/impl/PhoneWindow.java | 24 +++++++++---------- .../policy/impl/PhoneWindowManager.java | 12 +++++----- 4 files changed, 36 insertions(+), 36 deletions(-) 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 99480e79d0f8b..112d7b2149e8a 100644 --- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -679,12 +679,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 10067bd48387e..2a54e3dc7469d 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1386,12 +1386,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;