Loading services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -6239,9 +6239,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // relatively fixed. overrideConfig.colorMode = fullConfig.colorMode; overrideConfig.densityDpi = fullConfig.densityDpi; overrideConfig.screenLayout = fullConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); // The smallest screen width is the short side of screen bounds. Because the bounds // and density won't be changed, smallestScreenWidthDp is also fixed. overrideConfig.smallestScreenWidthDp = fullConfig.smallestScreenWidthDp; Loading Loading @@ -6376,6 +6373,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Use resolvedBounds to compute other override configurations such as appBounds task.computeConfigResourceOverrides(resolvedConfig, newParentConfiguration, mCompatDisplayInsets); // Use current screen layout as source because the size of app is independent to parent. resolvedConfig.screenLayout = Task.computeScreenLayoutOverride( getConfiguration().screenLayout, resolvedConfig.screenWidthDp, resolvedConfig.screenHeightDp); // Use parent orientation if it cannot be decided by bounds, so the activity can fit inside // the parent bounds appropriately. Loading services/core/java/com/android/server/wm/Task.java +12 −7 Original line number Diff line number Diff line Loading @@ -2064,15 +2064,20 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta // could never go away in Honeycomb. final int compatScreenWidthDp = (int) (mTmpNonDecorBounds.width() / density); final int compatScreenHeightDp = (int) (mTmpNonDecorBounds.height() / density); // We're only overriding LONG, SIZE and COMPAT parts of screenLayout, so we start // override calculation with partial default. // Reducing the screen layout starting from its parent config. final int sl = parentConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); final int longSize = Math.max(compatScreenHeightDp, compatScreenWidthDp); final int shortSize = Math.min(compatScreenHeightDp, compatScreenWidthDp); inOutConfig.screenLayout = Configuration.reduceScreenLayout(sl, longSize, shortSize); inOutConfig.screenLayout = computeScreenLayoutOverride(parentConfig.screenLayout, compatScreenWidthDp, compatScreenHeightDp); } } /** Computes LONG, SIZE and COMPAT parts of {@link Configuration#screenLayout}. */ static int computeScreenLayoutOverride(int sourceScreenLayout, int screenWidthDp, int screenHeightDp) { sourceScreenLayout = sourceScreenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); final int longSize = Math.max(screenWidthDp, screenHeightDp); final int shortSize = Math.min(screenWidthDp, screenHeightDp); return Configuration.reduceScreenLayout(sourceScreenLayout, longSize, shortSize); } @Override Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -290,10 +290,12 @@ public class SizeCompatTests extends ActivityTestsBase { public void testFixedScreenLayoutSizeBits() { setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build()); final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO | Configuration.SCREENLAYOUT_SIZE_NORMAL; | Configuration.SCREENLAYOUT_SIZE_NORMAL | Configuration.SCREENLAYOUT_COMPAT_NEEDED; final int layoutMask = Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK | Configuration.SCREENLAYOUT_LAYOUTDIR_MASK; | Configuration.SCREENLAYOUT_LAYOUTDIR_MASK | Configuration.SCREENLAYOUT_COMPAT_NEEDED; Configuration c = new Configuration(mTask.getRequestedOverrideConfiguration()); c.screenLayout = fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_LTR; mTask.onRequestedOverrideConfigurationChanged(c); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +4 −3 Original line number Diff line number Diff line Loading @@ -6239,9 +6239,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // relatively fixed. overrideConfig.colorMode = fullConfig.colorMode; overrideConfig.densityDpi = fullConfig.densityDpi; overrideConfig.screenLayout = fullConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); // The smallest screen width is the short side of screen bounds. Because the bounds // and density won't be changed, smallestScreenWidthDp is also fixed. overrideConfig.smallestScreenWidthDp = fullConfig.smallestScreenWidthDp; Loading Loading @@ -6376,6 +6373,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Use resolvedBounds to compute other override configurations such as appBounds task.computeConfigResourceOverrides(resolvedConfig, newParentConfiguration, mCompatDisplayInsets); // Use current screen layout as source because the size of app is independent to parent. resolvedConfig.screenLayout = Task.computeScreenLayoutOverride( getConfiguration().screenLayout, resolvedConfig.screenWidthDp, resolvedConfig.screenHeightDp); // Use parent orientation if it cannot be decided by bounds, so the activity can fit inside // the parent bounds appropriately. Loading
services/core/java/com/android/server/wm/Task.java +12 −7 Original line number Diff line number Diff line Loading @@ -2064,15 +2064,20 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta // could never go away in Honeycomb. final int compatScreenWidthDp = (int) (mTmpNonDecorBounds.width() / density); final int compatScreenHeightDp = (int) (mTmpNonDecorBounds.height() / density); // We're only overriding LONG, SIZE and COMPAT parts of screenLayout, so we start // override calculation with partial default. // Reducing the screen layout starting from its parent config. final int sl = parentConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); final int longSize = Math.max(compatScreenHeightDp, compatScreenWidthDp); final int shortSize = Math.min(compatScreenHeightDp, compatScreenWidthDp); inOutConfig.screenLayout = Configuration.reduceScreenLayout(sl, longSize, shortSize); inOutConfig.screenLayout = computeScreenLayoutOverride(parentConfig.screenLayout, compatScreenWidthDp, compatScreenHeightDp); } } /** Computes LONG, SIZE and COMPAT parts of {@link Configuration#screenLayout}. */ static int computeScreenLayoutOverride(int sourceScreenLayout, int screenWidthDp, int screenHeightDp) { sourceScreenLayout = sourceScreenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); final int longSize = Math.max(screenWidthDp, screenHeightDp); final int shortSize = Math.min(screenWidthDp, screenHeightDp); return Configuration.reduceScreenLayout(sourceScreenLayout, longSize, shortSize); } @Override Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -290,10 +290,12 @@ public class SizeCompatTests extends ActivityTestsBase { public void testFixedScreenLayoutSizeBits() { setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build()); final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO | Configuration.SCREENLAYOUT_SIZE_NORMAL; | Configuration.SCREENLAYOUT_SIZE_NORMAL | Configuration.SCREENLAYOUT_COMPAT_NEEDED; final int layoutMask = Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK | Configuration.SCREENLAYOUT_LAYOUTDIR_MASK; | Configuration.SCREENLAYOUT_LAYOUTDIR_MASK | Configuration.SCREENLAYOUT_COMPAT_NEEDED; Configuration c = new Configuration(mTask.getRequestedOverrideConfiguration()); c.screenLayout = fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_LTR; mTask.onRequestedOverrideConfigurationChanged(c); Loading