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

Commit 54834b09 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Merge commit '2cd8dd62' into merge_ub-launcher3-master_6976145

Test: manual, presubmit on the source branch
    x20/teams/android-launcher/merge/ub-launcher3-master_master_6976145.html

Change-Id: Ic13b1a20cc3d555e8e86717ca0da97103ff09c85
parents af0391f9 2cd8dd62
Loading
Loading
Loading
Loading
+89 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep.util;

import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_180;
import static android.view.Surface.ROTATION_90;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import android.content.Context;

import com.android.quickstep.FallbackActivityInterface;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.LooperMode;
import org.robolectric.annotation.LooperMode.Mode;

/**
 * Tests for {@link RecentsOrientedState}
 */
@RunWith(RobolectricTestRunner.class)
@LooperMode(Mode.PAUSED)
public class RecentsOrientedStateTest {

    private RecentsOrientedState mR1, mR2;

    @Before
    public void setup() {
        Context context = RuntimeEnvironment.application;
        mR1 = new RecentsOrientedState(context, FallbackActivityInterface.INSTANCE, i -> { });
        mR2 = new RecentsOrientedState(context, FallbackActivityInterface.INSTANCE, i -> { });
        assertEquals(mR1.getStateId(), mR2.getStateId());
    }

    @Test
    public void stateId_changesWithFlags() {
        mR1.setGestureActive(true);
        mR2.setGestureActive(false);
        assertNotEquals(mR1.getStateId(), mR2.getStateId());

        mR2.setGestureActive(true);
        assertEquals(mR1.getStateId(), mR2.getStateId());
    }

    @Test
    public void stateId_changesWithRecentsRotation() {
        mR1.setRecentsRotation(ROTATION_90);
        mR2.setRecentsRotation(ROTATION_180);
        assertNotEquals(mR1.getStateId(), mR2.getStateId());

        mR2.setRecentsRotation(ROTATION_90);
        assertEquals(mR1.getStateId(), mR2.getStateId());
    }

    @Test
    public void stateId_changesWithDisplayRotation() {
        mR1.update(ROTATION_0, ROTATION_90);
        mR2.update(ROTATION_0, ROTATION_180);
        assertNotEquals(mR1.getStateId(), mR2.getStateId());

        mR2.update(ROTATION_90, ROTATION_90);
        assertNotEquals(mR1.getStateId(), mR2.getStateId());

        mR2.update(ROTATION_90, ROTATION_0);
        assertNotEquals(mR1.getStateId(), mR2.getStateId());

        mR2.update(ROTATION_0, ROTATION_90);
        assertEquals(mR1.getStateId(), mR2.getStateId());
    }
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -148,7 +148,7 @@ public class TaskViewSimulatorTest {
            if (mAppRotation < 0) {
            if (mAppRotation < 0) {
                mAppRotation = launcherRotation;
                mAppRotation = launcherRotation;
            }
            }
            tvs.setLayoutRotation(launcherRotation, mAppRotation);
            tvs.getOrientationState().update(launcherRotation, mAppRotation);
            if (mAppInsets == null) {
            if (mAppInsets == null) {
                mAppInsets = new Rect(mLauncherInsets);
                mAppInsets = new Rect(mLauncherInsets);
            }
            }
+3 −1
Original line number Original line Diff line number Diff line
@@ -326,6 +326,8 @@ public abstract class BaseQuickstepLauncher extends Launcher
    @Override
    @Override
    public void onAttachedToWindow() {
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        super.onAttachedToWindow();
        if (Utilities.ATLEAST_R) {
            InteractionJankMonitorWrapper.init(getWindow().getDecorView());
            InteractionJankMonitorWrapper.init(getWindow().getDecorView());
        }
        }
    }
    }
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3;


import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;
import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously;


import android.animation.Animator;
import android.animation.Animator;
@@ -62,7 +63,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
        Runnable r = () -> {
        Runnable r = () -> {
            finishExistingAnimation();
            finishExistingAnimation();
            mAnimationResult = new AnimationResult(() -> {
            mAnimationResult = new AnimationResult(() -> {
                runnable.run();
                UI_HELPER_EXECUTOR.execute(runnable);
                mAnimationResult = null;
                mAnimationResult = null;
            });
            });
            onCreateAnimation(appTargets, wallpaperTargets, mAnimationResult);
            onCreateAnimation(appTargets, wallpaperTargets, mAnimationResult);
+4 −1
Original line number Original line Diff line number Diff line
@@ -251,7 +251,10 @@ public class HotseatPredictionController implements DragController.DragListener,
     * Sets or updates the predicted items
     * Sets or updates the predicted items
     */
     */
    public void setPredictedItems(FixedContainerItems items) {
    public void setPredictedItems(FixedContainerItems items) {
        if (!mLauncher.isWorkspaceLoading()
        boolean shouldIgnoreVisibility = mLauncher.isWorkspaceLoading()
                || mPredictedItems.equals(items.items)
                || mHotseat.getShortcutsAndWidgets().getChildCount() < mHotSeatItemsCount;
        if (!shouldIgnoreVisibility
                && mHotseat.isShown()
                && mHotseat.isShown()
                && mHotseat.getWindowVisibility() == View.VISIBLE) {
                && mHotseat.getWindowVisibility() == View.VISIBLE) {
            mHotseat.setOnVisibilityAggregatedCallback((isVisible) -> {
            mHotseat.setOnVisibilityAggregatedCallback((isVisible) -> {
Loading