Fixes wrong measurements on QS animation

Clipping of PagedTileLayout is done independent of padding so no
measurement corrections are needed. Padding in TilePage fixed so
the pages are centered (they use all the width).

FrameLayout in qs_paged_tile_layout removed as not used.

Change-Id: If8cd95855ebcddf533e87b9203c4ee3d831bdf2c
Test: atest && visual
Fixes: 117452733
Bug: 117401270
Bug: 117096186
diff --git a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
index c398a4a..76dfddb 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/PagedTileLayout.java
@@ -8,6 +8,7 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.graphics.Rect;
 import android.os.Bundle;
 import android.util.AttributeSet;
 import android.util.Log;
@@ -60,6 +61,7 @@
     private int mPageToRestore = -1;
     private int mLayoutOrientation;
     private int mLayoutDirection;
+    private int mHorizontalClipBound;
 
     public PagedTileLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -260,8 +262,8 @@
         // Update bottom padding, useful for removing extra space once the panel page indicator is
         // hidden.
         Resources res = getContext().getResources();
-        final int sidePadding = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
-        setPadding(sidePadding, 0, sidePadding,
+        mHorizontalClipBound = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
+        setPadding(0, 0, 0,
                 getContext().getResources().getDimensionPixelSize(
                         R.dimen.qs_paged_tile_layout_padding_bottom));
         boolean changed = false;
@@ -276,6 +278,13 @@
     }
 
     @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        super.onLayout(changed, l, t, r, b);
+        Rect clipBounds = new Rect(mHorizontalClipBound, 0, (r-l) - mHorizontalClipBound, b - t);
+        setClipBounds(clipBounds);
+    }
+
+    @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
 
         final int nTiles = mTiles.size();
@@ -412,6 +421,14 @@
         public int maxTiles() {
             return mColumns * mRows;
         }
+
+        @Override
+        public boolean updateResources() {
+            final int sidePadding = getContext().getResources().getDimensionPixelSize(
+                    R.dimen.notification_side_paddings);
+            setPadding(sidePadding, 0, sidePadding, 0);
+            return super.updateResources();
+        }
     }
 
     private final PagerAdapter mAdapter = new PagerAdapter() {