From 82cbc1e3df10c4eb2b8c54372354694ed1210457 Mon Sep 17 00:00:00 2001
From: Piotr Ganicz
Date: Tue, 24 May 2016 13:48:33 +0200
Subject: [PATCH] Fix manifest attributes
This patch repairs manifest.xml attributes when ime is the
type of the app.
Change-Id: I6cf77401058b922e426311b5a00ad8ab48a0e64a
---
src/wgt/step/configuration/step_parse.cc | 23 ++++++++++++++++++++---
src/wgt/step/pkgmgr/step_generate_xml.cc | 10 ++++++----
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc
index 680ab35..c438598 100644
--- a/src/wgt/step/configuration/step_parse.cc
+++ b/src/wgt/step/configuration/step_parse.cc
@@ -51,6 +51,7 @@ const char kCategoryWatchClock[] = "com.samsung.wmanager.WATCH_CLOCK";
const std::string kManifestVersion = "1.0.0";
const char kTizenPackageXmlNamespace[] = "http://tizen.org/ns/packages";
+const char kImeCategoryName[] = "http://tizen.org/category/ime";
const char kResWgt[] = "res/wgt";
@@ -80,7 +81,6 @@ void SetApplicationXDefaults(application_x* application) {
application->screenreader = strdup("use-system-setting");
application->submode = strdup("false");
application->support_disable = strdup("false");
- application->taskmanage = strdup("true");
application->ui_gadget = strdup("false");
}
@@ -252,6 +252,7 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
return false;
}
bool has_watch_catergory = false;
+ bool has_ime = false;
std::shared_ptr category_info =
std::static_pointer_cast(
parser_->GetManifestData(app_keys::kTizenCategoryKey));
@@ -262,6 +263,10 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
return category == kCategoryWearableClock ||
category == kCategoryWatchClock;
}) != category_info->categories.end();
+ has_ime = std::find(category_info->categories.begin(),
+ category_info->categories.end(),
+ kImeCategoryName
+ ) != category_info->categories.end();
}
// application data
@@ -270,9 +275,10 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
application->component_type =
has_watch_catergory ? strdup("watchapp") : strdup("uiapp");
application->mainapp = strdup("true");
- application->nodisplay = strdup("false");
application->multiple = strdup("false");
application->appid = strdup(app_info->id().c_str());
+ application->nodisplay = has_ime ? strdup("true") : strdup("false");
+ application->taskmanage = has_ime ? strdup("false") : strdup("true");
SetApplicationXDefaults(application);
if (has_watch_catergory)
application->ambient_support =
@@ -309,12 +315,21 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
parser_->GetManifestData(app_keys::kTizenServiceKey));
if (!service_list)
return true;
+ bool has_ime = false;
+ std::shared_ptr category_info =
+ std::static_pointer_cast(
+ parser_->GetManifestData(app_keys::kTizenCategoryKey));
+ if (category_info) {
+ has_ime = std::find(category_info->categories.begin(),
+ category_info->categories.end(),
+ kImeCategoryName
+ ) != category_info->categories.end();
+ }
for (auto& service_info : service_list->services) {
application_x* application = reinterpret_cast
(calloc(1, sizeof(application_x)));
application->component_type = strdup("svcapp");
application->mainapp = strdup("false");
- application->nodisplay = strdup("false");
application->multiple = strdup("false");
application->appid = strdup(service_info.id().c_str());
application->exec =
@@ -325,6 +340,8 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
service_info.on_boot() ? strdup("true") : strdup("false");
application->autorestart =
service_info.auto_restart() ? strdup("true") : strdup("false");
+ application->nodisplay = has_ime ? strdup("true") : strdup("false");
+ application->taskmanage = has_ime ? strdup("false") : strdup("true");
SetApplicationXDefaults(application);
application->ambient_support = strdup("false");
application->package = strdup(manifest->package);
diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc
index 614009e..79339f1 100644
--- a/src/wgt/step/pkgmgr/step_generate_xml.cc
+++ b/src/wgt/step/pkgmgr/step_generate_xml.cc
@@ -31,8 +31,9 @@ namespace {
void WriteUIApplicationAttributes(
xmlTextWriterPtr writer, application_x *app) {
- xmlTextWriterWriteAttribute(writer, BAD_CAST "taskmanage",
- BAD_CAST "true");
+ if (app->taskmanage)
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "taskmanage",
+ BAD_CAST app->taskmanage);
if (app->nodisplay)
xmlTextWriterWriteAttribute(writer, BAD_CAST "nodisplay",
BAD_CAST app->nodisplay);
@@ -74,8 +75,9 @@ void WriteServiceApplicationAttributes(
BAD_CAST(app->autorestart ? app->autorestart : "false"));
xmlTextWriterWriteAttribute(writer, BAD_CAST "on-boot",
BAD_CAST(app->onboot ? app->onboot : "false"));
- xmlTextWriterWriteAttribute(writer, BAD_CAST "taskmanage",
- BAD_CAST "false");
+ if (app->taskmanage)
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "taskmanage",
+ BAD_CAST app->taskmanage);
}
void WriteWidgetApplicationAttributes(
--
2.7.4