Don't default to 1.33 min aspect ratio for pre-Q apps
1.33 minAspectRatio requirement for legacy apps was removed from CDD. Bug: 165945457 Test: Verify resolved minAspectRatio on pre-Q apps Change-Id: Ib9e14c2986dd27f900bd8a5fc4d500da3381e73d
This commit is contained in:
@@ -30,7 +30,6 @@ import static android.content.pm.ApplicationInfo.FLAG_SUSPENDED;
|
||||
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE;
|
||||
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION;
|
||||
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_ACTIVITIES_RESIZE_MODE_UNRESIZEABLE;
|
||||
import static android.content.pm.PackageManager.FEATURE_WATCH;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
|
||||
@@ -159,8 +158,6 @@ public class PackageParser {
|
||||
SystemProperties.getBoolean(PROPERTY_CHILD_PACKAGES_ENABLED, false);
|
||||
|
||||
public static final float DEFAULT_PRE_O_MAX_ASPECT_RATIO = 1.86f;
|
||||
public static final float DEFAULT_PRE_Q_MIN_ASPECT_RATIO = 1.333f;
|
||||
public static final float DEFAULT_PRE_Q_MIN_ASPECT_RATIO_WATCH = 1f;
|
||||
|
||||
private static final int DEFAULT_MIN_SDK_VERSION = 1;
|
||||
private static final int DEFAULT_TARGET_SDK_VERSION = 0;
|
||||
@@ -4683,20 +4680,8 @@ public class PackageParser {
|
||||
* ratio set.
|
||||
*/
|
||||
private void setMinAspectRatio(Package owner) {
|
||||
final float minAspectRatio;
|
||||
if (owner.applicationInfo.minAspectRatio != 0) {
|
||||
// Use the application max aspect ration as default if set.
|
||||
minAspectRatio = owner.applicationInfo.minAspectRatio;
|
||||
} else {
|
||||
// Default to (1.33) 4:3 aspect ratio for pre-Q apps and unset for Q and greater.
|
||||
// NOTE: 4:3 was the min aspect ratio Android devices can support pre-Q per the CDD,
|
||||
// except for watches which always supported 1:1.
|
||||
minAspectRatio = owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.Q
|
||||
? 0
|
||||
: (mCallback != null && mCallback.hasFeature(FEATURE_WATCH))
|
||||
? DEFAULT_PRE_Q_MIN_ASPECT_RATIO_WATCH
|
||||
: DEFAULT_PRE_Q_MIN_ASPECT_RATIO;
|
||||
}
|
||||
// Use the application max aspect ration as default if set.
|
||||
final float minAspectRatio = owner.applicationInfo.minAspectRatio;
|
||||
|
||||
for (Activity activity : owner.activities) {
|
||||
if (activity.hasMinAspectRatio()) {
|
||||
|
||||
@@ -18,7 +18,6 @@ package android.content.pm.parsing;
|
||||
|
||||
import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE;
|
||||
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
|
||||
import static android.content.pm.PackageManager.FEATURE_WATCH;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
|
||||
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_ONLY_COREAPP_ALLOWED;
|
||||
@@ -2375,21 +2374,8 @@ public class ParsingPackageUtils {
|
||||
* ratio set.
|
||||
*/
|
||||
private void setMinAspectRatio(ParsingPackage pkg) {
|
||||
final float minAspectRatio;
|
||||
float packageMinAspectRatio = pkg.getMinAspectRatio();
|
||||
if (packageMinAspectRatio != 0) {
|
||||
// Use the application max aspect ration as default if set.
|
||||
minAspectRatio = packageMinAspectRatio;
|
||||
} else {
|
||||
// Default to (1.33) 4:3 aspect ratio for pre-Q apps and unset for Q and greater.
|
||||
// NOTE: 4:3 was the min aspect ratio Android devices can support pre-Q per the CDD,
|
||||
// except for watches which always supported 1:1.
|
||||
minAspectRatio = pkg.getTargetSdkVersion() >= Build.VERSION_CODES.Q
|
||||
? 0
|
||||
: (mCallback != null && mCallback.hasFeature(FEATURE_WATCH))
|
||||
? PackageParser.DEFAULT_PRE_Q_MIN_ASPECT_RATIO_WATCH
|
||||
: PackageParser.DEFAULT_PRE_Q_MIN_ASPECT_RATIO;
|
||||
}
|
||||
// Use the application max aspect ration as default if set.
|
||||
final float minAspectRatio = pkg.getMinAspectRatio();
|
||||
|
||||
List<ParsedActivity> activities = pkg.getActivities();
|
||||
int activitiesSize = activities.size();
|
||||
|
||||
@@ -51,8 +51,6 @@ public class TaskResizingAlgorithm {
|
||||
public static final int CTRL_BOTTOM = 0x8;
|
||||
|
||||
// The minimal aspect ratio which needs to be met to count as landscape (or 1/.. for portrait).
|
||||
// Note: We do not use the 1.33 from the CDD here since the user is allowed to use what ever
|
||||
// aspect he desires.
|
||||
@VisibleForTesting
|
||||
public static final float MIN_ASPECT = 1.2f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user