diff options
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java index 11ed5bc8bdb4..4e8082be11a8 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java @@ -79,6 +79,7 @@ public class KeyguardHostView extends KeyguardViewBase { private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid; private int mAppWidgetToShow; + private int mPreviousWidgetPage = -1; private boolean mCheckAppWidgetConsistencyOnBootCompleted = false; private boolean mCleanupAppWidgetsOnBootCompleted = false; @@ -894,6 +895,7 @@ public class KeyguardHostView extends KeyguardViewBase { public void clearAppWidgetToShow() { mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID; + mPreviousWidgetPage = -1; } @Override @@ -1281,10 +1283,22 @@ public class KeyguardHostView extends KeyguardViewBase { showAppropriateWidgetPage(); } }; + Runnable mOnRestoreUpdatePageRunnable = new Runnable() { + @Override + public void run() { + mSwitchPageRunnable.run(); + + // We need to update the alpha's of the hints and content after setting the current page + mViewStateManager.showUsabilityHints(); + }; + }; + static class SavedState extends BaseSavedState { int transportState; int appWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID; + // Note the appWidgetContainerPage is only used if the appWidgetToShow is invalid + int appWidgetContainerPage = -1; SavedState(Parcelable superState) { super(superState); @@ -1294,6 +1308,7 @@ public class KeyguardHostView extends KeyguardViewBase { super(in); this.transportState = in.readInt(); this.appWidgetToShow = in.readInt(); + this.appWidgetContainerPage = in.readInt(); } @Override @@ -1301,6 +1316,7 @@ public class KeyguardHostView extends KeyguardViewBase { super.writeToParcel(out, flags); out.writeInt(this.transportState); out.writeInt(this.appWidgetToShow); + out.writeInt(this.appWidgetContainerPage); } public static final Parcelable.Creator<SavedState> CREATOR @@ -1322,6 +1338,7 @@ public class KeyguardHostView extends KeyguardViewBase { SavedState ss = new SavedState(superState); ss.transportState = mViewStateManager.getTransportState(); ss.appWidgetToShow = mAppWidgetToShow; + ss.appWidgetContainerPage = mAppWidgetContainer.getCurrentPage(); return ss; } @@ -1336,7 +1353,8 @@ public class KeyguardHostView extends KeyguardViewBase { super.onRestoreInstanceState(ss.getSuperState()); mViewStateManager.setTransportState(ss.transportState); mAppWidgetToShow = ss.appWidgetToShow; - post(mSwitchPageRunnable); + mPreviousWidgetPage = ss.appWidgetContainerPage; + post(mOnRestoreUpdatePageRunnable); } @Override @@ -1393,6 +1411,9 @@ public class KeyguardHostView extends KeyguardViewBase { } mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID; } + if (mPreviousWidgetPage > -1) { + return mPreviousWidgetPage; + } // if music playing, show transport if (isMusicPlaying) { if (DEBUG) Log.d(TAG, "Music playing, show transport"); |