OSDN Git Service

Fixing animation jump when dismissing paged task.
authorWinson <winsonc@google.com>
Mon, 23 Nov 2015 22:47:37 +0000 (14:47 -0800)
committerWinson Chung <winsonc@google.com>
Tue, 24 Nov 2015 00:44:32 +0000 (00:44 +0000)
Change-Id: Ida07053da59f14f8ef3820e48a7bc73eef15840f

packages/SystemUI/src/com/android/systemui/recents/events/component/ScreenPinningRequestEvent.java
packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java

index 9d96d8e..f9ccfc8 100644 (file)
@@ -18,7 +18,6 @@ package com.android.systemui.recents.events.component;
 
 import android.content.Context;
 import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.misc.SystemServicesProxy;
 
 /**
  * This is sent when we want to start screen pinning.
index f3c66a5..ff3aef9 100644 (file)
@@ -17,7 +17,6 @@
 package com.android.systemui.recents.views;
 
 import android.annotation.Nullable;
-import android.app.ActivityManager;
 import android.app.ActivityManager.StackId;
 import android.app.ActivityOptions;
 import android.content.Context;
@@ -49,7 +48,6 @@ import com.android.systemui.recents.model.TaskStack;
 import java.util.ArrayList;
 import java.util.List;
 
-import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
 import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
 import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
 import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
index b75115c..311ee65 100644 (file)
@@ -23,15 +23,12 @@ import android.graphics.drawable.Drawable;
 import android.os.Handler;
 import android.util.ArraySet;
 import android.util.AttributeSet;
-import android.view.AppTransitionAnimationSpec;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
-import android.view.View;
 import android.view.WindowInsets;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 import android.widget.FrameLayout;
-import com.android.internal.annotations.GuardedBy;
 import com.android.internal.logging.MetricsLogger;
 import com.android.systemui.R;
 import com.android.systemui.recents.Recents;
index d8fa868..67710bf 100644 (file)
@@ -1117,8 +1117,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
         mLayersDisabled = false;
 
         // Draw the freeform workspace background
-        if (mFreeformWorkspaceBackground.getAlpha() > 0) {
-            mFreeformWorkspaceBackground.draw(canvas);
+        SystemServicesProxy ssp = Recents.getSystemServices();
+        if (ssp.hasFreeformWorkspaceSupport()) {
+            if (mFreeformWorkspaceBackground.getAlpha() > 0) {
+                mFreeformWorkspaceBackground.draw(canvas);
+            }
         }
 
         super.dispatchDraw(canvas);
@@ -1162,8 +1165,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                 mViewPool.returnViewToPool(tv);
             }
 
-            // Get the stack scroll of the task to anchor to (since we are removing something, the front
-            // most task will be our anchor task)
+            // Get the stack scroll of the task to anchor to (since we are removing something, the
+            // front most task will be our anchor task)
             Task anchorTask = null;
             float prevAnchorTaskScroll = 0;
             boolean pullStackForward = stack.getTaskCount() > 0;
@@ -1180,11 +1183,16 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
                 // to ensure that the new front most task is now fully visible
                 mStackScroller.setStackScroll(mLayoutAlgorithm.mMaxScrollP);
             } else if (pullStackForward) {
-                // Otherwise, offset the scroll by half the movement of the anchor task to allow the
-                // tasks behind the removed task to move forward, and the tasks in front to move back
+                // Otherwise, offset the scroll by the movement of the anchor task
                 float anchorTaskScroll = mLayoutAlgorithm.getStackScrollForTask(anchorTask);
-                mStackScroller.setStackScroll(mStackScroller.getStackScroll() + (anchorTaskScroll
-                        - prevAnchorTaskScroll) / 2);
+                float newStackScroll = mStackScroller.getStackScroll() +
+                        (anchorTaskScroll - prevAnchorTaskScroll);
+                if (mLayoutAlgorithm.getFocusState() != TaskStackLayoutAlgorithm.STATE_FOCUSED) {
+                    // If we are focused, we don't want the front task to move, but otherwise, we
+                    // allow the back task to move up, and the front task to move back
+                    newStackScroll /= 2;
+                }
+                mStackScroller.setStackScroll(newStackScroll);
                 mStackScroller.boundScroll();
             }
 
@@ -1507,16 +1515,5 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
 
         // Remove the task from the stack
         mStack.removeTask(task);
-
-        if (taskWasFocused || ssp.isTouchExplorationEnabled()) {
-            // If the dismissed task was focused or if we are in touch exploration mode, then focus
-            // the next task
-            RecentsConfiguration config = Recents.getConfiguration();
-            RecentsActivityLaunchState launchState = config.getLaunchState();
-            boolean isFreeformTask = taskIndex > 0 ?
-                    mStack.getTasks().get(taskIndex - 1).isFreeformTask() : false;
-            setFocusedTask(taskIndex - 1, !isFreeformTask /* scrollToTask */,
-                    launchState.launchedWithAltTab);
-        }
     }
 }
index 2a2ff4a..76c6691 100644 (file)
 
 package com.android.systemui.recents.views;
 
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ArgbEvaluator;
 import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
 import android.content.Context;
 import android.content.res.ColorStateList;
 import android.graphics.Canvas;