mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 15:20:34 +00:00
Fix bug
Signed-off-by: njupthan <hanhaibin@huawei.com>
This commit is contained in:
parent
02ce23ffb9
commit
047c4d6bce
@ -2583,10 +2583,19 @@ int AbilityManagerService::GenerateAbilityRequest(
|
||||
AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_METADATA);
|
||||
HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId);
|
||||
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryAbilityInfo(want, abilityInfoFlag, userId, request.abilityInfo));
|
||||
if (request.abilityInfo.name.empty() || request.abilityInfo.bundleName.empty()) {
|
||||
HILOG_WARN("%{public}s, QueryAbilityInfo again, userId is 0", __func__);
|
||||
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryAbilityInfo(want, abilityInfoFlag, U0_USER_ID, request.abilityInfo));
|
||||
}
|
||||
if (request.abilityInfo.name.empty() || request.abilityInfo.bundleName.empty()) {
|
||||
// try to find extension
|
||||
std::vector<AppExecFwk::ExtensionAbilityInfo> extensionInfos;
|
||||
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryExtensionAbilityInfos(want, abilityInfoFlag, userId, extensionInfos));
|
||||
if (extensionInfos.size() <= 0) {
|
||||
HILOG_WARN("%{public}s, QueryExtensionAbilityInfos again, userId is 0", __func__);
|
||||
IN_PROCESS_CALL_WITHOUT_RET(bms->QueryExtensionAbilityInfos(want, abilityInfoFlag,
|
||||
U0_USER_ID, extensionInfos));
|
||||
}
|
||||
if (extensionInfos.size() <= 0) {
|
||||
HILOG_ERROR("Get extension info failed.");
|
||||
return RESOLVE_ABILITY_ERR;
|
||||
@ -3263,8 +3272,8 @@ void AbilityManagerService::RestartAbility(const sptr<IRemoteObject> &token)
|
||||
}
|
||||
|
||||
auto abilityRecord = Token::GetAbilityRecordByToken(token);
|
||||
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
|
||||
CHECK_POINTER(abilityRecord);
|
||||
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
|
||||
|
||||
auto stackManager = GetStackManagerByUserId(userId);
|
||||
if (!stackManager) {
|
||||
@ -4710,6 +4719,11 @@ int AbilityManagerService::VerifyAccountPermission(int32_t userId)
|
||||
int AbilityManagerService::BlockAmsService()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
||||
if (callerUid != AbilityUtil::ROOT_UID) {
|
||||
HILOG_ERROR("calling uid has no permission to force timeout.");
|
||||
return INVALID_DATA;
|
||||
}
|
||||
if (handler_) {
|
||||
HILOG_DEBUG("%{public}s begain post block ams service task", __func__);
|
||||
auto BlockAmsServiceTask = [aams = shared_from_this()]() {
|
||||
@ -4727,12 +4741,22 @@ int AbilityManagerService::BlockAmsService()
|
||||
int AbilityManagerService::BlockAbility(int32_t abilityRecordId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
||||
if (callerUid != AbilityUtil::ROOT_UID) {
|
||||
HILOG_ERROR("calling uid has no permission to force timeout.");
|
||||
return INVALID_DATA;
|
||||
}
|
||||
return currentMissionListManager_->BlockAbility(abilityRecordId);
|
||||
}
|
||||
|
||||
int AbilityManagerService::BlockAppService()
|
||||
{
|
||||
HILOG_DEBUG("%{public}s", __func__);
|
||||
int32_t callerUid = IPCSkeleton::GetCallingUid();
|
||||
if (callerUid != AbilityUtil::ROOT_UID) {
|
||||
HILOG_ERROR("calling uid has no permission to force timeout.");
|
||||
return INVALID_DATA;
|
||||
}
|
||||
return DelayedSingleton<AppScheduler>::GetInstance()->BlockAppService();
|
||||
}
|
||||
} // namespace AAFwk
|
||||
|
@ -181,7 +181,7 @@ int AbilityManagerStub::TerminateAbilityInner(MessageParcel &data, MessageParcel
|
||||
{
|
||||
sptr<IRemoteObject> token = data.ReadParcelable<IRemoteObject>();
|
||||
int resultCode = data.ReadInt32();
|
||||
Want *resultWant = data.ReadParcelable<Want>();
|
||||
Want *resultWant = data.ReadParcelable<Want>();
|
||||
bool flag = data.ReadBool();
|
||||
int32_t result;
|
||||
if (flag) {
|
||||
|
@ -886,6 +886,11 @@ ErrCode AbilityManagerShellCommand::RunAsDumpCommand()
|
||||
ErrCode AbilityManagerShellCommand::RunAsForceStop()
|
||||
{
|
||||
HILOG_INFO("[%{public}s(%{public}s)] enter", __FILE__, __FUNCTION__);
|
||||
if (argList_.empty()) {
|
||||
resultReceiver_.append(HELP_MSG_FORCE_STOP + "\n");
|
||||
return OHOS::ERR_INVALID_VALUE;
|
||||
}
|
||||
HILOG_INFO("Bundle name : %{public}s", argList_[0].c_str());
|
||||
ErrCode result = OHOS::ERR_OK;
|
||||
result = AbilityManagerClient::GetInstance()->KillProcess(argList_[0]);
|
||||
if (result == OHOS::ERR_OK) {
|
||||
@ -1416,7 +1421,11 @@ ErrCode AbilityManagerShellCommand::RunAsBlockAbilityCommand()
|
||||
{
|
||||
HILOG_INFO("[%{public}s(%{public}s)] enter", __FILE__, __FUNCTION__);
|
||||
ErrCode result = OHOS::ERR_OK;
|
||||
result = AbilityManagerClient::GetInstance()->BlockAbility(atoi(argList_[0].c_str()));
|
||||
if (argList_.size() > 0) {
|
||||
result = AbilityManagerClient::GetInstance()->BlockAbility(atoi(argList_[0].c_str()));
|
||||
} else {
|
||||
result = OHOS::ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (result == OHOS::ERR_OK) {
|
||||
HILOG_INFO("%{public}s", STRING_BLOCK_ABILITY_OK.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user