From 3f8dc1586146ea3cea0b6b25970e2bb51c0e590e Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Tue, 17 May 2016 19:07:24 -0700 Subject: [PATCH] Workaround for ignored resizeableActivity param If tag is below in AndroidManifest.xml then, when activity is parsed, targetSdkVersion param is not yet set correctly. Because of that we're defaulting to RESIZE_MODE_FORCE_RESIZEABLE and the param resizeableActivity will be ignored. This CL checks if resizeableActivity was set explicitly when targetSdkVersion is less than N (or not set). Bug: 28020462 Change-Id: I099f6c00dd50547ddea873e47dbb447869d0be6f --- core/java/android/content/pm/PackageParser.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 7ee70440a15c9..0cf6c1c127e97 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -3536,6 +3536,12 @@ public class PackageParser { a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; final boolean appDefault = (owner.applicationInfo.privateFlags & PRIVATE_FLAG_RESIZEABLE_ACTIVITIES) != 0; + // This flag is used to workaround the issue with ignored resizeableActivity param when + // either targetSdkVersion is not set at all or tag is below + // tag in AndroidManifest. If this param was explicitly set to 'false' we need to set + // corresponding resizeMode regardless of targetSdkVersion value at this point in time. + final boolean resizeableSetExplicitly + = sa.hasValue(R.styleable.AndroidManifestActivity_resizeableActivity); final boolean resizeable = sa.getBoolean( R.styleable.AndroidManifestActivity_resizeableActivity, appDefault); @@ -3546,7 +3552,8 @@ public class PackageParser { } else { a.info.resizeMode = RESIZE_MODE_RESIZEABLE; } - } else if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N) { + } else if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N + || resizeableSetExplicitly) { a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; } else if (!a.info.isFixedOrientation() && (a.info.flags & FLAG_IMMERSIVE) == 0) { a.info.resizeMode = RESIZE_MODE_FORCE_RESIZEABLE;