am 3f677b1b: Merge "Fix periodically disappearing status icons." into gingerbread

Merge commit '3f677b1b3e45240728de39d60441d791c0e8d3f8' into gingerbread-plus-aosp

* commit '3f677b1b3e45240728de39d60441d791c0e8d3f8':
  Fix periodically disappearing status icons.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
index 07bcce7..d2346e4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
@@ -817,7 +817,8 @@
 
     void performCollapse() {
         if (SPEW) Slog.d(TAG, "performCollapse: mExpanded=" + mExpanded
-                + " mExpandedVisible=" + mExpandedVisible);
+                + " mExpandedVisible=" + mExpandedVisible
+                + " mTicking=" + mTicking);
 
         if (!mExpandedVisible) {
             return;
@@ -832,7 +833,9 @@
         if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) {
             setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
         }
-        setDateViewVisibility(false, com.android.internal.R.anim.fade_out);
+        if (mDateView.getVisibility() == View.VISIBLE) {
+            setDateViewVisibility(false, com.android.internal.R.anim.fade_out);
+        }
 
         if (!mExpanded) {
             return;
@@ -1147,6 +1150,7 @@
 
         @Override
         void tickerStarting() {
+            if (SPEW) Slog.d(TAG, "tickerStarting");
             mTicking = true;
             mIcons.setVisibility(View.GONE);
             mTickerView.setVisibility(View.VISIBLE);
@@ -1159,38 +1163,30 @@
 
         @Override
         void tickerDone() {
+            if (SPEW) Slog.d(TAG, "tickerDone");
+            mTicking = false;
             mIcons.setVisibility(View.VISIBLE);
             mTickerView.setVisibility(View.GONE);
             mIcons.startAnimation(loadAnim(com.android.internal.R.anim.push_down_in, null));
-            mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.push_down_out,
-                        mTickingDoneListener));
+            mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.push_down_out, null));
             if (mExpandedVisible) {
                 setDateViewVisibility(true, com.android.internal.R.anim.push_down_in);
             }
         }
 
         void tickerHalting() {
+            if (SPEW) Slog.d(TAG, "tickerHalting");
+            mTicking = false;
             mIcons.setVisibility(View.VISIBLE);
             mTickerView.setVisibility(View.GONE);
             mIcons.startAnimation(loadAnim(com.android.internal.R.anim.fade_in, null));
-            mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.fade_out,
-                        mTickingDoneListener));
+            mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.fade_out, null));
             if (mExpandedVisible) {
                 setDateViewVisibility(true, com.android.internal.R.anim.fade_in);
             }
         }
     }
 
-    Animation.AnimationListener mTickingDoneListener = new Animation.AnimationListener() {;
-        public void onAnimationEnd(Animation animation) {
-            mTicking = false;
-        }
-        public void onAnimationRepeat(Animation animation) {
-        }
-        public void onAnimationStart(Animation animation) {
-        }
-    };
-
     private Animation loadAnim(int id, Animation.AnimationListener listener) {
         Animation anim = AnimationUtils.loadAnimation(StatusBarService.this, id);
         if (listener != null) {
@@ -1373,7 +1369,8 @@
     void updateExpandedViewPos(int expandedPosition) {
         if (SPEW) {
             Slog.d(TAG, "updateExpandedViewPos before expandedPosition=" + expandedPosition
-                    + " mTrackingParams.y=" + mTrackingParams.y
+                    + " mTrackingParams.y=" 
+                    + ((mTrackingParams == null) ? "???" : mTrackingParams.y)
                     + " mTrackingPosition=" + mTrackingPosition);
         }
 
@@ -1518,6 +1515,9 @@
                 }
             }
         } else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
+            Slog.d(TAG, "DISABLE_NOTIFICATION_TICKER: "
+                + (((net & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0)
+                    ? "yes" : "no"));
             if (mTicking && (net & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
                 mTicker.halt();
             }
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index 16b3001..37976ee 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -633,6 +633,20 @@
             }
         },
 
+        new Test("Ticker") {
+            public void run() {
+                Notification not = new Notification(
+                    R.drawable.app_gmail, 
+                    "New mail from joeo@example.com, on the topic of very long ticker texts",
+                    System.currentTimeMillis());
+                not.setLatestEventInfo(NotificationTestList.this,
+                    "A new message awaits",
+                    "The contents are very interesting and important",
+                    makeIntent());
+                mNM.notify(1, not);
+            }
+        },
+
         new Test("Crash") {
             public void run()
             {