Make QS do simpler anim on lock screen

Also add in some tunables to make it easier to play with some
animation options.

Bug: 27301323
Change-Id: I4b6b4978e8473016e8868bf9eb58c02fca0ca5cf
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 8b826ee..f8a57d0 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -26,6 +26,8 @@
 import com.android.systemui.R;
 import com.android.systemui.qs.QSTile.SignalState;
 import com.android.systemui.qs.QSTile.State;
+import com.android.systemui.tuner.TunerService;
+import com.android.systemui.tuner.TunerService.Tunable;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -35,6 +37,8 @@
  */
 public class QuickQSPanel extends QSPanel {
 
+    public static final String NUM_QUICK_TILES = "sysui_qqs_count";
+
     private int mMaxTiles;
     private QSPanel mFullPanel;
     private View mHeader;
@@ -52,6 +56,18 @@
     }
 
     @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        TunerService.get(mContext).addTunable(mNumTiles, NUM_QUICK_TILES);
+    }
+
+    @Override
+    protected void onDetachedFromWindow() {
+        super.onDetachedFromWindow();
+        TunerService.get(mContext).removeTunable(mNumTiles);
+    }
+
+    @Override
     protected void createCustomizePanel() {
         // No customizing from the header.
     }
@@ -86,6 +102,7 @@
 
     public void setMaxTiles(int maxTiles) {
         mMaxTiles = maxTiles;
+        setTiles(mHost.getTiles());
     }
 
     @Override
@@ -114,6 +131,17 @@
         super.setTiles(quickTiles);
     }
 
+    private final Tunable mNumTiles = new Tunable() {
+        @Override
+        public void onTuningChanged(String key, String newValue) {
+            setMaxTiles(getNumQuickTiles(mContext));
+        }
+    };
+
+    public static int getNumQuickTiles(Context context) {
+        return TunerService.get(context).getValue(NUM_QUICK_TILES, 5);
+    }
+
     private static class HeaderTileLayout extends LinearLayout implements QSTileLayout {
 
         private final Space mEndSpacer;