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

Commit 60c1abaa authored by Winson Chung's avatar Winson Chung
Browse files

Fixing bad refactoring of orientation calculation.

- The orientation needs to be calculated from the screen width/height,
  which are set below the current calculation of the orientation (whoops).
  This bug was introduced in ag/1905010 and causes extra configuration
  changes due to the configuration orientation being set correctly before
  it is corrected on the next change (at the end of the transition).

Bug: 36099204
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: Ieca1f73fe61fc1dcea106535c019b52d126b8743
parent 41eae911
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2013,10 +2013,6 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
        final Configuration parentConfig = getParent().getConfiguration();
        final float density = parentConfig.densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;

        // TODO: Orientation?
        config.orientation = (config.screenWidthDp <= config.screenHeightDp)
                ? Configuration.ORIENTATION_PORTRAIT
                : Configuration.ORIENTATION_LANDSCAPE;
        if (mStack != null) {
            final StackWindowController stackController = mStack.getWindowContainerController();
            stackController.adjustConfigurationForBounds(bounds, insetBounds,
@@ -2030,6 +2026,10 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
            Slog.wtf(TAG, "Expected stack when caclulating override config");
        }

        config.orientation = (config.screenWidthDp <= config.screenHeightDp)
                ? Configuration.ORIENTATION_PORTRAIT
                : Configuration.ORIENTATION_LANDSCAPE;

        // For calculating screen layout, we need to use the non-decor inset screen area for the
        // calculation for compatibility reasons, i.e. screen area without system bars that could
        // never go away in Honeycomb.