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

Commit 0d22befc authored by Hongwei Wang's avatar Hongwei Wang
Browse files

VisD update for the PipAppIconOverlay 2/N

- Pass the up-to-dated app icon size from Launcher to WMShell
    this is for non-auto-enter-pip cases
- For auto-enter-pip, use the DeviceProfile#allAppsIconSizePx directly

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/ha3ebrRk0hAEyU8GSWBrYE
Bug: Bug: 271912318
Test: manual with 4x4 and 5x5 grid, see the video
Change-Id: Iaad26758a25c6cb3832a2da10e15c53e72de0ce5
parent 51a86489
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -172,7 +172,6 @@ import com.android.quickstep.views.FloatingTaskView;
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.unfold.RemoteUnfoldSharedComponent;
import com.android.systemui.unfold.UnfoldSharedComponent;
@@ -192,7 +191,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

@@ -1219,11 +1217,18 @@ public class QuickstepLauncher extends Launcher {
        return false;
    }

    @Override
    protected void onDeviceProfileInitiated() {
        super.onDeviceProfileInitiated();
        SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx);
    }

    @Override
    public void dispatchDeviceProfileChanged() {
        super.dispatchDeviceProfileChanged();
        Trace.instantForTrack(TRACE_TAG_APP, "QuickstepLauncher#DeviceProfileChanged",
                getDeviceProfile().toSmallString());
        SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx);
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -1602,6 +1602,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                .setContext(mContext)
                .setTaskId(runningTaskTarget.taskId)
                .setActivityInfo(taskInfo.topActivityInfo)
                .setAppIconSizePx(mDp.iconSizePx)
                .setLeash(runningTaskTarget.leash)
                .setSourceRectHint(
                        runningTaskTarget.taskInfo.pictureInPictureParams.getSourceRectHint())
+13 −0
Original line number Diff line number Diff line
@@ -546,6 +546,19 @@ public class SystemUiProxy implements ISystemUiProxy {
        }
    }

    /**
     * Sets the app icon size in pixel used by Launcher all apps.
     */
    public void setLauncherAppIconSize(int iconSizePx) {
        if (mPip != null) {
            try {
                mPip.setLauncherAppIconSize(iconSizePx);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed call setLauncherAppIconSize", e);
            }
        }
    }

    //
    // Splitscreen
    //
+12 −3
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
     * @param taskId Task id associated with this animator, see also {@link #getTaskId()}
     * @param activityInfo {@link ActivityInfo} associated with this animator,
     *                      see also {@link #getComponentName()}
     * @param appIconSizePx The size in pixel for the app icon in content overlay
     * @param leash {@link SurfaceControl} this animator operates on
     * @param sourceRectHint See the definition in {@link android.app.PictureInPictureParams}
     * @param appBounds Bounds of the application, sourceRectHint is based on this bounds
@@ -111,6 +112,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
    private SwipePipToHomeAnimator(@NonNull Context context,
            int taskId,
            @NonNull ActivityInfo activityInfo,
            int appIconSizePx,
            @NonNull SurfaceControl leash,
            @Nullable Rect sourceRectHint,
            @NonNull Rect appBounds,
@@ -153,7 +155,8 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
            if (SystemProperties.getBoolean(
                    "persist.wm.debug.enable_pip_app_icon_overlay", true)) {
                mPipContentOverlay = new PipContentOverlay.PipAppIconOverlay(view.getContext(),
                        mAppBounds, () -> new IconProvider(context).getIcon(mActivityInfo));
                        mAppBounds, new IconProvider(context).getIcon(mActivityInfo),
                        appIconSizePx);
            }  else {
                mPipContentOverlay = new PipContentOverlay.PipColorOverlay(view.getContext());
            }
@@ -317,6 +320,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
        private Context mContext;
        private int mTaskId;
        private ActivityInfo mActivityInfo;
        private int mAppIconSizePx;
        private SurfaceControl mLeash;
        private Rect mSourceRectHint;
        private Rect mDisplayCutoutInsets;
@@ -345,6 +349,11 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
            return this;
        }

        public Builder setAppIconSizePx(int appIconSizePx) {
            mAppIconSizePx = appIconSizePx;
            return this;
        }

        public Builder setLeash(SurfaceControl leash) {
            mLeash = leash;
            return this;
@@ -425,8 +434,8 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
                    mAppBounds.inset(mDisplayCutoutInsets);
                }
            }
            return new SwipePipToHomeAnimator(mContext, mTaskId, mActivityInfo, mLeash,
                    mSourceRectHint, mAppBounds,
            return new SwipePipToHomeAnimator(mContext, mTaskId, mActivityInfo, mAppIconSizePx,
                    mLeash, mSourceRectHint, mAppBounds,
                    mHomeToWindowPositionMap, mStartBounds, mDestinationBounds,
                    mFromRotation, mDestinationBoundsTransformed,
                    mCornerRadius, mShadowRadius, mAttachedView);