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

Commit de0494eb authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Request transition for global config change

So all displays can be collected with a snapshot if needed.
Then if there are any activities recreated for the changes,
there won't be flickering.

Bug: 364879728
Flag: EXEMPT bugfix
Test: Change locale with multiple displays.
      All displays are included in transition with a snapshot.

Change-Id: I6fd39b1bd3ff8be56a5217a1788479c2b8e20df2
parent 70d5e516
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -5061,7 +5061,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        deferWindowLayout();
        try {
            if (values != null) {
                changes = updateGlobalConfigurationLocked(values, initLocale, persistent, userId);
                changes = updateGlobalConfigurationWithTransition(
                        values, initLocale, persistent, userId);
                mTmpUpdateConfigurationResult.changes = changes;
            }

@@ -5075,6 +5076,38 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        return kept;
    }

    /** This is mainly to handle changes in locale, font scale/weight, uiMode, asset paths. */
    @ActivityInfo.Config
    private int updateGlobalConfigurationWithTransition(@NonNull Configuration values,
            boolean initLocale, boolean persistent, @UserIdInt int userId) {
        final int changes = getGlobalConfiguration().diffPublicOnly(values);
        if (changes == 0) {
            return 0;
        }
        ActionChain chain = null;
        final TransitionController tc = mRootWindowContainer.mTransitionController;
        if (tc.isShellTransitionsEnabled()) {
            chain = mChainTracker.startTransit("updateGlobalConfig");
            Transition transition = chain.getTransition();
            if (transition == null || !transition.isCollecting()) {
                transition = tc.createTransition(TRANSIT_CHANGE);
                chain.attachTransition(tc.requestStartTransition(transition, null /* startTask */,
                        null /* remoteTransition */, null /* displayChange */));
            }
            for (int i = mRootWindowContainer.getChildCount() - 1; i >= 0; i--) {
                final DisplayContent dc = mRootWindowContainer.getChildAt(i);
                dc.collectDisplayChange(transition);
                transition.setKnownConfigChanges(dc, changes);
            }
            startPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);
        }
        updateGlobalConfigurationLocked(values, initLocale, persistent, userId);
        if (chain != null) {
            mChainTracker.endPartial();
        }
        return changes;
    }

    /**
     * Updates default (global) configuration and notifies listeners about changes.
     *