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

Commit df73e3f2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "BLASTSyncEngine: Disable overlapping calls to a single container" into...

Merge "BLASTSyncEngine: Disable overlapping calls to a single container" into rvc-dev am: 3a18890e

Change-Id: Ia627bb5bb2bc35531833afafddb18412408200e8
parents b06e5c51 3a18890e
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2476,9 +2476,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<

    boolean prepareForSync(BLASTSyncEngine.TransactionReadyListener waitingListener,
            int waitingId) {
        boolean willSync = false;
        if (!isVisible()) {
            return willSync;
        boolean willSync = true;

        // If we are invisible, no need to sync, likewise if we are already engaged in a sync,
        // we can't support overlapping syncs on a single container yet.
        if (!isVisible() || mWaitingListener != null) {
            return false;
        }
        mUsingBLASTSyncTransaction = true;

+32 −0
Original line number Diff line number Diff line
@@ -550,6 +550,9 @@ public class TaskOrganizerTests extends WindowTestsBase {
        final Task task = createTaskInStack(stackController1, 0 /* userId */);
        final ITaskOrganizer organizer = registerMockOrganizer();

        spyOn(task);
        doReturn(true).when(task).isVisible();

        BLASTSyncEngine bse = new BLASTSyncEngine();

        BLASTSyncEngine.TransactionReadyListener transactionListener =
@@ -563,6 +566,35 @@ public class TaskOrganizerTests extends WindowTestsBase {
            .transactionReady(anyInt(), any());
    }

    @Test
    public void testOverlappingBLASTCallback() throws RemoteException {
        final ActivityStack stackController1 = createTaskStackOnDisplay(mDisplayContent);
        final Task task = createTaskInStack(stackController1, 0 /* userId */);
        final ITaskOrganizer organizer = registerMockOrganizer();

        spyOn(task);
        doReturn(true).when(task).isVisible();
        final WindowState w = createAppWindow(task, TYPE_APPLICATION, "Enlightened Window");
        makeWindowVisible(w);

        BLASTSyncEngine bse = new BLASTSyncEngine();

        BLASTSyncEngine.TransactionReadyListener transactionListener =
            mock(BLASTSyncEngine.TransactionReadyListener.class);

        int id = bse.startSyncSet(transactionListener);
        assertEquals(true, bse.addToSyncSet(id, task));
        bse.setReady(id);

        int id2 = bse.startSyncSet(transactionListener);
        // We should be rejected from the second sync since we are already
        // in one.
        assertEquals(false, bse.addToSyncSet(id2, task));
        w.finishDrawing(null);
        assertEquals(true, bse.addToSyncSet(id2, task));
        bse.setReady(id2);
    }

    @Test
    public void testBLASTCallbackWithWindow() {
        final ActivityStack stackController1 = createTaskStackOnDisplay(mDisplayContent);