- WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(tizenAppId));
- m_context.locations = WidgetLocation(m_context.tzAppid);
- m_context.tzPkgid = DPL::ToUTF8String(dao.getTizenPkgId());
-
- LogInfo("Widget model exists. Pkg name: " << m_context.tzAppid);
-
- AddTask(new TaskSmack(m_context));
- AddTask(new TaskCheck(m_context));
+ WidgetStatus status = getWidgetStatus(tizenAppId);
+
+ if (WidgetStatus::Ok == status) {
+ WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(m_context.tzAppid));
+ m_context.tzPkgid = DPL::ToUTF8String(dao.getTizenPkgId());
+ m_context.locations = WidgetLocation(m_context.tzPkgid);
+ m_context.locations->registerAppid(m_context.tzAppid);
+
+ LogInfo("Widget model exists. App id : " << m_context.tzAppid);
+
+ AddTask(new TaskSmack(m_context));
+ AddTask(new TaskCheck(m_context));
+
+ if (dao.getPackagingType() == PKG_TYPE_HYBRID_WEB_APP) {
+ AddTask(new TaskUninstallOspsvc(m_context));
+ }
+ AddTask(new TaskRemoveFiles(m_context));
+ AddTask(new TaskDbUpdate(m_context));
+ AddTask(new TaskRemoveCustomHandlers(m_context));
+ AddTask(new TaskDeleteCertificates(m_context));
+
+ // send start signal of pkgmgr
+ if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzPkgid))
+ {
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_UNINSTALL);
+ }
+ } else if (WidgetStatus::NOT_INSTALLED == status) {
+ AddTask(new UninstallerTaskFail(true));
+ } else if (WidgetStatus::ABNORMAL == status) {
+ m_context.locations = WidgetLocation(m_context.tzPkgid);
+ m_context.removeAbnormal = true;
+ AddTask(new TaskRemoveFiles(m_context));
+ } else {
+ AddTask(new UninstallerTaskFail(false));
+ }
+ } Catch(WidgetDAOReadOnly::Exception::Base) {
+ AddTask(new UninstallerTaskFail(false));
+ }
+}