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

Commit 5dd46d51 authored by Winson Chung's avatar Winson Chung
Browse files

Update sysui flags on swipe, skip task backgrounds on opaque apps

Bug: 79228291
Bug: 77984778
Bug: 78659249
Bug: 73714156
Change-Id: I3bb9ce5b4d5d16bc229a1caba99891cb87775136
parent 9b789cbb
Loading
Loading
Loading
Loading
−86 B (125 KiB)

File changed.

No diff preview for this file type.

+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;

import android.animation.Animator;
import android.animation.AnimatorSet;
@@ -106,6 +107,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
    };
    public static final boolean FLIP_RECENTS = true;
    private static final int DISMISS_TASK_DURATION = 300;
    // The threshold at which we update the SystemUI flags when animating from the task into the app
    private static final float UPDATE_SYSUI_FLAGS_THRESHOLD = 0.6f;

    private static final float[] sTempFloatArray = new float[3];

@@ -1152,12 +1155,21 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        }

        tv.setVisibility(INVISIBLE);
        int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
        TaskViewDrawable drawable = new TaskViewDrawable(tv, this);
        getOverlay().add(drawable);

        ObjectAnimator drawableAnim =
                ObjectAnimator.ofFloat(drawable, TaskViewDrawable.PROGRESS, 1, 0);
        drawableAnim.setInterpolator(LINEAR);
        drawableAnim.addUpdateListener((animator) -> {
            // Once we pass a certain threshold, update the sysui flags to match the target tasks'
            // flags
            mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW,
                    animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD
                            ? targetSysUiFlags
                            : 0);
        });

        AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv,
                drawable.getClipAnimationHelper());
+32 −13
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.quickstep.views;

import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;

import android.content.Context;
@@ -38,6 +39,7 @@ import com.android.launcher3.BaseActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.SystemUiController;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.systemui.shared.recents.model.Task;
@@ -143,6 +145,20 @@ public class TaskThumbnailView extends View {
        return new Rect();
    }

    public int getSysUiStatusNavFlags() {
        if (mThumbnailData != null) {
            int flags = 0;
            flags |= (mThumbnailData.systemUiVisibility & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0
                    ? SystemUiController.FLAG_LIGHT_STATUS
                    : SystemUiController.FLAG_DARK_STATUS;
            flags |= (mThumbnailData.systemUiVisibility & SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) != 0
                    ? SystemUiController.FLAG_LIGHT_NAV
                    : SystemUiController.FLAG_DARK_NAV;
            return flags;
        }
        return 0;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        drawOnCanvas(canvas, 0, 0, getMeasuredWidth(), getMeasuredHeight(), mCornerRadius);
@@ -154,12 +170,16 @@ public class TaskThumbnailView extends View {

    public void drawOnCanvas(Canvas canvas, float x, float y, float width, float height,
            float cornerRadius) {
        // Always draw the background since the snapshots may be translucent
        // Draw the background in all cases, except when the thumbnail data is opaque
        final boolean drawBackgroundOnly = mTask == null || mTask.isLocked || mBitmapShader == null
                || mThumbnailData == null;
        if (drawBackgroundOnly || mClipBottom > 0 || mThumbnailData.isTranslucent) {
            canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mBackgroundPaint);
        if (mTask == null) {
            if (drawBackgroundOnly) {
                return;
            }
        if (!mTask.isLocked) {
        }

        if (mClipBottom > 0) {
            canvas.save();
            canvas.clipRect(x, y, width, mClipBottom);
@@ -169,7 +189,6 @@ public class TaskThumbnailView extends View {
            canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mPaint);
        }
    }
    }

    private void updateThumbnailPaintFilter() {
        int mul = (int) ((1 - mDimAlpha) * 255);
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.launcher3;

import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.app.Activity;
@@ -153,6 +154,12 @@ public abstract class BaseActivity extends Activity {
    protected void onPause() {
        mActivityFlags &= ~ACTIVITY_STATE_RESUMED;
        super.onPause();

        // Reset the overridden sysui flags used for the task-swipe launch animation, we do this
        // here instead of at the end of the animation because the start of the new activity does
        // not happen immediately, which would cause us to reset to launcher's sysui flags and then
        // back to the new app (causing a flash)
        getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
    }

    public boolean isStarted() {
+2 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public class SystemUiController {
    public static final int UI_STATE_ALL_APPS = 1;
    public static final int UI_STATE_WIDGET_BOTTOM_SHEET = 2;
    public static final int UI_STATE_ROOT_VIEW = 3;
    public static final int UI_STATE_OVERVIEW = 4;

    public static final int FLAG_LIGHT_NAV = 1 << 0;
    public static final int FLAG_DARK_NAV = 1 << 1;
@@ -38,7 +39,7 @@ public class SystemUiController {
    public static final int FLAG_DARK_STATUS = 1 << 3;

    private final Window mWindow;
    private final int[] mStates = new int[4];
    private final int[] mStates = new int[5];

    public SystemUiController(Window window) {
        mWindow = window;