[installd] Prepare profiles for app code paths
Implement profile preparation for individual application code paths.
The preparation is:
- create the current profile
- merge the profile from the dex metadata file (if present) into the
reference profile.
Note: currently the current profile is created as part of
InstalldNativeService::createAppData for the entire package. That logic
does not support dex metadata or individual code paths and will be removed
once the PackageManager switches over the new method.
(cherry picked from commit bc5ab878b56bcd3a300cc5fc0facc864421dfcb6)
Test: installd_dexopt_test
Bug: 30934496
Merged-In: I2aeddcda7b78017bd46838985bef5f92a79d4573
Change-Id: I2aeddcda7b78017bd46838985bef5f92a79d4573
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 9ab5447..c6eee0d 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2480,5 +2480,17 @@
return ok();
}
+binder::Status InstalldNativeService::prepareAppProfile(const std::string& packageName,
+ int32_t userId, int32_t appId, const std::string& profileName, const std::string& codePath,
+ const std::unique_ptr<std::string>& dexMetadata, bool* _aidl_return) {
+ ENFORCE_UID(AID_SYSTEM);
+ CHECK_ARGUMENT_PACKAGE_NAME(packageName);
+ std::lock_guard<std::recursive_mutex> lock(mLock);
+
+ *_aidl_return = prepare_app_profile(packageName, userId, appId, profileName, codePath,
+ dexMetadata);
+ return ok();
+}
+
} // namespace installd
} // namespace android