Merge "Update pointer icon when View.setPointerIcon is called" into nyc-dev
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/RenameDocumentUiTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/RenameDocumentUiTest.java
index 1069a66..770bc2c 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/RenameDocumentUiTest.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/RenameDocumentUiTest.java
@@ -81,7 +81,6 @@
         bot.openOverflowMenu();
         bot.openDialog(R.string.menu_rename);
         bot.setDialogText(newName);
-        bot.dismissKeyboardIfPresent();
 
         device.waitForIdle(TIMEOUT);
         bot.findRenameDialogOkButton().click();
@@ -110,7 +109,6 @@
         bot.openOverflowMenu();
         bot.openDialog(R.string.menu_rename);
         bot.setDialogText(newName);
-        bot.dismissKeyboardIfPresent();
 
         device.waitForIdle(TIMEOUT);
         bot.findRenameDialogCancelButton().click();
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index c0652d8..122413d 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -95,4 +95,10 @@
     <dimen name="navigation_key_padding">25dp</dimen>
 
     <dimen name="qs_expand_margin">0dp</dimen>
+
+    <!-- The top padding for the task stack. -->
+    <dimen name="recents_stack_top_padding">40dp</dimen>
+
+    <!-- The side padding for the task stack. -->
+    <dimen name="recents_stack_left_right_padding">64dp</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index a6ba8b5..72421a3 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -165,9 +165,6 @@
     <!-- The animation duration for entering and exiting the history. -->
     <integer name="recents_history_transition_duration">250</integer>
 
-    <!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
-    <integer name="recents_max_task_stack_view_dim">96</integer>
-
     <!-- The delay to enforce between each alt-tab key press. -->
     <integer name="recents_alt_tab_key_delay">200</integer>
 
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 6702cef..f3b9199 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -249,15 +249,15 @@
     <!-- The height of the search bar space. -->
     <dimen name="recents_search_bar_space_height">64dp</dimen>
 
-    <!-- The side padding for the task stack as a percentage of the width. -->
-    <item name="recents_stack_width_padding_percentage" format="float" type="dimen">0.03333</item>
-
     <!-- The overscroll percentage allowed on the stack. -->
     <item name="recents_stack_overscroll_percentage" format="float" type="dimen">0.0875</item>
 
-    <!-- The top offset for the task stack. -->
+    <!-- The top padding for the task stack. -->
     <dimen name="recents_stack_top_padding">16dp</dimen>
 
+    <!-- The side padding for the task stack. -->
+    <dimen name="recents_stack_left_right_padding">16dp</dimen>
+
     <!-- The dimesnsions of the dismiss all recents button. -->
     <dimen name="recents_dismiss_all_button_size">48dp</dimen>
 
@@ -274,7 +274,10 @@
     <dimen name="recents_stack_overscroll">24dp</dimen>
 
     <!-- The size of the peek area at the top of the stack. -->
-    <dimen name="recents_layout_focused_peek_size">@dimen/recents_history_button_height</dimen>
+    <dimen name="recents_layout_focused_top_peek_size">@dimen/recents_history_button_height</dimen>
+
+    <!-- The size of the peek area at the bottom of the stack. -->
+    <dimen name="recents_layout_focused_bottom_peek_size">@dimen/recents_history_button_height</dimen>
 
     <!-- The height of the history button. -->
     <dimen name="recents_history_button_height">48dp</dimen>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 4116962..5e8c123 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1176,15 +1176,10 @@
     <!-- Option to use new paging layout in quick settings [CHAR LIMIT=60] -->
     <string name="qs_paging" translatable="false">Use the new Quick Settings</string>
 
-    <!-- Toggles fast-toggling recents via the recents button. DO NOT TRANSLATE -->
-    <string name="overview_fast_toggle_via_button">Enable fast toggle</string>
+    <!-- Disables fast-toggling recents via the recents button. DO NOT TRANSLATE -->
+    <string name="overview_disable_fast_toggle_via_button">Disable fast toggle</string>
     <!-- Description for the toggle for fast-toggling recents via the recents button. DO NOT TRANSLATE -->
-    <string name="overview_fast_toggle_via_button_desc">Enable launch timeout while paging</string>
-
-    <!-- Toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
-    <string name="overview_initial_state_paging">Initialize to paging</string>
-    <!-- Description for the toggle to set the initial scroll state to be paging or stack. DO NOT TRANSLATE -->
-    <string name="overview_initial_state_paging_desc">Determines whether Overview will initially be in a stacked or paged state</string>
+    <string name="overview_disable_fast_toggle_via_button_desc">Disable launch timeout while paging</string>
 
     <!-- Toggle to enable the gesture to enter split-screen by swiping up from the Overview button. [CHAR LIMIT=60]-->
     <string name="overview_nav_bar_gesture">Enable split-screen swipe-up accelerator</string>
diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml
index 4de4ced..39281bc 100644
--- a/packages/SystemUI/res/xml/tuner_prefs.xml
+++ b/packages/SystemUI/res/xml/tuner_prefs.xml
@@ -113,14 +113,9 @@
         android:title="@string/overview" >
 
         <com.android.systemui.tuner.TunerSwitch
