2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "anbox/android/intent.h"
24 bool Intent::valid() const {
25 // At the moment we only support component+package for intents
26 // (see android/service/android_api_skeleton.cpp for more details)
27 return !(component.empty() && package.empty());
30 std::ostream &operator<<(std::ostream &out, const Intent &intent) {
32 if (!intent.action.empty())
33 out << " " << "action=" << intent.action << " ";
34 if (!intent.uri.empty())
35 out << " " << "uri=" << intent.uri << " ";
36 if (!intent.type.empty())
37 out << " " << "type=" << intent.type << " ";
39 out << " " << "flags=" << intent.flags << " ";
40 if (!intent.package.empty())
41 out << " " << "package=" << intent.package << " ";
42 if (!intent.component.empty())
43 out << "component=" << intent.component << " ";
44 if (intent.categories.size() > 0) {
45 out << "categories=[ ";
46 for (const auto &category : intent.categories) out << category << " ";
52 } // namespace android