* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <widget_uninstall/job_widget_uninstall.h>
#include <widget_uninstall/widget_uninstall_errors.h>
#include <widget_uninstall/task_check.h>
#include <widget_uninstall/task_remove_files.h>
#include <widget_uninstall/task_smack.h>
#include <widget_uninstall/task_uninstall_ospsvc.h>
+#include <widget_uninstall/task_delete_certificates.h>
#include <pkg-manager/pkgmgr_signal.h>
+#include <app2ext_interface.h>
using namespace WrtDB;
namespace Jobs {
namespace WidgetUninstall {
-JobWidgetUninstall::JobWidgetUninstall(WidgetHandle widgetHandle,
+JobWidgetUninstall::JobWidgetUninstall(const std::string & widgetPkgName,
const WidgetUninstallationStruct &uninstallerStruct) :
Job(Uninstallation),
JobContextBase<WidgetUninstallationStruct>(uninstallerStruct)
{
using namespace PackageManager;
- m_context.widgetHandle = widgetHandle;
m_context.removeStarted = false;
m_context.removeFinished = false;
m_context.uninstallStep = UninstallerContext::UNINSTALL_START;
m_context.job = this;
+ m_context.pkgname = widgetPkgName;
+ m_context.isExternalWidget = getExternalWidgetFlag();
+
+ Try
+ {
+ WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(widgetPkgName));
+ m_context.locations = WidgetLocation(m_context.pkgname);
- Try {
- WrtDB::WidgetDAOReadOnly dao(widgetHandle);
- m_context.pkgname = DPL::ToUTF8String(*dao.getPkgname());
LogInfo("Widget model exists. Pkg name: " << m_context.pkgname);
AddTask(new TaskSmack(m_context));
AddTask(new TaskCheck(m_context));
- if (dao.getPkgType() == PKG_TYPE_TIZEN_WITHSVCAPP) {
+ 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 TaskDeleteCertificates(m_context));
// send start signal of pkgmgr
- if (PkgmgrSignalSingleton::Instance().setPkgname(m_context.pkgname)) {
- PkgmgrSignalSingleton::Instance().sendSignal(
+ if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.pkgname)) {
+ getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_START_KEY,
PKGMGR_START_UNINSTALL);
}
-
} Catch (WidgetDAOReadOnly::Exception::WidgetNotExist) {
AddTask(new UninstallerTaskFail(true));
} Catch (WidgetDAOReadOnly::Exception::Base) {
}
}
-WidgetHandle JobWidgetUninstall::getRemovedWidgetHandle() const
+std::string JobWidgetUninstall::getRemovedTizenId() const
{
- return m_context.widgetHandle;
+ return m_context.pkgname;
}
bool JobWidgetUninstall::getRemoveStartedFlag() const
// send progress signal of pkgmgr
std::ostringstream percent;
percent << static_cast<int>(GetProgressPercent());
- PkgmgrSignalSingleton::Instance().sendSignal(
+ getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_PROGRESS_KEY,
percent.str());
{
using namespace PackageManager;
// send signal of pkgmgr
- PkgmgrSignalSingleton::Instance().sendSignal(
+ getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_END_KEY,
PKGMGR_END_SUCCESS);
LogDebug("Call widget uninstall success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- getRemovedWidgetHandle(),Exceptions::Success);
+ getRemovedTizenId(),Exceptions::Success);
}
void JobWidgetUninstall::SendFinishedFailure()
LogError("Message: " << m_exceptionMessage);
// send signal of pkgmgr
- PkgmgrSignalSingleton::Instance().sendSignal(
+ getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_END_KEY,
PKGMGR_END_FAILURE);
LogDebug("Call widget uninstall failure finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- getRemovedWidgetHandle(), m_exceptionCaught); //TODO
+ getRemovedTizenId(), m_exceptionCaught); //TODO
LogDebug("[JobWidgetUninstall] Asynchronous failure callback status sent");
}
m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
m_exceptionMessage = e.GetMessage();
}
+
+bool JobWidgetUninstall::getExternalWidgetFlag() const
+{
+
+ LogDebug("Get external widget");
+ if (APP2EXT_SD_CARD == app2ext_get_app_location(m_context.pkgname.c_str())) {
+ LogDebug("This widget is in external stroage");
+ return true;
+ }
+ return false;
+}
+
} //namespace WidgetUninstall
} //namespace Jobs