Loading cmds/installd/InstalldNativeService.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -2107,10 +2107,15 @@ binder::Status InstalldNativeService::dexopt(const std::string& apkPath, int32_t CHECK_ARGUMENT_PATH(dexMetadataPath); std::lock_guard<std::recursive_mutex> 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); Loading cmds/installd/tests/installd_dexopt_test.cpp +14 −8 Original line number Diff line number Diff line Loading @@ -241,18 +241,14 @@ protected: } ::testing::AssertionResult create_mock_app() { // Create the oat dir. app_oat_dir_ = app_apk_dir_ + "/oat"; // For debug mode, the directory might already exist. Avoid erroring out. if (mkdir(app_apk_dir_, kSystemUid, kSystemGid, 0755) != 0 && !kDebug) { return ::testing::AssertionFailure() << "Could not create app dir " << app_apk_dir_ << " : " << strerror(errno); } binder::Status status = service_->createOatDir(app_oat_dir_, kRuntimeIsa); if (!status.isOk()) { return ::testing::AssertionFailure() << "Could not create oat dir: " << status.toString8().c_str(); } // Initialize the oat dir path. app_oat_dir_ = app_apk_dir_ + "/oat"; // Copy the primary apk. apk_path_ = app_apk_dir_ + "/base.jar"; Loading Loading @@ -283,7 +279,7 @@ protected: } // Create the app user data. status = service_->createAppData( binder::Status status = service_->createAppData( volume_uuid_, package_name_, kTestUserId, Loading Loading @@ -647,6 +643,16 @@ TEST_F(DexoptTest, DexoptPrimaryPublic) { DEX2OAT_FROM_SCRATCH); } TEST_F(DexoptTest, DexoptPrimaryPublicCreateOatDir) { LOG(INFO) << "DexoptPrimaryPublic"; ASSERT_BINDER_SUCCESS(service_->createOatDir(app_oat_dir_, kRuntimeIsa)); CompilePrimaryDexOk("verify", DEXOPT_BOOTCOMPLETE | DEXOPT_PUBLIC, app_oat_dir_.c_str(), kTestAppGid, DEX2OAT_FROM_SCRATCH); } TEST_F(DexoptTest, DexoptPrimaryFailedInvalidFilter) { LOG(INFO) << "DexoptPrimaryFailedInvalidFilter"; binder::Status status; Loading Loading
cmds/installd/InstalldNativeService.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -2107,10 +2107,15 @@ binder::Status InstalldNativeService::dexopt(const std::string& apkPath, int32_t CHECK_ARGUMENT_PATH(dexMetadataPath); std::lock_guard<std::recursive_mutex> 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); Loading
cmds/installd/tests/installd_dexopt_test.cpp +14 −8 Original line number Diff line number Diff line Loading @@ -241,18 +241,14 @@ protected: } ::testing::AssertionResult create_mock_app() { // Create the oat dir. app_oat_dir_ = app_apk_dir_ + "/oat"; // For debug mode, the directory might already exist. Avoid erroring out. if (mkdir(app_apk_dir_, kSystemUid, kSystemGid, 0755) != 0 && !kDebug) { return ::testing::AssertionFailure() << "Could not create app dir " << app_apk_dir_ << " : " << strerror(errno); } binder::Status status = service_->createOatDir(app_oat_dir_, kRuntimeIsa); if (!status.isOk()) { return ::testing::AssertionFailure() << "Could not create oat dir: " << status.toString8().c_str(); } // Initialize the oat dir path. app_oat_dir_ = app_apk_dir_ + "/oat"; // Copy the primary apk. apk_path_ = app_apk_dir_ + "/base.jar"; Loading Loading @@ -283,7 +279,7 @@ protected: } // Create the app user data. status = service_->createAppData( binder::Status status = service_->createAppData( volume_uuid_, package_name_, kTestUserId, Loading Loading @@ -647,6 +643,16 @@ TEST_F(DexoptTest, DexoptPrimaryPublic) { DEX2OAT_FROM_SCRATCH); } TEST_F(DexoptTest, DexoptPrimaryPublicCreateOatDir) { LOG(INFO) << "DexoptPrimaryPublic"; ASSERT_BINDER_SUCCESS(service_->createOatDir(app_oat_dir_, kRuntimeIsa)); CompilePrimaryDexOk("verify", DEXOPT_BOOTCOMPLETE | DEXOPT_PUBLIC, app_oat_dir_.c_str(), kTestAppGid, DEX2OAT_FROM_SCRATCH); } TEST_F(DexoptTest, DexoptPrimaryFailedInvalidFilter) { LOG(INFO) << "DexoptPrimaryFailedInvalidFilter"; binder::Status status; Loading