Loading tools/aapt/Command.cpp +31 −10 Original line number Diff line number Diff line Loading @@ -769,7 +769,7 @@ int doDump(Bundle* bundle) config.country[1] = 'S'; config.orientation = ResTable_config::ORIENTATION_PORT; config.density = ResTable_config::DENSITY_MEDIUM; config.sdkVersion = 10000; // Very high. config.sdkVersion = SDK_CUR_DEVELOPMENT; // Very high. config.screenWidthDp = 320; config.screenHeightDp = 480; config.smallestScreenWidthDp = 320; Loading Loading @@ -1306,16 +1306,30 @@ int doDump(Bundle* bundle) splitName.string()).string()); } // For 'platformBuildVersionName', using both string and int type as a fallback // since it may be the code name of Android or the API level. String8 platformBuildVersionName = AaptXml::getAttribute(tree, NULL, "platformBuildVersionName"); int32_t platformBuildVersionNameInt = AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionName", 0, NULL); if (platformBuildVersionName != "") { printf(" platformBuildVersionName='%s'", platformBuildVersionName.string()); } else if (platformBuildVersionNameInt > 0) { printf(" platformBuildVersionName='%d'", platformBuildVersionNameInt); } // For 'platformBuildVersionCode', using both string and int type as a fallback // since it may be the code name of Android or the API level. String8 platformBuildVersionCode = AaptXml::getAttribute(tree, NULL, "platformBuildVersionCode"); int32_t platformBuildVersionCodeInt = AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionCode", 0, NULL); if (platformBuildVersionCode != "") { printf(" platformBuildVersionCode='%s'", platformBuildVersionCode.string()); } else if (platformBuildVersionCodeInt > 0) { printf(" platformBuildVersionCode='%d'", platformBuildVersionCodeInt); } int32_t compileSdkVersion = AaptXml::getIntegerAttribute(tree, Loading Loading @@ -1490,7 +1504,7 @@ int doDump(Bundle* bundle) error.string()); goto bail; } if (name == "Donut") targetSdk = 4; if (name == "Donut") targetSdk = SDK_DONUT; printf("sdkVersion:'%s'\n", ResTable::normalizeForOutput(name.string()).string()); } else if (code != -1) { Loading @@ -1512,7 +1526,12 @@ int doDump(Bundle* bundle) error.string()); goto bail; } if (name == "Donut" && targetSdk < 4) targetSdk = 4; if (name == "Donut" && targetSdk < SDK_DONUT) { targetSdk = SDK_DONUT; } else if (name != "" && targetSdk == 0) { // Bump to current development version targetSdk = SDK_CUR_DEVELOPMENT; } printf("targetSdkVersion:'%s'\n", ResTable::normalizeForOutput(name.string()).string()); } else if (code != -1) { Loading Loading @@ -2122,7 +2141,7 @@ int doDump(Bundle* bundle) } // Pre-1.6 implicitly granted permission compatibility logic if (targetSdk < 4) { if (targetSdk < SDK_DONUT) { if (!hasWriteExternalStoragePermission) { printUsesPermission(String8("android.permission.WRITE_EXTERNAL_STORAGE")); printUsesImpliedPermission(String8("android.permission.WRITE_EXTERNAL_STORAGE"), Loading @@ -2149,7 +2168,7 @@ int doDump(Bundle* bundle) } // Pre-JellyBean call log permission compatibility. if (targetSdk < 16) { if (targetSdk < SDK_JELLY_BEAN) { if (!hasReadCallLogPermission && hasReadContactsPermission) { printUsesPermission(String8("android.permission.READ_CALL_LOG")); printUsesImpliedPermission(String8("android.permission.READ_CALL_LOG"), Loading Loading @@ -2291,21 +2310,23 @@ int doDump(Bundle* bundle) // the screen size support was introduced, so all default to // enabled. if (smallScreen > 0) { smallScreen = targetSdk >= 4 ? -1 : 0; smallScreen = targetSdk >= SDK_DONUT ? -1 : 0; } if (normalScreen > 0) { normalScreen = -1; } if (largeScreen > 0) { largeScreen = targetSdk >= 4 ? -1 : 0; largeScreen = targetSdk >= SDK_DONUT ? -1 : 0; } if (xlargeScreen > 0) { // Introduced in Gingerbread. xlargeScreen = targetSdk >= 9 ? -1 : 0; xlargeScreen = targetSdk >= SDK_GINGERBREAD ? -1 : 0; } if (anyDensity > 0) { anyDensity = (targetSdk >= 4 || requiresSmallestWidthDp > 0 || compatibleWidthLimitDp > 0) ? -1 : 0; anyDensity = (targetSdk >= SDK_DONUT || requiresSmallestWidthDp > 0 || compatibleWidthLimitDp > 0) ? -1 : 0; } printf("supports-screens:"); if (smallScreen != 0) { Loading tools/aapt/SdkConstants.h +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ enum { SDK_Q = 29, SDK_R = 30, SDK_S = 31, SDK_CUR_DEVELOPMENT = 10000, }; #endif // H_AAPT_SDK_CONSTANTS tools/aapt2/SdkConstants.h +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ enum : ApiVersion { SDK_Q = 29, SDK_R = 30, SDK_S = 31, SDK_CUR_DEVELOPMENT = 10000, }; ApiVersion FindAttributeSdkLevel(const ResourceId& id); Loading tools/aapt2/dump/DumpManifest.cpp +12 −11 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ enum { }; const std::string& kAndroidNamespace = "http://schemas.android.com/apk/res/android"; constexpr int kCurrentDevelopmentVersion = 10000; constexpr int kNeverForLocation = 0x00010000; /** Retrieves the attribute of the element with the specified attribute resource id. */ Loading Loading @@ -331,7 +330,7 @@ class ManifestExtractor { ConfigDescription config; config.orientation = android::ResTable_config::ORIENTATION_PORT; config.density = android::ResTable_config::DENSITY_MEDIUM; config.sdkVersion = kCurrentDevelopmentVersion; // Very high. config.sdkVersion = SDK_CUR_DEVELOPMENT; // Very high. config.screenWidthDp = 320; config.screenHeightDp = 480; config.smallestScreenWidthDp = 320; Loading Loading @@ -621,7 +620,7 @@ class UsesSdkBadging : public ManifestExtractor::Element { // Detect the target sdk of the element if ((min_sdk_name && *min_sdk_name == "Donut") || (target_sdk_name && *target_sdk_name == "Donut")) { extractor()->RaiseTargetSdk(4); extractor()->RaiseTargetSdk(SDK_DONUT); } if (min_sdk) { extractor()->RaiseTargetSdk(*min_sdk); Loading @@ -629,7 +628,7 @@ class UsesSdkBadging : public ManifestExtractor::Element { if (target_sdk) { extractor()->RaiseTargetSdk(*target_sdk); } else if (target_sdk_name) { extractor()->RaiseTargetSdk(kCurrentDevelopmentVersion); extractor()->RaiseTargetSdk(SDK_CUR_DEVELOPMENT); } } Loading Loading @@ -746,21 +745,23 @@ class SupportsScreen : public ManifestExtractor::Element { // the screen size support was introduced, so all default to // enabled. if (small_screen_temp > 0) { small_screen_temp = target_sdk >= 4 ? -1 : 0; small_screen_temp = target_sdk >= SDK_DONUT ? -1 : 0; } if (normal_screen_temp > 0) { normal_screen_temp = -1; } if (large_screen_temp > 0) { large_screen_temp = target_sdk >= 4 ? -1 : 0; large_screen_temp = target_sdk >= SDK_DONUT ? -1 : 0; } if (xlarge_screen_temp > 0) { // Introduced in Gingerbread. xlarge_screen_temp = target_sdk >= 9 ? -1 : 0; xlarge_screen_temp = target_sdk >= SDK_GINGERBREAD ? -1 : 0; } if (any_density_temp > 0) { any_density_temp = (target_sdk >= 4 || requires_smallest_width_dp > 0 || compatible_width_limit_dp > 0) ? -1 : 0; any_density_temp = (target_sdk >= SDK_DONUT || requires_smallest_width_dp > 0 || compatible_width_limit_dp > 0) ? -1 : 0; } // Print the formatted screen info Loading Loading @@ -2030,7 +2031,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { auto write_external_permission = ElementCast<UsesPermission>( FindPermission(root.get(), "android.permission.WRITE_EXTERNAL_STORAGE")); if (target_sdk() < 4) { if (target_sdk() < SDK_DONUT) { if (!write_external_permission) { PrintPermission("android.permission.WRITE_EXTERNAL_STORAGE", "targetSdkVersion < 4", -1); insert_write_external = true; Loading @@ -2053,7 +2054,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { } // Pre-JellyBean call log permission compatibility. if (target_sdk() < 16) { if (target_sdk() < SDK_JELLY_BEAN) { if (!FindPermission(root.get(), "android.permission.READ_CALL_LOG") && FindPermission(root.get(), "android.permission.READ_CONTACTS")) { PrintPermission("android.permission.READ_CALL_LOG", Loading Loading
tools/aapt/Command.cpp +31 −10 Original line number Diff line number Diff line Loading @@ -769,7 +769,7 @@ int doDump(Bundle* bundle) config.country[1] = 'S'; config.orientation = ResTable_config::ORIENTATION_PORT; config.density = ResTable_config::DENSITY_MEDIUM; config.sdkVersion = 10000; // Very high. config.sdkVersion = SDK_CUR_DEVELOPMENT; // Very high. config.screenWidthDp = 320; config.screenHeightDp = 480; config.smallestScreenWidthDp = 320; Loading Loading @@ -1306,16 +1306,30 @@ int doDump(Bundle* bundle) splitName.string()).string()); } // For 'platformBuildVersionName', using both string and int type as a fallback // since it may be the code name of Android or the API level. String8 platformBuildVersionName = AaptXml::getAttribute(tree, NULL, "platformBuildVersionName"); int32_t platformBuildVersionNameInt = AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionName", 0, NULL); if (platformBuildVersionName != "") { printf(" platformBuildVersionName='%s'", platformBuildVersionName.string()); } else if (platformBuildVersionNameInt > 0) { printf(" platformBuildVersionName='%d'", platformBuildVersionNameInt); } // For 'platformBuildVersionCode', using both string and int type as a fallback // since it may be the code name of Android or the API level. String8 platformBuildVersionCode = AaptXml::getAttribute(tree, NULL, "platformBuildVersionCode"); int32_t platformBuildVersionCodeInt = AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionCode", 0, NULL); if (platformBuildVersionCode != "") { printf(" platformBuildVersionCode='%s'", platformBuildVersionCode.string()); } else if (platformBuildVersionCodeInt > 0) { printf(" platformBuildVersionCode='%d'", platformBuildVersionCodeInt); } int32_t compileSdkVersion = AaptXml::getIntegerAttribute(tree, Loading Loading @@ -1490,7 +1504,7 @@ int doDump(Bundle* bundle) error.string()); goto bail; } if (name == "Donut") targetSdk = 4; if (name == "Donut") targetSdk = SDK_DONUT; printf("sdkVersion:'%s'\n", ResTable::normalizeForOutput(name.string()).string()); } else if (code != -1) { Loading @@ -1512,7 +1526,12 @@ int doDump(Bundle* bundle) error.string()); goto bail; } if (name == "Donut" && targetSdk < 4) targetSdk = 4; if (name == "Donut" && targetSdk < SDK_DONUT) { targetSdk = SDK_DONUT; } else if (name != "" && targetSdk == 0) { // Bump to current development version targetSdk = SDK_CUR_DEVELOPMENT; } printf("targetSdkVersion:'%s'\n", ResTable::normalizeForOutput(name.string()).string()); } else if (code != -1) { Loading Loading @@ -2122,7 +2141,7 @@ int doDump(Bundle* bundle) } // Pre-1.6 implicitly granted permission compatibility logic if (targetSdk < 4) { if (targetSdk < SDK_DONUT) { if (!hasWriteExternalStoragePermission) { printUsesPermission(String8("android.permission.WRITE_EXTERNAL_STORAGE")); printUsesImpliedPermission(String8("android.permission.WRITE_EXTERNAL_STORAGE"), Loading @@ -2149,7 +2168,7 @@ int doDump(Bundle* bundle) } // Pre-JellyBean call log permission compatibility. if (targetSdk < 16) { if (targetSdk < SDK_JELLY_BEAN) { if (!hasReadCallLogPermission && hasReadContactsPermission) { printUsesPermission(String8("android.permission.READ_CALL_LOG")); printUsesImpliedPermission(String8("android.permission.READ_CALL_LOG"), Loading Loading @@ -2291,21 +2310,23 @@ int doDump(Bundle* bundle) // the screen size support was introduced, so all default to // enabled. if (smallScreen > 0) { smallScreen = targetSdk >= 4 ? -1 : 0; smallScreen = targetSdk >= SDK_DONUT ? -1 : 0; } if (normalScreen > 0) { normalScreen = -1; } if (largeScreen > 0) { largeScreen = targetSdk >= 4 ? -1 : 0; largeScreen = targetSdk >= SDK_DONUT ? -1 : 0; } if (xlargeScreen > 0) { // Introduced in Gingerbread. xlargeScreen = targetSdk >= 9 ? -1 : 0; xlargeScreen = targetSdk >= SDK_GINGERBREAD ? -1 : 0; } if (anyDensity > 0) { anyDensity = (targetSdk >= 4 || requiresSmallestWidthDp > 0 || compatibleWidthLimitDp > 0) ? -1 : 0; anyDensity = (targetSdk >= SDK_DONUT || requiresSmallestWidthDp > 0 || compatibleWidthLimitDp > 0) ? -1 : 0; } printf("supports-screens:"); if (smallScreen != 0) { Loading
tools/aapt/SdkConstants.h +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ enum { SDK_Q = 29, SDK_R = 30, SDK_S = 31, SDK_CUR_DEVELOPMENT = 10000, }; #endif // H_AAPT_SDK_CONSTANTS
tools/aapt2/SdkConstants.h +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ enum : ApiVersion { SDK_Q = 29, SDK_R = 30, SDK_S = 31, SDK_CUR_DEVELOPMENT = 10000, }; ApiVersion FindAttributeSdkLevel(const ResourceId& id); Loading
tools/aapt2/dump/DumpManifest.cpp +12 −11 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ enum { }; const std::string& kAndroidNamespace = "http://schemas.android.com/apk/res/android"; constexpr int kCurrentDevelopmentVersion = 10000; constexpr int kNeverForLocation = 0x00010000; /** Retrieves the attribute of the element with the specified attribute resource id. */ Loading Loading @@ -331,7 +330,7 @@ class ManifestExtractor { ConfigDescription config; config.orientation = android::ResTable_config::ORIENTATION_PORT; config.density = android::ResTable_config::DENSITY_MEDIUM; config.sdkVersion = kCurrentDevelopmentVersion; // Very high. config.sdkVersion = SDK_CUR_DEVELOPMENT; // Very high. config.screenWidthDp = 320; config.screenHeightDp = 480; config.smallestScreenWidthDp = 320; Loading Loading @@ -621,7 +620,7 @@ class UsesSdkBadging : public ManifestExtractor::Element { // Detect the target sdk of the element if ((min_sdk_name && *min_sdk_name == "Donut") || (target_sdk_name && *target_sdk_name == "Donut")) { extractor()->RaiseTargetSdk(4); extractor()->RaiseTargetSdk(SDK_DONUT); } if (min_sdk) { extractor()->RaiseTargetSdk(*min_sdk); Loading @@ -629,7 +628,7 @@ class UsesSdkBadging : public ManifestExtractor::Element { if (target_sdk) { extractor()->RaiseTargetSdk(*target_sdk); } else if (target_sdk_name) { extractor()->RaiseTargetSdk(kCurrentDevelopmentVersion); extractor()->RaiseTargetSdk(SDK_CUR_DEVELOPMENT); } } Loading Loading @@ -746,21 +745,23 @@ class SupportsScreen : public ManifestExtractor::Element { // the screen size support was introduced, so all default to // enabled. if (small_screen_temp > 0) { small_screen_temp = target_sdk >= 4 ? -1 : 0; small_screen_temp = target_sdk >= SDK_DONUT ? -1 : 0; } if (normal_screen_temp > 0) { normal_screen_temp = -1; } if (large_screen_temp > 0) { large_screen_temp = target_sdk >= 4 ? -1 : 0; large_screen_temp = target_sdk >= SDK_DONUT ? -1 : 0; } if (xlarge_screen_temp > 0) { // Introduced in Gingerbread. xlarge_screen_temp = target_sdk >= 9 ? -1 : 0; xlarge_screen_temp = target_sdk >= SDK_GINGERBREAD ? -1 : 0; } if (any_density_temp > 0) { any_density_temp = (target_sdk >= 4 || requires_smallest_width_dp > 0 || compatible_width_limit_dp > 0) ? -1 : 0; any_density_temp = (target_sdk >= SDK_DONUT || requires_smallest_width_dp > 0 || compatible_width_limit_dp > 0) ? -1 : 0; } // Print the formatted screen info Loading Loading @@ -2030,7 +2031,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { auto write_external_permission = ElementCast<UsesPermission>( FindPermission(root.get(), "android.permission.WRITE_EXTERNAL_STORAGE")); if (target_sdk() < 4) { if (target_sdk() < SDK_DONUT) { if (!write_external_permission) { PrintPermission("android.permission.WRITE_EXTERNAL_STORAGE", "targetSdkVersion < 4", -1); insert_write_external = true; Loading @@ -2053,7 +2054,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { } // Pre-JellyBean call log permission compatibility. if (target_sdk() < 16) { if (target_sdk() < SDK_JELLY_BEAN) { if (!FindPermission(root.get(), "android.permission.READ_CALL_LOG") && FindPermission(root.get(), "android.permission.READ_CONTACTS")) { PrintPermission("android.permission.READ_CALL_LOG", Loading