Loading cmds/dumpstate/DumpstateService.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -202,7 +202,6 @@ status_t DumpstateService::dump(int fd, const Vector<String16>&) { dprintf(fd, "base_name: %s\n", ds_->base_name_.c_str()); dprintf(fd, "name: %s\n", ds_->name_.c_str()); dprintf(fd, "now: %ld\n", ds_->now_); dprintf(fd, "is_zipping: %s\n", ds_->IsZipping() ? "true" : "false"); dprintf(fd, "notification title: %s\n", ds_->options_->notification_title.c_str()); dprintf(fd, "notification description: %s\n", ds_->options_->notification_description.c_str()); Loading cmds/dumpstate/dumpstate.cpp +6 −65 Original line number Diff line number Diff line Loading @@ -371,14 +371,10 @@ static const CommandOptions AS_ROOT_20 = CommandOptions::WithTimeout(20).AsRoot( /* * Returns a vector of dump fds under |dir_path| with a given |file_prefix|. * The returned vector is sorted by the mtimes of the dumps with descending * order. If |limit_by_mtime| is set, the vector only contains files that * were written in the last 30 minutes. * order. */ static std::vector<DumpData> GetDumpFds(const std::string& dir_path, const std::string& file_prefix, bool limit_by_mtime) { const time_t thirty_minutes_ago = ds.now_ - 60 * 30; const std::string& file_prefix) { std::unique_ptr<DIR, decltype(&closedir)> dump_dir(opendir(dir_path.c_str()), closedir); if (dump_dir == nullptr) { Loading Loading @@ -412,11 +408,6 @@ static std::vector<DumpData> GetDumpFds(const std::string& dir_path, continue; } if (limit_by_mtime && st.st_mtime < thirty_minutes_ago) { MYLOGI("Excluding stale dump file: %s\n", abs_path.c_str()); continue; } dump_data.emplace_back(DumpData{abs_path, std::move(fd), st.st_mtime}); } if (!dump_data.empty()) { Loading Loading @@ -447,7 +438,7 @@ static bool AddDumps(const std::vector<DumpData>::const_iterator start, strerror(errno)); } if (ds.IsZipping() && add_to_zip) { if (add_to_zip) { if (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + name, fd, /* timeout = */ 0ms) != OK) { MYLOGE("Unable to add %s to zip file, addZipEntryFromFd failed\n", name.c_str()); } Loading Loading @@ -486,7 +477,6 @@ void do_mountinfo(int pid, const char* name __attribute__((unused))) { } void add_mountinfo() { if (!ds.IsZipping()) return; std::string title = "MOUNT INFO"; mount_points.clear(); DurationReporter duration_reporter(title, true); Loading Loading @@ -823,11 +813,6 @@ static const std::set<std::string> PROBLEMATIC_FILE_EXTENSIONS = { status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, std::chrono::milliseconds timeout = 0ms) { if (!IsZipping()) { MYLOGD("Not adding zip entry %s from fd because it's not a zipped bugreport\n", entry_name.c_str()); return INVALID_OPERATION; } std::string valid_name = entry_name; // Rename extension if necessary. Loading Loading @@ -928,21 +913,12 @@ static int _add_file_from_fd(const char* title __attribute__((unused)), const ch } void Dumpstate::AddDir(const std::string& dir, bool recursive) { if (!IsZipping()) { MYLOGD("Not adding dir %s because it's not a zipped bugreport\n", dir.c_str()); return; } MYLOGD("Adding dir %s (recursive: %d)\n", dir.c_str(), recursive); DurationReporter duration_reporter(dir, true); dump_files("", dir.c_str(), recursive ? skip_none : is_dir, _add_file_from_fd); } bool Dumpstate::AddTextZipEntry(const std::string& entry_name, const std::string& content) { if (!IsZipping()) { MYLOGD("Not adding text zip entry %s because it's not a zipped bugreport\n", entry_name.c_str()); return false; } MYLOGD("Adding zip text entry %s\n", entry_name.c_str()); int32_t err = zip_writer_->StartEntryWithTime(entry_name.c_str(), ZipWriter::kCompress, ds.now_); if (err != 0) { Loading Loading @@ -1035,10 +1011,6 @@ static void DoLogcat() { } static void DumpIncidentReport() { if (!ds.IsZipping()) { MYLOGD("Not dumping incident report because it's not a zipped bugreport\n"); return; } const std::string path = ds.bugreport_internal_dir_ + "/tmp_incident_report"; auto fd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW, Loading @@ -1064,10 +1036,6 @@ static void MaybeAddSystemTraceToZip() { // This function copies into the .zip the system trace that was snapshotted // by the early call to MaybeSnapshotSystemTrace(), if any background // tracing was happening. if (!ds.IsZipping()) { MYLOGD("Not dumping system trace because it's not a zipped bugreport\n"); return; } if (!ds.has_system_trace_) { // No background trace was happening at the time dumpstate was invoked. return; Loading @@ -1079,10 +1047,6 @@ static void MaybeAddSystemTraceToZip() { } static void DumpVisibleWindowViews() { if (!ds.IsZipping()) { MYLOGD("Not dumping visible views because it's not a zipped bugreport\n"); return; } DurationReporter duration_reporter("VISIBLE WINDOW VIEWS"); const std::string path = ds.bugreport_internal_dir_ + "/tmp_visible_window_views"; auto fd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(path.c_str(), Loading Loading @@ -1163,7 +1127,7 @@ static void AddAnrTraceDir(const bool add_to_zip, const std::string& anr_traces_ } static void AddAnrTraceFiles() { const bool add_to_zip = ds.IsZipping() && ds.version_ == VERSION_SPLIT_ANR; const bool add_to_zip = ds.version_ == VERSION_SPLIT_ANR; std::string anr_traces_dir = "/data/anr"; Loading Loading @@ -1303,10 +1267,6 @@ static Dumpstate::RunStatus RunDumpsysTextNormalPriority(const std::string& titl static Dumpstate::RunStatus RunDumpsysProto(const std::string& title, int priority, std::chrono::milliseconds timeout, std::chrono::milliseconds service_timeout) { if (!ds.IsZipping()) { MYLOGD("Not dumping %s because it's not a zipped bugreport\n", title.c_str()); return Dumpstate::RunStatus::OK; } sp<android::IServiceManager> sm = defaultServiceManager(); Dumpsys dumpsys(sm.get()); Vector<String16> args; Loading Loading @@ -1386,12 +1346,6 @@ static Dumpstate::RunStatus RunDumpsysNormal() { * if it's not running in the parallel task. */ static void DumpHals(int out_fd = STDOUT_FILENO) { if (!ds.IsZipping()) { RunCommand("HARDWARE HALS", {"lshal", "--all", "--types=all", "--debug"}, CommandOptions::WithTimeout(60).AsRootIfAvailable().Build(), false, out_fd); return; } RunCommand("HARDWARE HALS", {"lshal", "--all", "--types=all"}, CommandOptions::WithTimeout(10).AsRootIfAvailable().Build(), false, out_fd); Loading Loading @@ -1846,8 +1800,8 @@ Dumpstate::RunStatus Dumpstate::DumpstateDefaultAfterCritical() { /* Run some operations that require root. */ if (!PropertiesHelper::IsDryRun()) { ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX, !ds.IsZipping()); ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX, !ds.IsZipping()); ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX); ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX); } ds.AddDir(RECOVERY_DIR, true); Loading Loading @@ -2394,11 +2348,6 @@ void Dumpstate::DumpstateBoard(int out_fd) { dprintf(out_fd, "== Board\n"); dprintf(out_fd, "========================================================\n"); if (!IsZipping()) { MYLOGD("Not dumping board info because it's not a zipped bugreport\n"); return; } /* * mount debugfs for non-user builds with ro.product.debugfs_restrictions.enabled * set to true and unmount it after invoking dumpstateBoard_* methods. Loading Loading @@ -3567,10 +3516,6 @@ void Progress::Dump(int fd, const std::string& prefix) const { dprintf(fd, "%saverage_max: %d\n", pr, average_max_); } bool Dumpstate::IsZipping() const { return zip_writer_ != nullptr; } std::string Dumpstate::GetPath(const std::string& suffix) const { return GetPath(bugreport_internal_dir_, suffix); } Loading Loading @@ -4216,10 +4161,6 @@ void dump_frozen_cgroupfs(const char *dir, int level, } void dump_frozen_cgroupfs() { if (!ds.IsZipping()) { MYLOGD("Not adding cgroupfs because it's not a zipped bugreport\n"); return; } MYLOGD("Adding frozen processes from %s\n", CGROUPFS_DIR); DurationReporter duration_reporter("FROZEN CGROUPFS"); if (PropertiesHelper::IsDryRun()) return; Loading cmds/dumpstate/dumpstate.h +0 −3 Original line number Diff line number Diff line Loading @@ -214,9 +214,6 @@ class Dumpstate { static Dumpstate& GetInstance(); /* Checkes whether dumpstate is generating a zipped bugreport. */ bool IsZipping() const; /* Initialize dumpstate fields before starting bugreport generation */ void Initialize(); Loading libs/gui/WindowInfo.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ bool WindowInfo::operator==(const WindowInfo& info) const { info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.packageName == packageName && info.inputFeatures == inputFeatures && info.displayId == displayId && info.portalToDisplayId == portalToDisplayId && info.displayId == displayId && info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop && info.applicationInfo == applicationInfo; } Loading Loading @@ -116,7 +116,6 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const { parcel->writeUtf8AsUtf16(packageName) ?: parcel->writeInt32(inputFeatures.get()) ?: parcel->writeInt32(displayId) ?: parcel->writeInt32(portalToDisplayId) ?: applicationInfo.writeToParcel(parcel) ?: parcel->write(touchableRegion) ?: parcel->writeBool(replaceTouchableRegionWithCrop) ?: Loading Loading @@ -180,7 +179,6 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) { inputFeatures = Flags<Feature>(parcel->readInt32()); // clang-format off status = parcel->readInt32(&displayId) ?: parcel->readInt32(&portalToDisplayId) ?: applicationInfo.readFromParcel(parcel) ?: parcel->read(touchableRegion) ?: parcel->readBool(&replaceTouchableRegionWithCrop); Loading libs/gui/include/gui/WindowInfo.h +0 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,6 @@ struct WindowInfo : public Parcelable { std::string packageName; Flags<Feature> inputFeatures; int32_t displayId = ADISPLAY_ID_NONE; int32_t portalToDisplayId = ADISPLAY_ID_NONE; InputApplicationInfo applicationInfo; bool replaceTouchableRegionWithCrop = false; wp<IBinder> touchableRegionCropHandle; Loading Loading
cmds/dumpstate/DumpstateService.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -202,7 +202,6 @@ status_t DumpstateService::dump(int fd, const Vector<String16>&) { dprintf(fd, "base_name: %s\n", ds_->base_name_.c_str()); dprintf(fd, "name: %s\n", ds_->name_.c_str()); dprintf(fd, "now: %ld\n", ds_->now_); dprintf(fd, "is_zipping: %s\n", ds_->IsZipping() ? "true" : "false"); dprintf(fd, "notification title: %s\n", ds_->options_->notification_title.c_str()); dprintf(fd, "notification description: %s\n", ds_->options_->notification_description.c_str()); Loading
cmds/dumpstate/dumpstate.cpp +6 −65 Original line number Diff line number Diff line Loading @@ -371,14 +371,10 @@ static const CommandOptions AS_ROOT_20 = CommandOptions::WithTimeout(20).AsRoot( /* * Returns a vector of dump fds under |dir_path| with a given |file_prefix|. * The returned vector is sorted by the mtimes of the dumps with descending * order. If |limit_by_mtime| is set, the vector only contains files that * were written in the last 30 minutes. * order. */ static std::vector<DumpData> GetDumpFds(const std::string& dir_path, const std::string& file_prefix, bool limit_by_mtime) { const time_t thirty_minutes_ago = ds.now_ - 60 * 30; const std::string& file_prefix) { std::unique_ptr<DIR, decltype(&closedir)> dump_dir(opendir(dir_path.c_str()), closedir); if (dump_dir == nullptr) { Loading Loading @@ -412,11 +408,6 @@ static std::vector<DumpData> GetDumpFds(const std::string& dir_path, continue; } if (limit_by_mtime && st.st_mtime < thirty_minutes_ago) { MYLOGI("Excluding stale dump file: %s\n", abs_path.c_str()); continue; } dump_data.emplace_back(DumpData{abs_path, std::move(fd), st.st_mtime}); } if (!dump_data.empty()) { Loading Loading @@ -447,7 +438,7 @@ static bool AddDumps(const std::vector<DumpData>::const_iterator start, strerror(errno)); } if (ds.IsZipping() && add_to_zip) { if (add_to_zip) { if (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + name, fd, /* timeout = */ 0ms) != OK) { MYLOGE("Unable to add %s to zip file, addZipEntryFromFd failed\n", name.c_str()); } Loading Loading @@ -486,7 +477,6 @@ void do_mountinfo(int pid, const char* name __attribute__((unused))) { } void add_mountinfo() { if (!ds.IsZipping()) return; std::string title = "MOUNT INFO"; mount_points.clear(); DurationReporter duration_reporter(title, true); Loading Loading @@ -823,11 +813,6 @@ static const std::set<std::string> PROBLEMATIC_FILE_EXTENSIONS = { status_t Dumpstate::AddZipEntryFromFd(const std::string& entry_name, int fd, std::chrono::milliseconds timeout = 0ms) { if (!IsZipping()) { MYLOGD("Not adding zip entry %s from fd because it's not a zipped bugreport\n", entry_name.c_str()); return INVALID_OPERATION; } std::string valid_name = entry_name; // Rename extension if necessary. Loading Loading @@ -928,21 +913,12 @@ static int _add_file_from_fd(const char* title __attribute__((unused)), const ch } void Dumpstate::AddDir(const std::string& dir, bool recursive) { if (!IsZipping()) { MYLOGD("Not adding dir %s because it's not a zipped bugreport\n", dir.c_str()); return; } MYLOGD("Adding dir %s (recursive: %d)\n", dir.c_str(), recursive); DurationReporter duration_reporter(dir, true); dump_files("", dir.c_str(), recursive ? skip_none : is_dir, _add_file_from_fd); } bool Dumpstate::AddTextZipEntry(const std::string& entry_name, const std::string& content) { if (!IsZipping()) { MYLOGD("Not adding text zip entry %s because it's not a zipped bugreport\n", entry_name.c_str()); return false; } MYLOGD("Adding zip text entry %s\n", entry_name.c_str()); int32_t err = zip_writer_->StartEntryWithTime(entry_name.c_str(), ZipWriter::kCompress, ds.now_); if (err != 0) { Loading Loading @@ -1035,10 +1011,6 @@ static void DoLogcat() { } static void DumpIncidentReport() { if (!ds.IsZipping()) { MYLOGD("Not dumping incident report because it's not a zipped bugreport\n"); return; } const std::string path = ds.bugreport_internal_dir_ + "/tmp_incident_report"; auto fd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW, Loading @@ -1064,10 +1036,6 @@ static void MaybeAddSystemTraceToZip() { // This function copies into the .zip the system trace that was snapshotted // by the early call to MaybeSnapshotSystemTrace(), if any background // tracing was happening. if (!ds.IsZipping()) { MYLOGD("Not dumping system trace because it's not a zipped bugreport\n"); return; } if (!ds.has_system_trace_) { // No background trace was happening at the time dumpstate was invoked. return; Loading @@ -1079,10 +1047,6 @@ static void MaybeAddSystemTraceToZip() { } static void DumpVisibleWindowViews() { if (!ds.IsZipping()) { MYLOGD("Not dumping visible views because it's not a zipped bugreport\n"); return; } DurationReporter duration_reporter("VISIBLE WINDOW VIEWS"); const std::string path = ds.bugreport_internal_dir_ + "/tmp_visible_window_views"; auto fd = android::base::unique_fd(TEMP_FAILURE_RETRY(open(path.c_str(), Loading Loading @@ -1163,7 +1127,7 @@ static void AddAnrTraceDir(const bool add_to_zip, const std::string& anr_traces_ } static void AddAnrTraceFiles() { const bool add_to_zip = ds.IsZipping() && ds.version_ == VERSION_SPLIT_ANR; const bool add_to_zip = ds.version_ == VERSION_SPLIT_ANR; std::string anr_traces_dir = "/data/anr"; Loading Loading @@ -1303,10 +1267,6 @@ static Dumpstate::RunStatus RunDumpsysTextNormalPriority(const std::string& titl static Dumpstate::RunStatus RunDumpsysProto(const std::string& title, int priority, std::chrono::milliseconds timeout, std::chrono::milliseconds service_timeout) { if (!ds.IsZipping()) { MYLOGD("Not dumping %s because it's not a zipped bugreport\n", title.c_str()); return Dumpstate::RunStatus::OK; } sp<android::IServiceManager> sm = defaultServiceManager(); Dumpsys dumpsys(sm.get()); Vector<String16> args; Loading Loading @@ -1386,12 +1346,6 @@ static Dumpstate::RunStatus RunDumpsysNormal() { * if it's not running in the parallel task. */ static void DumpHals(int out_fd = STDOUT_FILENO) { if (!ds.IsZipping()) { RunCommand("HARDWARE HALS", {"lshal", "--all", "--types=all", "--debug"}, CommandOptions::WithTimeout(60).AsRootIfAvailable().Build(), false, out_fd); return; } RunCommand("HARDWARE HALS", {"lshal", "--all", "--types=all"}, CommandOptions::WithTimeout(10).AsRootIfAvailable().Build(), false, out_fd); Loading Loading @@ -1846,8 +1800,8 @@ Dumpstate::RunStatus Dumpstate::DumpstateDefaultAfterCritical() { /* Run some operations that require root. */ if (!PropertiesHelper::IsDryRun()) { ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX, !ds.IsZipping()); ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX, !ds.IsZipping()); ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX); ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX); } ds.AddDir(RECOVERY_DIR, true); Loading Loading @@ -2394,11 +2348,6 @@ void Dumpstate::DumpstateBoard(int out_fd) { dprintf(out_fd, "== Board\n"); dprintf(out_fd, "========================================================\n"); if (!IsZipping()) { MYLOGD("Not dumping board info because it's not a zipped bugreport\n"); return; } /* * mount debugfs for non-user builds with ro.product.debugfs_restrictions.enabled * set to true and unmount it after invoking dumpstateBoard_* methods. Loading Loading @@ -3567,10 +3516,6 @@ void Progress::Dump(int fd, const std::string& prefix) const { dprintf(fd, "%saverage_max: %d\n", pr, average_max_); } bool Dumpstate::IsZipping() const { return zip_writer_ != nullptr; } std::string Dumpstate::GetPath(const std::string& suffix) const { return GetPath(bugreport_internal_dir_, suffix); } Loading Loading @@ -4216,10 +4161,6 @@ void dump_frozen_cgroupfs(const char *dir, int level, } void dump_frozen_cgroupfs() { if (!ds.IsZipping()) { MYLOGD("Not adding cgroupfs because it's not a zipped bugreport\n"); return; } MYLOGD("Adding frozen processes from %s\n", CGROUPFS_DIR); DurationReporter duration_reporter("FROZEN CGROUPFS"); if (PropertiesHelper::IsDryRun()) return; Loading
cmds/dumpstate/dumpstate.h +0 −3 Original line number Diff line number Diff line Loading @@ -214,9 +214,6 @@ class Dumpstate { static Dumpstate& GetInstance(); /* Checkes whether dumpstate is generating a zipped bugreport. */ bool IsZipping() const; /* Initialize dumpstate fields before starting bugreport generation */ void Initialize(); Loading
libs/gui/WindowInfo.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ bool WindowInfo::operator==(const WindowInfo& info) const { info.hasWallpaper == hasWallpaper && info.paused == paused && info.ownerPid == ownerPid && info.ownerUid == ownerUid && info.packageName == packageName && info.inputFeatures == inputFeatures && info.displayId == displayId && info.portalToDisplayId == portalToDisplayId && info.displayId == displayId && info.replaceTouchableRegionWithCrop == replaceTouchableRegionWithCrop && info.applicationInfo == applicationInfo; } Loading Loading @@ -116,7 +116,6 @@ status_t WindowInfo::writeToParcel(android::Parcel* parcel) const { parcel->writeUtf8AsUtf16(packageName) ?: parcel->writeInt32(inputFeatures.get()) ?: parcel->writeInt32(displayId) ?: parcel->writeInt32(portalToDisplayId) ?: applicationInfo.writeToParcel(parcel) ?: parcel->write(touchableRegion) ?: parcel->writeBool(replaceTouchableRegionWithCrop) ?: Loading Loading @@ -180,7 +179,6 @@ status_t WindowInfo::readFromParcel(const android::Parcel* parcel) { inputFeatures = Flags<Feature>(parcel->readInt32()); // clang-format off status = parcel->readInt32(&displayId) ?: parcel->readInt32(&portalToDisplayId) ?: applicationInfo.readFromParcel(parcel) ?: parcel->read(touchableRegion) ?: parcel->readBool(&replaceTouchableRegionWithCrop); Loading
libs/gui/include/gui/WindowInfo.h +0 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,6 @@ struct WindowInfo : public Parcelable { std::string packageName; Flags<Feature> inputFeatures; int32_t displayId = ADISPLAY_ID_NONE; int32_t portalToDisplayId = ADISPLAY_ID_NONE; InputApplicationInfo applicationInfo; bool replaceTouchableRegionWithCrop = false; wp<IBinder> touchableRegionCropHandle; Loading