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

Commit 719327fc authored by Danny Baumann's avatar Danny Baumann
Browse files

Fix divisions by zero on boot.

Change I976ffae3a56d411b00026f86b16efa9743a23293 introduced a problem
where depending on the rotation settings the WM override display
configuration would be filled with invalid values.
Fix that by correctly checking that the display is ready prior to
setting the override configuration.

Change-Id: Ia3fd7603d9c1212cd32536803b4c12390a798606
parent c0ea33a4
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -6964,6 +6964,10 @@ public class WindowManagerService extends IWindowManager.Stub

    private ApplicationDisplayMetrics updateApplicationDisplayMetricsLocked(
            DisplayContent displayContent) {
        if (!mDisplayReady) {
            return null;
        }

        final ApplicationDisplayMetrics m = calculateDisplayMetrics(displayContent);
        final int appWidth = mPolicy.getNonDecorDisplayWidth(m.dw, m.dh, mRotation);
        final int appHeight = mPolicy.getNonDecorDisplayHeight(m.dw, m.dh, mRotation);
@@ -6992,16 +6996,17 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    boolean computeScreenConfigurationLocked(Configuration config) {
        if (!mDisplayReady) {
            return false;
        }

        // TODO(multidisplay): For now, apply Configuration to main screen only.
        final DisplayContent displayContent = getDefaultDisplayContentLocked();

        // Update application display metrics.
        final ApplicationDisplayMetrics appDm = updateApplicationDisplayMetricsLocked(
                displayContent);

        if (appDm == null) {
            return false;
        }

        final boolean rotated = appDm.rotated;
        final int dw = appDm.dw;
        final int dh = appDm.dh;