return;
}
- int request_id = 0;
- int ret = package_manager_request_uninstall(request_, id.c_str(), &request_id);
+ package_info_h pkg_info;
+ int ret = package_manager_get_package_info(id.c_str(), &pkg_info);
if ( ret != PACKAGE_MANAGER_ERROR_NONE ) {
- if ( ret == PACKAGE_MANAGER_ERROR_INVALID_PARAMETER ) {
- LoggerE("The package is not found at the specified location");
- InvokeErrorCallbackAsync(callback_id,
- NotFoundException(
- "The package is not found at the specified location"));
+ if ( ret == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE ) {
+ LoggerE("The package is not found at the specified location");
+ InvokeErrorCallbackAsync(callback_id,
+ NotFoundException(
+ "The package is not found at the specified location"));
} else {
- LoggerE("Failed to uninstall package: %d (%s)", ret, get_error_message(ret));
- InvokeErrorCallbackAsync(callback_id, UnknownException(
- "It is not allowed to install the package by the platform or " \
- "any other platform error occurs"));
+ LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
+ InvokeErrorCallbackAsync(callback_id, UnknownException(
+ "It is not allowed to get package information by the platform or " \
+ "any other platform error occurs"));
}
} else {
- RegisterCallback(request_id, callback_id);
+ int request_id = 0;
+ int ret = package_manager_request_uninstall(request_, id.c_str(), &request_id);
+ if ( ret != PACKAGE_MANAGER_ERROR_NONE ) {
+ LoggerE("Failed to uninstall package: %d (%s)", ret, get_error_message(ret));
+ InvokeErrorCallbackAsync(callback_id, UnknownException(
+ "It is not allowed to install the package by the platform or " \
+ "any other platform error occurs"));
+ } else {
+ RegisterCallback(request_id, callback_id);
+ }
}
ReportSuccess(out);