QS: Introduce bluetooth control panel.

- Factor out common detail item panel view, share with Wifi.
- Add an empty state (large icon + text)
- Implement connect / disconnect for supported BT profiles.
- Wire up "scanning" state, but still waiting on asset.
- Add BT controller info to dump.

Bug:16235253
Change-Id: Icf854cafba962fe4b63767d7206e309d80b7b87b
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index 36cd388..449cc1d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -168,6 +168,12 @@
                     fireToggleStateChanged(state);
                 }
             }
+            @Override
+            public void onScanStateChanged(boolean state) {
+                if (mDetailRecord == r) {
+                    fireScanStateChanged(state);
+                }
+            }
         });
         final View.OnClickListener click = new View.OnClickListener() {
             @Override
@@ -195,6 +201,7 @@
             if (mDetailRecord != null) return;  // already showing something in detail
             r.detailAdapter = r.tile.getDetailAdapter();
             if (r.detailAdapter == null) return;
+            mDetailRecord = r;
             r.detailView = r.detailAdapter.createDetailView(mContext, r.detailView, mDetailContent);
             if (r.detailView == null) throw new IllegalStateException("Must return detail view");
             mDetailDoneButton.setOnClickListener(new OnClickListener() {
@@ -211,7 +218,6 @@
                     mDetailRecord.tile.mHost.startSettingsActivity(settingsIntent);
                 }
             });
-            mDetailRecord = r;
             mDetailContent.removeAllViews();
             mDetail.bringToFront();
             mDetailContent.addView(r.detailView);
@@ -312,6 +318,12 @@
         }
     }
 
+    private void fireScanStateChanged(boolean state) {
+        if (mCallback != null) {
+            mCallback.onScanStateChanged(state);
+        }
+    }
+
     private class H extends Handler {
         private static final int SHOW_DETAIL = 1;
         private static final int SET_TILE_VISIBILITY = 2;
@@ -344,5 +356,6 @@
     public interface Callback {
         void onShowingDetail(QSTile.DetailAdapter detail);
         void onToggleStateChanged(boolean state);
+        void onScanStateChanged(boolean state);
     }
 }