mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 07:10:19 +00:00
aa debug add appProvisionType check
Signed-off-by: tantingting <tantingting5@huawei.com>
This commit is contained in:
parent
32c5f8eb9f
commit
45079358d0
@ -590,6 +590,11 @@ enum {
|
||||
*/
|
||||
ERR_CHILD_PROCESS_REACH_LIMIT = 2097266,
|
||||
|
||||
/**
|
||||
* Result(2097267) for check is debug app.
|
||||
*/
|
||||
ERR_NOT_DEBUG_APP = 2097267,
|
||||
|
||||
/**
|
||||
* Native error(3000000) for target bundle not exist.
|
||||
*/
|
||||
|
@ -84,6 +84,7 @@ constexpr const char* PARAM_SEND_RESULT_CALLER_BUNDLENAME = "ohos.anco.param.sen
|
||||
constexpr const char* PARAM_SEND_RESULT_CALLER_TOKENID = "ohos.anco.param.sendResultCallerTokenId";
|
||||
// Developer mode param
|
||||
constexpr const char* DEVELOPER_MODE_STATE = "const.security.developermode.state";
|
||||
constexpr const char* APP_PROVISION_TYPE_DEBUG = "debug";
|
||||
const int32_t SHELL_ASSISTANT_DIETYPE = 0;
|
||||
int64_t AbilityRecord::abilityRecordId = 0;
|
||||
const int32_t DEFAULT_USER_ID = 0;
|
||||
@ -3693,7 +3694,8 @@ void AbilityRecord::SetSpecifyTokenId(uint32_t specifyTokenId)
|
||||
|
||||
void AbilityRecord::SetDebugAppByWaitingDebugFlag()
|
||||
{
|
||||
if (!applicationInfo_.debug || !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
if (!(applicationInfo_.debug && applicationInfo_.appProvisionType == APP_PROVISION_TYPE_DEBUG) ||
|
||||
!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Not meeting the set debugging conditions.");
|
||||
return;
|
||||
}
|
||||
|
@ -1548,6 +1548,7 @@ private:
|
||||
void MakeIsolateSandBoxProcessName(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
const HapModuleInfo &hapModuleInfo, std::string &processName) const;
|
||||
void DealMultiUserConfig(const Configuration &config, const int32_t userId);
|
||||
bool CheckIsDebugApp(const std::string &bundleName);
|
||||
const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask";
|
||||
std::vector<AppStateCallbackWithUserId> appStateCallbacks_;
|
||||
std::shared_ptr<RemoteClientManager> remoteClientManager_;
|
||||
|
@ -6174,6 +6174,11 @@ int32_t AppMgrServiceInner::SetAppWaitingDebug(const std::string &bundleName, bo
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (!CheckIsDebugApp(bundleName)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "is not debug app");
|
||||
return AAFwk::ERR_NOT_DEBUG_APP;
|
||||
}
|
||||
|
||||
InitAppWaitingDebugList();
|
||||
|
||||
bool isClear = false;
|
||||
@ -6271,6 +6276,25 @@ void AppMgrServiceInner::InitAppWaitingDebugList()
|
||||
}
|
||||
}
|
||||
|
||||
bool AppMgrServiceInner::CheckIsDebugApp(const std::string &bundleName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
CHECK_POINTER_AND_RETURN_VALUE(remoteClientManager_, false);
|
||||
auto bundleMgrHelper = remoteClientManager_->GetBundleManagerHelper();
|
||||
CHECK_POINTER_AND_RETURN_VALUE(bundleMgrHelper, false);
|
||||
|
||||
BundleInfo bundleInfo;
|
||||
auto ret = IN_PROCESS_CALL(bundleMgrHelper->GetBundleInfoV9(bundleName,
|
||||
static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION), bundleInfo, currentUserId_));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "getBundleInfo fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
return bundleInfo.applicationInfo.debug &&
|
||||
(bundleInfo.applicationInfo.appProvisionType == AppExecFwk::Constants::APP_PROVISION_TYPE_DEBUG);
|
||||
}
|
||||
|
||||
bool AppMgrServiceInner::IsWaitingDebugApp(const std::string &bundleName)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
|
@ -215,6 +215,7 @@ ErrCode AbilityManagerShellCommand::CreateMessageMap()
|
||||
messageMap_[ERR_UNLOCK_SCREEN_FAILED_IN_DEVELOPER_MODE] = "error: unlock screen failed in developer mode.";
|
||||
messageMap_[ERR_NOT_SUPPORTED_PRODUCT_TYPE] = "error: not supported in the current product type.";
|
||||
messageMap_[ERR_NOT_IN_APP_PROVISION_MODE] = "error: not supported in non-app-provision mode.";
|
||||
messageMap_[ERR_NOT_DEBUG_APP] = "error: not debug app.";
|
||||
return OHOS::ERR_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user