2 * Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "status_all_operation.hh"
20 #include <bundle_cpp.h>
26 #include "aul/api/aul_app_context.h"
27 #include "aul/boot_sequence/boot_sequence_manager.hh"
31 bool StatusAllOperation::Process() {
32 auto& manager = internal::boot_sequence::BootSequenceManager::GetInst();
33 auto app_list = manager.GetAppInfoList(getuid());
34 if (app_list.empty()) {
35 std::cerr << "Failed to get boot sequence app list." << std::endl;
39 for (const auto& app : app_list) {
40 std::cout << "===========================================" << std::endl;
41 std::cout << "appid: " << app->GetAppId() << std::endl;
43 std::cout << "status: " << app->GetActiveState() << std::endl;
45 aul_app_context_h context;
46 int ret = aul_app_context_create(app->GetAppId().c_str(), &context);
48 const char* val = nullptr;
49 aul_app_context_get_app_path(context, const_cast<char**>(&val));
50 std::cout << "app path: " << val << std::endl;
51 std::free(const_cast<char*>(val));
53 aul_app_context_get_pid(context, &pid);
54 std::cout << "pid: " << pid << std::endl;
55 aul_app_context_destroy(context);
58 std::cout << "requires: ";
59 for (auto& appid : app->RequiresGet())
60 std::cout << appid << " ";
62 std::cout << std::endl;
64 std::cout << "before: ";
65 for (auto& appid : app->BeforeGet())
66 std::cout << appid << " ";
68 std::cout << std::endl;
70 std::cout << "after: ";
71 for (auto& appid : app->AfterGet())
72 std::cout << appid << " ";
74 std::cout << std::endl;
76 std::cout << "conflict: ";
77 for (auto& appid : app->ConflictsGet())
78 std::cout << appid << " ";
80 std::cout << std::endl;
82 std::cout << "args: {\n";
83 auto& b = app->GetArgs();
86 [](const char* key, const int type,
87 const bundle_keyval_t* kv, void* data) {
88 auto& kb = *static_cast<tizen_base::Bundle*>(data);
89 std::cout << key << ": ";
92 std::cout << kb.GetString(key) << std::endl;
94 case BUNDLE_TYPE_STR_ARRAY:
96 for (auto& val : kb.GetStringArray(key))
97 std::cout << val << ", ";
99 std::cout << "]" << std::endl;
105 const_cast<tizen_base::Bundle*>(&b));
106 std::cout << "}" << std::endl;
108 std::cout << "bg-launch: " << app->IsBackgroundLaunch() << std::endl;
109 std::cout << "===========================================" << std::endl;