strdup(profile.c_str()));
}
}
+ return true;
+}
- if (ui_application_list) {
- manifest->mainapp_id =
- strdup(ui_application_list->items[0].app_info.appid().c_str());
- } else if (service_application_list) {
- manifest->mainapp_id =
- strdup(service_application_list->items[0].app_info.appid().c_str());
- } else if (widget_application_list) {
- manifest->mainapp_id =
- strdup(widget_application_list->items[0].app_info.appid().c_str());
+bool StepParseManifest::FillPackageMainApp(manifest_x* manifest) {
+ // if no widget-application declared to be main app then take first one
+ if (!manifest->mainapp_id) {
+ application_x* first_app =
+ *GListRange<application_x*>(manifest->application).begin();
+ manifest->mainapp_id = strdup(first_app->appid);
+ free(const_cast<char*>(first_app->mainapp));
+ first_app->mainapp = strdup("true");
}
return true;
}
for (const auto& application : widget_application_list->items) {
// if there is no app yet, set this app as mainapp
- bool main_app = manifest->application == nullptr;
+ bool main_app = application.app_info.main() == "true";
+ if (main_app && manifest->mainapp_id) {
+ LOG(ERROR) << "Main application already set";
+ return false;
+ }
application_x* widget_app =
static_cast<application_x*>(calloc(1, sizeof(application_x)));
strdup(application.app_info.hwacceleration().c_str());
widget_app->onboot = strdup("false");
widget_app->autorestart = strdup("false");
- widget_app->mainapp = main_app ? strdup("true") : strdup("false");
+ if (main_app) {
+ widget_app->mainapp = strdup("true");
+ manifest->mainapp_id = strdup(widget_app->appid);
+ } else {
+ widget_app->mainapp = strdup("false");
+ }
widget_app->enabled = strdup("true");
widget_app->screenreader = strdup("use-system-setting");
widget_app->recentimage = strdup("false");
return true;
for (const auto& application : service_application_list->items) {
- // if there is no app yet, set this app as mainapp
- bool main_app = manifest->application == nullptr;
-
application_x* service_app =
static_cast<application_x*>(calloc(1, sizeof(application_x)));
service_app->appid = strdup(application.app_info.appid().c_str());
service_app->process_pool =
strdup(application.app_info.process_pool().c_str());
service_app->component_type = strdup("svcapp");
- service_app->mainapp = main_app ? strdup("true") : strdup("false");
+ service_app->mainapp = strdup("false");
service_app->enabled = strdup("true");
service_app->hwacceleration = strdup("default");
service_app->screenreader = strdup("use-system-setting");
return true;
for (const auto& application : ui_application_list->items) {
- // if there is no app yet, set this app as mainapp
- bool main_app = manifest->application == nullptr;
-
application_x* ui_app =
static_cast<application_x*>(calloc(1, sizeof(application_x)));
ui_app->appid = strdup(application.app_info.appid().c_str());
ui_app->onboot = strdup("false");
ui_app->autorestart = strdup("false");
ui_app->component_type = strdup("uiapp");
- ui_app->mainapp = main_app ? strdup("true") : strdup("false");
+ ui_app->mainapp = strdup("false");
ui_app->enabled = strdup("true");
ui_app->screenreader = strdup("use-system-setting");
ui_app->recentimage = strdup("false");
return false;
if (!FillWatchApplication(manifest))
return false;
+ if (!FillPackageMainApp(manifest))
+ return false;
if (!FillPrivileges(manifest))
return false;
if (!FillAuthorInfo(manifest))