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

Commit 00c5e4e1 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Set TaskStack config orientation based on dimensions"

parents ee2d6ecd a928127a
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -3083,9 +3083,6 @@ public class PackageParser {
            a.info.maxRecents = sa.getInt(
                    R.styleable.AndroidManifestActivity_maxRecents,
                    ActivityManager.getDefaultAppRecentsLimitStatic());
            a.info.screenOrientation = sa.getInt(
                    R.styleable.AndroidManifestActivity_screenOrientation,
                    ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            a.info.configChanges = sa.getInt(R.styleable.AndroidManifestActivity_configChanges, 0);
            a.info.softInputMode = sa.getInt(
                    R.styleable.AndroidManifestActivity_windowSoftInputMode, 0);
@@ -3113,6 +3110,14 @@ public class PackageParser {
            a.info.resizeable = sa.getBoolean(
                    R.styleable.AndroidManifestActivity_resizeableActivity,
                    owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.MNC);
            if (a.info.resizeable) {
                // Fixed screen orientation isn't supported with resizeable activities.
                a.info.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
            } else {
                a.info.screenOrientation = sa.getInt(
                        R.styleable.AndroidManifestActivity_screenOrientation,
                        ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            }
        } else {
            a.info.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
            a.info.configChanges = 0;
+5 −1
Original line number Diff line number Diff line
@@ -1023,7 +1023,11 @@
         <p>NOTE: A task's root activity value is applied to all additional activities launched in
         the task. That is if the root activity of a task is resizeable then the system will treat
         all other activities in the task as resizeable and will not if the root activity isn't
         resizeable. -->
         resizeable.

         <p>NOTE: The value of {@link android.R.attr#screenOrientation} will be ignored for
         resizeable activities as the system doesn't store fixed orientation on a resizeable
         activity. -->
    <attr name="resizeableActivity" format="boolean" />

    <!-- The <code>manifest</code> tag is the root of an
+4 −0
Original line number Diff line number Diff line
@@ -3731,6 +3731,10 @@ public final class ActivityManagerService extends ActivityManagerNative
            if (r == null) {
                return;
            }
            if (r.task != null && r.task.mResizeable) {
                // Fixed screen orientation isn't supported with resizeable activities.
                return;
            }
            final long origId = Binder.clearCallingIdentity();
            mWindowManager.setAppOrientation(r.appToken, requestedOrientation);
            Configuration config = mWindowManager.updateOrientationFromAppTokens(
+13 −4
Original line number Diff line number Diff line
@@ -3730,10 +3730,19 @@ final class ActivityStack {
        // we just want to leave the official config object now in the
        // activity and do nothing else.
        int stackChanges = oldStackOverride.diff(mOverrideConfig);
        if (stackChanges == 0 && !oldStackOverride.equals(mOverrideConfig)) {
            // Assume size change if diff didn't report any changes,
            // but configurations are not equal.
            stackChanges = ActivityInfo.CONFIG_SCREEN_SIZE;
        if (stackChanges == 0) {
            // {@link Configuration#diff} doesn't catch changes from unset values.
            // Check for changes we care about.
            if (oldStackOverride.orientation != mOverrideConfig.orientation) {
                stackChanges |= ActivityInfo.CONFIG_ORIENTATION;
            }
            if (oldStackOverride.screenHeightDp != mOverrideConfig.screenHeightDp
                    || oldStackOverride.screenWidthDp != mOverrideConfig.screenWidthDp) {
                stackChanges |= ActivityInfo.CONFIG_SCREEN_SIZE;
            }
            if (oldStackOverride.smallestScreenWidthDp != mOverrideConfig.smallestScreenWidthDp) {
                stackChanges |= ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
            }
        }
        final int changes = oldConfig.diff(newConfig) | stackChanges;
        if (changes == 0 && !r.forceNewConfig) {
+3 −0
Original line number Diff line number Diff line
@@ -185,6 +185,9 @@ public class TaskStack {
                Math.min((int)(mBounds.height() / density), serviceConfig.screenHeightDp);
        mOverrideConfig.smallestScreenWidthDp =
                Math.min(mOverrideConfig.screenWidthDp, mOverrideConfig.screenHeightDp);
        mOverrideConfig.orientation =
                (mOverrideConfig.screenWidthDp <= mOverrideConfig.screenHeightDp)
                        ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
    }

    void updateDisplayInfo() {