Merge "Correctly parse minSdk even when targetSdk is a codename" into tm-dev am: 2fb8b2d84c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19087061 Change-Id: I3cce39de76a533ef3f0a854b9482429bb8d4c893 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -542,14 +542,17 @@ public class ApkLiteParseUtils {
|
|||||||
|
|
||||||
int minVer = DEFAULT_MIN_SDK_VERSION;
|
int minVer = DEFAULT_MIN_SDK_VERSION;
|
||||||
String minCode = null;
|
String minCode = null;
|
||||||
|
boolean minAssigned = false;
|
||||||
int targetVer = DEFAULT_TARGET_SDK_VERSION;
|
int targetVer = DEFAULT_TARGET_SDK_VERSION;
|
||||||
String targetCode = null;
|
String targetCode = null;
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(minSdkVersionString)) {
|
if (!TextUtils.isEmpty(minSdkVersionString)) {
|
||||||
try {
|
try {
|
||||||
minVer = Integer.parseInt(minSdkVersionString);
|
minVer = Integer.parseInt(minSdkVersionString);
|
||||||
|
minAssigned = true;
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
minCode = minSdkVersionString;
|
minCode = minSdkVersionString;
|
||||||
|
minAssigned = !TextUtils.isEmpty(minCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +561,7 @@ public class ApkLiteParseUtils {
|
|||||||
targetVer = Integer.parseInt(targetSdkVersionString);
|
targetVer = Integer.parseInt(targetSdkVersionString);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
targetCode = targetSdkVersionString;
|
targetCode = targetSdkVersionString;
|
||||||
if (minCode == null) {
|
if (!minAssigned) {
|
||||||
minCode = targetCode;
|
minCode = targetCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1540,6 +1540,7 @@ public class ParsingPackageUtils {
|
|||||||
try {
|
try {
|
||||||
int minVers = ParsingUtils.DEFAULT_MIN_SDK_VERSION;
|
int minVers = ParsingUtils.DEFAULT_MIN_SDK_VERSION;
|
||||||
String minCode = null;
|
String minCode = null;
|
||||||
|
boolean minAssigned = false;
|
||||||
int targetVers = ParsingUtils.DEFAULT_TARGET_SDK_VERSION;
|
int targetVers = ParsingUtils.DEFAULT_TARGET_SDK_VERSION;
|
||||||
String targetCode = null;
|
String targetCode = null;
|
||||||
int maxVers = Integer.MAX_VALUE;
|
int maxVers = Integer.MAX_VALUE;
|
||||||
@@ -1548,9 +1549,11 @@ public class ParsingPackageUtils {
|
|||||||
if (val != null) {
|
if (val != null) {
|
||||||
if (val.type == TypedValue.TYPE_STRING && val.string != null) {
|
if (val.type == TypedValue.TYPE_STRING && val.string != null) {
|
||||||
minCode = val.string.toString();
|
minCode = val.string.toString();
|
||||||
|
minAssigned = !TextUtils.isEmpty(minCode);
|
||||||
} else {
|
} else {
|
||||||
// If it's not a string, it's an integer.
|
// If it's not a string, it's an integer.
|
||||||
minVers = val.data;
|
minVers = val.data;
|
||||||
|
minAssigned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1558,7 +1561,7 @@ public class ParsingPackageUtils {
|
|||||||
if (val != null) {
|
if (val != null) {
|
||||||
if (val.type == TypedValue.TYPE_STRING && val.string != null) {
|
if (val.type == TypedValue.TYPE_STRING && val.string != null) {
|
||||||
targetCode = val.string.toString();
|
targetCode = val.string.toString();
|
||||||
if (minCode == null) {
|
if (!minAssigned) {
|
||||||
minCode = targetCode;
|
minCode = targetCode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user