/* cache external */
ret = __get_sdcard_path(&sdpath);
- if (ret != 0 || sdpath == NULL)
- LOGE("Failed to get external storage path");
+ if (ret != 0 || sdpath == NULL) {
+ LOGW("Unable to retrieve external storage path");
+ tzplatform_reset_user();
+ return 0;
+ }
snprintf(dirname, sizeof(dirname), "%s/%s%s%s",
sdpath, "apps",
const char *rootpath;
pkgmgrinfo_pkginfo_h pkg_handle = NULL;
char *pkg_type = NULL;
+ char *sdpath = NULL;
if (pkgid == NULL) {
LOGE("pkgid is NULL\n");
tzplatform_set_user(uid);
rootpath = tzplatform_getenv(TZ_USER_APP);
- tzplatform_reset_user();
__send_signal(pkgid, pkg_type,
PKGMGR_INSTALLER_START_KEY_STR,
goto catch;
}
+ /* external data */
+ ret = __get_sdcard_path(&sdpath);
+ if (ret != 0 || sdpath == NULL) {
+ LOGW("Unable to retrieve external storage path");
+ __send_signal(pkgid, pkg_type, PKGMGR_INSTALLER_END_KEY_STR,
+ PKGMGR_INSTALLER_OK_EVENT_STR);
+ ret = 0;
+ goto catch;
+ }
+
+ snprintf(dirname, sizeof(dirname), "%s/%s%s/data",
+ sdpath, "apps",
+ tzplatform_mkpath3(TZ_USER_NAME, "apps_rw", pkgid));
+ ret = __clear_dir(dirname);
+ if (ret < 0)
+ LOGE("Failed to clear external data dir.");
+
+ /* external shared/data */
+ snprintf(dirname, sizeof(dirname), "%s/%s%s/shared/data",
+ sdpath, "apps",
+ tzplatform_mkpath3(TZ_USER_NAME, "apps_rw", pkgid));
+ ret = __clear_dir(dirname);
+ if (ret < 0)
+ LOGE("Failed to clear external shared data dir.");
+
+ /* external shared/trusted */
+ snprintf(dirname, sizeof(dirname), "%s/%s%s/shared/trusted",
+ sdpath, "apps",
+ tzplatform_mkpath3(TZ_USER_NAME, "apps_rw", pkgid));
+ ret = __clear_dir(dirname);
+ if (ret < 0)
+ LOGE("Failed to clear external shared trusted dir.");
+
__send_signal(pkgid, pkg_type, PKGMGR_INSTALLER_END_KEY_STR,
PKGMGR_INSTALLER_OK_EVENT_STR);
catch:
+ tzplatform_reset_user();
+ if (sdpath)
+ free(sdpath);
if (pkg_handle)
pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_handle);
return ret;
printf("-d, --data clear pkg's data\n");
printf("-h, --help print this help\n");
printf("-n, --pkgid package id\n");
+ printf("-u, --uid user id\n");
printf("\n");
printf("Usage: pkg_cleardata [options]\n");
- printf("pkg_cleardata -c -n <pkgid> \n");
- printf("pkg_cleardata -d -n <pkgid> \n");
- printf("pkg_cleardata -cd -n <pkgid> \n");
+ printf("pkg_cleardata -c -n <pkgid> -u <uid>\n");
+ printf("pkg_cleardata -d -n <pkgid> -u <uid>\n");
+ printf("pkg_cleardata -cd -n <pkgid> -u <uid>\n");
printf("\n");
}