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

Commit 40245d32 authored by Hongwei Wang's avatar Hongwei Wang Committed by Automerger Merge Worker
Browse files

Merge "Add extra debug logging" into udc-dev am: 3ed995b3 am: 0073e454

parents b64f6dcd 0073e454
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
@@ -438,6 +438,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
     */
     */
    public Rect startSwipePipToHome(ComponentName componentName, ActivityInfo activityInfo,
    public Rect startSwipePipToHome(ComponentName componentName, ActivityInfo activityInfo,
            PictureInPictureParams pictureInPictureParams) {
            PictureInPictureParams pictureInPictureParams) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "startSwipePipToHome: %s, state=%s", componentName, mPipTransitionState);
        mPipTransitionState.setInSwipePipToHomeTransition(true);
        mPipTransitionState.setInSwipePipToHomeTransition(true);
        sendOnPipTransitionStarted(TRANSITION_DIRECTION_TO_PIP);
        sendOnPipTransitionStarted(TRANSITION_DIRECTION_TO_PIP);
        setBoundsStateForEntry(componentName, pictureInPictureParams, activityInfo);
        setBoundsStateForEntry(componentName, pictureInPictureParams, activityInfo);
@@ -450,6 +452,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
     */
     */
    public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds,
    public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds,
            SurfaceControl overlay) {
            SurfaceControl overlay) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "stopSwipePipToHome: %s, state=%s", componentName, mPipTransitionState);
        // do nothing if there is no startSwipePipToHome being called before
        // do nothing if there is no startSwipePipToHome being called before
        if (!mPipTransitionState.getInSwipePipToHomeTransition()) {
        if (!mPipTransitionState.getInSwipePipToHomeTransition()) {
            return;
            return;
@@ -522,6 +526,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            return;
            return;
        }
        }


        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "exitPip: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        if (isLaunchIntoPipTask()) {
        if (isLaunchIntoPipTask()) {
            exitLaunchIntoPipTask(wct);
            exitLaunchIntoPipTask(wct);
@@ -559,6 +565,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            // destinationBounds calculated above will be incorrect if this is with rotation.
            // destinationBounds calculated above will be incorrect if this is with rotation.
            wct.setBounds(mToken, null);
            wct.setBounds(mToken, null);
        } else {
        } else {
            ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                    "exitPip: %s, dest=%s", mTaskInfo.topActivity, destinationBounds);
            final SurfaceControl.Transaction tx =
            final SurfaceControl.Transaction tx =
                    mSurfaceControlTransactionFactory.getTransaction();
                    mSurfaceControlTransactionFactory.getTransaction();
            mSurfaceTransactionHelper.scale(tx, mLeash, destinationBounds,
            mSurfaceTransactionHelper.scale(tx, mLeash, destinationBounds,
@@ -656,9 +664,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        animator.setInterpolator(Interpolators.ALPHA_OUT);
        animator.setInterpolator(Interpolators.ALPHA_OUT);
        animator.start();
        animator.start();
        mPipTransitionState.setTransitionState(PipTransitionState.EXITING_PIP);
        mPipTransitionState.setTransitionState(PipTransitionState.EXITING_PIP);
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "removePip: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
    }
    }


    private void removePipImmediately() {
    private void removePipImmediately() {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "removePipImmediately: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
        if (Transitions.ENABLE_SHELL_TRANSITIONS) {
        if (Transitions.ENABLE_SHELL_TRANSITIONS) {
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            wct.setBounds(mToken, null);
            wct.setBounds(mToken, null);
@@ -723,6 +735,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        }
        }
        mPipUiEventLoggerLogger.log(uiEventEnum);
        mPipUiEventLoggerLogger.log(uiEventEnum);


        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onTaskAppeared: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
        if (mPipTransitionState.getInSwipePipToHomeTransition()) {
        if (mPipTransitionState.getInSwipePipToHomeTransition()) {
            if (!mWaitForFixedRotation) {
            if (!mWaitForFixedRotation) {
                onEndOfSwipePipToHomeTransition();
                onEndOfSwipePipToHomeTransition();
@@ -774,6 +788,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
    }
    }


    private void onTaskAppearedWithFixedRotation(int animationType) {
    private void onTaskAppearedWithFixedRotation(int animationType) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onTaskAppearedWithFixedRotation: %s, state=%s animationType=%d",
                mTaskInfo.topActivity, mPipTransitionState, animationType);
        if (animationType == ANIM_TYPE_ALPHA) {
        if (animationType == ANIM_TYPE_ALPHA) {
            ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
            ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                    "%s: Defer entering PiP alpha animation, fixed rotation is ongoing", TAG);
                    "%s: Defer entering PiP alpha animation, fixed rotation is ongoing", TAG);
@@ -920,6 +937,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
     */
     */
    @Override
    @Override
    public void onTaskVanished(ActivityManager.RunningTaskInfo info) {
    public void onTaskVanished(ActivityManager.RunningTaskInfo info) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onTaskVanished: %s, state=%s", mTaskInfo.topActivity, mPipTransitionState);
        if (mPipTransitionState.getTransitionState() == PipTransitionState.UNDEFINED) {
        if (mPipTransitionState.getTransitionState() == PipTransitionState.UNDEFINED) {
            return;
            return;
        }
        }
@@ -961,6 +980,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        mPipBoundsState.setOverrideMinSize(
        mPipBoundsState.setOverrideMinSize(
                mPipBoundsAlgorithm.getMinimalSize(info.topActivityInfo));
                mPipBoundsAlgorithm.getMinimalSize(info.topActivityInfo));
        final PictureInPictureParams newParams = info.pictureInPictureParams;
        final PictureInPictureParams newParams = info.pictureInPictureParams;
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onTaskInfoChanged: %s, state=%s oldParams=%s newParams=%s",
                mTaskInfo.topActivity, mPipTransitionState, mPictureInPictureParams, newParams);


        // mPictureInPictureParams is only null if there is no PiP
        // mPictureInPictureParams is only null if there is no PiP
        if (newParams == null || mPictureInPictureParams == null) {
        if (newParams == null || mPictureInPictureParams == null) {
@@ -1001,6 +1023,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,


    @Override
    @Override
    public void onFixedRotationStarted(int displayId, int newRotation) {
    public void onFixedRotationStarted(int displayId, int newRotation) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onFixedRotationStarted: %s, state=%s", mTaskInfo, mPipTransitionState);
        mNextRotation = newRotation;
        mNextRotation = newRotation;
        mWaitForFixedRotation = true;
        mWaitForFixedRotation = true;


@@ -1022,6 +1046,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,


    @Override
    @Override
    public void onFixedRotationFinished(int displayId) {
    public void onFixedRotationFinished(int displayId) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onFixedRotationFinished: %s, state=%s", mTaskInfo, mPipTransitionState);
        if (!mWaitForFixedRotation) {
        if (!mWaitForFixedRotation) {
            return;
            return;
        }
        }
@@ -1057,6 +1083,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,


    /** Called when exiting PIP transition is finished to do the state cleanup. */
    /** Called when exiting PIP transition is finished to do the state cleanup. */
    void onExitPipFinished(TaskInfo info) {
    void onExitPipFinished(TaskInfo info) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "onExitPipFinished: %s, state=%s leash=%s",
                info.topActivity, mPipTransitionState, mLeash);
        if (mLeash == null) {
        if (mLeash == null) {
            // TODO(239461594): Remove once the double call to onExitPipFinished() is fixed
            // TODO(239461594): Remove once the double call to onExitPipFinished() is fixed
            ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
            ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
@@ -1108,6 +1137,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,


    /** Explicitly set the visibility of PiP window. */
    /** Explicitly set the visibility of PiP window. */
    public void setPipVisibility(boolean visible) {
    public void setPipVisibility(boolean visible) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "setPipVisibility: %s, state=%s visible=%s",
                mTaskInfo.topActivity, mPipTransitionState, visible);
        if (!isInPip()) {
        if (!isInPip()) {
            return;
            return;
        }
        }
+18 −0
Original line number Original line Diff line number Diff line
@@ -140,6 +140,24 @@ public class PipTransitionState {
        return state == ENTERING_PIP;
        return state == ENTERING_PIP;
    }
    }


    private String stateToString() {
        switch (mState) {
            case UNDEFINED: return "undefined";
            case TASK_APPEARED: return "task-appeared";
            case ENTRY_SCHEDULED: return "entry-scheduled";
            case ENTERING_PIP: return "entering-pip";
            case ENTERED_PIP: return "entered-pip";
            case EXITING_PIP: return "exiting-pip";
        }
        throw new IllegalStateException("Unknown state: " + mState);
    }

    @Override
    public String toString() {
        return String.format("PipTransitionState(mState=%s, mInSwipePipToHomeTransition=%b)",
                stateToString(), mInSwipePipToHomeTransition);
    }

    public interface OnPipTransitionStateChangedListener {
    public interface OnPipTransitionStateChangedListener {
        void onPipTransitionStateChanged(@TransitionState int oldState,
        void onPipTransitionStateChanged(@TransitionState int oldState,
                @TransitionState int newState);
                @TransitionState int newState);
+6 −0
Original line number Original line Diff line number Diff line
@@ -574,6 +574,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                    @Override
                    @Override
                    public void onActivityPinned(String packageName, int userId, int taskId,
                    public void onActivityPinned(String packageName, int userId, int taskId,
                            int stackId) {
                            int stackId) {
                        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                                "onActivityPinned: %s", packageName);
                        mTouchHandler.onActivityPinned();
                        mTouchHandler.onActivityPinned();
                        mMediaController.onActivityPinned();
                        mMediaController.onActivityPinned();
                        mAppOpsListener.onActivityPinned(packageName);
                        mAppOpsListener.onActivityPinned(packageName);
@@ -585,6 +587,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                        final Pair<ComponentName, Integer> topPipActivityInfo =
                        final Pair<ComponentName, Integer> topPipActivityInfo =
                                PipUtils.getTopPipActivity(mContext);
                                PipUtils.getTopPipActivity(mContext);
                        final ComponentName topActivity = topPipActivityInfo.first;
                        final ComponentName topActivity = topPipActivityInfo.first;
                        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                                "onActivityUnpinned: %s", topActivity);
                        mTouchHandler.onActivityUnpinned(topActivity);
                        mTouchHandler.onActivityUnpinned(topActivity);
                        mAppOpsListener.onActivityUnpinned();
                        mAppOpsListener.onActivityUnpinned();
                        mPipInputConsumer.unregisterInputConsumer();
                        mPipInputConsumer.unregisterInputConsumer();
@@ -593,6 +597,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                    @Override
                    @Override
                    public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
                    public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
                            boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
                            boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
                        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                                "onActivityRestartAttempt: %s", task.topActivity);
                        if (task.getWindowingMode() != WINDOWING_MODE_PINNED) {
                        if (task.getWindowingMode() != WINDOWING_MODE_PINNED) {
                            return;
                            return;
                        }
                        }