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

Commit 2fe88b50 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Start client only if requested when ensuring activity visibility

If the caller specifies notifyClients=false, it should only update
server side states without affect the client.

A corner case:
realStartActivityLocked for an attaching non-top visible activity
 beginDeferResume
  ensureVisibilityAndConfig
   > ensureActivitiesVisible(notifyClients=false)
    > realStartActivity the real top (attached but not finishAttached)
     > Unable to be resumed becase readyToResume() is false
       by the beginDeferResume
 endDeferResume

Bug: 352423986
Flag: EXEMPT bugfix
Test: atest TaskTests#testEnsureActivitiesVisible
Change-Id: I16b0e7facd8cfe6d6ed2f6eeb9da78835afbf471
parent ce8e50cf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ class EnsureActivitiesVisibleHelper {
            }
            r.setVisibility(true);
        }
        if (r != starting) {
        if (r != starting && mNotifyClients) {
            mTaskFragment.mTaskSupervisor.startSpecificActivity(r, andResume,
                    true /* checkConfig */);
        }
+9 −0
Original line number Diff line number Diff line
@@ -390,6 +390,15 @@ public class TaskTests extends WindowTestsBase {
        rootTask.ensureActivitiesVisible(null /* starting */);
        assertTrue(activity1.isVisible());
        assertTrue(activity2.isVisible());

        // If notifyClients is false, it should only update the state without starting the client.
        activity1.setVisible(false);
        activity1.setVisibleRequested(false);
        activity1.detachFromProcess();
        rootTask.ensureActivitiesVisible(null /* starting */, false /* notifyClients */);
        verify(mSupervisor, never()).startSpecificActivity(eq(activity1),
                anyBoolean() /* andResume */, anyBoolean() /* checkConfig */);
        assertTrue(activity1.isVisibleRequested());
    }

    @Test