-            android:key="overview_initial_state_paging"
-            android:title="@string/overview_initial_state_paging"
-            android:summary="@string/overview_initial_state_paging_desc" />
-
-        <com.android.systemui.tuner.TunerSwitch
-            android:key="overview_fast_toggle_via_button"
-            android:title="@string/overview_fast_toggle_via_button"
-            android:summary="@string/overview_fast_toggle_via_button_desc" />
+            android:key="overview_disable_fast_toggle_via_button"
+            android:title="@string/overview_disable_fast_toggle_via_button"
+            android:summary="@string/overview_disable_fast_toggle_via_button_desc" />
 
         <com.android.systemui.tuner.TunerSwitch
             android:key="overview_nav_bar_gesture"
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
index fc14758..711d834 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java
@@ -52,11 +52,9 @@
         public static final int MockTaskGroupsTaskCount = 12;
     }
 
-    private static final String KEY_FAST_TOGGLE = "overview_fast_toggle_via_button";
-    private static final String KEY_INITIAL_STATE_PAGING = "overview_initial_state_paging";
+    private static final String KEY_DISABLE_FAST_TOGGLE = "overview_disable_fast_toggle_via_button";
 
-    private boolean mFastToggleRecents;
-    private boolean mInitialStatePaging;
+    private boolean mDisableFastToggleRecents;
 
     /**
      * We read the prefs once when we start the activity, then update them as the tuner changes
@@ -65,7 +63,7 @@
     public RecentsDebugFlags(Context context) {
         // Register all our flags, this will also call onTuningChanged() for each key, which will
         // initialize the current state of each flag
-        TunerService.get(context).addTunable(this, KEY_FAST_TOGGLE, KEY_INITIAL_STATE_PAGING);
+        TunerService.get(context).addTunable(this, KEY_DISABLE_FAST_TOGGLE);
     }
 
     /**
@@ -74,32 +72,21 @@
     public boolean isFastToggleRecentsEnabled() {
         // These checks EnableFastToggleTimeoutOverride
         SystemServicesProxy ssp = Recents.getSystemServices();
-        if (ssp.hasFreeformWorkspaceSupport() || ssp.hasDockedTask() ||
-                ssp.isTouchExplorationEnabled()) {
+        if (mDisableFastToggleRecents || ssp.hasFreeformWorkspaceSupport() || ssp.hasDockedTask()
+                || ssp.isTouchExplorationEnabled()) {
             return false;
         }
         if (Static.EnableFastToggleTimeoutOverride) {
             return true;
         }
-        return mFastToggleRecents;
-    }
-
-    /**
-     * @return whether the initial stack state is paging.
-     */
-    public boolean isInitialStatePaging() {
-        return mInitialStatePaging;
+        return true;
     }
 
     @Override
     public void onTuningChanged(String key, String newValue) {
         switch (key) {
-            case KEY_FAST_TOGGLE:
-                mFastToggleRecents = (newValue != null) &&
-                        (Integer.parseInt(newValue) != 0);
-                break;
-            case KEY_INITIAL_STATE_PAGING:
-                mInitialStatePaging = (newValue != null) &&
+            case KEY_DISABLE_FAST_TOGGLE:
+                mDisableFastToggleRecents = (newValue != null) &&
                         (Integer.parseInt(newValue) != 0);
                 break;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
index 843adc1..3c4adb2 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
@@ -186,6 +186,7 @@
         mRecyclerView = (RecyclerView) findViewById(R.id.list);
         mRecyclerView.setAdapter(mAdapter);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+        mRecyclerView.getItemAnimator().setRemoveDuration(100);
         ItemTouchHelper touchHelper = new ItemTouchHelper(mItemTouchHandler);
         touchHelper.attachToRecyclerView(mRecyclerView);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
index 52043f4..e86b92d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/Utilities.java
@@ -17,6 +17,8 @@
 package com.android.systemui.recents.misc;
 
 import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.annotation.FloatRange;
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.graphics.RectF;
@@ -30,6 +32,7 @@
 import com.android.systemui.recents.model.Task;
 import com.android.systemui.recents.views.TaskViewTransform;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -102,6 +105,46 @@
         return setOut;
     }
 
+    /**
+     * @return the clamped {@param value} between the provided {@param min} and {@param max}.
+     */
+    public static float clamp(float value, float min, float max) {
+        return Math.max(min, Math.min(max, value));
+    }
+
+    /**
+     * @return the clamped {@param value} between the provided {@param min} and {@param max}.
+     */
+    public static int clamp(int value, int min, int max) {
+        return Math.max(min, Math.min(max, value));
+    }
+
+    /**
+     * @return the clamped {@param value} between 0 and 1.
+     */
+    public static float clamp01(float value) {
+        return Math.max(0f, Math.min(1f, value));
+    }
+
+    /**
+     * Scales the {@param value} to be proportionally between the {@param min} and
+     * {@param max} values.
+     *
+     * @param value must be between 0 and 1
+     */
+    public static float mapRange(@FloatRange(from=0.0,to=1.0) float value, float min, float max) {
+        return min + (value * (max - min));
+    }
+
+    /**
+     * Scales the {@param value} proportionally from {@param min} and {@param max} to 0 and 1.
+     *
+     * @param value must be between {@param min} and {@param max}
+     */
+    public static float unmapRange(float value, float min, float max) {
+        return (value - min) / (max - min);
+    }
+
     /** Scales a rect about its centroid */
     public static void scaleRectAboutCenter(RectF r, float scale) {
         if (scale != 1.0f) {
@@ -154,12 +197,25 @@
      */
     public static void cancelAnimationWithoutCallbacks(Animator animator) {
         if (animator != null) {
-            animator.removeAllListeners();
+            removeAnimationListenersRecursive(animator);
             animator.cancel();
         }
     }
 
     /**
+     * Recursively removes all the listeners of all children of this animator
+     */
+    public static void removeAnimationListenersRecursive(Animator animator) {
+        if (animator instanceof AnimatorSet) {
+            ArrayList<Animator> animators = ((AnimatorSet) animator).getChildAnimations();
+            for (int i = animators.size() - 1; i >= 0; i--) {
+                removeAnimationListenersRecursive(animators.get(i));
+            }
+        }
+        animator.removeAllListeners();
+    }
+
+    /**
      * Updates {@param transforms} to be the same size as {@param tasks}.
      */
     public static void matchTaskListSize(List<Task> tasks, List<TaskViewTransform> transforms) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
index 67a6a9f..d433b6c0 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskKeyLruCache.java
@@ -96,6 +96,6 @@
 
     /** Trims the cache to a specific size */
     final void trimToSize(int cacheSize) {
-        mCache.resize(cacheSize);
+        mCache.trimToSize(cacheSize);
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
index 4a65374..8575c0d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/AnimateableViewBounds.java
@@ -22,9 +22,14 @@
 import android.view.ViewDebug;
 import android.view.ViewOutlineProvider;
 
+import com.android.systemui.recents.misc.Utilities;
+
 /* An outline provider that has a clip and outline that can be animated. */
 public class AnimateableViewBounds extends ViewOutlineProvider {
 
+    private static final float MIN_ALPHA = 0.1f;
+    private static final float MAX_ALPHA = 0.8f;
+
     View mSourceView;
     @ViewDebug.ExportedProperty(category="recents")
     Rect mClipRect = new Rect();
@@ -36,7 +41,6 @@
     int mCornerRadius;
     @ViewDebug.ExportedProperty(category="recents")
     float mAlpha = 1f;
-    final float mMinAlpha = 0.25f;
 
     public AnimateableViewBounds(View source, int cornerRadius) {
         mSourceView = source;
@@ -53,7 +57,7 @@
 
     @Override
     public void getOutline(View view, Outline outline) {
-        outline.setAlpha(mMinAlpha + mAlpha / (1f - mMinAlpha));
+        outline.setAlpha(Utilities.mapRange(mAlpha, MIN_ALPHA, MAX_ALPHA));
         if (mCornerRadius > 0) {
             outline.setRoundRect(mClipRect.left, mClipRect.top,
                     mSourceView.getWidth() - mClipRect.right,
@@ -66,7 +70,9 @@
         }
     }
 
-    /** Sets the view outline alpha. */
+    /**
+     * Sets the view outline alpha.
+     */
     void setAlpha(float alpha) {
         if (Float.compare(alpha, mAlpha) != 0) {
             mAlpha = alpha;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/AnimationProps.java b/packages/SystemUI/src/com/android/systemui/recents/views/AnimationProps.java
index 93878c52..48e1370 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/AnimationProps.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/AnimationProps.java
@@ -49,6 +49,8 @@
     public static final int ALPHA = 4;
     public static final int SCALE = 5;
     public static final int BOUNDS = 6;
+    public static final int DIM_ALPHA = 7;
+    public static final int FOCUS_STATE = 8;
 
     private SparseLongArray mPropStartDelay;
     private SparseLongArray mPropDuration;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
index 511aa3c..d8a3e76 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/FreeformWorkspaceLayoutAlgorithm.java
@@ -152,10 +152,10 @@
             transformOut.scale = 1f;
             transformOut.alpha = 1f;
             transformOut.translationZ = stackLayout.mMaxTranslationZ;
+            transformOut.dimAlpha = 0f;
             transformOut.rect.set(ffRect);
             transformOut.rect.offset(stackLayout.mFreeformRect.left, stackLayout.mFreeformRect.top);
             transformOut.visible = true;
-            transformOut.p = 1f;
             return transformOut;
         }
         return null;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
index 98bc92f..360a139 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java
@@ -16,6 +16,8 @@
 
 package com.android.systemui.recents.views;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.content.Context;
 import android.content.res.Resources;
@@ -32,7 +34,6 @@
 import com.android.systemui.recents.Recents;
 import com.android.systemui.recents.RecentsActivityLaunchState;
 import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.RecentsDebugFlags;
 import com.android.systemui.recents.misc.FreePathInterpolator;
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.misc.Utilities;
@@ -107,6 +108,27 @@
     // The scale factor to apply to the user movement in the stack to unfocus it
     private static final float UNFOCUS_MULTIPLIER = 0.8f;
 
+    // The distribution of dim to apply to tasks in the stack
+    public static final float DIM_MAX_VALUE = 0.35f;
+    private static final Path UNFOCUSED_DIM_PATH = new Path();
+    private static final Path FOCUSED_DIM_PATH = new Path();
+    static {
+        // The unfocused dim interpolator peaks to 1 at 0.5 (the focused task), then slowly drops
+        // back to 0.5 at the front of the stack
+        UNFOCUSED_DIM_PATH.moveTo(0f, 0f);
+        UNFOCUSED_DIM_PATH.cubicTo(0f, 0.1f, 0.4f, 0.8f, 0.5f, 1f);
+        UNFOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0.6f, 1f, 0.5f);
+        // The focused dim interpolator peaks to 1 at 0.5 (the focused task), then drops back to 0
+        // at the front of the stack
+        FOCUSED_DIM_PATH.moveTo(0f, 0f);
+        FOCUSED_DIM_PATH.cubicTo(0.1f, 0f, 0.4f, 1f, 0.5f, 1f);
+        FOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0f, 1f, 0f);
+    }
+    private static final FreePathInterpolator UNFOCUSED_DIM_INTERPOLATOR =
+            new FreePathInterpolator(UNFOCUSED_DIM_PATH);
+    private static final FreePathInterpolator FOCUSED_DIM_INTERPOLATOR =
+            new FreePathInterpolator(FOCUSED_DIM_PATH);
+
     // The various focus states
     public static final float STATE_FOCUSED = 1f;
     public static final float STATE_UNFOCUSED = 0f;
@@ -239,7 +261,9 @@
 
     // The offset from the top when scrolled to the top of the stack
     @ViewDebug.ExportedProperty(category="recents")
-    private int mFocusedPeekHeight;
+    private int mFocusedTopPeekHeight;
+    @ViewDebug.ExportedProperty(category="recents")
+    private int mFocusedBottomPeekHeight;
 
     // The offset from the top of the stack to the top of the bounds when the stack is scrolled to
     // the end
@@ -311,7 +335,10 @@
         mUnfocusedRange = new Range(res.getFloat(R.integer.recents_layout_unfocused_range_min),
                 res.getFloat(R.integer.recents_layout_unfocused_range_max));
         mFocusState = getDefaultFocusState();
-        mFocusedPeekHeight = res.getDimensionPixelSize(R.dimen.recents_layout_focused_peek_size);
+        mFocusedTopPeekHeight =
+                res.getDimensionPixelSize(R.dimen.recents_layout_focused_top_peek_size);
+        mFocusedBottomPeekHeight =
+                res.getDimensionPixelSize(R.dimen.recents_layout_focused_bottom_peek_size);
 
         mMinTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_min);
         mMaxTranslationZ = res.getDimensionPixelSize(R.dimen.recents_task_view_z_max);
@@ -365,19 +392,19 @@
         // The freeform height is the visible height (not including system insets) - padding above
         // freeform and below stack - gap between the freeform and stack
         mState = state;
-        mStackTopOffset = mFocusedPeekHeight + heightPadding;
+        mStackTopOffset = mFocusedTopPeekHeight + heightPadding;
         mStackBottomOffset = mSystemInsets.bottom + heightPadding;
         state.computeRects(mFreeformRect, mStackRect, taskStackBounds, widthPadding, heightPadding,
                 mStackBottomOffset);
         // The history button will take the full un-padded header space above the stack
         mHistoryButtonRect.set(mStackRect.left, mStackRect.top - heightPadding,
-                mStackRect.right, mStackRect.top + mFocusedPeekHeight);
+                mStackRect.right, mStackRect.top + mFocusedTopPeekHeight);
 
         // Anchor the task rect to the top-center of the non-freeform stack rect
         float aspect = (float) (taskStackBounds.width() - mSystemInsets.left - mSystemInsets.right)
                 / (taskStackBounds.height() - mSystemInsets.bottom);
         int width = mStackRect.width();
-        int minHeight = mStackRect.height() - mFocusedPeekHeight - mStackBottomOffset;
+        int minHeight = mStackRect.height() - mFocusedTopPeekHeight - mStackBottomOffset;
         int height = (int) Math.min(width / aspect, minHeight);
         mTaskRect.set(mStackRect.left, mStackRect.top,
                 mStackRect.left + width, mStackRect.top + height);
@@ -452,8 +479,8 @@
                         mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(bottomOffsetPct);
                 mMinScrollP = 0;
-                mMaxScrollP = Math.max(mMinScrollP,
-                        (mNumStackTasks - 1) - Math.max(0, mUnfocusedRange.getAbsoluteX(normX)));
+                mMaxScrollP = Math.max(mMinScrollP, (mNumStackTasks - 1) -
+                        Math.max(0, mUnfocusedRange.getAbsoluteX(normX)));
             }
         }
 
@@ -469,16 +496,16 @@
                 mInitialScrollP = mMinScrollP;
             } else if (getDefaultFocusState() > 0f) {
                 if (launchState.launchedFromHome) {
-                    mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP, launchTaskIndex));
+                    mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
                 } else {
-                    mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP,
-                            launchTaskIndex - 1));
+                    mInitialScrollP = Utilities.clamp(launchTaskIndex - 1, mMinScrollP,
+                            mMaxScrollP);
                 }
             } else {
                 float offsetPct = (float) (mTaskRect.height() / 3) / mStackRect.height();
                 float normX = mUnfocusedCurveInterpolator.getX(offsetPct);
-                mInitialScrollP = Math.max(mMinScrollP, Math.min(mMaxScrollP,
-                        launchTaskIndex - mUnfocusedRange.getAbsoluteX(normX)));
+                mInitialScrollP = Utilities.clamp(launchTaskIndex -
+                        mUnfocusedRange.getAbsoluteX(normX), mMinScrollP, mMaxScrollP);
             }
         }
     }
