<xs:restriction base="xs:anyURI"/>
</xs:simpleType>
-<xs:simpleType name="applicationIdType">
+<xs:simpleType name="PackageType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9a-zA-Z]{10}"/>
</xs:restriction>
</xs:simpleType>
+<xs:simpleType name="applicationIdType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[0-9a-zA-Z]{10}.[0-9a-zA-Z]{1,}"/>
+ </xs:restriction>
+</xs:simpleType>
+
<xs:simpleType name="screenOrientationType">
<xs:restriction base="xs:token">
<xs:enumeration value="portrait"/>
<xs:element name="application">
<xs:complexType>
<xs:attribute name="id" type="tizen:applicationIdType" use="required"/>
+ <xs:attribute name="package" type="tizen:PackageType" use="required"/>
<xs:attribute name="required_version" type="xs:float" use="required"/>
</xs:complexType>
</xs:element>
LogDebug("attribute");
if (attribute.name == L"id") {
m_id = attribute.value;
+ } else if (attribute.name == L"package") {
+ m_package = attribute.value;
} else if (attribute.name == L"required_version") {
m_version = attribute.value;
NormalizeString(m_version);
"application element must have id attribute");
}
+ if(!!m_package) {
+ m_data.tizenPkgId = m_package;
+ }
+
if(!m_version) {
ThrowMsg(Exception::ParseError,
"application element must have required_version attribute");
}
//TODO check if id and version format is right
- m_data.tizenId = m_id;
+ m_data.tizenAppId = m_id;
m_data.tizenMinVersionRequired = m_version;
}
private:
ConfigParserData& m_data;
DPL::OptionalString m_id;
+ DPL::OptionalString m_package;
DPL::OptionalString m_version;
bool m_properNamespace;
};
const char * const WITH_OSP_XML = "res/wgt/config.xml";
//allowed: a-z, A-Z, 0-9
-const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}$";
+const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}.[a-zA-Z0-9]{1,}$";
+const size_t PACKAGE_ID_LENGTH = 10;
static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
return (0 == filename.compare(fileLen-extLen, extLen, extension));
}
-bool checkTizenIdExist(const std::string& tizenId) {
+bool checkTizenPkgIdExist(const std::string& tizenPkgId) {
std::string installPath =
std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
- "/" + tizenId;
+ "/" + tizenPkgId;
std::string preinstallPath =
std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
- "/" + tizenId;
+ "/" + tizenPkgId;
struct stat dirStat;
if ((stat(installPath.c_str(), &dirStat) == 0) &&
void JobWidgetInstall::setTizenId(
const WrtDB::ConfigParserData &configInfo)
{
+ bool shouldMakeAppid = false;
using namespace PackageManager;
+ if(!!configInfo.tizenAppId) {
+ LogDebug("Setting tizenAppId provided in config.xml: " <<
+ configInfo.tizenAppId);
- if(!!configInfo.tizenId) {
- LogDebug("Setting tizenId provided in config.xml: " << configInfo.tizenId);
- // send start signal of pkgmgr
- getInstallerStruct().pkgmgrInterface->setPkgname(
- DPL::ToUTF8String(*(configInfo.tizenId)));
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
-
- m_installerContext.widgetConfig.pkgName = *configInfo.tizenId;
+ m_installerContext.widgetConfig.tzAppid = *configInfo.tizenAppId;
+ //check package id.
+ if(!!configInfo.tizenPkgId) {
+ LogDebug("Setting tizenPkgId provided in config.xml: " <<
+ configInfo.tizenPkgId);
+ m_installerContext.widgetConfig.tzPkgid = *configInfo.tizenPkgId;
+ } else {
+ std::string appid = DPL::ToUTF8String(*configInfo.tizenAppId);
+ if(appid.length() > PACKAGE_ID_LENGTH) {
+ m_installerContext.widgetConfig.tzPkgid =
+ DPL::FromUTF8String(appid.substr(PACKAGE_ID_LENGTH));
+ } else {
+ m_installerContext.widgetConfig.tzPkgid =
+ *configInfo.tizenAppId;
+ }
+ shouldMakeAppid = true;
+ }
} else {
- WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId();
- LogDebug("Checking if tizen id is unique");
+ shouldMakeAppid = true;
+ TizenPkgId pkgId = WidgetDAOReadOnly::generatePkgId();
+ LogDebug("Checking if pkg id is unique");
while (true) {
- if (checkTizenIdExist(DPL::ToUTF8String(tizenId))) {
+ if (checkTizenPkgIdExist(DPL::ToUTF8String(pkgId))) {
//path exist, chose another one
- tizenId = WidgetDAOReadOnly::generateTizenId();
+ pkgId = WidgetDAOReadOnly::generatePkgId();
continue;
}
break;
}
+ m_installerContext.widgetConfig.tzPkgid = pkgId;
+ LogInfo("tizen_id name was generated by WRT: " <<
+ m_installerContext.widgetConfig.tzPkgid);
+
+ }
+
+ if(shouldMakeAppid == true) {
+ DPL::OptionalString name;
+ DPL::OptionalString defaultLocale = configInfo.defaultlocale;
+
+ FOREACH(localizedData, configInfo.localizedDataSet)
+ {
+ Locale i = localizedData->first;
+ if (!!defaultLocale) {
+ if (defaultLocale == i) {
+ name = localizedData->second.name;
+ break;
+ }
- m_installerContext.widgetConfig.pkgName = tizenId;
- LogInfo("tizen_id name was generated by WRT: " << tizenId);
- // send start signal of pkgmgr
- getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
- m_installerContext.widgetConfig.pkgName));
- getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
+ } else {
+ name = localizedData->second.name;
+ break;
+ }
+ }
+ if (!!name) {
+ LogDebug("Name : " << name);
+ std::ostringstream appid;
+ appid << m_installerContext.widgetConfig.tzPkgid << "." << name;
+ LogDebug("tizen appid was generated by WRT : " << appid.str());
+ m_installerContext.widgetConfig.tzAppid =
+ DPL::FromUTF8String(appid.str());
+ } else {
+ m_installerContext.widgetConfig.tzAppid =
+ m_installerContext.widgetConfig.tzPkgid;
+ }
}
- LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgName);
+ // send start signal of pkgmgr
+ getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
+ m_installerContext.widgetConfig.tzAppid));
+ getInstallerStruct().pkgmgrInterface->sendSignal(
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
+
+ LogInfo("Tizen App Id : " << m_installerContext.widgetConfig.tzAppid);
+ LogInfo("Tizen Pkg Id : " << m_installerContext.widgetConfig.tzPkgid);
LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
}
const std::string& tempPath)
{
m_installerContext.locations =
- WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgName),
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid),
widgetPath, tempPath,
m_installerContext.widgetConfig.packagingType,
m_installerContext.locationType);
{
WidgetUpdateInfo update = detectWidgetUpdate(configData,
m_installerContext.widgetConfig.webAppType,
- m_installerContext.widgetConfig.pkgName);
+ m_installerContext.widgetConfig.tzAppid);
ConfigureResult result = checkWidgetUpdate(update);
// Validate tizenId
}
if ((regexec(®,
- DPL::ToUTF8String(m_installerContext.widgetConfig.pkgName).c_str(),
+ DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).c_str(),
static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
- (checkTizenIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgName)) &&
+ (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid)) &&
result != ConfigureResult::Updated))
{
//it is true when tizenId does not fit REG_TIZENID_PATTERN
LogInfo("Widget info does not exist");
updateTypeCheckBit = WidgetUpdateMode::NotInstalled;
} else {
- LogInfo("Widget info exists. PkgName: " <<
- update.existingWidgetInfo.pkgname);
+ LogInfo("Widget info exists. appid: " <<
+ update.existingWidgetInfo.tzAppid);
- WidgetPkgName pkgname = update.existingWidgetInfo.pkgname;
+ TizenAppId tzAppid = update.existingWidgetInfo.tzAppid;
- LogInfo("Widget model exists. package name: " << pkgname);
+ LogInfo("Widget model exists. tizen app id: " << tzAppid);
// Check running state
int retval = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- retval = app_manager_is_running(DPL::ToUTF8String(pkgname).c_str(), &isRunning);
+ retval = app_manager_is_running(DPL::ToUTF8String(tzAppid).c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != retval) {
LogError("Fail to get running state");
return ConfigureResult::Failed;
}
}
- m_installerContext.widgetConfig.pkgName = pkgname;
+ m_installerContext.widgetConfig.tzAppid = tzAppid;
OptionalWidgetVersion existingVersion;
existingVersion = update.existingWidgetInfo.existingVersion;
OptionalWidgetVersion incomingVersion = update.incomingVersion;
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
const ConfigParserData &configInfo,
const WrtDB::WidgetType appType,
- const WrtDB::WidgetPkgName &tizenId)
+ const WrtDB::TizenAppId &tizenId)
{
LogInfo("Checking up widget package for config.xml...");
widgetGUID,
widgetVersion,
WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getPkgName(), dao.getVersion()));
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
widgetGUID,
widgetVersion,
WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getPkgName(), dao.getVersion()));
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
//inform widget info
JobWidgetInstall::displayWidgetInfo();
- WidgetPkgName& tizenId = m_installerContext.widgetConfig.pkgName;
+ TizenAppId& tizenId = m_installerContext.widgetConfig.tzAppid;
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
LogError("Error in installation step: " << m_exceptionCaught);
LogError("Message: " << m_exceptionMessage);
- WidgetPkgName & tizenId = m_installerContext.widgetConfig.pkgName;
+ TizenAppId & tizenId = m_installerContext.widgetConfig.tzAppid;
LogDebug("Call widget install failure finishedCallback");
void JobWidgetInstall::displayWidgetInfo()
{
- WidgetDAOReadOnly dao(m_installerContext.locations->getPkgname());
+ WidgetDAOReadOnly dao(m_installerContext.widgetConfig.tzAppid);
std::ostringstream out;
WidgetLocalizedInfo localizedInfo =
- W3CFileLocalization::getLocalizedInfo(dao.getPkgName());
+ W3CFileLocalization::getLocalizedInfo(dao.getTzAppId());
out << std::endl <<
"===================================== INSTALLED WIDGET INFO ========="\
"============================";
out << std::endl << "Name: " << localizedInfo.name;
- out << std::endl << "PkgName: " << dao.getPkgName();
+ out << std::endl << "AppId: " << dao.getTzAppId();
WidgetSize size = dao.getPreferredSize();
out << std::endl << "Width: " << size.width;
out << std::endl << "Height: " << size.height;
out << std::endl << "Start File: " <<
- W3CFileLocalization::getStartFile(dao.getPkgName());
+ W3CFileLocalization::getStartFile(dao.getTzAppId());
out << std::endl << "Version: " << dao.getVersion();
out << std::endl << "Licence: " <<
localizedInfo.license;
dao.isDistributorSigned();
out << std::endl << "Widget trusted: " << dao.isTrusted();
- OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getPkgName());
+ OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getTzAppId());
DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null;
out << std::endl << "Icon: " << iconSrc;
static WidgetUpdateInfo detectWidgetUpdate(
const WrtDB::ConfigParserData &configInfo,
const WrtDB::WidgetType appType,
- const WrtDB::WidgetPkgName &tizenId);
+ const WrtDB::TizenAppId &tizenId);
WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
const OptionalWidgetVersion &existingVersion,
const OptionalWidgetVersion &incomingVersion) const;
void TaskAceCheck::StepPrepareForAce()
{
m_context.featureLogic =
- FeatureLogicPtr(new FeatureLogic(m_context.locations->getPkgname()));
+ FeatureLogicPtr(new FeatureLogic(m_context.widgetConfig.tzAppid));
m_context.job->UpdateProgress(
InstallerContext::INSTALL_ACE_PREPARE,
"Widget Access Control Check Prepared");
void TaskAceCheck::StepAceCheck()
{
- WrtDB::WidgetDAO dao(m_context.locations->getPkgname());
+ WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
LogInfo("StepAceCheck!");
// This widget does not use any device cap
if (m_context.featureLogic->isDone()) {
void TaskAceCheck::StepProcessAceResponse()
{
- WrtDB::WidgetDAO dao(m_context.locations->getPkgname());
+ WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
if (m_context.widgetConfig.packagingType ==
WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
return;
for(;it != end; ++it){
LogInfo(" |- Feature: " << it->name << " has reject status: " << it->rejected);
if (it->rejected) {
- WrtDB::WidgetDAO dao(m_context.locations->getPkgname());
+ WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
dao.updateFeatureRejectStatus(*it);
}
}
if ((pkgmgr_installer_save_certinfo(
const_cast<char*>(DPL::ToUTF8String(
- m_context.widgetConfig.pkgName).c_str()),
+ m_context.widgetConfig.tzAppid).c_str()),
m_pkgHandle)) < 0) {
LogError("pkgmgrInstallerSaveCertinfo fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
{
if ((pkgmgr_installer_delete_certinfo(
const_cast<char*>(DPL::ToUTF8String(
- m_context.widgetConfig.pkgName).c_str()))) < 0) {
+ m_context.widgetConfig.tzAppid).c_str()))) < 0) {
LogError("pkgmgr_installer_delete_certinfo fail");
}
}
Try
{
m_handleToRemove = WidgetDAOReadOnly::getHandle(
- m_context.locations->getPkgname());
+ m_context.widgetConfig.tzAppid);
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
ThrowMsg(Exceptions::InvalidPackage, "Given tizenId not found for update installation");
}
WidgetDAO::registerOrUpdateWidget(
- m_context.locations->getPkgname(),
+ m_context.widgetConfig.tzAppid,
m_context.widgetConfig,
m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.locations->getPkgname());
+ m_context.widgetConfig.tzAppid);
}
else //new installation
{
LogInfo("Registering widget...");
WidgetDAO::registerWidget(
- m_context.locations->getPkgname(),
+ m_context.widgetConfig.tzAppid,
m_context.widgetConfig,
m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.locations->getPkgname());
+ m_context.widgetConfig.tzAppid);
}
FOREACH (cap, m_context.staticPermittedDevCaps) {
{
Try
{
- WidgetDAO dao(m_context.locations->getPkgname());
+ WidgetDAO dao(m_context.widgetConfig.tzAppid);
WrtDB::ExternalLocationList externalLocationsDB = dao.getWidgetExternalLocations();
FOREACH(file, externalLocationsDB)
{
std::map<std::string, WrtDB::SettingsType> vconfData;
vconfData[
WrtDB::VconfConfig::GetVconfKeyPopupUsage(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
- m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_OFF;
+ m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_OFF;
// vconftool -g 5000 set -t int <path> initialize value
// Current installer should use vconftool for setting group ID
LogWarning("[DB Update Task] Aborting... (DB Clean)");
Try
{
- WidgetDAO::unregisterWidget(m_context.locations->getPkgname());
+ WidgetDAO::unregisterWidget(m_context.widgetConfig.tzAppid);
LogDebug("Cleaning DB successful!");
}
Catch(DPL::DB::SqlConnection::Exception::Base)
LogDebug("Step Encrypt resource");
m_resEnc = new ResourceEncryptor;
m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context.
- widgetConfig.pkgName));
+ widgetConfig.tzAppid));
EncryptDirectory(m_context.locations->getTemporaryRootDir());
}
{
LogDebug("Step prepare to install in exernal directory");
Try {
- std::string pkgname =
- DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+ std::string appid =
+ DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
- WidgetInstallToExtSingleton::Instance().initialize(pkgname);
+ WidgetInstallToExtSingleton::Instance().initialize(appid);
size_t totalSize =
Utils::getFolderSize(m_context.locations->getTemporaryPackageDir());
const DPL::String& languageTag) const
{
DPL::OStringStream filename;
- WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
+ TizenAppId appid = m_context.widgetConfig.tzAppid;
- filename << DPL::ToUTF8String(pkgname).c_str();
+ filename << DPL::ToUTF8String(appid).c_str();
if (!languageTag.empty()) {
DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc
void TaskManifestFile::updateAilInfo()
{
// Update ail for desktop
- std::string cfgPkgname =
- DPL::ToUTF8String(m_context.widgetConfig.pkgName);
- const char* pkgname = cfgPkgname.c_str();
+ std::string cfgAppid =
+ DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+ const char* appid = cfgAppid.c_str();
- LogDebug("Update ail desktop : " << pkgname );
+ LogDebug("Update ail desktop : " << appid);
ail_appinfo_h ai = NULL;
ail_error_e ret;
- ret = ail_package_get_appinfo(pkgname, &ai);
+ ret = ail_package_get_appinfo(appid, &ai);
if (ai) {
ail_package_destroy_appinfo(ai);
}
if (AIL_ERROR_NO_DATA == ret) {
- if (ail_desktop_add(pkgname) < 0) {
- LogWarning("Failed to add ail desktop : " << pkgname);
+ if (ail_desktop_add(appid) < 0) {
+ LogWarning("Failed to add ail desktop : " << appid);
}
} else if (AIL_ERROR_OK == ret) {
- if (ail_desktop_update(pkgname) < 0) {
- LogWarning("Failed to update ail desktop : " << pkgname);
+ if (ail_desktop_update(appid) < 0) {
+ LogWarning("Failed to update ail desktop : " << appid);
}
}
}
std::list<std::string> fileList;
getFileList(GlobalConfig::GetUserWidgetDesktopIconPath(), fileList);
- std::string pkgname = DPL::ToUTF8String(m_context.widgetConfig.pkgName);
+ std::string appid = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
FOREACH(it, fileList)
{
- if (0 == (strncmp((*it).c_str(), pkgname.c_str(),
- strlen(pkgname.c_str())))) {
+ if (0 == (strncmp((*it).c_str(), appid.c_str(),
+ strlen(appid.c_str())))) {
std::ostringstream icon_file, backup_icon;
icon_file << GlobalConfig::GetUserWidgetDesktopIconPath();
icon_file << "/" << (*it);
void TaskManifestFile::stepGenerateManifest()
{
- WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
- manifest_name = pkgname + L".xml";
+ TizenPkgId pkgid = m_context.widgetConfig.tzPkgid;
+ manifest_name = pkgid + L".xml";
manifest_file += L"/tmp/" + manifest_name;
//libxml - init and check
generateWidgetName(manifest, uiApp, DPL::OptionalString::Null, name, defaultNameSaved);
}
//appid
- WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
- uiApp.setAppid(pkgname);
+ TizenAppId appid = m_context.widgetConfig.tzAppid;
+ uiApp.setAppid(appid);
//extraid
if(!!m_context.widgetConfig.guid) {
uiApp.setExtraid(*m_context.widgetConfig.guid);
} else {
- if(!pkgname.empty()) {
- uiApp.setExtraid(DPL::String(L"http://") + pkgname);
+ if(!appid.empty()) {
+ uiApp.setExtraid(DPL::String(L"http://") + appid);
}
}
void TaskManifestFile::setWidgetManifest(Manifest & manifest)
{
- manifest.setPackage(m_context.widgetConfig.pkgName);
+ manifest.setPackage(m_context.widgetConfig.tzPkgid);
if(!!m_context.widgetConfig.version)
{
LogInfo("setLiveBoxInfo");
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
- DPL::String pkgname = m_context.widgetConfig.pkgName;
+ DPL::String pkgid = m_context.widgetConfig.tzPkgid;
size_t found;
if(ConfigInfo->m_liveboxId != L"") {
found = ConfigInfo->m_liveboxId.find_first_of(L".");
if(found != std::string::npos) {
- if(0 == ConfigInfo->m_liveboxId.compare(0, found, pkgname))
+ if(0 == ConfigInfo->m_liveboxId.compare(0, found, pkgid))
liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
else {
DPL::String liveboxId =
- pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+ pkgid+DPL::String(L".")+ConfigInfo->m_liveboxId;
liveBox.setLiveboxId(liveboxId);
}
} else {
DPL::String liveboxId =
- pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+ pkgid+DPL::String(L".")+ConfigInfo->m_liveboxId;
liveBox.setLiveboxId(liveboxId);
}
}
liveBox.setPrimary(ConfigInfo->m_primary);
if(ConfigInfo->m_autoLaunch == L"true")
- liveBox.setAutoLaunch(pkgname);
+ liveBox.setAutoLaunch(pkgid);
if(ConfigInfo->m_updatePeriod != L"")
liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
devcaps << utf8;
}
}
- WidgetPkgName pkgName = m_context.widgetConfig.pkgName;
+ TizenAppId tzAppid = m_context.widgetConfig.tzAppid;
int result = handle_access_control_conf_forWAC(
- DPL::ToUTF8String(pkgName).c_str(),
+ DPL::ToUTF8String(tzAppid).c_str(),
devcaps.str().c_str(),
OPERATION_INSTALL);
Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
}
}
}
- if (!!configInfo.tizenId) {
- if (pWidgetConfigInfo.pkgName != *configInfo.tizenId) {
- LogError("Invalid archive - Tizen ID not same error");
+ if (!!configInfo.tizenAppId) {
+ if(DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare(
+ DPL::ToUTF8String(*configInfo.tizenAppId)) < 0) {
+ LogError("Invalid archive - Tizen App ID not same error");
+ return false;
+ }
+ }
+ if (!!configInfo.tizenPkgId) {
+ if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) {
+ LogError("Invalid archive - Tizen Pkg ID not same error");
return false;
}
}
}
WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
- const WrtDB::WidgetPkgName & name,
+ const WrtDB::TizenAppId & appid,
const DPL::Optional<WidgetVersion> &version) :
- pkgname(name),
+ tzAppid(appid),
isExist(true),
existingVersion(version)
{
}
WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
- const WrtDB::WidgetPkgName & name,
+ const WrtDB::TizenAppId & appid,
const DPL::Optional<DPL::String> &version) :
- pkgname(name),
+ tzAppid(appid),
isExist(true)
{
if (!!version) {
{
struct ExistingWidgetInfo
{
- WrtDB::WidgetPkgName pkgname;
+ WrtDB::TizenAppId tzAppid;
bool isExist;
DPL::Optional<WidgetVersion> existingVersion;
ExistingWidgetInfo();
- ExistingWidgetInfo(const WrtDB::WidgetPkgName & name,
+ ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
const DPL::Optional<WidgetVersion> &version);
- ExistingWidgetInfo(const WrtDB::WidgetPkgName & name,
+ ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
const DPL::Optional<DPL::String> &version);
};
namespace Jobs {
namespace WidgetUninstall {
-JobWidgetUninstall::JobWidgetUninstall(const std::string & widgetPkgName,
+JobWidgetUninstall::JobWidgetUninstall(const std::string & tizenAppId,
const WidgetUninstallationStruct &uninstallerStruct) :
Job(Uninstallation),
JobContextBase<WidgetUninstallationStruct>(uninstallerStruct)
m_context.removeFinished = false;
m_context.uninstallStep = UninstallerContext::UNINSTALL_START;
m_context.job = this;
- m_context.pkgname = widgetPkgName;
+ m_context.tzAppid = tizenAppId;
m_context.isExternalWidget = getExternalWidgetFlag();
Try
{
- WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(widgetPkgName));
- m_context.locations = WidgetLocation(m_context.pkgname);
+ 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.pkgname);
+ LogInfo("Widget model exists. Pkg name: " << m_context.tzAppid);
AddTask(new TaskSmack(m_context));
AddTask(new TaskCheck(m_context));
AddTask(new TaskDeleteCertificates(m_context));
// send start signal of pkgmgr
- if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.pkgname)) {
+ if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzAppid)) {
getInstallerStruct().pkgmgrInterface->sendSignal(
PKGMGR_START_KEY,
PKGMGR_START_UNINSTALL);
std::string JobWidgetUninstall::getRemovedTizenId() const
{
- return m_context.pkgname;
+ return m_context.tzAppid;
}
bool JobWidgetUninstall::getRemoveStartedFlag() const
{
LogDebug("Get external widget");
- if (APP2EXT_SD_CARD == app2ext_get_app_location(m_context.pkgname.c_str())) {
+ if (APP2EXT_SD_CARD == app2ext_get_app_location(m_context.tzAppid.c_str())) {
LogDebug("This widget is in external stroage");
return true;
}
/**
* @brief Uninstaller must to know which widget to uninstall.
*
- * @param[in] WrtDB::WidgetPkgName widgetPkgName - widget to uninstall
+ * @param[in] WrtDB::TizenAppId tzAppId - widget to uninstall
*/
- JobWidgetUninstall(const std::string &widgetPkgName,
+ JobWidgetUninstall(const std::string &tizenAppId,
const WidgetUninstallationStruct& uninstallerStruct);
std::string getRemovedTizenId() const;
void TaskCheck::StepUninstallPreCheck()
{
- LogInfo("Uninstall check for pkgname: " << m_context.locations->getPkgname());
+ LogInfo("Uninstall check for appid: " << m_context.tzAppid);
//check if deferred
//TODO if widget to be updated, then remove it from Deferred list?
int ret = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- ret = app_manager_is_running(m_context.pkgname.c_str(), &isRunning);
+ ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != ret) {
LogError("Fail to get running state");
ThrowMsg(Exceptions::PlatformAPIFailure,
//TODO or defer uninstall?
}
- LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.locations->getPkgname());
+ LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzAppid);
m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_PRECHECK,
"Uninstall pre-checking Finished");
}
{
//TODO: widget handle should not be used any more
ace_unregister_widget(static_cast<ace_widget_handle_t>(
- WidgetDAOReadOnly::getHandle(m_context.locations->getPkgname())));
- WidgetDAO::unregisterWidget(m_context.locations->getPkgname());
+ WidgetDAOReadOnly::getHandle(DPL::FromUTF8String(m_context.tzAppid))));
+ WidgetDAO::unregisterWidget(DPL::FromUTF8String(m_context.tzAppid));
LogDebug("Unregistered widget successfully!");
}
if ((pkgmgr_installer_delete_certinfo(
const_cast<char*>((
- m_context.pkgname).c_str()))) < 0) {
+ m_context.tzAppid).c_str()))) < 0) {
LogError("pkgmgr_installer_delete_certinfo fail");
}
}
void TaskRemoveCustomHandlers::Step()
{
LogDebug("Removing widget from appsvc");
- int result = appsvc_unset_defapp(m_context.pkgname.c_str());
+ int result = appsvc_unset_defapp(m_context.tzAppid.c_str());
LogDebug("Result: " << result);
CustomHandlerDB::Interface::attachDatabaseRW();
CustomHandlerDB::CustomHandlerDAO handlersDao(
- DPL::FromASCIIString(m_context.pkgname));
+ DPL::FromASCIIString(m_context.tzAppid));
handlersDao.removeWidgetProtocolHandlers();
handlersDao.removeWidgetContentHandlers();
CustomHandlerDB::Interface::detachDatabase();
std::ostringstream desktopFile;
desktopFile << GlobalConfig::GetUserWidgetDesktopPath() << "/";
- desktopFile << m_context.pkgname << ".desktop";
+ desktopFile << m_context.tzAppid << ".desktop";
unlink(desktopFile.str().c_str());
ail_appinfo_h ai = NULL;
ail_error_e ret;
- const char* package = m_context.pkgname.c_str();
+ const char* package = m_context.tzAppid.c_str();
LogDebug("ail delete : " << package);
ret = ail_package_get_appinfo(package, &ai);
void TaskRemoveFiles::StepRemoveManifest()
{
std::ostringstream manifest_name;
- manifest_name << m_context.pkgname << ".xml";
+ manifest_name << m_context.tzPkgid<< ".xml";
std::ostringstream destFile;
destFile << "/opt/share/packages" << "/"; //TODO constant with path
destFile << manifest_name.str();
void TaskRemoveFiles::StepRemoveExternalLocations()
{
- WidgetDAO dao(m_context.locations->getPkgname());
+ WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
LogDebug("Removing external locations:");
WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
FOREACH(path, externalPaths)
void TaskRemoveFiles::StepRemoveVconf()
{
std::string key =
- WrtDB::VconfConfig::GetVconfKeyRootPath(
- m_context.locations->getPkgname());
+ WrtDB::VconfConfig::GetVconfKeyRootPath(DPL::FromUTF8String(m_context.tzAppid));
if(vconf_unset_recursive(key.c_str())) {
LogError("Fail to unset vconf file");
} else {
void TaskRemoveFiles::StepRemoveExternalWidget()
{
Try {
- WidgetInstallToExtSingleton::Instance().initialize(m_context.pkgname);
+ WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid);
WidgetInstallToExtSingleton::Instance().uninstallation();
WidgetInstallToExtSingleton::Instance().deinitialize();
}
LogInfo("------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
#ifdef WRT_SMACK_ENABLED
try {
- WrtDB::WidgetDAOReadOnly dao(m_context.locations->getPkgname());
- WidgetPkgName pkgName = dao.getPkgName();
+ WrtDB::WidgetDAOReadOnly dao(m_context.widgetConfig.tzAppid);
+ TizenAppId tzAppid = dao.getTizenAppId();
const char *devCap = "";
int result = handle_access_control_conf_forWAC(
- DPL::ToUTF8String(pkgName).c_str(),
+ DPL::ToUTF8String(tzAppid).c_str(),
NULL,
OPERATION_UNINSTALL);
Assert(result==PC_OPERATION_SUCCESS && "access control setup failed");
LogInfo("Step : Uninstall Osp service ");
std::ostringstream commStr;
- commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.pkgname);
+ commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.tzPkgid);
LogDebug("osp uninstall command : " << commStr.str());
char readBuf[MAX_BUF_SIZE];
pclose(fd);
- LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.pkgname);
+ LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid);
m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_REMOVE_OSPSVC,
"Uninstall OSP service finished");
}
UninstallStep uninstallStep; ///< current step of installation
Jobs::WidgetUninstall::JobWidgetUninstall *job;
- std::string pkgname;
+ std::string tzAppid;
+ std::string tzPkgid;
bool isExternalWidget;
};
namespace Jobs {
namespace WidgetInstall {
-FeatureLogic::FeatureLogic(const WrtDB::WidgetPkgName & pkgname)
+FeatureLogic::FeatureLogic(const WrtDB::TizenAppId & tzAppid)
: m_rejected(false)
{
- WrtDB::WidgetDAOReadOnly widgetDao(pkgname);
+ WrtDB::WidgetDAOReadOnly widgetDao(tzAppid);
WidgetFeatureSet featureSet = widgetDao.getFeaturesList();
FOREACH(it, featureSet) {
LogInfo("Feature name : " << it->name);
class FeatureLogic : DPL::Noncopyable {
public:
- FeatureLogic(const WrtDB::WidgetPkgName & pkgname);
+ FeatureLogic(const WrtDB::TizenAppId & tzAppid);
bool isDone() const;
}
WidgetLocation::WidgetLocation(const std::string & widgetname) :
- m_pkgname(widgetname)
+ m_pkgid(widgetname)
{
}
std::string sourcePath,
WrtDB::PackagingType t,
InstallLocationType locationType):
- m_pkgname(widgetname),
+ m_pkgid(widgetname),
m_widgetSource(sourcePath),
m_type(t),
m_temp(new WidgetLocation::DirectoryDeletor())
std::string dirPath,
WrtDB::PackagingType t,
InstallLocationType locationType):
- m_pkgname(widgetname),
+ m_pkgid(widgetname),
m_widgetSource(sourcePath),
m_type(t),
m_temp(new
std::string WidgetLocation::getPackageInstallationDir() const
{
- return m_installedPath + "/" + m_pkgname;
+ return m_installedPath + "/" + m_pkgid;
}
std::string WidgetLocation::getSourceDir() const
{
return m_installedPath + "/"
- + m_pkgname + WrtDB::GlobalConfig::GetWidgetSrcPath();
+ + m_pkgid + WrtDB::GlobalConfig::GetWidgetSrcPath();
}
std::string WidgetLocation::getBinaryDir() const
{
return m_installedPath + "/"
- + m_pkgname + WrtDB::GlobalConfig::GetUserWidgetExecPath();
+ + m_pkgid + WrtDB::GlobalConfig::GetUserWidgetExecPath();
}
std::string WidgetLocation::getExecFile() const
{
- return getBinaryDir() + "/" + m_pkgname;
+ return getBinaryDir() + "/" + m_pkgid;
}
std::string WidgetLocation::getBackupDir() const
std::string WidgetLocation::getBackupExecFile() const
{
- return getBackupBinaryDir() + "/" + m_pkgname;
+ return getBackupBinaryDir() + "/" + m_pkgid;
}
std::string WidgetLocation::getUserDataRootDir() const
{
return std::string(WrtDB::GlobalConfig::GetWidgetUserDataPath()) +
- "/" + m_pkgname;
+ "/" + m_pkgid;
}
std::string WidgetLocation::getPrivateStorageDir() const
std::string WidgetLocation::getShareDir() const
{
return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/"
- + m_pkgname + "/" + WrtDB::GlobalConfig::GetWidgetSharePath();
+ + m_pkgid + "/" + WrtDB::GlobalConfig::GetWidgetSharePath();
}
std::string WidgetLocation::getTemporaryPackageDir() const
}
}
-DPL::String WidgetLocation::getPkgname() const
+DPL::String WidgetLocation::getPkgId() const
{
- return DPL::FromUTF8String(m_pkgname);
+ return DPL::FromUTF8String(m_pkgid);
}
std::string WidgetLocation::getInstalledIconPath() const
*/
std::string getWidgetSource() const;
/**
- * @brief pkgname Returns pkgname
- * @return pkgname
+ * @brief pkgid Returns pkgid
+ * @return pkgid
*/
- DPL::String getPkgname() const;
+ DPL::String getPkgId() const;
//external files
/**
private:
std::string m_widgetSource; // Source widget zip file/widget url
- std::string m_pkgname; //name of package
+ std::string m_pkgid; //id of package
std::string m_iconPath; //installed icon path
WrtDB::PackagingType m_type;
std::shared_ptr<DirectoryDeletor> m_temp; //directory
WrtDB::WrtDatabase::attachToThreadRO();
- WidgetPkgNameList pkgnameslList = WidgetDAOReadOnly::getPkgnameList();
+ TizenAppIdList tizenAppidList = WidgetDAOReadOnly::getTizenAppidList();
*count = 0;
- FOREACH(iterator, pkgnameslList) {
+ FOREACH(iterator, tizenAppidList) {
package_manager_pkg_info_t *pkg_info =
static_cast<package_manager_pkg_info_t*>
(malloc(sizeof(package_manager_pkg_info_t)));
pkg_last->next = pkg_info;
}
- WidgetPkgName pkgname = *iterator;
- WidgetDAOReadOnly widget(pkgname);
+ TizenAppId tzAppid = *iterator;
+ WidgetDAOReadOnly widget(tzAppid);
strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s",
- DPL::ToUTF8String(pkgname).c_str());
+ DPL::ToUTF8String(tzAppid).c_str());
DPL::Optional<DPL::String> version = widget.getVersion();
if (!version.IsNull()) {
void WrtInstaller::uninstallGuidStep()
{
LogDebug("Uninstalling widget ...");
- std::string pkgname;
- WrtErrStatus status = wrt_get_widget_by_guid(pkgname, m_name);
+ std::string appid;
+ WrtErrStatus status = wrt_get_widget_by_guid(appid, m_name);
if (status == WRT_SUCCESS) {
LogDebug("Guid : " << m_name);
- wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
+ wrt_uninstall_widget(appid.c_str(), this, &staticWrtStatusCallback,
!m_quiet ? &staticWrtUninstallProgressCallback : NULL,
pkgmgrSignalInterface);
} else {
std::string guid = DPL::ToUTF8String(*widgetGUID);
- std::string pkgname;
- WrtErrStatus status = wrt_get_widget_by_guid(pkgname, guid);
+ std::string appid;
+ WrtErrStatus status = wrt_get_widget_by_guid(appid, guid);
if (status == WRT_SUCCESS) {
- LogDebug("Pkgname from packagePath : " << pkgname);
- wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
+ LogDebug("Appid from packagePath : " << appid);
+ wrt_uninstall_widget(appid.c_str(), this, &staticWrtStatusCallback,
!m_quiet ? &staticWrtUninstallProgressCallback : NULL,
pkgmgrSignalInterface);
} else {
UNHANDLED_EXCEPTION_HANDLER_END
}
- EXPORT_API void wrt_uninstall_widget(const char * const pkg_name,
+ EXPORT_API void wrt_uninstall_widget(const char * const tzAppid,
void* userdata,
WrtInstallerStatusCallback status_cb,
WrtProgressCallback progress_cb,
{
UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
- std::string widgetPkgName(pkg_name);
- LogInfo("[WRT-API] UNINSTALL WIDGET: " << widgetPkgName);
+ std::string tizenAppid(tzAppid);
+ LogInfo("[WRT-API] UNINSTALL WIDGET: " << tizenAppid);
// Post uninstallation event
CONTROLLER_POST_EVENT(
Logic::InstallerController,
InstallerControllerEvents::UninstallWidgetEvent(
- widgetPkgName,
+ tizenAppid,
WidgetUninstallationStruct(
InstallerCallbacksTranslate::uninstallFinishedCallback,
InstallerCallbacksTranslate::installProgressCallback,
}
}
- EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & pkgname,
+ EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
const std::string guid)
{
try
WidgetGUID widget_guid = DPL::FromUTF8String(guid);
WrtDB::WidgetDAOReadOnly dao(widget_guid);
- pkgname = DPL::ToUTF8String(dao.getPkgName());
+ tzAppid = DPL::ToUTF8String(dao.getTzAppId());
return WRT_SUCCESS;
}
catch (WidgetDAOReadOnly::Exception::WidgetNotExist)
);
/**
- * @fn void wrt_installer_uninstall_widget (const char * const pkg_name,
+ * @fn void wrt_installer_uninstall_widget (const char * const tizenAppid,
* void* userdata,
* WrtInstallerStatusCallback cb)
* @brief Uninstalls widget using its name
*
- * This method is used to uninstall the widget specified by its pkgname.
+ * This method is used to uninstall the widget specified by its appid.
* The callback function is called when the uninstall operation is done.
*
- * @param [in] pkg_name - package name
+ * @param [in] tzAppid - tizen appid
* @param [in] userdata - user parameters to be passed to the callback
* @param [in] status_cb - Call to this one will be done at the end of
* operation
*
* @see wrt_installer_install_widget
*/
-void wrt_uninstall_widget (const char * const pkg_name,
+void wrt_uninstall_widget (const char * const tzAppid,
void* userdata,
WrtInstallerStatusCallback status_cb,
WrtProgressCallback progress_cb,
void wrt_installer_shutdown_for_tests();
/**
- * @brief wrt_get_widget_by_guid Returns pkgname by pkg guid (widgetId)
- * @param pkgname pkgname argument ot be set
+ * @brief wrt_get_widget_by_guid Returns tizenAppid by pkg guid (widgetId)
+ * @param tzAppid tizen appid argument ot be set
* @param guid guid that we look for
* @return error code
*/
-WrtErrStatus wrt_get_widget_by_guid(std::string &pkgname, const std::string guid);
+WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid, const std::string guid);
#ifdef __cplusplus
}
#endif