IssueNo:#I5Z8AZ

Description:the dependency of libinputmethod_service.z.so to libabilityms.z.so didn't approprite.
Sig:SIG_ApplicationFramework
Feature or BugFix: Feature
Binary Source: No

Signed-off-by: zhangyafei.echo <zhangyafei12@huawei.com>
Change-Id: Ia5e07171afa03675ba3d80aab0005c7fc70fe02d
This commit is contained in:
zhangyafei.echo 2022-11-03 21:20:52 +08:00
parent 8b94a63ec8
commit 7e725e52e7
3 changed files with 21 additions and 11 deletions

View File

@ -57,7 +57,6 @@ ohos_shared_library("inputmethod_service") {
deps = [
"${ability_runtime_inner_api_path}/ability_manager:ability_manager",
"${ability_runtime_services_path}/abilitymgr:abilityms",
"${inputmethod_path}/services/adapter/keyboard:keboard_event_static",
"${inputmethod_path}/services/dfx:inputmethod_dfx_static",
"//base/global/resource_management/frameworks/resmgr:global_resmgr",

View File

@ -35,7 +35,6 @@
#include "os_account_manager.h"
#include "para_handle.h"
#include "resource_manager.h"
#include "sa_mgr_client.h"
#include "system_ability.h"
#include "system_ability_definition.h"
#include "ui_service_mgr_client.h"
@ -1374,12 +1373,18 @@ namespace MiscServices {
sptr<AAFwk::IAbilityManager> InputMethodSystemAbility::GetAbilityManagerService()
{
IMSA_HILOGE("InputMethodSystemAbility::GetAbilityManagerService start");
sptr<IRemoteObject> abilityMsObj =
OHOS::DelayedSingleton<AAFwk::SaMgrClient>::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (!abilityMsObj) {
IMSA_HILOGE("failed to get ability manager service");
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
IMSA_HILOGE("SystemAbilityManager is nullptr.");
return nullptr;
}
auto abilityMsObj = systemAbilityManager->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (abilityMsObj == nullptr) {
IMSA_HILOGE("Failed to get ability manager service.");
return nullptr;
}
return iface_cast<AAFwk::IAbilityManager>(abilityMsObj);
}

View File

@ -31,7 +31,7 @@
#include "para_handle.h"
#include "parcel.h"
#include "platform.h"
#include "sa_mgr_client.h"
#include "iservice_registry.h"
#include "system_ability_definition.h"
#include "unistd.h"
#include "utils.h"
@ -1030,12 +1030,18 @@ namespace MiscServices {
sptr<AAFwk::IAbilityManager> PerUserSession::GetAbilityManagerService()
{
IMSA_HILOGE("GetAbilityManagerService start");
sptr<IRemoteObject> abilityMsObj =
OHOS::DelayedSingleton<AAFwk::SaMgrClient>::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (!abilityMsObj) {
IMSA_HILOGE("failed to get ability manager service");
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
IMSA_HILOGE("SystemAbilityManager is nullptr.");
return nullptr;
}
auto abilityMsObj = systemAbilityManager->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (abilityMsObj == nullptr) {
IMSA_HILOGE("Failed to get ability manager service.");
return nullptr;
}
return iface_cast<AAFwk::IAbilityManager>(abilityMsObj);
}