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

Commit 9e1c04ac authored by wilsonshih's avatar wilsonshih
Browse files

Clear mTranslucentActivityWaiting if the activity is going to relaunch

When client has request transition, the starting activity would convert
itself to be translucent, if there is a configuration change and
trigger the activity to relaunch, the activity will not become resumed
because the server thought its still translucent. So actually we do not
need to wait for translucent activity if it is going to relaunch.

Fixes: 184713003
Test: atest ActivityRecordTests
Change-Id: Ib66f89938672993610f59b6ad938300a309ccd87
parent 33466948
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -5160,6 +5160,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // Task#ensureActivitiesVisible will bring the activity to a proper
        // active state.
        if (!isState(STARTED, RESUMED, PAUSED, STOPPED, STOPPING)
                // TODO (b/185876784) Check could we remove the check condition
                //  mTranslucentActivityWaiting != null here
                || getRootTask().mTranslucentActivityWaiting != null) {
            return false;
        }
@@ -7800,7 +7802,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            configChangeFlags = 0;
            return;
        }

        // Do not waiting for translucent activity if it is going to relaunch.
        final Task rootTask = getRootTask();
        if (rootTask != null && rootTask.mTranslucentActivityWaiting == this) {
            rootTask.checkTranslucentActivityWaiting(null);
        }
        final boolean andResume = shouldBeResumed(null /*activeActivity*/);
        List<ResultInfo> pendingResults = null;
        List<ReferrerIntent> pendingNewIntents = null;
+21 −0
Original line number Diff line number Diff line
@@ -386,6 +386,27 @@ public class ActivityRecordTests extends WindowTestsBase {
                activity.mRelaunchReason);
    }

    @Test
    public void testRelaunchClearTopWaitingTranslucent() {
        final ActivityRecord activity = createActivityWithTask();
        final Task task = activity.getTask();
        activity.setState(Task.ActivityState.RESUMED, "Testing");

        task.onRequestedOverrideConfigurationChanged(task.getConfiguration());
        activity.setLastReportedConfiguration(new MergedConfiguration(new Configuration(),
                activity.getConfiguration()));

        activity.info.configChanges &= ~CONFIG_ORIENTATION;
        final Configuration newConfig = new Configuration(task.getConfiguration());
        newConfig.orientation = newConfig.orientation == ORIENTATION_PORTRAIT
                ? ORIENTATION_LANDSCAPE
                : ORIENTATION_PORTRAIT;
        task.onRequestedOverrideConfigurationChanged(newConfig);
        task.mTranslucentActivityWaiting = activity;
        ensureActivityConfiguration(activity);
        assertNull(task.mTranslucentActivityWaiting);
    }

    @Test
    public void testSetsRelaunchReason_NonResizeConfigChanges() {
        final ActivityRecord activity = createActivityWithTask();