From aba08754228eeb07efcefdee47a9905706e4201b Mon Sep 17 00:00:00 2001 From: Rich Cannings Date: Tue, 11 Nov 2008 15:12:25 +0900 Subject: [PATCH 1/9] Fix the lock screen bypass issue reported in http://forum.xda-developers.com/showthread.php?t=436767. --- .../android/internal/policy/impl/PhoneWindowManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 250d2d40e5318..17312062960e0 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1325,11 +1325,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { // If the user is holding the menu key code, then we are // going to boot into safe mode. ActivityManagerNative.getDefault().enterSafeMode(); - } else { - // tell the keyguard - mKeyguardMediator.onSystemReady(); - android.os.SystemProperties.set("dev.bootcomplete", "1"); } + // tell the keyguard + mKeyguardMediator.onSystemReady(); + android.os.SystemProperties.set("dev.bootcomplete", "1"); } catch (RemoteException e) { // Ignore } From 871f4ce2eef7443237aa321d60a52cc011caeacf Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Thu, 15 Jan 2009 14:33:27 -0800 Subject: [PATCH 2/9] Optional provisioning This introduces an ro.requires_provisioning property, which defaults to false, such that by default the platform doesn't require any setup application to set a run-time "provisioned" bit and allows all behaviors right away (home key, lock screen, etc...). --- .../internal/policy/impl/KeyguardUpdateMonitor.java | 9 +++++++-- .../android/internal/policy/impl/PhoneWindowManager.java | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index 4671957592cca..a9f93566c6000 100644 --- a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -27,6 +27,7 @@ import static android.os.BatteryManager.BATTERY_STATUS_FULL; import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; import android.os.Handler; import android.os.Message; +import android.os.SystemProperties; import android.provider.Settings; import android.provider.Telephony; import static android.provider.Telephony.Intents.EXTRA_PLMN; @@ -160,8 +161,12 @@ public class KeyguardUpdateMonitor { } }; - mDeviceProvisioned = Settings.Secure.getInt( - mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; + if (!SystemProperties.getBoolean("ro.requires_provisioning", false)) { + mDeviceProvisioned = true; + } else { + mDeviceProvisioned = Settings.Secure.getInt( + mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; + } // Since device can't be un-provisioned, we only need to register a content observer // to update mDeviceProvisioned when we are... diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 603b2216e4183..2dcf81df7aa35 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -350,6 +350,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } boolean isDeviceProvisioned() { + if (!SystemProperties.getBoolean("ro.requires_provisioning", false)) { + return true; + } return Settings.Secure.getInt( mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; } From 572612e1c05f7640657083743f1e3ed39319d4de Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Wed, 21 Jan 2009 14:53:23 -0800 Subject: [PATCH 3/9] Revert "Optional provisioning" This reverts commit a9f4ccea6d0463345206a4306fdae9376932eb79. --- .../internal/policy/impl/KeyguardUpdateMonitor.java | 9 ++------- .../android/internal/policy/impl/PhoneWindowManager.java | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index a9f93566c6000..4671957592cca 100644 --- a/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -27,7 +27,6 @@ import static android.os.BatteryManager.BATTERY_STATUS_FULL; import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN; import android.os.Handler; import android.os.Message; -import android.os.SystemProperties; import android.provider.Settings; import android.provider.Telephony; import static android.provider.Telephony.Intents.EXTRA_PLMN; @@ -161,12 +160,8 @@ public class KeyguardUpdateMonitor { } }; - if (!SystemProperties.getBoolean("ro.requires_provisioning", false)) { - mDeviceProvisioned = true; - } else { - mDeviceProvisioned = Settings.Secure.getInt( - mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; - } + mDeviceProvisioned = Settings.Secure.getInt( + mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; // Since device can't be un-provisioned, we only need to register a content observer // to update mDeviceProvisioned when we are... diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java index 2dcf81df7aa35..603b2216e4183 100644 --- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java @@ -350,9 +350,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } boolean isDeviceProvisioned() { - if (!SystemProperties.getBoolean("ro.requires_provisioning", false)) { - return true; - } return Settings.Secure.getInt( mContext.getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 0) != 0; } From 092639eccf1ac6b854b7c18774f9e9f891e0ac61 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Thu, 19 Mar 2009 23:08:56 -0700 Subject: [PATCH 4/9] auto import from //branches/cupcake_rel/...@141571 --- .../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 75898be585d5e075b7d4bfc0af74a73a318ece2e Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 24 Mar 2009 18:18:49 -0700 Subject: [PATCH 5/9] Automated import from //branches/cupcake/...@141745,141745 --- .../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 ad22c18b7ce346ec0fcd751f50ab39474804d312 Mon Sep 17 00:00:00 2001 From: Suchi Amalapurapu <> Date: Tue, 24 Mar 2009 19:18:40 -0700 Subject: [PATCH 6/9] Automated import from //branches/cupcake/...@142231,142231 --- .../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 d3a60997ebcba710bbf192554d055aaaad8e1bed Mon Sep 17 00:00:00 2001 From: Karl Rosaen <> Date: Tue, 24 Mar 2009 19:31:39 -0700 Subject: [PATCH 7/9] Automated import from //branches/cupcake/...@142360,142360 --- .../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 42c1397842d65768e0714f6e21ce3d64de6e11e7 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Wed, 25 Mar 2009 22:39:21 -0700 Subject: [PATCH 8/9] Automated import from //branches/cupcake/...@142870,142870 --- .../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 d63323bb542c02c056b119ae667edc625823e992 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Thu, 26 Mar 2009 00:04:52 -0700 Subject: [PATCH 9/9] Automated import from //branches/cupcake/...@142879,142879 --- .../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 }