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

Commit 42476cc3 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Waiting for wallpaper animation completion when configuring new widget" into main

parents 7b7dca38 61434924
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAU
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE;
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
@@ -120,6 +121,7 @@ import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.icons.FastBitmapDrawable;
import com.android.launcher3.model.data.ItemInfo;
@@ -1651,6 +1653,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        if (launcherIsForceInvisibleOrOpening) {
            addCujInstrumentation(anim, playFallBackAnimation
                    ? CUJ_APP_CLOSE_TO_HOME_FALLBACK : CUJ_APP_CLOSE_TO_HOME);

            anim.addListener(new AnimationSuccessListener() {
                @Override
                public void onAnimationSuccess(Animator animator) {
                    AccessibilityManagerCompat.sendTestProtocolEventToTest(
                            mLauncher, WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE);
                }
            });

            // Only register the content animation for cancellation when state changes
            mLauncher.getStateManager().setCurrentAnimation(anim);

+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ public final class TestProtocol {
    public static final String FOLDER_OPENED_MESSAGE = "TAPL_FOLDER_OPENED";
    public static final String SEARCH_RESULT_COMPLETE = "SEARCH_RESULT_COMPLETE";
    public static final String LAUNCHER_ACTIVITY_STOPPED_MESSAGE = "TAPL_LAUNCHER_ACTIVITY_STOPPED";
    public static final String WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE =
            "TAPL_WALLPAPER_OPEN_ANIMATION_FINISHED";
    public static final int NORMAL_STATE_ORDINAL = 0;
    public static final int SPRING_LOADED_STATE_ORDINAL = 1;
    public static final int OVERVIEW_STATE_ORDINAL = 2;
+5 −3
Original line number Diff line number Diff line
@@ -113,9 +113,11 @@ public class AddConfigWidgetTest extends AbstractLauncherUiTest {
    }

    private void setResult(boolean success) {
        mLauncher.executeAndWaitForWallpaperAnimation(() ->
                        getInstrumentation().getTargetContext().sendBroadcast(
                                WidgetConfigActivity.getCommandIntent(WidgetConfigActivity.class,
                        success ? "clickOK" : "clickCancel"));
                                        success ? "clickOK" : "clickCancel")),
                "setting widget coinfig result");
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -2313,4 +2313,14 @@ public final class LauncherInstrumentation {
        }
        return result;
    }

    /** Executes a runnable and waits for the wallpaper-open animation completion. */
    public void executeAndWaitForWallpaperAnimation(Runnable r, String actionName) {
        executeAndWaitForLauncherEvent(
                () -> r.run(),
                event -> TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE
                        .equals(event.getClassName().toString()),
                () -> "Didn't detect finishing wallpaper-open animation",
                actionName);
    }
}