!8380 增加Attach调试 PC通信权限校验相关逻辑

Merge pull request !8380 from xinking129/master
This commit is contained in:
openharmony_ci 2024-04-29 12:57:20 +00:00 committed by Gitee
commit addaf7aa1b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 12 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "hilog_tag_wrapper.h"
#include "hilog_wrapper.h"
#include "hitrace_meter.h"
#include "in_process_call_wrapper.h"
namespace OHOS {
namespace AAFwk {
@ -30,7 +31,8 @@ void AbilityDebugDeal::RegisterAbilityDebugResponse()
return;
}
DelayedSingleton<AppScheduler>::GetInstance()->RegisterAbilityDebugResponse(abilityDebugResponse_);
IN_PROCESS_CALL_WITHOUT_RET(
DelayedSingleton<AppScheduler>::GetInstance()->RegisterAbilityDebugResponse(abilityDebugResponse_));
}
void AbilityDebugDeal::OnAbilitysDebugStarted(const std::vector<sptr<IRemoteObject>> &tokens)

View File

@ -5380,6 +5380,10 @@ void AppMgrServiceInner::ClearNonPersistWaitingDebugFlag()
int32_t AppMgrServiceInner::RegisterAbilityDebugResponse(const sptr<IAbilityDebugResponse> &response)
{
if (IPCSkeleton::GetCallingUid() != FOUNDATION_UID) {
TAG_LOGE(AAFwkTag::APPMGR, "Not foundation call.");
return ERR_PERMISSION_DENIED;
}
if (response == nullptr) {
TAG_LOGE(AAFwkTag::APPMGR, "Response is nullptr.");
return ERR_INVALID_VALUE;
@ -5429,6 +5433,11 @@ int32_t AppMgrServiceInner::NotifyAbilitysAssertDebugChange(
bool AppMgrServiceInner::IsAttachDebug(const std::string &bundleName)
{
TAG_LOGD(AAFwkTag::APPMGR, "Called.");
auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall();
if (!isSaCall) {
TAG_LOGE(AAFwkTag::APPMGR, "Caller token is not SA.");
return false;
}
if (appRunningManager_ == nullptr || bundleName.empty()) {
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ or bundleName is nullptr.");
return false;