From 855a391a5bf579f647fa47d8d5d7c9223528edaa Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 2 May 2017 08:13:33 +0200 Subject: [PATCH] android: only print intent information when available --- src/anbox/android/intent.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/anbox/android/intent.cpp b/src/anbox/android/intent.cpp index aa40f2c..8344dc0 100644 --- a/src/anbox/android/intent.cpp +++ b/src/anbox/android/intent.cpp @@ -22,16 +22,25 @@ namespace anbox { namespace android { std::ostream &operator<<(std::ostream &out, const Intent &intent) { - out << "[" - << "action=" << intent.action << " " - << "uri=" << intent.uri << " " - << "type=" << intent.type << " " - << "flags=" << intent.flags << " " - << "package=" << intent.package << " " - << "component=" << intent.component << " " - << "categories=[ "; - for (const auto &category : intent.categories) out << category << " "; - out << "]]"; + out << "["; + if (intent.action.length() > 0) + out << " " << "action=" << intent.action << " "; + if (intent.uri.length() > 0) + out << " " << "uri=" << intent.uri << " "; + if (intent.type.length() > 0) + out << " " << "type=" << intent.type << " "; + if (intent.flags > 0) + out << " " << "flags=" << intent.flags << " "; + if (intent.package.length() > 0) + out << " " << "package=" << intent.package << " "; + if (intent.component.length() > 0) + out << "component=" << intent.component << " "; + if (intent.categories.size() > 0) { + out << "categories=[ "; + for (const auto &category : intent.categories) out << category << " "; + out << "] "; + } + out << "]"; return out; } } // namespace android