Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dddfff3c authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes Ia8a90434,I35f484c7,I2e87e764 into nyc-dev

* changes:
  Tweaks to make overview animations to match spec.
  Closing system windows when dismissing recents to app or home.
  Caching the display rect to reduce binder calls.
parents ce83dcf4 3f32e7eb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,5 +26,6 @@
        android:layout_gravity="center"
        android:drawableTop="@drawable/recents_info_light"
        android:drawablePadding="8dp"
        android:text="@string/recents_incompatible_app_message" />
        android:text="@string/recents_incompatible_app_message"
        android:textColor="@android:color/white" />
</FrameLayout>
 No newline at end of file
+0 −6
Original line number Diff line number Diff line
@@ -144,12 +144,6 @@
    <!-- The min animation duration for animating the nav bar scrim in. -->
    <integer name="recents_nav_bar_scrim_enter_duration">400</integer>

    <!-- The animation duration for animating the removal of a task view. -->
    <integer name="recents_animate_task_view_remove_duration">175</integer>

    <!-- The base animation duration for animating the removal of all task views. -->
    <integer name="recents_animate_task_views_remove_all_duration">300</integer>

    <!-- The animation duration for scrolling the stack to a particular item. -->
    <integer name="recents_animate_task_stack_scroll_duration">200</integer>

+12 −13
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.IntentFilter;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
@@ -97,6 +98,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    public final static int INCOMPATIBLE_APP_ALPHA_DURATION = 150;

    private RecentsPackageMonitor mPackageMonitor;
    private Handler mHandler = new Handler();
    private long mLastTabKeyEventTime;
    private int mLastDeviceOrientation = Configuration.ORIENTATION_UNDEFINED;
    private int mLastDisplayDensity;
