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

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

Work around the flicker on enter PiP for foldables

This is work around for b/311084698

We use to rely on the mIsInStateChange flag to avoid resetting the
surface of PiP task, it's broken recently. The windowing mode check here
is not ideal but it should be safe to ignore any resetting from
UnfoldAnimationController for a Task that's already pinned.

Before: http://recall/-/aaaaaabFQoRHlzixHdtY/ahJ6dpKl1ajsaReCX70Wb
After: http://recall/-/aaaaaabFQoRHlzixHdtY/cc0H4jAt0KxqzFxzkfVjk7
Flag: NONE
Bug: 311084698
Test: Manually following the reproduce steps in bug
Change-Id: I5f60b2da8eaf948145ca61fb21433f5640f1feeb
parent 00599c9c
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.wm.shell.unfold;

import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;

import android.annotation.NonNull;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.TaskInfo;
@@ -28,11 +30,11 @@ import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider.UnfoldListener;
import com.android.wm.shell.unfold.animation.UnfoldTaskAnimator;

import dagger.Lazy;

import java.util.List;
import java.util.Optional;

import dagger.Lazy;

/**
 * Manages fold/unfold animations of tasks on foldable devices.
 * When folding or unfolding a foldable device we play animations that
@@ -228,7 +230,8 @@ public class UnfoldAnimationController implements UnfoldListener {
    }

    private void maybeResetTask(UnfoldTaskAnimator animator, TaskInfo taskInfo) {
        if (!mIsInStageChange) {
        // TODO(b/311084698): the windowing mode check is added here as a work around.
        if (!mIsInStageChange || taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) {
            // No need to resetTask if there is no ongoing state change.
            return;
        }