Loading core/java/android/content/res/AssetManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -1190,7 +1190,20 @@ public final class AssetManager implements AutoCloseable { */ public @NonNull XmlResourceParser openXmlResourceParser(int cookie, @NonNull String fileName) throws IOException { try (XmlBlock block = openXmlBlockAsset(cookie, fileName, true)) { return openXmlResourceParser(cookie, fileName, true); } /** * Retrieve a parser for a compiled XML file. * * @param cookie Identifier of the package to be opened. * @param fileName The name of the file to retrieve. * @param hasFlags Whether the parser should check for flags on each element * @hide */ public @NonNull XmlResourceParser openXmlResourceParser(int cookie, @NonNull String fileName, boolean hasFlags) throws IOException { try (XmlBlock block = openXmlBlockAsset(cookie, fileName, hasFlags)) { XmlResourceParser parser = block.newParser(ID_NULL, new Validator()); // If openXmlBlockAsset doesn't throw, it will always return an XmlBlock object with // a valid native pointer, which makes newParser always return non-null. But let's Loading core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java +5 −1 Original line number Diff line number Diff line Loading @@ -672,8 +672,12 @@ public class ParsingPackageUtils { return input.error(INSTALL_PARSE_FAILED_BAD_MANIFEST, "Failed adding asset path: " + apkPath); } // We pass false for hasFlags because manifest flags are handled separately in the parsing // code. If the xml parser also checks and removes flags, not only will it be slower but // also PackageManager will not work properly because it won't collect the referenced flags // and won't be able to invalidate the package cache when one of those flags changes. try (XmlResourceParser parser = assets.openXmlResourceParser(cookie, ANDROID_MANIFEST_FILENAME)) { ANDROID_MANIFEST_FILENAME, false)) { Resources res = new Resources(assets, mDisplayMetrics, null); ParseResult<ParsingPackage> parseResult = parseSplitApk(input, pkg, res, parser, flags, splitIndex); Loading Loading
core/java/android/content/res/AssetManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -1190,7 +1190,20 @@ public final class AssetManager implements AutoCloseable { */ public @NonNull XmlResourceParser openXmlResourceParser(int cookie, @NonNull String fileName) throws IOException { try (XmlBlock block = openXmlBlockAsset(cookie, fileName, true)) { return openXmlResourceParser(cookie, fileName, true); } /** * Retrieve a parser for a compiled XML file. * * @param cookie Identifier of the package to be opened. * @param fileName The name of the file to retrieve. * @param hasFlags Whether the parser should check for flags on each element * @hide */ public @NonNull XmlResourceParser openXmlResourceParser(int cookie, @NonNull String fileName, boolean hasFlags) throws IOException { try (XmlBlock block = openXmlBlockAsset(cookie, fileName, hasFlags)) { XmlResourceParser parser = block.newParser(ID_NULL, new Validator()); // If openXmlBlockAsset doesn't throw, it will always return an XmlBlock object with // a valid native pointer, which makes newParser always return non-null. But let's Loading
core/java/com/android/internal/pm/pkg/parsing/ParsingPackageUtils.java +5 −1 Original line number Diff line number Diff line Loading @@ -672,8 +672,12 @@ public class ParsingPackageUtils { return input.error(INSTALL_PARSE_FAILED_BAD_MANIFEST, "Failed adding asset path: " + apkPath); } // We pass false for hasFlags because manifest flags are handled separately in the parsing // code. If the xml parser also checks and removes flags, not only will it be slower but // also PackageManager will not work properly because it won't collect the referenced flags // and won't be able to invalidate the package cache when one of those flags changes. try (XmlResourceParser parser = assets.openXmlResourceParser(cookie, ANDROID_MANIFEST_FILENAME)) { ANDROID_MANIFEST_FILENAME, false)) { Resources res = new Resources(assets, mDisplayMetrics, null); ParseResult<ParsingPackage> parseResult = parseSplitApk(input, pkg, res, parser, flags, splitIndex); Loading