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

Commit 047631b8 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Add HW_TIMEOUT_MULTIPLIER to timeouts" into udc-dev am: 1d8d37bb

parents 43bcb005 1d8d37bb
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.server.wm;
package com.android.server.wm;


import static android.os.Build.HW_TIMEOUT_MULTIPLIER;
import static android.window.SurfaceSyncGroup.TRANSACTION_READY_TIMEOUT;
import static android.window.SurfaceSyncGroup.TRANSACTION_READY_TIMEOUT;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
@@ -52,6 +53,8 @@ import java.util.concurrent.TimeUnit;
public class SurfaceSyncGroupTests {
public class SurfaceSyncGroupTests {
    private static final String TAG = "SurfaceSyncGroupTests";
    private static final String TAG = "SurfaceSyncGroupTests";


    private static final long TIMEOUT_S = HW_TIMEOUT_MULTIPLIER * 5L;

    @Rule
    @Rule
    public ActivityTestRule<SurfaceSyncGroupActivity> mActivityRule = new ActivityTestRule<>(
    public ActivityTestRule<SurfaceSyncGroupActivity> mActivityRule = new ActivityTestRule<>(
            SurfaceSyncGroupActivity.class);
            SurfaceSyncGroupActivity.class);
@@ -93,7 +96,7 @@ public class SurfaceSyncGroupTests {
        addSecondSyncGroup(secondSsg, secondDrawCompleteLatch, bothSyncGroupsComplete);
        addSecondSyncGroup(secondSsg, secondDrawCompleteLatch, bothSyncGroupsComplete);


        assertTrue("Failed to draw two frames",
        assertTrue("Failed to draw two frames",
                secondDrawCompleteLatch.await(5, TimeUnit.SECONDS));
                secondDrawCompleteLatch.await(TIMEOUT_S, TimeUnit.SECONDS));


        mHandler.postDelayed(() -> {
        mHandler.postDelayed(() -> {
            // Don't add a markSyncReady for the first sync group until after it's added to another
            // Don't add a markSyncReady for the first sync group until after it's added to another
@@ -105,7 +108,7 @@ public class SurfaceSyncGroupTests {
        }, 200);
        }, 200);


        assertTrue("Failed to wait for both SurfaceSyncGroups to apply",
        assertTrue("Failed to wait for both SurfaceSyncGroups to apply",
                bothSyncGroupsComplete.await(5, TimeUnit.SECONDS));
                bothSyncGroupsComplete.await(TIMEOUT_S, TimeUnit.SECONDS));


        validateScreenshot();
        validateScreenshot();
    }
    }
@@ -123,7 +126,7 @@ public class SurfaceSyncGroupTests {
                transaction -> mHandler.postDelayed(() -> {
                transaction -> mHandler.postDelayed(() -> {
                    try {
                    try {
                        assertTrue("Failed to draw two frames",
                        assertTrue("Failed to draw two frames",
                                secondDrawCompleteLatch.await(5, TimeUnit.SECONDS));
                                secondDrawCompleteLatch.await(TIMEOUT_S, TimeUnit.SECONDS));
                    } catch (InterruptedException e) {
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                        throw new RuntimeException(e);
                    }
                    }
@@ -143,7 +146,7 @@ public class SurfaceSyncGroupTests {
        addSecondSyncGroup(secondSsg, secondDrawCompleteLatch, bothSyncGroupsComplete);
        addSecondSyncGroup(secondSsg, secondDrawCompleteLatch, bothSyncGroupsComplete);


        assertTrue("Failed to wait for both SurfaceSyncGroups to apply",
        assertTrue("Failed to wait for both SurfaceSyncGroups to apply",
                bothSyncGroupsComplete.await(5, TimeUnit.SECONDS));
                bothSyncGroupsComplete.await(TIMEOUT_S, TimeUnit.SECONDS));


        validateScreenshot();
        validateScreenshot();
    }
    }