@@ -513,12 +540,7 @@
      * Returns the default focus state.
      */
     public float getDefaultFocusState() {
-        RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
-        RecentsDebugFlags debugFlags = Recents.getDebugFlags();
-        if (launchState.launchedWithAltTab || debugFlags.isInitialStatePaging()) {
-            return STATE_FOCUSED;
-        }
-        return STATE_UNFOCUSED;
+        return STATE_FOCUSED;
     }
 
     /**
@@ -667,20 +689,9 @@
 
         // Compute the focused and unfocused offset
         mUnfocusedRange.offset(stackScroll);
-        float p = mUnfocusedRange.getNormalizedX(taskProgress);
-        float yp = mUnfocusedCurveInterpolator.getInterpolation(p);
-        float unfocusedP = p;
-        int unFocusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
+        mFocusedRange.offset(stackScroll);
         boolean unfocusedVisible = mUnfocusedRange.isInRange(taskProgress);
-        int focusedY = 0;
-        boolean focusedVisible = true;
-        if (mFocusState > 0f) {
-            mFocusedRange.offset(stackScroll);
-            p = mFocusedRange.getNormalizedX(taskProgress);
-            yp = mFocusedCurveInterpolator.getInterpolation(p);
-            focusedY = (int) (Math.max(0f, (1f - yp)) * mStackRect.height());
-            focusedVisible = mFocusedRange.isInRange(taskProgress);
-        }
+        boolean focusedVisible = mFocusedRange.isInRange(taskProgress);
 
         // Skip if the task is not visible
         if (!forceUpdate && !unfocusedVisible && !focusedVisible) {
@@ -688,43 +699,48 @@
             return;
         }
 
+        float unfocusedRangeX = mUnfocusedRange.getNormalizedX(taskProgress);
+        float focusedRangeX = mFocusedRange.getNormalizedX(taskProgress);
+
         int x = (mStackRect.width() - mTaskRect.width()) / 2;
         int y;
         float z;
-        float relP;
+        float dimAlpha;
         if (!ssp.hasFreeformWorkspaceSupport() && mNumStackTasks == 1 && !ignoreSingleTaskCase) {
             // When there is exactly one task, then decouple the task from the stack and just move
             // in screen space
-            p = (mMinScrollP - stackScroll) / mNumStackTasks;
+            float tmpP = (mMinScrollP - stackScroll) / mNumStackTasks;
             int centerYOffset = (mStackRect.top - mTaskRect.top) +
                     (mStackRect.height() - mTaskRect.height()) / 2;
-            y = centerYOffset + getYForDeltaP(p, 0);
+            y = centerYOffset + getYForDeltaP(tmpP, 0);
             z = mMaxTranslationZ;
-            relP = 1f;
+            dimAlpha = 0f;
 
         } else {
             // Otherwise, update the task to the stack layout
-            y = unFocusedY + (int) (mFocusState * (focusedY - unFocusedY));
-            y += (mStackRect.top - mTaskRect.top);
-            z = Math.max(mMinTranslationZ, Math.min(mMaxTranslationZ,
-                    mMinTranslationZ + (p * (mMaxTranslationZ - mMinTranslationZ))));
-            if (mNumStackTasks == 1) {
-                relP = 1f;
-            } else {
-                relP = Math.min(mMaxScrollP, unfocusedP);
-            }
+            int unfocusedY = (int) ((1f - mUnfocusedCurveInterpolator.getInterpolation(
+                    unfocusedRangeX)) * mStackRect.height());
+            int focusedY = (int) ((1f - mFocusedCurveInterpolator.getInterpolation(
+                    focusedRangeX)) * mStackRect.height());
+            float unfocusedDim = 1f - UNFOCUSED_DIM_INTERPOLATOR.getInterpolation(unfocusedRangeX);
+            float focusedDim = 1f - FOCUSED_DIM_INTERPOLATOR.getInterpolation(focusedRangeX);
+
+            y = (mStackRect.top - mTaskRect.top) +
+                    (int) Utilities.mapRange(mFocusState, unfocusedY, focusedY);
+            z = Utilities.clamp01(unfocusedRangeX) * mMaxTranslationZ;
+            dimAlpha = Utilities.mapRange(mFocusState, unfocusedDim, focusedDim);
         }
 
         // Fill out the transform
         transformOut.scale = 1f;
         transformOut.alpha = 1f;
         transformOut.translationZ = z;
+        transformOut.dimAlpha = DIM_MAX_VALUE * dimAlpha;
         transformOut.rect.set(mTaskRect);
         transformOut.rect.offset(x, y);
         Utilities.scaleRectAboutCenter(transformOut.rect, transformOut.scale);
         transformOut.visible = (transformOut.rect.top < mStackRect.bottom) &&
                 (frontTransform == null || transformOut.rect.top != frontTransform.rect.top);
-        transformOut.p = relP;
     }
 
     /**
@@ -768,18 +784,16 @@
      * Creates a new path for the focused curve.
      */
     private Path constructFocusedCurve() {
-        int taskBarHeight = mContext.getResources().getDimensionPixelSize(
-                R.dimen.recents_task_bar_height);
-
         // Initialize the focused curve. This curve is a piecewise curve composed of several
-        // quadradic beziers that goes from (0,1) through (0.5, peek height offset),
-        // (0.667, next task offset), (0.833, bottom task offset), and (1,0).
-        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
+        // linear pieces that goes from (0,1) through (0.5, peek height offset),
+        // (0.5, bottom task offsets), and (1,0).
+        float topPeekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
+        float bottomPeekHeightPct = (float) Math.max(mFocusedBottomPeekHeight, mStackRect.bottom -
+                mTaskRect.bottom) / mStackRect.height();
         Path p = new Path();
         p.moveTo(0f, 1f);
-        p.lineTo(0.5f, 1f - peekHeightPct);
-        p.lineTo(0.66666667f, (float) (taskBarHeight * 3) / mStackRect.height());
-        p.lineTo(0.83333333f, (float) (taskBarHeight / 2) / mStackRect.height());
+        p.lineTo(0.5f, 1f - topPeekHeightPct);
+        p.lineTo(0.5f + (0.5f / mFocusedRange.relativeMax), bottomPeekHeightPct);
         p.lineTo(1f, 0f);
         return p;
     }
