未验证 提交 5809adea 编写于 作者: S Stanislav Baranov 提交者: GitHub

Make the layout of dynamic patch bundle similar to APK. (#7925)

This will help further changes when we pull other artifacts into the bundle.
上级 e2a449a5
......@@ -179,6 +179,7 @@ class ResourceExtractor {
for (String asset : mResources) {
try {
final String resource = "assets/" + asset;
final File output = new File(dataDir, asset);
if (output.exists()) {
continue;
......@@ -192,7 +193,7 @@ class ResourceExtractor {
copy(is, os);
}
Log.i(TAG, "Extracted baseline resource " + asset);
Log.i(TAG, "Extracted baseline resource " + resource);
} catch (FileNotFoundException fnfe) {
continue;
......@@ -239,11 +240,10 @@ class ResourceExtractor {
}
for (String asset : mResources) {
boolean useDiff = false;
ZipEntry entry = zipFile.getEntry(asset);
final String resource = "assets/" + asset;
ZipEntry entry = zipFile.getEntry(resource);
if (entry == null) {
useDiff = true;
entry = zipFile.getEntry(asset + ".bzdiff40");
entry = zipFile.getEntry(resource + ".bzdiff40");
if (entry == null) {
continue;
}
......@@ -258,7 +258,7 @@ class ResourceExtractor {
}
try {
if (useDiff) {
if (entry.getName().endsWith(".bzdiff40")) {
ByteArrayOutputStream diff = new ByteArrayOutputStream();
try (InputStream is = zipFile.getInputStream(entry)) {
copy(is, diff);
......@@ -267,6 +267,8 @@ class ResourceExtractor {
ByteArrayOutputStream orig = new ByteArrayOutputStream();
try (InputStream is = manager.open(asset)) {
copy(is, orig);
} catch (FileNotFoundException e) {
throw new IOException("Could not find APK resource " + resource);
}
try (OutputStream os = new FileOutputStream(output)) {
......@@ -280,7 +282,7 @@ class ResourceExtractor {
}
}
Log.i(TAG, "Extracted override resource " + asset);
Log.i(TAG, "Extracted override resource " + entry.getName());
} catch (FileNotFoundException fnfe) {
continue;
......
......@@ -252,8 +252,9 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env,
// bundle or a zip asset bundle.
const auto file_ext_index = bundlepath.rfind(".");
if (bundlepath.substr(file_ext_index) == ".zip") {
asset_manager->PushBack(
std::make_unique<blink::ZipAssetStore>(bundlepath, "flutter_assets"));
asset_manager->PushBack(std::make_unique<blink::ZipAssetStore>(
bundlepath, "assets/flutter_assets"));
} else {
asset_manager->PushBack(
std::make_unique<blink::DirectoryAssetBundle>(fml::OpenDirectory(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册