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

Commit e5d91778 authored by Charles Chen's avatar Charles Chen
Browse files

Update display before dispatching config change

When #onConfgurationChanged is called, developers may use combination
of configuration and displayMetrics for UI rendering.

However, it could be wrong because the confg callback is dispatched
before updating display for WindowContext and InputMethodService.

This CL moves #updateDisplay before dispatching #onConfgurationChanged.

Bug: 320375083
Test: manual
Change-Id: I4fe919a09c487ec874e5124aecfe2b934676f429
parent c30ec00b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -167,6 +167,11 @@ public class WindowTokenClient extends Binder {
                    + ", reported config=" + currentConfig
                    + ", updated config=" + newConfig);
        }
        // Update display first. In case callers want to obtain display information(
        // ex: DisplayMetrics) in #onConfigurationChanged callback.
        if (displayChanged) {
            context.updateDisplay(newDisplayId);
        }
        if (shouldUpdateResources) {
            // TODO(ag/9789103): update resource manager logic to track non-activity tokens
            mResourcesManager.updateResourcesForActivity(this, newConfig, newDisplayId);
@@ -195,9 +200,6 @@ public class WindowTokenClient extends Binder {
                }
            }
        }
        if (displayChanged) {
            context.updateDisplay(newDisplayId);
        }
    }

    /**