@@ -65,11 +65,6 @@ public class KeyguardHostView extends KeyguardViewBase {
6565 // also referenced in SecuritySettings.java
6666 static final int APPWIDGET_HOST_ID = 0x4B455947 ;
6767
68- // transport control states
69- private static final int TRANSPORT_GONE = 0 ;
70- private static final int TRANSPORT_INVISIBLE = 1 ;
71- private static final int TRANSPORT_VISIBLE = 2 ;
72-
7368 private AppWidgetHost mAppWidgetHost ;
7469 private KeyguardWidgetPager mAppWidgetContainer ;
7570 private KeyguardSecurityViewFlipper mSecurityViewContainer ;
@@ -89,7 +84,6 @@ public class KeyguardHostView extends KeyguardViewBase {
8984 private KeyguardViewStateManager mViewStateManager ;
9085
9186 private Rect mTempRect = new Rect ();
92- private int mTransportState = TRANSPORT_GONE ;
9387
9488 /*package*/ interface TransportCallback {
9589 void onListenerDetached ();
@@ -914,7 +908,7 @@ private void removeTransportFromWidgetPager() {
914908 // XXX keep view attached so we still get show/hide events from AudioManager
915909 KeyguardHostView .this .addView (mTransportControl );
916910 mTransportControl .setVisibility (View .GONE );
917- mTransportState = TRANSPORT_GONE ;
911+ mViewStateManager . setTransportState ( KeyguardViewStateManager . TRANSPORT_GONE ) ;
918912 mTransportControl .post (mSwitchPageRunnable );
919913 }
920914 }
@@ -1044,7 +1038,7 @@ public Parcelable onSaveInstanceState() {
10441038 saveStickyWidgetIndex ();
10451039 Parcelable superState = super .onSaveInstanceState ();
10461040 SavedState ss = new SavedState (superState );
1047- ss .transportState = mTransportState ;
1041+ ss .transportState = mViewStateManager . getTransportState () ;
10481042 return ss ;
10491043 }
10501044
@@ -1057,7 +1051,7 @@ public void onRestoreInstanceState(Parcelable state) {
10571051 }
10581052 SavedState ss = (SavedState ) state ;
10591053 super .onRestoreInstanceState (ss .getSuperState ());
1060- mTransportState = ss .transportState ;
1054+ mViewStateManager . setTransportState ( ss .transportState ) ;
10611055 post (mSwitchPageRunnable );
10621056 }
10631057
@@ -1071,13 +1065,14 @@ public void onWindowFocusChanged(boolean hasWindowFocus) {
10711065 }
10721066
10731067 private void showAppropriateWidgetPage () {
1074- boolean isMusicPlaying =
1075- mTransportControl .isMusicPlaying () || mTransportState == TRANSPORT_VISIBLE ;
1068+ int state = mViewStateManager .getTransportState ();
1069+ boolean isMusicPlaying = mTransportControl .isMusicPlaying ()
1070+ || state == KeyguardViewStateManager .TRANSPORT_VISIBLE ;
10761071 if (isMusicPlaying ) {
1077- mTransportState = TRANSPORT_VISIBLE ;
1072+ mViewStateManager . setTransportState ( KeyguardViewStateManager . TRANSPORT_VISIBLE ) ;
10781073 addTransportToWidgetPager ();
1079- } else if (mTransportState == TRANSPORT_VISIBLE ) {
1080- mTransportState = TRANSPORT_INVISIBLE ;
1074+ } else if (state == KeyguardViewStateManager . TRANSPORT_VISIBLE ) {
1075+ mViewStateManager . setTransportState ( KeyguardViewStateManager . TRANSPORT_INVISIBLE ) ;
10811076 }
10821077 int pageToShow = getAppropriateWidgetPage (isMusicPlaying );
10831078 mAppWidgetContainer .setCurrentPage (pageToShow );
0 commit comments