From 17d8f820da6e15e85b8c643306e01e126df2e10e Mon Sep 17 00:00:00 2001 From: Alex Buynytskyy Date: Thu, 20 Jun 2019 16:29:57 -0700 Subject: Moving /oat folder creation to installd. Change-Id: I93208d84ff2101f6b8ce63e04fc42c0331ce920b Test: refactoring CL. Existing unit tests still pass. Test: atest installd_dexopt_test --- cmds/installd/InstalldNativeService.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmds/installd/InstalldNativeService.cpp') diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index ae4ea785bc..47fdcc479a 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -2055,10 +2055,15 @@ binder::Status InstalldNativeService::dexopt(const std::string& apkPath, int32_t CHECK_ARGUMENT_PATH(dexMetadataPath); std::lock_guard lock(mLock); + const char* oat_dir = getCStr(outputPath); + const char* instruction_set = instructionSet.c_str(); + if (oat_dir != nullptr && !createOatDir(oat_dir, instruction_set).isOk()) { + // Can't create oat dir - let dexopt use cache dir. + oat_dir = nullptr; + } + const char* apk_path = apkPath.c_str(); const char* pkgname = getCStr(packageName, "*"); - const char* instruction_set = instructionSet.c_str(); - const char* oat_dir = getCStr(outputPath); const char* compiler_filter = compilerFilter.c_str(); const char* volume_uuid = getCStr(uuid); const char* class_loader_context = getCStr(classLoaderContext); -- cgit v1.2.3-59-g8ed1b