From a928127a74d6ffe9334774e64a4470aedbe6c28b Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Sat, 7 Feb 2015 14:04:19 -0800 Subject: [PATCH] Set TaskStack config orientation based on dimensions The TaskStack override configuration is set based on the stack dimensions so we can load the most acturate resources for activities in the stack in a multi-window environment. Also, disabled fixed screen orientation for resizeable activities. Bug: 19305402 Change-Id: I7b182554523b12f2ef77f8bbc7b16891231125bf --- core/java/android/content/pm/PackageParser.java | 11 ++++++++--- core/res/res/values/attrs_manifest.xml | 6 +++++- .../server/am/ActivityManagerService.java | 4 ++++ .../com/android/server/am/ActivityStack.java | 17 +++++++++++++---- .../java/com/android/server/wm/TaskStack.java | 3 +++ 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 04777baf13943..be41a7cf200c6 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -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; diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 84609cadaf140..1849b5c14f9ef 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1023,7 +1023,11 @@

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. + +

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. -->