From c07aa702703388747bd6e9b1091127e2736ffcd8 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 10 Mar 2020 13:49:12 -0700 Subject: Add ResourcesProvider.loadFromDirectory This API allows a directory to be loaded as if it was a zipped APK. This is a substitute for the DirectoryAssetProvider API that currently does not work in the native layer. Bug: 142716192 Test: atest FrameworksResourceLoaderTests Change-Id: Ia13e15653e75b421423dd56f9fe89e183ab4cb9a --- startop/view_compiler/apk_layout_compiler.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'startop') diff --git a/startop/view_compiler/apk_layout_compiler.cc b/startop/view_compiler/apk_layout_compiler.cc index 09cdbd5fee58..e70c68852b67 100644 --- a/startop/view_compiler/apk_layout_compiler.cc +++ b/startop/view_compiler/apk_layout_compiler.cc @@ -100,10 +100,12 @@ void CompileApkAssetsLayouts(const std::unique_ptr& as dex_file.MakeClass(StringPrintf("%s.CompiledView", package_name.c_str()))}; std::vector methods; - assets->ForEachFile("res/", [&](const android::StringPiece& s, android::FileType) { + assets->GetAssetsProvider()->ForEachFile("res/", [&](const android::StringPiece& s, + android::FileType) { if (s == "layout") { auto path = StringPrintf("res/%s/", s.to_string().c_str()); - assets->ForEachFile(path, [&](const android::StringPiece& layout_file, android::FileType) { + assets->GetAssetsProvider()->ForEachFile(path, [&](const android::StringPiece& layout_file, + android::FileType) { auto layout_path = StringPrintf("%s%s", path.c_str(), layout_file.to_string().c_str()); android::ApkAssetsCookie cookie = android::kInvalidCookie; auto asset = resources.OpenNonAsset(layout_path, android::Asset::ACCESS_RANDOM, &cookie); -- cgit v1.2.3