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

Commit 5549898e authored by wilsonshih's avatar wilsonshih
Browse files

Defer showing taskbar when playing back-to-home animation.

After migrate predictive back to shell transition, the home activity
will participant in the prepare transition instead of after gesture
commit, so HomeTransitionObserver should defer showing taskbar if the
transition change is back gesture animated, and let
LauncherBackAnimationController to control when to show taskbar.

Flag: com.android.window.flags.migrate_predictive_back_transition
Bug: 363927522
Test: atest HomeTransitionObserverTest
Change-Id: Icbfffac12e599fef7a2acce5ab013dd5fdd90831
parent 61dfb4a0
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ import android.os.IBinder;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
import android.window.TransitionInfo;
import android.window.TransitionInfo;


import com.android.window.flags.Flags;
import com.android.wm.shell.common.RemoteCallable;
import com.android.wm.shell.common.RemoteCallable;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SingleInstanceRemoteListener;
import com.android.wm.shell.common.SingleInstanceRemoteListener;
@@ -71,9 +72,17 @@ public class HomeTransitionObserver implements TransitionObserver,


            final int mode = change.getMode();
            final int mode = change.getMode();
            final boolean isBackGesture = change.hasFlags(FLAG_BACK_GESTURE_ANIMATED);
            final boolean isBackGesture = change.hasFlags(FLAG_BACK_GESTURE_ANIMATED);
            if (taskInfo.getActivityType() == ACTIVITY_TYPE_HOME
            if (taskInfo.getActivityType() == ACTIVITY_TYPE_HOME) {
                    && (TransitionUtil.isOpenOrCloseMode(mode) || isBackGesture)) {
                if (Flags.migratePredictiveBackTransition()) {
                notifyHomeVisibilityChanged(TransitionUtil.isOpeningType(mode) || isBackGesture);
                    if (!isBackGesture && TransitionUtil.isOpenOrCloseMode(mode)) {
                        notifyHomeVisibilityChanged(TransitionUtil.isOpeningType(mode));
                    }
                } else {
                    if (TransitionUtil.isOpenOrCloseMode(mode) || isBackGesture) {
                        notifyHomeVisibilityChanged(TransitionUtil.isOpeningType(mode)
                                || isBackGesture);
                    }
                }
            }
            }
        }
        }
    }
    }
+8 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,9 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Looper;
import android.os.Looper;
import android.os.RemoteException;
import android.os.RemoteException;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
import android.window.TransitionInfo;
import android.window.TransitionInfo;
import android.window.TransitionInfo.TransitionMode;
import android.window.TransitionInfo.TransitionMode;
@@ -46,6 +49,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import androidx.test.filters.SmallTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.platform.app.InstrumentationRegistry;


import com.android.window.flags.Flags;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.ShellTestCase;
import com.android.wm.shell.TestShellExecutor;
import com.android.wm.shell.TestShellExecutor;
@@ -57,6 +61,7 @@ import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.sysui.ShellInit;


import org.junit.Before;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;


@@ -70,6 +75,8 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
@RunWith(AndroidJUnit4.class)
public class HomeTransitionObserverTest extends ShellTestCase {
public class HomeTransitionObserverTest extends ShellTestCase {


    @Rule
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
    private final ShellTaskOrganizer mOrganizer = mock(ShellTaskOrganizer.class);
    private final ShellTaskOrganizer mOrganizer = mock(ShellTaskOrganizer.class);
    private final TransactionPool mTransactionPool = mock(TransactionPool.class);
    private final TransactionPool mTransactionPool = mock(TransactionPool.class);
    private final Context mContext =
    private final Context mContext =
@@ -187,6 +194,7 @@ public class HomeTransitionObserverTest extends ShellTestCase {
    }
    }


    @Test
    @Test
    @RequiresFlagsDisabled(Flags.FLAG_MIGRATE_PREDICTIVE_BACK_TRANSITION)
    public void testHomeActivityWithBackGestureNotifiesHomeIsVisible() throws RemoteException {
    public void testHomeActivityWithBackGestureNotifiesHomeIsVisible() throws RemoteException {
        TransitionInfo info = mock(TransitionInfo.class);
        TransitionInfo info = mock(TransitionInfo.class);
        TransitionInfo.Change change = mock(TransitionInfo.Change.class);
        TransitionInfo.Change change = mock(TransitionInfo.Change.class);