diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-03-10 13:49:12 -0700 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2020-03-19 18:33:55 -0700 |
commit | c07aa702703388747bd6e9b1091127e2736ffcd8 (patch) | |
tree | 9d2f3a07e88e7d5a2ef367c4b8d95c81e07cb576 /startop | |
parent | 349695f3701e90746cb2197552299dcb99960ce8 (diff) |
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
Diffstat (limited to 'startop')
-rw-r--r-- | startop/view_compiler/apk_layout_compiler.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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<const android::ApkAssets>& as dex_file.MakeClass(StringPrintf("%s.CompiledView", package_name.c_str()))}; std::vector<dex::MethodBuilder> 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); |