QS: Add scanning progress state indication.

- Create a modified version of the new platform horizontal
indeterminate progress indicator, and align it to the bottom
of the header.
- Ensure the scanning state takes the active detail panel into
account.

Bug:16145178
Change-Id: I7f80c458ff6565aa00085da9059a4e9fe7e49233
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index c3144c1..1fa97bd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -234,8 +234,9 @@
             }
             @Override
             public void onScanStateChanged(boolean state) {
+                r.scanState = state;
                 if (mDetailRecord == r) {
-                    fireScanStateChanged(state);
+                    fireScanStateChanged(r.scanState);
                 }
             }
         };
@@ -310,9 +311,10 @@
             mDetailContent.removeAllViews();
             mDetail.bringToFront();
             mDetailContent.addView(r.detailView);
-            mDetailRecord = r;
+            setDetailRecord(r);
         } else {
             listener = mTeardownDetailWhenDone;
+            fireScanStateChanged(false);
         }
         fireShowingDetail(show ? detailAdapter : null);
         mClipper.animateCircularClip(x, y, show, listener);
@@ -425,6 +427,14 @@
         }
     }
 
+    private void setDetailRecord(Record r) {
+        if (r == mDetailRecord) return;
+        mDetailRecord = r;
+        final boolean scanState = mDetailRecord instanceof TileRecord
+                && ((TileRecord) mDetailRecord).scanState;
+        fireScanStateChanged(scanState);
+    }
+
     private class H extends Handler {
         private static final int SHOW_DETAIL = 1;
         private static final int SET_TILE_VISIBILITY = 2;
@@ -448,12 +458,13 @@
         QSTileView tileView;
         int row;
         int col;
+        boolean scanState;
     }
 
     private final AnimatorListenerAdapter mTeardownDetailWhenDone = new AnimatorListenerAdapter() {
         public void onAnimationEnd(Animator animation) {
             mDetailContent.removeAllViews();
-            mDetailRecord = null;
+            setDetailRecord(null);
         };
     };