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

Commit 70a634a9 authored by Roy Chou's avatar Roy Chou
Browse files

fix(#Magnification): fix WindowMagnificationAnimationControllerTest test case...

fix(#Magnification): fix WindowMagnificationAnimationControllerTest test case fails on cf_x86_64 devices

On cf_x86_64 devices, smaller animation duration might cause the mainthread loading too intense, therefore the Instrumentation.runOnMainSync would take too much time dispatching task to mainthread. This would make the ValueAnimator does not work as expected. Therefore, we increase the animation duration to decrease the dispatching time.

Bug: 288926821
Test: atest WindowMagnificationAnimationControllerTest on aosp_cf_x86_64_phone
Change-Id: Id357688d7212f6fa365882ce9c6cdd52a0efd6f9
Merged-In: If0ea2df64f58b9032d629446da74c15b6e691db5
parent b31cf50a
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ import com.android.systemui.model.SysUiState;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -64,7 +63,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

@Ignore
@LargeTest
@RunWith(AndroidTestingRunner.class)
public class WindowMagnificationAnimationControllerTest extends SysuiTestCase {
@@ -72,8 +70,11 @@ public class WindowMagnificationAnimationControllerTest extends SysuiTestCase {
    private static final float DEFAULT_SCALE = 4.0f;
    private static final float DEFAULT_CENTER_X = 400.0f;
    private static final float DEFAULT_CENTER_Y = 500.0f;
    // The duration couldn't too short, otherwise the ValueAnimator won't work in expectation.
    private static final long ANIMATION_DURATION_MS = 300;
    // The duration and period can't be too short, otherwise the ValueAnimator and
    //    Instrumentation.runOnMainSync won't work in expectation. (b/288926821)
    private static final long ANIMATION_DURATION_MS = 600;
    private static final long WAIT_FULL_ANIMATION_PERIOD = 1000;
    private static final long WAIT_INTERMEDIATE_ANIMATION_PERIOD = 250;

    private AtomicReference<Float> mCurrentScale = new AtomicReference<>((float) 0);
    private AtomicReference<Float> mCurrentCenterX = new AtomicReference<>((float) 0);
@@ -113,8 +114,8 @@ public class WindowMagnificationAnimationControllerTest extends SysuiTestCase {
        mWindowManager = spy(new TestableWindowManager(wm));
        mContext.addMockSystemService(Context.WINDOW_SERVICE, mWindowManager);

        mWaitingAnimationPeriod = 2 * ANIMATION_DURATION_MS;
        mWaitIntermediateAnimationPeriod = ANIMATION_DURATION_MS / 2;
        mWaitingAnimationPeriod = WAIT_FULL_ANIMATION_PERIOD;
        mWaitIntermediateAnimationPeriod = WAIT_INTERMEDIATE_ANIMATION_PERIOD;
        mWindowMagnificationAnimationController = new WindowMagnificationAnimationController(
                mContext, newValueAnimator());
        mController = new SpyWindowMagnificationController(mContext, mHandler,