Loading cmds/installd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ cc_defaults { "dexopt.cpp", "globals.cpp", "utils.cpp", "view_compiler.cpp", ":installd_aidl", ], header_libs: [ Loading Loading @@ -190,6 +191,7 @@ cc_binary { "globals.cpp", "otapreopt.cpp", "utils.cpp", "view_compiler.cpp", ], header_libs: ["dex2oat_headers"], Loading cmds/installd/InstalldNativeService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ #include "installd_deps.h" #include "otapreopt_utils.h" #include "utils.h" #include "view_compiler.h" #include "CacheTracker.h" #include "MatchExtensionGen.h" Loading Loading @@ -1831,6 +1832,17 @@ binder::Status InstalldNativeService::dexopt(const std::string& apkPath, int32_t return res ? error(res, error_msg) : ok(); } binder::Status InstalldNativeService::compileLayouts(const std::string& apkPath, const std::string& packageName, const std ::string& outDexFile, int uid, bool* _aidl_return) { const char* apk_path = apkPath.c_str(); const char* package_name = packageName.c_str(); const char* out_dex_file = outDexFile.c_str(); *_aidl_return = android::installd::view_compiler(apk_path, package_name, out_dex_file, uid); return *_aidl_return ? ok() : error("viewcompiler failed"); } binder::Status InstalldNativeService::markBootComplete(const std::string& instructionSet) { ENFORCE_UID(AID_SYSTEM); std::lock_guard<std::recursive_mutex> lock(mLock); Loading cmds/installd/InstalldNativeService.h +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,9 @@ public: const std::unique_ptr<std::string>& dexMetadataPath, const std::unique_ptr<std::string>& compilationReason); binder::Status compileLayouts(const std::string& apkPath, const std::string& packageName, const std::string& outDexFile, int uid, bool* _aidl_return); binder::Status rmdex(const std::string& codePath, const std::string& instructionSet); binder::Status mergeProfiles(int32_t uid, const std::string& packageName, Loading cmds/installd/binder/android/os/IInstalld.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ interface IInstalld { @nullable @utf8InCpp String profileName, @nullable @utf8InCpp String dexMetadataPath, @nullable @utf8InCpp String compilationReason); boolean compileLayouts(@utf8InCpp String apkPath, @utf8InCpp String packageName, @utf8InCpp String outDexFile, int uid); void rmdex(@utf8InCpp String codePath, @utf8InCpp String instructionSet); Loading cmds/installd/dexopt.cpp +0 −21 Original line number Diff line number Diff line Loading @@ -628,27 +628,6 @@ static void open_profile_files(uid_t uid, const std::string& package_name, } } static void drop_capabilities(uid_t uid) { if (setgid(uid) != 0) { PLOG(ERROR) << "setgid(" << uid << ") failed in installd during dexopt"; exit(DexoptReturnCodes::kSetGid); } if (setuid(uid) != 0) { PLOG(ERROR) << "setuid(" << uid << ") failed in installd during dexopt"; exit(DexoptReturnCodes::kSetUid); } // drop capabilities struct __user_cap_header_struct capheader; struct __user_cap_data_struct capdata[2]; memset(&capheader, 0, sizeof(capheader)); memset(&capdata, 0, sizeof(capdata)); capheader.version = _LINUX_CAPABILITY_VERSION_3; if (capset(&capheader, &capdata[0]) < 0) { PLOG(ERROR) << "capset failed"; exit(DexoptReturnCodes::kCapSet); } } static constexpr int PROFMAN_BIN_RETURN_CODE_COMPILE = 0; static constexpr int PROFMAN_BIN_RETURN_CODE_SKIP_COMPILATION = 1; static constexpr int PROFMAN_BIN_RETURN_CODE_BAD_PROFILES = 2; Loading Loading
cmds/installd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ cc_defaults { "dexopt.cpp", "globals.cpp", "utils.cpp", "view_compiler.cpp", ":installd_aidl", ], header_libs: [ Loading Loading @@ -190,6 +191,7 @@ cc_binary { "globals.cpp", "otapreopt.cpp", "utils.cpp", "view_compiler.cpp", ], header_libs: ["dex2oat_headers"], Loading
cmds/installd/InstalldNativeService.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ #include "installd_deps.h" #include "otapreopt_utils.h" #include "utils.h" #include "view_compiler.h" #include "CacheTracker.h" #include "MatchExtensionGen.h" Loading Loading @@ -1831,6 +1832,17 @@ binder::Status InstalldNativeService::dexopt(const std::string& apkPath, int32_t return res ? error(res, error_msg) : ok(); } binder::Status InstalldNativeService::compileLayouts(const std::string& apkPath, const std::string& packageName, const std ::string& outDexFile, int uid, bool* _aidl_return) { const char* apk_path = apkPath.c_str(); const char* package_name = packageName.c_str(); const char* out_dex_file = outDexFile.c_str(); *_aidl_return = android::installd::view_compiler(apk_path, package_name, out_dex_file, uid); return *_aidl_return ? ok() : error("viewcompiler failed"); } binder::Status InstalldNativeService::markBootComplete(const std::string& instructionSet) { ENFORCE_UID(AID_SYSTEM); std::lock_guard<std::recursive_mutex> lock(mLock); Loading
cmds/installd/InstalldNativeService.h +3 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,9 @@ public: const std::unique_ptr<std::string>& dexMetadataPath, const std::unique_ptr<std::string>& compilationReason); binder::Status compileLayouts(const std::string& apkPath, const std::string& packageName, const std::string& outDexFile, int uid, bool* _aidl_return); binder::Status rmdex(const std::string& codePath, const std::string& instructionSet); binder::Status mergeProfiles(int32_t uid, const std::string& packageName, Loading
cmds/installd/binder/android/os/IInstalld.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,8 @@ interface IInstalld { @nullable @utf8InCpp String profileName, @nullable @utf8InCpp String dexMetadataPath, @nullable @utf8InCpp String compilationReason); boolean compileLayouts(@utf8InCpp String apkPath, @utf8InCpp String packageName, @utf8InCpp String outDexFile, int uid); void rmdex(@utf8InCpp String codePath, @utf8InCpp String instructionSet); Loading
cmds/installd/dexopt.cpp +0 −21 Original line number Diff line number Diff line Loading @@ -628,27 +628,6 @@ static void open_profile_files(uid_t uid, const std::string& package_name, } } static void drop_capabilities(uid_t uid) { if (setgid(uid) != 0) { PLOG(ERROR) << "setgid(" << uid << ") failed in installd during dexopt"; exit(DexoptReturnCodes::kSetGid); } if (setuid(uid) != 0) { PLOG(ERROR) << "setuid(" << uid << ") failed in installd during dexopt"; exit(DexoptReturnCodes::kSetUid); } // drop capabilities struct __user_cap_header_struct capheader; struct __user_cap_data_struct capdata[2]; memset(&capheader, 0, sizeof(capheader)); memset(&capdata, 0, sizeof(capdata)); capheader.version = _LINUX_CAPABILITY_VERSION_3; if (capset(&capheader, &capdata[0]) < 0) { PLOG(ERROR) << "capset failed"; exit(DexoptReturnCodes::kCapSet); } } static constexpr int PROFMAN_BIN_RETURN_CODE_COMPILE = 0; static constexpr int PROFMAN_BIN_RETURN_CODE_SKIP_COMPILATION = 1; static constexpr int PROFMAN_BIN_RETURN_CODE_BAD_PROFILES = 2; Loading