From 87748df8165f95cde1f0cac82230899e9b45706d Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 28 Jan 2016 14:11:05 +0100 Subject: [PATCH] Implement PKGMGR_REQUEST_TYPE_CLEARDATA for tpk-backend Verify by running: pkgcmd -t tpk -c -n $pkgid_of_installed_package and check if all content of apps_rw/$pkgid/data/ was removed. Requires: - https://review.tizen.org/gerrit/58245 Change-Id: Ia68cf1269f46b4a5306eed43ecc7f8673aa00f7e --- src/tpk/step/step_tpk_patch_icons.cc | 6 +++++- src/tpk/tpk_installer.cc | 9 +++++++++ src/tpk/tpk_installer.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tpk/step/step_tpk_patch_icons.cc b/src/tpk/step/step_tpk_patch_icons.cc index e28dfc3..b62d462 100644 --- a/src/tpk/step/step_tpk_patch_icons.cc +++ b/src/tpk/step/step_tpk_patch_icons.cc @@ -41,6 +41,10 @@ bf::path LocateIcon(const bf::path& filename, const std::string& pkgid, return {}; } +bool IsTpkApp(application_x* app) { + return strcmp(app->type, "capp") == 0 || strcmp(app->type, "jsapp") == 0; +} + } // namespace namespace tpk { @@ -84,7 +88,7 @@ common_installer::Step::Status StepTpkPatchIcons::process() { bf::create_directories(common_icon_location, error); for (application_x* app : GListRange(context_->manifest_data.get()->application)) { - if (strcmp(app->type, "capp") != 0 && strcmp(app->type, "jsapp") != 0) + if (!IsTpkApp(app)) continue; if (app->icon) { icon_x* icon = reinterpret_cast(app->icon->data); diff --git a/src/tpk/tpk_installer.cc b/src/tpk/tpk_installer.cc index 34fdd0c..aaac56c 100644 --- a/src/tpk/tpk_installer.cc +++ b/src/tpk/tpk_installer.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -90,6 +91,9 @@ void TpkInstaller::Prepare() { case ci::RequestType::ManifestDirectUpdate: ManifestDirectUpdateSteps(); break; + case ci::RequestType::Clear: + ClearSteps(); + break; default: AddStep(); break; @@ -243,4 +247,9 @@ void TpkInstaller::ManifestDirectUpdateSteps() { AddStep(); } +void TpkInstaller::ClearSteps() { + AddStep(pkgmgr_); + AddStep(); +} + } // namespace tpk diff --git a/src/tpk/tpk_installer.h b/src/tpk/tpk_installer.h index 1b5d8fe..8037f81 100644 --- a/src/tpk/tpk_installer.h +++ b/src/tpk/tpk_installer.h @@ -32,6 +32,7 @@ class TpkInstaller : public common_installer::AppInstaller { void RecoverySteps(); void ManifestDirectInstallSteps(); void ManifestDirectUpdateSteps(); + void ClearSteps(); SCOPE_LOG_TAG(TpkInstaller) }; -- 2.7.4