@@ -796,7 +810,7 @@
         // there is a tangent at (0.5, peek height offset).
         float cpoint1X = 0.4f;
         float cpoint1Y = 1f;
-        float peekHeightPct = (float) mFocusedPeekHeight / mStackRect.height();
+        float peekHeightPct = (float) mFocusedTopPeekHeight / mStackRect.height();
         float slope = ((1f - peekHeightPct) - cpoint1Y) / (0.5f - cpoint1X);
         float b = 1f - slope * cpoint1X;
         float cpoint2X = 0.75f;
@@ -817,10 +831,10 @@
             return;
         }
 
-        float min = mUnfocusedRange.relativeMin +
-                mFocusState * (mFocusedRange.relativeMin - mUnfocusedRange.relativeMin);
-        float max = mUnfocusedRange.relativeMax +
-                mFocusState * (mFocusedRange.relativeMax - mUnfocusedRange.relativeMax);
+        float min = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMin,
+                mFocusedRange.relativeMin);
+        float max = Utilities.mapRange(mFocusState, mUnfocusedRange.relativeMax,
+                mFocusedRange.relativeMax);
         getStackTransform(min, 0f, mBackOfStackTransform, null, true /* ignoreSingleTaskCase */,
                 true /* forceUpdate */);
         getStackTransform(max, 0f, mFrontOfStackTransform, null, true /* ignoreSingleTaskCase */,
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 9560eb4..2195b5e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -560,7 +560,7 @@
                     tv.updateViewPropertiesToTaskTransform(transform, AnimationProps.IMMEDIATE,
                             mRequestUpdateClippingListener);
                 } else {
-                    if (Float.compare(transform.p, 0f) <= 0) {
+                    if (transform.rect.top <= mLayoutAlgorithm.mStackRect.top) {
                         tv.updateViewPropertiesToTaskTransform(
                                 mLayoutAlgorithm.getBackOfStackTransform(),
                                 AnimationProps.IMMEDIATE, mRequestUpdateClippingListener);
@@ -838,7 +838,7 @@
             boolean requestViewFocus, int timerIndicatorDuration) {
         // Find the next task to focus
         int newFocusedTaskIndex = mStack.getTaskCount() > 0 ?
-                Math.max(0, Math.min(mStack.getTaskCount() - 1, focusTaskIndex)) : -1;
+                Utilities.clamp(focusTaskIndex, 0, mStack.getTaskCount() - 1) : -1;
         final Task newFocusedTask = (newFocusedTaskIndex != -1) ?
                 mStack.getStackTasks().get(newFocusedTaskIndex) : null;
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
index b54ea1d..b7ff8bc 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java
@@ -152,8 +152,7 @@
 
     /** Returns the bounded stack scroll */
     float getBoundedStackScroll(float scroll) {
-        return Math.max(mLayoutAlgorithm.mMinScrollP,
-                Math.min(mLayoutAlgorithm.mMaxScrollP, scroll));
+        return Utilities.clamp(scroll, mLayoutAlgorithm.mMinScrollP, mLayoutAlgorithm.mMaxScrollP);
     }
 
     /** Returns the amount that the absolute value of how much the scroll is out of bounds. */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index 55f9fba..b94a9f7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -30,7 +30,6 @@
 import android.view.ViewConfiguration;
 import android.view.ViewDebug;
 import android.view.ViewParent;
-import android.view.animation.Animation;
 import android.view.animation.Interpolator;
 import android.view.animation.PathInterpolator;
 
@@ -45,7 +44,6 @@
 import com.android.systemui.recents.events.activity.HideRecentsEvent;
 import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
 import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
-import com.android.systemui.recents.misc.RectFEvaluator;
 import com.android.systemui.recents.misc.SystemServicesProxy;
 import com.android.systemui.recents.misc.Utilities;
 import com.android.systemui.recents.model.Task;
@@ -547,7 +545,8 @@
             // We only really need to interpolate the bounds, progress and translation
             mTmpTransform.rect.set(Utilities.RECTF_EVALUATOR.evaluate(dismissFraction,
                     fromTransform.rect, toTransform.rect));
-            mTmpTransform.p = fromTransform.p + (toTransform.p - fromTransform.p) * dismissFraction;
+            mTmpTransform.dimAlpha = fromTransform.dimAlpha + (toTransform.dimAlpha -
+                    fromTransform.dimAlpha) * dismissFraction;
             mTmpTransform.translationZ = fromTransform.translationZ +
                     (toTransform.translationZ - fromTransform.translationZ) * dismissFraction;
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 0f485ac..972b02aa 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -31,13 +31,11 @@
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.util.FloatProperty;
-import android.util.IntProperty;
 import android.util.Property;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewDebug;
 import android.view.ViewOutlineProvider;
-import android.view.animation.AccelerateInterpolator;
 import android.widget.Toast;
 
 import com.android.internal.logging.MetricsLogger;
@@ -81,39 +79,21 @@
      * The dim overlay is generally calculated from the task progress, but occasionally (like when
      * launching) needs to be animated independently of the task progress.
      */
-    public static final Property<TaskView, Integer> DIM =
-            new IntProperty<TaskView>("dim") {
+    public static final Property<TaskView, Float> DIM_ALPHA =
+            new FloatProperty<TaskView>("dim") {
                 @Override
-                public void setValue(TaskView tv, int dim) {
-                    tv.setDim(dim);
-                }
-
-                @Override
-                public Integer get(TaskView tv) {
-                    return tv.getDim();
-                }
-            };
-
-    public static final Property<TaskView, Float> TASK_PROGRESS =
-            new FloatProperty<TaskView>("taskProgress") {
-                @Override
-                public void setValue(TaskView tv, float p) {
-                    tv.setTaskProgress(p);
+                public void setValue(TaskView tv, float dimAlpha) {
+                    tv.setDimAlpha(dimAlpha);
                 }
 
                 @Override
                 public Float get(TaskView tv) {
-                    return tv.getTaskProgress();
+                    return tv.getDimAlpha();
                 }
             };
 
     @ViewDebug.ExportedProperty(category="recents")
-    float mTaskProgress;
-    @ViewDebug.ExportedProperty(category="recents")
-    float mMaxDimScale;
-    @ViewDebug.ExportedProperty(category="recents")
-    int mDimAlpha;
-    AccelerateInterpolator mDimInterpolator = new AccelerateInterpolator(3f);
+    float mDimAlpha;
     PorterDuffColorFilter mDimColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_ATOP);
     Paint mDimLayerPaint = new Paint();
     float mActionButtonTranslationZ;
@@ -163,7 +143,6 @@
         super(context, attrs, defStyleAttr, defStyleRes);
         RecentsConfiguration config = Recents.getConfiguration();
         Resources res = context.getResources();
-        mMaxDimScale = res.getInteger(R.integer.recents_max_task_stack_view_dim) / 255f;
         mViewBounds = new AnimateableViewBounds(this, res.getDimensionPixelSize(
                 R.dimen.recents_task_view_rounded_corners_radius));
         if (config.fakeShadows) {
@@ -269,8 +248,8 @@
         mTmpAnimators.clear();
         toTransform.applyToTaskView(this, mTmpAnimators, toAnimation, !config.fakeShadows);
         if (toAnimation.isImmediate()) {
-            if (Float.compare(getTaskProgress(), toTransform.p) != 0) {
-                setTaskProgress(toTransform.p);
+            if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
+                setDimAlpha(toTransform.dimAlpha);
             }
             // Manually call back to the animator listener and update callback
             if (toAnimation.getListener() != null) {
@@ -281,9 +260,9 @@
             }
         } else {
             // Both the progress and the update are a function of the bounds movement of the task
-            if (Float.compare(getTaskProgress(), toTransform.p) != 0) {
-                ObjectAnimator anim = ObjectAnimator.ofFloat(this, TASK_PROGRESS, getTaskProgress(),
-                        toTransform.p);
+            if (Float.compare(getDimAlpha(), toTransform.dimAlpha) != 0) {
+                ObjectAnimator anim = ObjectAnimator.ofFloat(this, DIM_ALPHA, getDimAlpha(),
+                        toTransform.dimAlpha);
                 mTmpAnimators.add(toAnimation.apply(AnimationProps.BOUNDS, anim));
             }
             if (updateCallback != null) {
@@ -301,7 +280,7 @@
     /** Resets this view's properties */
     void resetViewProperties() {
         cancelTransformAnimation();
-        setDim(0);
+        setDimAlpha(0);
         setVisibility(View.VISIBLE);
         getViewBounds().reset();
         getHeaderView().reset();
@@ -376,76 +355,58 @@
         }
     }
 
-    /** Sets the current task progress. */
-    public void setTaskProgress(float p) {
-        mTaskProgress = p;
-        mViewBounds.setAlpha(p);
-        updateDimFromTaskProgress();
-    }
-
     public TaskViewHeader getHeaderView() {
         return mHeaderView;
     }
 
-    /** Returns the current task progress. */
-    public float getTaskProgress() {
-        return mTaskProgress;
-    }
-
-    /** Returns the current dim. */
-    public void setDim(int dim) {
+    /**
+     * Sets the current dim.
+     */
+    public void setDimAlpha(float dimAlpha) {
         RecentsConfiguration config = Recents.getConfiguration();
 
-        mDimAlpha = dim;
+        int dimAlphaInt = (int) (dimAlpha * 255);
+        mDimAlpha = dimAlpha;
+        mViewBounds.setAlpha(1f - (dimAlpha / TaskStackLayoutAlgorithm.DIM_MAX_VALUE));
         if (config.useHardwareLayers) {
             // Defer setting hardware layers if we have not yet measured, or there is no dim to draw
             if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0) {
-                mDimColorFilter.setColor(Color.argb(mDimAlpha, 0, 0, 0));
+                mDimColorFilter.setColor(Color.argb(dimAlphaInt, 0, 0, 0));
                 mDimLayerPaint.setColorFilter(mDimColorFilter);
                 mContent.setLayerType(LAYER_TYPE_HARDWARE, mDimLayerPaint);
             }
         } else {
-            float dimAlpha = mDimAlpha / 255.0f;
             mThumbnailView.setDimAlpha(dimAlpha);
             mHeaderView.setDimAlpha(dimAlpha);
         }
     }
 
-    /** Returns the current dim. */
-    public int getDim() {
+    /**
+     * Returns the current dim.
+     */
+    public float getDimAlpha() {
         return mDimAlpha;
     }
 
-    /** Animates the dim to the task progress. */
-    void animateDimToProgress(int duration, Animator.AnimatorListener animListener) {
+    /**
+     * Animates the dim to the given value.
+     */
+    void animateDimAlpha(float toDimAlpha, AnimationProps animation) {
         // Animate the dim into view as well
-        int toDim = getDimFromTaskProgress();
-        if (toDim != getDim()) {
-            ObjectAnimator anim = ObjectAnimator.ofInt(this, DIM, getDim(), toDim);
-            anim.setDuration(duration);
-            if (animListener != null) {
-                anim.addListener(animListener);
+        if (Float.compare(toDimAlpha, getDimAlpha()) != 0) {
+            Animator anim = animation.apply(AnimationProps.DIM_ALPHA, ObjectAnimator.ofFloat(this,
+                    DIM_ALPHA, getDimAlpha(), toDimAlpha));
+            if (animation.getListener() != null) {
+                anim.addListener(animation.getListener());
             }
             anim.start();
         } else {
-            animListener.onAnimationEnd(null);
+            if (animation.getListener() != null) {
+                animation.getListener().onAnimationEnd(null);
+            }
         }
     }
 
-    /** Compute the dim as a function of the scale of this view. */
-    int getDimFromTaskProgress() {
-        float x = mTaskProgress < 0
-                ? 1f
-                : mDimInterpolator.getInterpolation(1f - mTaskProgress);
-        float dim = mMaxDimScale * x;
-        return (int) (dim * 255);
-    }
-
-    /** Update the dim as a function of the scale of this view. */
-    void updateDimFromTaskProgress() {
-        setDim(getDimFromTaskProgress());
-    }
-
     /**
      * Explicitly sets the focused state of this task.
      */
@@ -532,15 +493,18 @@
     @Override
     public void onPrepareLaunchTargetForEnterAnimation() {
         // These values will be animated in when onStartLaunchTargetEnterAnimation() is called
-        setDim(0);
+        setDimAlpha(0);
         mActionButtonView.setAlpha(0f);
     }
 
     @Override
     public void onStartLaunchTargetEnterAnimation(int duration, boolean screenPinningEnabled,
             ReferenceCountedTrigger postAnimationTrigger) {
+        // Un-dim the view before/while launching the target
+        AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT)
+                .setListener(postAnimationTrigger.decrementOnAnimationEnd());
         postAnimationTrigger.increment();
-        animateDimToProgress(duration, postAnimationTrigger.decrementOnAnimationEnd());
+        animateDimAlpha(0, animation);
 
         if (screenPinningEnabled) {
             showActionButton(true /* fadeIn */, duration /* fadeInDuration */);
@@ -550,12 +514,9 @@
     @Override
     public void onStartLaunchTargetLaunchAnimation(int duration, boolean screenPinningRequested,
             ReferenceCountedTrigger postAnimationTrigger) {
-        if (mDimAlpha > 0) {
-            ObjectAnimator anim = ObjectAnimator.ofInt(this, DIM, getDim(), 0);
-            anim.setDuration(duration);
-            anim.setInterpolator(Interpolators.ALPHA_OUT);
-            anim.start();
-        }
+        // Un-dim the view before/while launching the target
+        AnimationProps animation = new AnimationProps(duration, Interpolators.ALPHA_OUT);
+        animateDimAlpha(0, animation);
 
         postAnimationTrigger.increment();
         hideActionButton(true /* fadeOut */, duration,
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
index 32878b0..d3d2dbe 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
@@ -86,13 +86,10 @@
     public float translationZ = 0;
     public float scale = 1f;
     public float alpha = 1f;
+    public float dimAlpha = 0f;
 
     public boolean visible = false;
 
-    // This is the relative task progress of this task, relative to the stack scroll at which this
-    // transform was computed
-    public float p = 0f;
-
     // This is a window-space rect used for positioning the task in the stack and freeform workspace
     public RectF rect = new RectF();
 
@@ -104,7 +101,7 @@
         scale = tv.getScaleX();
         alpha = tv.getAlpha();
         visible = true;
-        p = tv.getTaskProgress();
+        dimAlpha = tv.getDimAlpha();
         rect.set(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
     }
 
@@ -116,7 +113,7 @@
         scale = other.scale;
         alpha = other.alpha;
         visible = other.visible;
-        p = other.p;
+        dimAlpha = other.dimAlpha;
         rect.set(other.rect);
     }
 
@@ -127,9 +124,9 @@
         translationZ = 0;
         scale = 1f;
         alpha = 1f;
+        dimAlpha = 0f;
         visible = false;
         rect.setEmpty();
-        p = 0f;
     }
 
     /** Convenience functions to compare against current property values */