Loading cmds/dumpstate/dumpstate.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2733,8 +2733,8 @@ void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, const android::base::unique_fd& screenshot_fd_in, bool is_screenshot_requested) { // Duplicate the fds because the passed in fds don't outlive the binder transaction. bugreport_fd.reset(dup(bugreport_fd_in.get())); screenshot_fd.reset(dup(screenshot_fd_in.get())); bugreport_fd.reset(fcntl(bugreport_fd_in.get(), F_DUPFD_CLOEXEC, 0)); screenshot_fd.reset(fcntl(screenshot_fd_in.get(), F_DUPFD_CLOEXEC, 0)); SetOptionsFromMode(bugreport_mode, this, is_screenshot_requested); } Loading cmds/installd/InstalldNativeService.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -1176,6 +1176,25 @@ binder::Status InstalldNativeService::destroyAppProfiles(const std::string& pack return res; } binder::Status InstalldNativeService::deleteReferenceProfile(const std::string& packageName, const std::string& profileName) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_PACKAGE_NAME(packageName); LOCK_PACKAGE(); // This function only supports primary dex'es. std::string path = create_reference_profile_path(packageName, profileName, /*is_secondary_dex=*/false); if (unlink(path.c_str()) != 0) { if (errno == ENOENT) { return ok(); } else { return error("Failed to delete profile " + profileName + " for " + packageName); } } return ok(); } binder::Status InstalldNativeService::destroyAppData(const std::optional<std::string>& uuid, const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode) { ENFORCE_UID(AID_SYSTEM); Loading cmds/installd/InstalldNativeService.h +2 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public: bool* _aidl_return); binder::Status clearAppProfiles(const std::string& packageName, const std::string& profileName); binder::Status destroyAppProfiles(const std::string& packageName); binder::Status deleteReferenceProfile(const std::string& packageName, const std::string& profileName); binder::Status createProfileSnapshot(int32_t appId, const std::string& packageName, const std::string& profileName, const std::string& classpath, bool* _aidl_return); Loading cmds/installd/binder/android/os/IInstalld.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ interface IInstalld { @utf8InCpp String packageName, @utf8InCpp String profileName); void clearAppProfiles(@utf8InCpp String packageName, @utf8InCpp String profileName); void destroyAppProfiles(@utf8InCpp String packageName); void deleteReferenceProfile(@utf8InCpp String packageName, @utf8InCpp String profileName); boolean createProfileSnapshot(int appId, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String classpath); Loading cmds/installd/utils.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -707,16 +707,16 @@ static int rename_delete_dir_contents(const std::string& pathname, auto temp_dir_path = base::StringPrintf("%s/%s", Dirname(pathname).c_str(), temp_dir_name.c_str()); if (::rename(pathname.c_str(), temp_dir_path.c_str())) { auto dir_to_delete = temp_dir_path.c_str(); if (::rename(pathname.c_str(), dir_to_delete)) { if (ignore_if_missing && (errno == ENOENT)) { return 0; } ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), temp_dir_path.c_str(), strerror(errno)); return -errno; ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), dir_to_delete, strerror(errno)); dir_to_delete = pathname.c_str(); } return delete_dir_contents(temp_dir_path.c_str(), 1, exclusion_predicate, ignore_if_missing); return delete_dir_contents(dir_to_delete, 1, exclusion_predicate, ignore_if_missing); } bool is_renamed_deleted_dir(const std::string& path) { Loading Loading
cmds/dumpstate/dumpstate.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2733,8 +2733,8 @@ void Dumpstate::DumpOptions::Initialize(BugreportMode bugreport_mode, const android::base::unique_fd& screenshot_fd_in, bool is_screenshot_requested) { // Duplicate the fds because the passed in fds don't outlive the binder transaction. bugreport_fd.reset(dup(bugreport_fd_in.get())); screenshot_fd.reset(dup(screenshot_fd_in.get())); bugreport_fd.reset(fcntl(bugreport_fd_in.get(), F_DUPFD_CLOEXEC, 0)); screenshot_fd.reset(fcntl(screenshot_fd_in.get(), F_DUPFD_CLOEXEC, 0)); SetOptionsFromMode(bugreport_mode, this, is_screenshot_requested); } Loading
cmds/installd/InstalldNativeService.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -1176,6 +1176,25 @@ binder::Status InstalldNativeService::destroyAppProfiles(const std::string& pack return res; } binder::Status InstalldNativeService::deleteReferenceProfile(const std::string& packageName, const std::string& profileName) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_PACKAGE_NAME(packageName); LOCK_PACKAGE(); // This function only supports primary dex'es. std::string path = create_reference_profile_path(packageName, profileName, /*is_secondary_dex=*/false); if (unlink(path.c_str()) != 0) { if (errno == ENOENT) { return ok(); } else { return error("Failed to delete profile " + profileName + " for " + packageName); } } return ok(); } binder::Status InstalldNativeService::destroyAppData(const std::optional<std::string>& uuid, const std::string& packageName, int32_t userId, int32_t flags, int64_t ceDataInode) { ENFORCE_UID(AID_SYSTEM); Loading
cmds/installd/InstalldNativeService.h +2 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public: bool* _aidl_return); binder::Status clearAppProfiles(const std::string& packageName, const std::string& profileName); binder::Status destroyAppProfiles(const std::string& packageName); binder::Status deleteReferenceProfile(const std::string& packageName, const std::string& profileName); binder::Status createProfileSnapshot(int32_t appId, const std::string& packageName, const std::string& profileName, const std::string& classpath, bool* _aidl_return); Loading
cmds/installd/binder/android/os/IInstalld.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ interface IInstalld { @utf8InCpp String packageName, @utf8InCpp String profileName); void clearAppProfiles(@utf8InCpp String packageName, @utf8InCpp String profileName); void destroyAppProfiles(@utf8InCpp String packageName); void deleteReferenceProfile(@utf8InCpp String packageName, @utf8InCpp String profileName); boolean createProfileSnapshot(int appId, @utf8InCpp String packageName, @utf8InCpp String profileName, @utf8InCpp String classpath); Loading
cmds/installd/utils.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -707,16 +707,16 @@ static int rename_delete_dir_contents(const std::string& pathname, auto temp_dir_path = base::StringPrintf("%s/%s", Dirname(pathname).c_str(), temp_dir_name.c_str()); if (::rename(pathname.c_str(), temp_dir_path.c_str())) { auto dir_to_delete = temp_dir_path.c_str(); if (::rename(pathname.c_str(), dir_to_delete)) { if (ignore_if_missing && (errno == ENOENT)) { return 0; } ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), temp_dir_path.c_str(), strerror(errno)); return -errno; ALOGE("Couldn't rename %s -> %s: %s \n", pathname.c_str(), dir_to_delete, strerror(errno)); dir_to_delete = pathname.c_str(); } return delete_dir_contents(temp_dir_path.c_str(), 1, exclusion_predicate, ignore_if_missing); return delete_dir_contents(dir_to_delete, 1, exclusion_predicate, ignore_if_missing); } bool is_renamed_deleted_dir(const std::string& path) { Loading