Commit e8fcaca8 authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

filter out window title for feedback report

Bug: 1098387
Change-Id: I7bf459692cf7746bea954264cd749ffb5f32d047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261095Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781946}
parent 154ef649
......@@ -122,7 +122,7 @@ void HandlePrintViewHierarchy() {
void HandlePrintWindowHierarchy() {
std::ostringstream out;
PrintWindowHierarchy(&out);
PrintWindowHierarchy(&out, /*scrub_data=*/false);
LOG(ERROR) << out.str();
}
......
......@@ -52,6 +52,7 @@ void PrintWindowHierarchy(const aura::Window* active_window,
const aura::Window* focused_window,
aura::Window* window,
int indent,
bool scrub_data,
std::ostringstream* out) {
std::string indent_str(indent, ' ');
std::string name(window->GetName());
......@@ -80,9 +81,13 @@ void PrintWindowHierarchy(const aura::Window* active_window,
std::string* tree_id = window->GetProperty(ui::kChildAXTreeID);
if (tree_id)
*out << " ax_tree_id=" << *tree_id;
if (!scrub_data) {
base::string16 title(window->GetTitle());
if (!title.empty())
*out << " title=" << title;
}
int app_type = window->GetProperty(aura::client::kAppType);
*out << " app_type=" << app_type;
std::string* pkg_name = window->GetProperty(ash::kArcPackageNameKey);
......@@ -90,17 +95,20 @@ void PrintWindowHierarchy(const aura::Window* active_window,
*out << " pkg_name=" << *pkg_name;
*out << '\n';
for (aura::Window* child : window->children())
PrintWindowHierarchy(active_window, focused_window, child, indent + 3, out);
for (aura::Window* child : window->children()) {
PrintWindowHierarchy(active_window, focused_window, child, indent + 3,
scrub_data, out);
}
}
void PrintWindowHierarchy(std::ostringstream* out) {
void PrintWindowHierarchy(std::ostringstream* out, bool scrub_data) {
aura::Window* active_window = window_util::GetActiveWindow();
aura::Window* focused_window = window_util::GetFocusedWindow();
aura::Window::Windows roots = Shell::Get()->GetAllRootWindows();
for (size_t i = 0; i < roots.size(); ++i) {
*out << "RootWindow " << i << ":\n";
PrintWindowHierarchy(active_window, focused_window, roots[i], 0, out);
PrintWindowHierarchy(active_window, focused_window, roots[i], 0, scrub_data,
out);
}
}
......
......@@ -18,8 +18,9 @@ ASH_EXPORT void PrintLayerHierarchy(std::ostringstream* out);
// Prints current active window's view hierarchy to |out|.
ASH_EXPORT void PrintViewHierarchy(std::ostringstream* out);
// Prints all windows hierarchy to |out|.
ASH_EXPORT void PrintWindowHierarchy(std::ostringstream* out);
// Prints all windows hierarchy to |out|. If |scrub_data| is true, we
// may skip some data fields that are not very important for debugging.
ASH_EXPORT void PrintWindowHierarchy(std::ostringstream* out, bool scrub_data);
} // namespace debug
} // namespace ash
......
......@@ -18,7 +18,7 @@ void UiHierarchyLogSource::Fetch(SysLogsSourceCallback callback) {
{
std::ostringstream out;
ash::debug::PrintWindowHierarchy(&out);
ash::debug::PrintWindowHierarchy(&out, scrub_data_);
response->emplace("UI Hierarchy: Windows", out.str());
}
......
......@@ -12,7 +12,8 @@ namespace system_logs {
class UiHierarchyLogSource : public SystemLogsSource {
public:
UiHierarchyLogSource() : SystemLogsSource("UiHierarchy") {}
explicit UiHierarchyLogSource(bool scrub_data)
: SystemLogsSource("UiHierarchy"), scrub_data_(scrub_data) {}
UiHierarchyLogSource(const UiHierarchyLogSource&) = delete;
UiHierarchyLogSource& operator=(const UiHierarchyLogSource&) = delete;
~UiHierarchyLogSource() override = default;
......@@ -20,6 +21,8 @@ class UiHierarchyLogSource : public SystemLogsSource {
private:
// Overridden from SystemLogsSource:
void Fetch(SysLogsSourceCallback callback) override;
const bool scrub_data_;
};
} // namespace system_logs
......
......@@ -36,11 +36,11 @@ SystemLogsFetcher* BuildAboutSystemLogsFetcher() {
fetcher->AddSource(std::make_unique<DBusLogSource>());
fetcher->AddSource(std::make_unique<DeviceEventLogSource>());
fetcher->AddSource(std::make_unique<TouchLogSource>());
fetcher->AddSource(std::make_unique<UiHierarchyLogSource>());
// Data sources that directly scrub itentifiable information.
fetcher->AddSource(std::make_unique<DebugDaemonLogSource>(scrub_data));
fetcher->AddSource(std::make_unique<NetworkHealthSource>(scrub_data));
fetcher->AddSource(std::make_unique<UiHierarchyLogSource>(scrub_data));
#endif
return fetcher;
......
......@@ -41,12 +41,12 @@ SystemLogsFetcher* BuildChromeSystemLogsFetcher() {
fetcher->AddSource(std::make_unique<DeviceEventLogSource>());
fetcher->AddSource(std::make_unique<IwlwifiDumpChecker>());
fetcher->AddSource(std::make_unique<TouchLogSource>());
fetcher->AddSource(std::make_unique<UiHierarchyLogSource>());
// Data sources that directly scrub itentifiable information, but the others
// still get scrubbed by SystemLogsFetcher.
fetcher->AddSource(std::make_unique<DebugDaemonLogSource>(scrub_data));
fetcher->AddSource(std::make_unique<NetworkHealthSource>(scrub_data));
fetcher->AddSource(std::make_unique<UiHierarchyLogSource>(scrub_data));
#endif
return fetcher;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment