Workaround for ignored resizeableActivity param

If <uses-sdk> tag is below <application> 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
This commit is contained in:
Andrii Kulian
2016-05-17 19:07:24 -07:00
parent e821f3d032
commit 3f8dc15861

View File

@@ -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 <uses-sdk> tag is below <application>
// 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;