Use speed-profile with the cloud profile for apks loaded by other apps.
- Add `getOdexVisibility`, which returns the visibility of the odex file
of an APK.
- Change `prepareAppProfile` to accept `userId` being `USER_NULL`. This
is needed by the corresponding change in framework/base, which passes
`USER_NULL` as `userId` to indicate that the current profile should
remain unchanged.
Bug: 175039995
Test: atest CtsCompilationTestCases
Ignore-AOSP-First: Merge conflicts.
Change-Id: I6a9a1077cee6a6d6d02ac2375da55c4a10b11861
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index 12579b0..f7af929 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -98,10 +98,9 @@
const std::string& pkgname,
const std::string& profile_name);
-// Prepare the app profile for the given code path:
-// - create the current profile using profile_name
-// - merge the profile from the dex metadata file (if present) into
-// the reference profile.
+// Prepares the app profile for the package at the given path:
+// - Creates the current profile for the given user ID, unless the user ID is `USER_NULL`.
+// - Merges the profile from the dex metadata file (if present) into the reference profile.
bool prepare_app_profile(const std::string& package_name,
userid_t user_id,
appid_t app_id,
@@ -153,6 +152,12 @@
bool is_release,
bool is_debuggable_build);
+// Returns `ODEX_NOT_FOUND` if the optimized artifacts are not found, or `ODEX_IS_PUBLIC` if the
+// optimized artifacts are accessible by all apps, or `ODEX_IS_PRIVATE` if the optimized artifacts
+// are only accessible by this app, or -1 if failed to get the visibility of the optimized
+// artifacts.
+int get_odex_visibility(const char* apk_path, const char* instruction_set, const char* oat_dir);
+
} // namespace installd
} // namespace android