ret = mClientManager.find_client_pid_by_appid(std::string{appid});
}
- if (-1 != ret && !mApplicationManager.is_application_running(ret)) {
+ if (-1 != ret && !mApplicationManager.is_application_running(appid)) {
MAS_LOGE("The PID for %s was %d, but it seems to be terminated", appid, ret);
on_deinitialize(ret);
ret = -1;
pkgmgrinfo_pkginfo_h handle = NULL;
static bool in_progress = false;
bool should_exit = false;
+ bool pkginfo_found = true;
if (!package || !type)
return;
return;
if (PACKAGE_MANAGER_EVENT_STATE_STARTED != event_state &&
- PACKAGE_MANAGER_EVENT_STATE_COMPLETED != event_state)
+ PACKAGE_MANAGER_EVENT_STATE_COMPLETED != event_state &&
+ PACKAGE_MANAGER_EVENT_STATE_FAILED != event_state)
return;
bool user = false;
user = true;
ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(package, uid, &handle);
if (ret != PMINFO_R_OK || NULL == handle) {
- MAS_LOGW("Failed to call pkgmgrinfo_pkginfo_get_pkginfo & get_usr_pkginfo(\"%s\",~) returned %d, uid : %d", package, ret, getuid());
- return;
+ MAS_LOGW("Failed to call pkgmgrinfo_pkginfo_get_pkginfo & get_usr_pkginfo(\"%s\",~) returned %d, uid : %d", package, ret, getuid ());
+ pkginfo_found = false;
}
}
- if (user) {
- /* Try to get in user packages */
- pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, pkg_app_list_cb, (void *)&ret, uid);
- } else {
- /* Try to get in global packages */
- pkgmgrinfo_appinfo_get_list(handle, PMINFO_ALL_APP, pkg_app_list_cb, (void *)&ret);
+ if (pkginfo_found) {
+ if (user) {
+ /* Try to get in user packages */
+ pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, pkg_app_list_cb, (void *)&ret, uid);
+ } else {
+ /* Try to get in global packages */
+ pkgmgrinfo_appinfo_get_list(handle, PMINFO_ALL_APP, pkg_app_list_cb, (void *)&ret);
+ }
+ } else {
+ /* Even if we failed acquiring the pkginfo, proceed if we're uninstalling
+ since at the time of uninstall completion, pkginfo would not exist */
+ if (in_progress) {
+ if (PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL == event_type &&
+ (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state ||
+ PACKAGE_MANAGER_EVENT_STATE_FAILED == event_state)) {
+ ret = 1;
+ }
+ }
}
if (1 == ret) {
if (PACKAGE_MANAGER_EVENT_STATE_STARTED == event_state) {
MAS_LOGE("service_main is NULL");
}
}
- } else if (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state) {
- MAS_LOGI("processing PACKAGE_MANAGER_EVENT_STATE_COMPLETED event : %d", event_type);
+ } else if (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state ||
+ PACKAGE_MANAGER_EVENT_STATE_FAILED == event_state) {
+ MAS_LOGI("processing PACKAGE_MANAGER_EVENT_STATE_COMPLETED/FAILED event : %d %d",
+ event_state, event_type);
if (false == in_progress) {
if (service_main) {
service_main->deinitialize_service_plugin();
}
}
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ if (handle) pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
if (should_exit) {
LOGI("Now restarting multi-assistant-service for reloading updated modules");
bool CServiceMain::app_create(void *data)
{
// Todo: add your code here.
- MAS_LOGI("[Enter] Service app create");
+ MAS_LOGI("[ENTER] Service app create");
g_service_main = this;
}
}
- MAS_LOGI("[END]");
+ MAS_LOGI("[END] Service app create");
return true;
}