@@ -138,12 +140,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        @Override
        public void run() {
            try {
                mHandler.post(() -> {
                    ActivityOptions opts = mOpts;
                    if (opts == null) {
                        opts = ActivityOptions.makeCustomAnimation(RecentsActivity.this,
                                R.anim.recents_to_launcher_enter, R.anim.recents_to_launcher_exit);
                    }
                    startActivityAsUser(mLaunchIntent, opts.toBundle(), UserHandle.CURRENT);
                });
            } catch (Exception e) {
                Log.e(TAG, getString(R.string.recents_launch_error_message, "Home"), e);
            }
@@ -223,13 +227,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
                new DismissRecentsToHomeAnimationStarted(animateTaskViews);
        dismissEvent.addPostAnimationCallback(new LaunchHomeRunnable(mHomeIntent,
                overrideAnimation));
        dismissEvent.addPostAnimationCallback(new Runnable() {
            @Override
            public void run() {
        Recents.getSystemServices().sendCloseSystemWindows(
                BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
            }
        });
        EventBus.getDefault().send(dismissEvent);
    }

+4 −3
Original line number Diff line number Diff line
@@ -588,6 +588,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
     */
    private void updateHeaderBarLayout(TaskStack stack, Rect windowRectOverride) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        Rect displayRect = ssp.getDisplayRect();
        Rect systemInsets = new Rect();
        ssp.getStableInsets(systemInsets);
        Rect windowRect = windowRectOverride != null
@@ -608,10 +609,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        // Rebind the header bar and draw it for the transition
        stackLayout.setSystemInsets(systemInsets);
        if (stack != null) {
            stackLayout.getTaskStackBounds(windowRect, systemInsets.top, systemInsets.right,
                    mTaskStackBounds);
            stackLayout.getTaskStackBounds(displayRect, windowRect, systemInsets.top,
                    systemInsets.right, mTaskStackBounds);
            stackLayout.reset();
            stackLayout.initialize(windowRect, mTaskStackBounds,
            stackLayout.initialize(displayRect, windowRect, mTaskStackBounds,
                    TaskStackLayoutAlgorithm.StackState.getStackStateForStack(stack));
            mDummyStackView.setTasks(stack, false /* allowNotifyStackChanges */);

+25 −12
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.util.SparseArray;
import android.view.animation.Interpolator;

import com.android.internal.policy.DockedDividerUtils;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsDebugFlags;
@@ -253,7 +254,7 @@ public class TaskStack {
        private static final int HORIZONTAL = 0;
        private static final int VERTICAL = 1;

        private static final int DOCK_AREA_ALPHA = 192;
        private static final int DOCK_AREA_ALPHA = 80;
        public static final DockState NONE = new DockState(DOCKED_INVALID, -1, 80, 255, HORIZONTAL,
                null, null, null);
        public static final DockState LEFT = new DockState(DOCKED_LEFT,
@@ -368,19 +369,28 @@ public class TaskStack {
                    mDockAreaOverlayAnimator.cancel();
                }

                ObjectAnimator anim;
                ArrayList<Animator> animators = new ArrayList<>();
                if (dockAreaOverlay.getAlpha() != areaAlpha) {
                    if (animateAlpha) {
                        animators.add(ObjectAnimator.ofInt(dockAreaOverlay,
                                Utilities.DRAWABLE_ALPHA, dockAreaOverlay.getAlpha(), areaAlpha));
                        anim = ObjectAnimator.ofInt(dockAreaOverlay,
                                Utilities.DRAWABLE_ALPHA, dockAreaOverlay.getAlpha(), areaAlpha);
                        anim.setDuration(duration);
                        anim.setInterpolator(interpolator);
                        animators.add(anim);
                    } else {
                        dockAreaOverlay.setAlpha(areaAlpha);
                    }
                }
                if (mHintTextAlpha != hintAlpha) {
                    if (animateAlpha) {
                        animators.add(ObjectAnimator.ofInt(this, HINT_ALPHA, mHintTextAlpha,
                                hintAlpha));
                        anim = ObjectAnimator.ofInt(this, HINT_ALPHA, mHintTextAlpha,
                                hintAlpha);
                        anim.setDuration(150);
                        anim.setInterpolator(hintAlpha > mHintTextAlpha
                                ? Interpolators.ALPHA_IN
                                : Interpolators.ALPHA_OUT);
                        animators.add(anim);
                    } else {
                        mHintTextAlpha = hintAlpha;
                        dockAreaOverlay.invalidateSelf();
@@ -390,8 +400,11 @@ public class TaskStack {
                    if (animateBounds) {
                        PropertyValuesHolder prop = PropertyValuesHolder.ofObject(
                                Utilities.DRAWABLE_RECT, Utilities.RECT_EVALUATOR,
                                dockAreaOverlay.getBounds(), bounds);
                        animators.add(ObjectAnimator.ofPropertyValuesHolder(dockAreaOverlay, prop));
                                new Rect(dockAreaOverlay.getBounds()), bounds);
                        anim = ObjectAnimator.ofPropertyValuesHolder(dockAreaOverlay, prop);
                        anim.setDuration(duration);
                        anim.setInterpolator(interpolator);
                        animators.add(anim);
                    } else {
                        dockAreaOverlay.setBounds(bounds);
                    }
@@ -399,8 +412,6 @@ public class TaskStack {
                if (!animators.isEmpty()) {
                    mDockAreaOverlayAnimator = new AnimatorSet();
                    mDockAreaOverlayAnimator.playTogether(animators);
                    mDockAreaOverlayAnimator.setDuration(duration);
                    mDockAreaOverlayAnimator.setInterpolator(interpolator);
                    mDockAreaOverlayAnimator.start();
                }
            }
@@ -481,8 +492,9 @@ public class TaskStack {
         * Returns the task stack bounds with the given {@param width} and
         * {@param height}.
         */
        public Rect getDockedTaskStackBounds(int width, int height, int dividerSize, Rect insets,
                TaskStackLayoutAlgorithm layoutAlgorithm, Resources res, Rect windowRectOut) {
        public Rect getDockedTaskStackBounds(Rect displayRect, int width, int height,
                int dividerSize, Rect insets, TaskStackLayoutAlgorithm layoutAlgorithm,
                Resources res, Rect windowRectOut) {
            // Calculate the inverse docked task bounds
            boolean isHorizontalDivision =
                    res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
@@ -499,7 +511,8 @@ public class TaskStack {
            int top = dockArea.bottom < 1f
                    ? 0
                    : insets.top;
            layoutAlgorithm.getTaskStackBounds(windowRectOut, top, insets.right, taskStackBounds);
            layoutAlgorithm.getTaskStackBounds(displayRect, windowRectOut, top, insets.right,
                    taskStackBounds);
            return taskStackBounds;
        }
    }
Loading