mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
@@ -1565,15 +1565,16 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
debugOption.isDebugApp = appInfo.debug;
|
||||
debugOption.isStartWithNative = appLaunchData.isNativeStart();
|
||||
debugOption.appProvisionType = applicationInfo_->appProvisionType;
|
||||
debugOption.isDebugFromLocal = appLaunchData.GetDebugFromLocal();
|
||||
debugOption.perfCmd = perfCmd;
|
||||
debugOption.isDeveloperMode = isDeveloperMode_;
|
||||
runtime->SetDebugOption(debugOption);
|
||||
if (perfCmd.find(PERFCMD_PROFILE) != std::string::npos ||
|
||||
perfCmd.find(PERFCMD_DUMPHEAP) != std::string::npos) {
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "perfCmd is %{public}s", perfCmd.c_str());
|
||||
debugOption.perfCmd = perfCmd;
|
||||
runtime->StartProfiler(debugOption);
|
||||
} else {
|
||||
if (isDeveloperMode_) {
|
||||
runtime->StartDebugMode(debugOption);
|
||||
}
|
||||
runtime->StartDebugMode(debugOption);
|
||||
}
|
||||
|
||||
std::vector<HqfInfo> hqfInfos = appInfo.appQuickFix.deployedAppqfInfo.hqfInfos;
|
||||
@@ -3484,10 +3485,47 @@ int32_t MainThread::ChangeAppGcState(int32_t state)
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void MainThread::AttachAppDebug()
|
||||
void MainThread::AttachAppDebug(bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
SetAppDebug(AbilityRuntime::AppFreezeState::AppFreezeFlag::ATTACH_DEBUG_MODE, true);
|
||||
|
||||
if (!isDebugFromLocal) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "no local debug");
|
||||
return;
|
||||
}
|
||||
wptr<MainThread> weak = this;
|
||||
auto task = [weak] {
|
||||
auto appThread = weak.promote();
|
||||
if (appThread == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null appThread");
|
||||
return;
|
||||
}
|
||||
appThread->OnAttachLocalDebug(true);
|
||||
};
|
||||
if (mainHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null handler");
|
||||
return;
|
||||
}
|
||||
if (!mainHandler_->PostTask(task, "MainThread:AttachAppDebug")) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "PostTask task failed");
|
||||
}
|
||||
}
|
||||
|
||||
int32_t MainThread::OnAttachLocalDebug(bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
if (application_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null application_");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto &runtime = application_->GetRuntime();
|
||||
if (runtime == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null runtime");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
runtime->StartLocalDebugMode(isDebugFromLocal);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void MainThread::DetachAppDebug()
|
||||
|
||||
@@ -231,6 +231,7 @@ void CJRuntime::StartDebugMode(const DebugOption dOption)
|
||||
TAG_LOGI(AAFwkTag::CJRUNTIME, "StartDebugMode %{public}s", bundleName_.c_str());
|
||||
|
||||
HdcRegister::Get().StartHdcRegister(bundleName_, inputProcessName, isDebugApp,
|
||||
HdcRegister::DebugRegisterMode::HDC_DEBUG_REG,
|
||||
[bundleName, isStartWithDebug, isDebugApp, instanceId](int socketFd, std::string option) {
|
||||
TAG_LOGI(AAFwkTag::CJRUNTIME, "hdcRegister callback call, socket fd: %{public}d, option: %{public}s.",
|
||||
socketFd, option.c_str());
|
||||
|
||||
@@ -37,37 +37,64 @@ HdcRegister& HdcRegister::Get()
|
||||
}
|
||||
|
||||
void HdcRegister::StartHdcRegister(const std::string& bundleName, const std::string& processName, bool debugApp,
|
||||
HdcRegisterCallback callback)
|
||||
DebugRegisterMode debugMode, HdcRegisterCallback callback)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "called");
|
||||
|
||||
registerHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY);
|
||||
if (registerHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerHandler_");
|
||||
return;
|
||||
if (debugMode == BOTH_REG) {
|
||||
registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY);
|
||||
registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY);
|
||||
} else if (debugMode == LOCAL_DEBUG_REG) {
|
||||
registerLocalHandler_ = dlopen("libda_register.z.so", RTLD_LAZY);
|
||||
} else {
|
||||
registerHdcHandler_ = dlopen("libhdc_register.z.so", RTLD_LAZY);
|
||||
}
|
||||
auto startRegister = reinterpret_cast<StartRegister>(dlsym(registerHandler_, "StartConnect"));
|
||||
if (startRegister == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null StartConnect");
|
||||
return;
|
||||
if (registerLocalHandler_ != nullptr) {
|
||||
auto startRegister = reinterpret_cast<StartRegister>(dlsym(registerLocalHandler_, "StartConnect"));
|
||||
if (startRegister != nullptr) {
|
||||
startRegister(processName, bundleName, debugApp, callback);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerLocalHandler_");
|
||||
}
|
||||
if (registerHdcHandler_ != nullptr) {
|
||||
auto startRegister = reinterpret_cast<StartRegister>(dlsym(registerHdcHandler_, "StartConnect"));
|
||||
if (startRegister != nullptr) {
|
||||
startRegister(processName, bundleName, debugApp, callback);
|
||||
}
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerHdcHandler_");
|
||||
}
|
||||
startRegister(processName, bundleName, debugApp, callback);
|
||||
}
|
||||
|
||||
void HdcRegister::StopHdcRegister()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "called");
|
||||
if (registerHandler_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerHandler_");
|
||||
return;
|
||||
}
|
||||
auto stopRegister = reinterpret_cast<StopRegister>(dlsym(registerHandler_, "StopConnect"));
|
||||
if (stopRegister != nullptr) {
|
||||
stopRegister();
|
||||
|
||||
if (registerLocalHandler_ != nullptr) {
|
||||
auto stopRegister = reinterpret_cast<StopRegister>(dlsym(registerLocalHandler_, "StopConnect"));
|
||||
if (stopRegister != nullptr) {
|
||||
stopRegister();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null StopConnect");
|
||||
}
|
||||
dlclose(registerLocalHandler_);
|
||||
registerLocalHandler_ = nullptr;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null StopConnect");
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerLocalHandler_");
|
||||
}
|
||||
|
||||
if (registerHdcHandler_ != nullptr) {
|
||||
auto stopRegister = reinterpret_cast<StopRegister>(dlsym(registerHdcHandler_, "StopConnect"));
|
||||
if (stopRegister != nullptr) {
|
||||
stopRegister();
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null StopConnect");
|
||||
}
|
||||
dlclose(registerHdcHandler_);
|
||||
registerHdcHandler_ = nullptr;
|
||||
} else {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null registerHdcHandler_");
|
||||
}
|
||||
dlclose(registerHandler_);
|
||||
registerHandler_ = nullptr;
|
||||
}
|
||||
} // namespace OHOS::AbilityRuntime
|
||||
|
||||
@@ -25,9 +25,14 @@ using HdcRegisterCallback = std::function<void(int socketFd, std::string option)
|
||||
|
||||
class HdcRegister final {
|
||||
public:
|
||||
enum DebugRegisterMode {
|
||||
HDC_DEBUG_REG = 0,
|
||||
LOCAL_DEBUG_REG,
|
||||
BOTH_REG,
|
||||
};
|
||||
static HdcRegister& Get();
|
||||
void StartHdcRegister(const std::string& bundleName, const std::string& processName, bool debugApp,
|
||||
HdcRegisterCallback callback);
|
||||
DebugRegisterMode debugMode, HdcRegisterCallback callback);
|
||||
|
||||
private:
|
||||
HdcRegister() = default;
|
||||
@@ -35,7 +40,8 @@ private:
|
||||
|
||||
void StopHdcRegister();
|
||||
|
||||
void* registerHandler_ = nullptr;
|
||||
void* registerHdcHandler_ = nullptr;
|
||||
void* registerLocalHandler_ = nullptr;
|
||||
|
||||
HdcRegister(const HdcRegister&) = delete;
|
||||
HdcRegister(HdcRegister&&) = delete;
|
||||
|
||||
@@ -160,7 +160,8 @@ std::unique_ptr<JsRuntime> JsRuntime::Create(const Options& options)
|
||||
void JsRuntime::StartDebugMode(const DebugOption dOption)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "localDebug %{public}d", dOption.isDebugFromLocal);
|
||||
if (!dOption.isDebugFromLocal && !dOption.isDeveloperMode) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "developer Mode false");
|
||||
return;
|
||||
}
|
||||
@@ -183,12 +184,18 @@ void JsRuntime::StartDebugMode(const DebugOption dOption)
|
||||
uint32_t instanceId = instanceId_;
|
||||
auto weak = jsEnv_;
|
||||
std::string inputProcessName = bundleName_ != dOption.processName ? dOption.processName : "";
|
||||
HdcRegister::Get().StartHdcRegister(bundleName_, inputProcessName, isDebugApp, [bundleName,
|
||||
isStartWithDebug, instanceId, weak, isDebugApp, appProvisionType] (int socketFd, std::string option) {
|
||||
TAG_LOGI(AAFwkTag::JSRUNTIME, "HdcRegister msg, fd= %{public}d, option= %{public}s",
|
||||
socketFd, option.c_str());
|
||||
HdcRegister::DebugRegisterMode debugMode = HdcRegister::DebugRegisterMode::HDC_DEBUG_REG;
|
||||
if (debugOption_.isDebugFromLocal && debugOption_.isDeveloperMode) {
|
||||
debugMode = HdcRegister::DebugRegisterMode::BOTH_REG;
|
||||
} else if (debugOption_.isDebugFromLocal) {
|
||||
debugMode = HdcRegister::DebugRegisterMode::LOCAL_DEBUG_REG;
|
||||
}
|
||||
HdcRegister::Get().StartHdcRegister(bundleName_, inputProcessName, isDebugApp, debugMode,
|
||||
[bundleName, isStartWithDebug, instanceId, weak, isDebugApp, appProvisionType]
|
||||
(int socketFd, std::string option) {
|
||||
TAG_LOGI(AAFwkTag::JSRUNTIME, "HdcRegister msg, fd= %{public}d, option= %{public}s", socketFd, option.c_str());
|
||||
if (weak == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null weak");
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "null weak");
|
||||
return;
|
||||
}
|
||||
// system is debuggable when const.secure is false and const.debuggable is true
|
||||
@@ -317,7 +324,8 @@ int32_t JsRuntime::JsperfProfilerCommandParse(const std::string &command, int32_
|
||||
void JsRuntime::StartProfiler(const DebugOption dOption)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "localDebug %{public}d", dOption.isDebugFromLocal);
|
||||
if (!dOption.isDebugFromLocal && !dOption.isDeveloperMode) {
|
||||
TAG_LOGE(AAFwkTag::JSRUNTIME, "developer Mode false");
|
||||
return;
|
||||
}
|
||||
@@ -335,6 +343,7 @@ void JsRuntime::StartProfiler(const DebugOption dOption)
|
||||
uint32_t instanceId = instanceId_;
|
||||
std::string inputProcessName = bundleName_ != dOption.processName ? dOption.processName : "";
|
||||
HdcRegister::Get().StartHdcRegister(bundleName_, inputProcessName, isDebugApp,
|
||||
HdcRegister::DebugRegisterMode::HDC_DEBUG_REG,
|
||||
[bundleName, isStartWithDebug, instanceId, weak, isDebugApp, appProvisionType](int socketFd, std::string option) {
|
||||
TAG_LOGI(AAFwkTag::JSRUNTIME, "HdcRegister msg, fd= %{public}d, option= %{public}s", socketFd, option.c_str());
|
||||
if (weak == nullptr) {
|
||||
@@ -1673,5 +1682,15 @@ void JsRuntime::UpdatePkgContextInfoJson(const std::string& moduleName, const st
|
||||
panda::JSNApi::UpdatePkgNameList(vm, packageNameList);
|
||||
}
|
||||
|
||||
void JsRuntime::SetDebugOption(const DebugOption debugOption)
|
||||
{
|
||||
debugOption_ = debugOption;
|
||||
}
|
||||
|
||||
void JsRuntime::StartLocalDebugMode(bool isDebugFromLocal)
|
||||
{
|
||||
debugOption_.isDebugFromLocal = isDebugFromLocal;
|
||||
StartDebugMode(debugOption_);
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1418,14 +1418,14 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode AttachAppDebug(const std::string &bundleName);
|
||||
ErrCode AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal = false);
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode DetachAppDebug(const std::string &bundleName);
|
||||
ErrCode DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal = false);
|
||||
|
||||
/**
|
||||
* @brief Check if ability controller can start.
|
||||
|
||||
@@ -1640,14 +1640,14 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t AttachAppDebug(const std::string &bundleName) = 0;
|
||||
virtual int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) = 0;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t DetachAppDebug(const std::string &bundleName) = 0;
|
||||
virtual int32_t DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal) = 0;
|
||||
|
||||
/**
|
||||
* @brief Execute intent.
|
||||
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int32_t AttachAppDebug(const std::string &bundleName) = 0;
|
||||
virtual int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) = 0;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -296,7 +296,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName) override;
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -299,6 +299,19 @@ public:
|
||||
*/
|
||||
bool IsAllowedNWebPreload() const;
|
||||
|
||||
/**
|
||||
* @brief Setting debug mode.
|
||||
*
|
||||
* @param ideDebugMode, false:old debug, true:local debug.
|
||||
*/
|
||||
void SetDebugFromLocal(bool isDebugFromLocal);
|
||||
/**
|
||||
* @brief Get debug mode.
|
||||
*
|
||||
* @return Returns debug mode.
|
||||
*/
|
||||
bool GetDebugFromLocal() const;
|
||||
|
||||
private:
|
||||
bool debugApp_ = false;
|
||||
bool jitEnabled_ = false;
|
||||
@@ -318,6 +331,7 @@ private:
|
||||
std::string appRunningUniqueId_;
|
||||
std::string instanceKey_;
|
||||
std::string preloadModuleName_;
|
||||
bool isDebugFromLocal_;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -642,7 +642,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName);
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal);
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
/**
|
||||
* @brief Attach app debug.
|
||||
*/
|
||||
virtual void AttachAppDebug() = 0;
|
||||
virtual void AttachAppDebug(bool isDebugFromLocal) = 0;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
/**
|
||||
* @brief Attach app debug.
|
||||
*/
|
||||
void AttachAppDebug() override;
|
||||
void AttachAppDebug(bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -991,7 +991,7 @@ int32_t AmsMgrProxy::UnregisterAppDebugListener(const sptr<IAppDebugListener> &l
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t AmsMgrProxy::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AmsMgrProxy::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
MessageParcel data;
|
||||
@@ -1005,6 +1005,11 @@ int32_t AmsMgrProxy::AttachAppDebug(const std::string &bundleName)
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (!data.WriteBool(isDebugFromLocal)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write isDebugFromLocal failed");
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
auto ret = SendTransactCmd(static_cast<uint32_t>(IAmsMgr::Message::ATTACH_APP_DEBUG),
|
||||
|
||||
@@ -651,8 +651,9 @@ int32_t AmsMgrStub::HandleAttachAppDebug(MessageParcel &data, MessageParcel &rep
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Bundle name is empty.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto isDebugFromLocal = data.ReadBool();
|
||||
|
||||
auto result = AttachAppDebug(bundleName);
|
||||
auto result = AttachAppDebug(bundleName, isDebugFromLocal);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Fail to write result.");
|
||||
return ERR_INVALID_VALUE;
|
||||
|
||||
@@ -130,6 +130,11 @@ bool AppLaunchData::MarshallingExtend(Parcel &parcel) const
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Marshalling, Failed to write preloadModuleName.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.WriteBool(isDebugFromLocal_)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Marshalling, Failed to write isDebugFromLocal");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -180,6 +185,7 @@ bool AppLaunchData::ReadFromParcel(Parcel &parcel)
|
||||
isNeedPreloadModule_ = parcel.ReadBool();
|
||||
isAllowedNWebPreload_ = parcel.ReadBool();
|
||||
preloadModuleName_ = parcel.ReadString();
|
||||
isDebugFromLocal_ = parcel.ReadBool();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -290,5 +296,15 @@ bool AppLaunchData::IsAllowedNWebPreload() const
|
||||
{
|
||||
return isAllowedNWebPreload_;
|
||||
}
|
||||
|
||||
void AppLaunchData::SetDebugFromLocal(bool isDebugFromLocal)
|
||||
{
|
||||
isDebugFromLocal_ = isDebugFromLocal;
|
||||
}
|
||||
|
||||
bool AppLaunchData::GetDebugFromLocal() const
|
||||
{
|
||||
return isDebugFromLocal_;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1028,12 +1028,12 @@ int32_t AppMgrClient::UnregisterAppDebugListener(const sptr<IAppDebugListener> &
|
||||
return amsService_->UnregisterAppDebugListener(listener);
|
||||
}
|
||||
|
||||
int32_t AppMgrClient::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AppMgrClient::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
if (!IsAmsServiceReady()) {
|
||||
return AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
return amsService_->AttachAppDebug(bundleName);
|
||||
return amsService_->AttachAppDebug(bundleName, isDebugFromLocal);
|
||||
}
|
||||
|
||||
int32_t AppMgrClient::DetachAppDebug(const std::string &bundleName)
|
||||
|
||||
@@ -444,7 +444,8 @@ int32_t AppSchedulerHost::HandleScheduleChangeAppGcState(MessageParcel &data, Me
|
||||
int32_t AppSchedulerHost::HandleAttachAppDebug(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
HITRACE_METER(HITRACE_TAG_APP);
|
||||
AttachAppDebug();
|
||||
auto isDebugFromLocal = data.ReadBool();
|
||||
AttachAppDebug(isDebugFromLocal);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ int32_t AppSchedulerProxy::ScheduleChangeAppGcState(int32_t state)
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void AppSchedulerProxy::AttachAppDebug()
|
||||
void AppSchedulerProxy::AttachAppDebug(bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
MessageParcel data;
|
||||
@@ -666,6 +666,10 @@ void AppSchedulerProxy::AttachAppDebug()
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteBool(isDebugFromLocal)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Write AttachAppDebug isDebugFromLocal failed");
|
||||
return;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
@@ -103,6 +103,8 @@ public:
|
||||
const std::string& hapPath, bool isEsMode, bool useCommonTrunk) override;
|
||||
bool PopPreloadObj(const std::string& key, std::unique_ptr<NativeReference>& obj);
|
||||
void StartDebugMode(const DebugOption debugOption) override;
|
||||
void SetDebugOption(const DebugOption debugOption) override;
|
||||
void StartLocalDebugMode(bool isDebugFromLocal) override;
|
||||
void DebuggerConnectionHandler(bool isDebugApp, bool isStartWithDebug);
|
||||
void StopDebugMode();
|
||||
bool LoadRepairPatch(const std::string& hqfFile, const std::string& hapPath) override;
|
||||
@@ -172,6 +174,7 @@ private:
|
||||
std::map<std::string, std::unique_ptr<NativeReference>> preloadList_;
|
||||
|
||||
static std::atomic<bool> hasInstance;
|
||||
DebugOption debugOption_;
|
||||
|
||||
private:
|
||||
bool CreateJsEnv(const Options& options);
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
bool isDebugApp = true;
|
||||
bool isStartWithDebug = false;
|
||||
bool isStartWithNative = false;
|
||||
bool isDebugFromLocal = false;
|
||||
bool isDeveloperMode;
|
||||
};
|
||||
|
||||
static std::unique_ptr<Runtime> Create(const Options& options);
|
||||
@@ -87,6 +89,8 @@ public:
|
||||
virtual Language GetLanguage() const = 0;
|
||||
|
||||
virtual void StartDebugMode(const DebugOption debugOption) = 0;
|
||||
virtual void SetDebugOption(const DebugOption debugOption) {};
|
||||
virtual void StartLocalDebugMode(bool isDebugFromLocal) {};
|
||||
virtual void DumpHeapSnapshot(bool isPrivate) = 0;
|
||||
virtual void DumpCpuProfile() = 0;
|
||||
virtual void DestroyHeapProfiler() = 0;
|
||||
|
||||
@@ -311,7 +311,7 @@ public:
|
||||
*/
|
||||
int32_t ScheduleChangeAppGcState(int32_t state) override;
|
||||
|
||||
void AttachAppDebug() override;
|
||||
void AttachAppDebug(bool isDebugFromLocal) override;
|
||||
void DetachAppDebug() override;
|
||||
bool NotifyDeviceDisConnect();
|
||||
|
||||
@@ -649,6 +649,8 @@ private:
|
||||
*/
|
||||
void ParseAppConfigurationParams(const std::string configuration, Configuration &config);
|
||||
|
||||
int32_t OnAttachLocalDebug(bool isDebugFromLocal);
|
||||
|
||||
#if defined(NWEB) && defined(NWEB_GRAPHIC)
|
||||
void HandleNWebPreload();
|
||||
#endif
|
||||
|
||||
@@ -1290,14 +1290,14 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName) override;
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t DetachAppDebug(const std::string &bundleName) override;
|
||||
int32_t DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Execute intent.
|
||||
|
||||
@@ -1624,14 +1624,14 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName) override;
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t DetachAppDebug(const std::string &bundleName) override;
|
||||
int32_t DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Execute intent.
|
||||
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName);
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal);
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -146,6 +146,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "StartAbility ability:%{public}s, userId:%{public}d, appCloneIndex:%{public}d",
|
||||
want.GetElement().GetURI().c_str(), userId, want.GetIntParam(Want::PARAM_APP_CLONE_INDEX_KEY, -1));
|
||||
|
||||
HandleDlpApp(const_cast<Want &>(want));
|
||||
return abms->StartAbility(want, userId, requestCode);
|
||||
}
|
||||
@@ -1848,20 +1849,20 @@ ErrCode AbilityManagerClient::UnregisterAppDebugListener(sptr<AppExecFwk::IAppDe
|
||||
return abms->UnregisterAppDebugListener(listener);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::AttachAppDebug(const std::string &bundleName)
|
||||
ErrCode AbilityManagerClient::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->AttachAppDebug(bundleName);
|
||||
return abms->AttachAppDebug(bundleName, isDebugFromLocal);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::DetachAppDebug(const std::string &bundleName)
|
||||
ErrCode AbilityManagerClient::DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
auto abms = GetAbilityManager();
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
return abms->DetachAppDebug(bundleName);
|
||||
return abms->DetachAppDebug(bundleName, isDebugFromLocal);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ExecuteIntent(uint64_t key, sptr<IRemoteObject> callerToken,
|
||||
|
||||
@@ -4953,7 +4953,7 @@ int32_t AbilityManagerProxy::UnregisterAppDebugListener(sptr<AppExecFwk::IAppDeb
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t AbilityManagerProxy::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AbilityManagerProxy::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
@@ -4967,6 +4967,11 @@ int32_t AbilityManagerProxy::AttachAppDebug(const std::string &bundleName)
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
if (!data.WriteBool(isDebugFromLocal)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "isDebugFromLocal write fail");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t error = SendRequest(AbilityManagerInterfaceCode::ATTACH_APP_DEBUG, data, reply, option);
|
||||
@@ -4977,7 +4982,7 @@ int32_t AbilityManagerProxy::AttachAppDebug(const std::string &bundleName)
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int32_t AbilityManagerProxy::DetachAppDebug(const std::string &bundleName)
|
||||
int32_t AbilityManagerProxy::DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
MessageParcel data;
|
||||
@@ -4991,6 +4996,11 @@ int32_t AbilityManagerProxy::DetachAppDebug(const std::string &bundleName)
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
if (!data.WriteBool(isDebugFromLocal)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "isDebugFromLocal write fail");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
int32_t error = SendRequest(AbilityManagerInterfaceCode::DETACH_APP_DEBUG, data, reply, option);
|
||||
|
||||
@@ -178,6 +178,7 @@ constexpr const char* DMS_CALLING_UID = "ohos.dms.callingUid";
|
||||
|
||||
constexpr const char* DEBUG_APP = "debugApp";
|
||||
constexpr const char* NATIVE_DEBUG = "nativeDebug";
|
||||
constexpr const char* DEBUG_FROM = "ohos.param.debugFrom";
|
||||
constexpr const char* AUTO_FILL_PASSWORD_TYPE = "autoFill/password";
|
||||
constexpr const char* AUTO_FILL_SMART_TYPE = "autoFill/smart";
|
||||
constexpr size_t INDEX_ZERO = 0;
|
||||
@@ -525,11 +526,17 @@ int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int re
|
||||
want.HasParameter(Want::PARAM_RESV_WINDOW_TOP) ||
|
||||
want.HasParameter(Want::PARAM_RESV_WINDOW_HEIGHT) ||
|
||||
want.HasParameter(Want::PARAM_RESV_WINDOW_WIDTH));
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "isDebugApp=%{public}d, hasWindowOptions=%{public}d, isNativeDebugApp=%{public}d",
|
||||
static_cast<int>(isDebugApp), static_cast<int>(hasWindowOptions), static_cast<int>(isNativeDebugApp));
|
||||
bool checkDeveloperModeFlag = (isDebugApp || hasWindowOptions || isNativeDebugApp);
|
||||
bool isDebugFromLocal = want.GetBoolParam(DEBUG_FROM, false);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR,
|
||||
"isDebugApp=%{public}d, hasWindowOptions=%{public}d, isNativeDebugApp=%{public}d, isDebugFromLocal=%{public}d",
|
||||
static_cast<int>(isDebugApp), static_cast<int>(hasWindowOptions), static_cast<int>(isNativeDebugApp),
|
||||
isDebugFromLocal);
|
||||
bool checkDeveloperModeFlag = (isDebugApp || hasWindowOptions || isNativeDebugApp || isDebugFromLocal);
|
||||
if (checkDeveloperModeFlag) {
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
if (isDebugFromLocal && !AAFwk::PermissionVerification::GetInstance()-> VerifyStartLocalDebug()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "local debugging, permission denied");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
} else if (!isDebugFromLocal && !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "not developer Mode");
|
||||
return ERR_NOT_DEVELOPER_MODE;
|
||||
}
|
||||
@@ -11027,11 +11034,14 @@ std::shared_ptr<AbilityDebugDeal> AbilityManagerService::ConnectInitAbilityDebug
|
||||
return abilityDebugDeal_;
|
||||
}
|
||||
|
||||
int32_t AbilityManagerService::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AbilityManagerService::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "developer Mode false");
|
||||
if (isDebugFromLocal && !AAFwk::PermissionVerification::GetInstance()-> VerifyStartLocalDebug()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "local debugging, permission denied");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
} else if (!isDebugFromLocal && !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "not developer Mode");
|
||||
return ERR_NOT_DEVELOPER_MODE;
|
||||
}
|
||||
|
||||
@@ -11049,14 +11059,17 @@ int32_t AbilityManagerService::AttachAppDebug(const std::string &bundleName)
|
||||
}
|
||||
|
||||
ConnectInitAbilityDebugDeal();
|
||||
return IN_PROCESS_CALL(DelayedSingleton<AppScheduler>::GetInstance()->AttachAppDebug(bundleName));
|
||||
return IN_PROCESS_CALL(DelayedSingleton<AppScheduler>::GetInstance()->AttachAppDebug(bundleName, isDebugFromLocal));
|
||||
}
|
||||
|
||||
int32_t AbilityManagerService::DetachAppDebug(const std::string &bundleName)
|
||||
int32_t AbilityManagerService::DetachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "developer Mode false");
|
||||
if (isDebugFromLocal && !AAFwk::PermissionVerification::GetInstance()-> VerifyStartLocalDebug()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "local debugging, permission denied");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
} else if (!isDebugFromLocal && !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "not developer Mode");
|
||||
return ERR_NOT_DEVELOPER_MODE;
|
||||
}
|
||||
|
||||
|
||||
@@ -3637,8 +3637,8 @@ int32_t AbilityManagerStub::AttachAppDebugInner(MessageParcel &data, MessageParc
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "empty bundleName");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto result = AttachAppDebug(bundleName);
|
||||
bool isDebugFromLocal = data.ReadBool();
|
||||
auto result = AttachAppDebug(bundleName, isDebugFromLocal);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail");
|
||||
return ERR_INVALID_VALUE;
|
||||
@@ -3654,7 +3654,8 @@ int32_t AbilityManagerStub::DetachAppDebugInner(MessageParcel &data, MessageParc
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
auto result = DetachAppDebug(bundleName);
|
||||
bool isDebugFromLocal = data.ReadBool();
|
||||
auto result = DetachAppDebug(bundleName, isDebugFromLocal);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail");
|
||||
return ERR_INVALID_VALUE;
|
||||
|
||||
@@ -576,10 +576,10 @@ int32_t AppScheduler::UnregisterAppDebugListener(const sptr<AppExecFwk::IAppDebu
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t AppScheduler::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AppScheduler::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR);
|
||||
auto ret = static_cast<int32_t>(appMgrClient_->AttachAppDebug(bundleName));
|
||||
auto ret = static_cast<int32_t>(appMgrClient_->AttachAppDebug(bundleName, isDebugFromLocal));
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "attach app debug failed");
|
||||
return INNER_ERR;
|
||||
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName) override;
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal) override;
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
*
|
||||
* @return ERR_OK, return back success, others fail.
|
||||
*/
|
||||
int32_t AttachAppDebug();
|
||||
int32_t AttachAppDebug(bool isDebugFromLocal);
|
||||
|
||||
/**
|
||||
* @brief detach a debugging process.
|
||||
|
||||
@@ -1103,7 +1103,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int32_t AttachAppDebug(const std::string &bundleName);
|
||||
int32_t AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal);
|
||||
|
||||
/**
|
||||
* @brief Detach app debug.
|
||||
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
* @param bundleName The application bundle name.
|
||||
* @param isAttachDebug Determine if it is in attach debug mode.
|
||||
*/
|
||||
void SetAttachAppDebug(const std::string &bundleName, const bool &isAttachDebug);
|
||||
void SetAttachAppDebug(const std::string &bundleName, const bool &isAttachDebug, bool isDebugFromLocal);
|
||||
|
||||
/**
|
||||
* @brief Obtain app debug infos through bundleName.
|
||||
|
||||
@@ -801,7 +801,7 @@ public:
|
||||
*/
|
||||
int32_t ChangeAppGcState(int32_t state);
|
||||
|
||||
void SetAttachDebug(bool isAttachDebug);
|
||||
void SetAttachDebug(bool isAttachDebug, bool isDebugFromLocal);
|
||||
bool IsAttachDebug() const;
|
||||
|
||||
void SetApplicationPendingState(ApplicationPendingState pendingState);
|
||||
@@ -1049,6 +1049,13 @@ public:
|
||||
return reasonExist_;
|
||||
}
|
||||
|
||||
void SetDebugFromLocal(bool isDebugFromLocal);
|
||||
|
||||
bool GetDebugFromLocal() const
|
||||
{
|
||||
return isDebugFromLocal_;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* SearchTheModuleInfoNeedToUpdated, Get an uninitialized abilityStage data.
|
||||
@@ -1223,6 +1230,7 @@ private:
|
||||
int32_t rssValue_ = 0;
|
||||
int32_t pssValue_ = 0;
|
||||
bool reasonExist_ = false;
|
||||
bool isDebugFromLocal_ = false;
|
||||
};
|
||||
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -550,7 +550,7 @@ int32_t AmsMgrScheduler::UnregisterAppDebugListener(const sptr<IAppDebugListener
|
||||
return amsMgrServiceInner_->UnregisterAppDebugListener(listener);
|
||||
}
|
||||
|
||||
int32_t AmsMgrScheduler::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AmsMgrScheduler::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
if (!IsReady()) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "not ready");
|
||||
@@ -560,7 +560,7 @@ int32_t AmsMgrScheduler::AttachAppDebug(const std::string &bundleName)
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "caller is not foundation");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
return amsMgrServiceInner_->AttachAppDebug(bundleName);
|
||||
return amsMgrServiceInner_->AttachAppDebug(bundleName, isDebugFromLocal);
|
||||
}
|
||||
|
||||
int32_t AmsMgrScheduler::DetachAppDebug(const std::string &bundleName)
|
||||
|
||||
@@ -325,7 +325,7 @@ int32_t AppLifeCycleDeal::ChangeAppGcState(int32_t state)
|
||||
return appThread->ScheduleChangeAppGcState(state);
|
||||
}
|
||||
|
||||
int32_t AppLifeCycleDeal::AttachAppDebug()
|
||||
int32_t AppLifeCycleDeal::AttachAppDebug(bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
auto appThread = GetApplicationClient();
|
||||
@@ -333,7 +333,7 @@ int32_t AppLifeCycleDeal::AttachAppDebug()
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "null appThread");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
appThread->AttachAppDebug();
|
||||
appThread->AttachAppDebug(isDebugFromLocal);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ constexpr const char* FOUNDATION_PROCESS = "foundation";
|
||||
constexpr const char* BS_PROCESS_NAME = "bgtaskmgr_service";
|
||||
constexpr int32_t USER_UID = 2000;
|
||||
constexpr const char* HIVIEW_PROCESS_NAME = "hiview";
|
||||
constexpr const char* DEBUG_FROM = "ohos.param.debugFrom";
|
||||
} // namespace
|
||||
|
||||
REGISTER_SYSTEM_ABILITY_BY_ID(AppMgrService, APP_MGR_SERVICE_ID, true);
|
||||
@@ -1194,6 +1195,12 @@ int32_t AppMgrService::StartNativeProcessForDebugger(const AAFwk::Want &want)
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "permission denied");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
bool isDebugFromLocal = want.GetBoolParam(DEBUG_FROM, false);
|
||||
if (isDebugFromLocal &&
|
||||
!AAFwk::PermissionVerification::GetInstance()->VerifyStartLocalDebug()) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "local debug permission denied");
|
||||
return ERR_PERMISSION_DENIED;
|
||||
}
|
||||
auto ret = appMgrServiceInner_->StartNativeProcessForDebugger(want);
|
||||
if (ret != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "start native process fail");
|
||||
|
||||
@@ -193,6 +193,7 @@ constexpr const char* SERVICE_EXT_MULTI_PROCESS_WHITE_LIST = "component.startup.
|
||||
constexpr const char* SCENE_BOARD_BUNDLE_NAME = "com.ohos.sceneboard";
|
||||
constexpr const char* DEBUG_APP = "debugApp";
|
||||
constexpr const char* NATIVE_DEBUG = "nativeDebug";
|
||||
constexpr const char* DEBUG_FROM = "ohos.param.debugFrom";
|
||||
constexpr const char* SERVICE_EXTENSION = ":ServiceExtension";
|
||||
constexpr const char* KEEP_ALIVE = ":KeepAlive";
|
||||
constexpr const char* PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag";
|
||||
@@ -2718,7 +2719,8 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(
|
||||
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want, bool isKia)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
if (want != nullptr && (want->GetBoolParam(DEBUG_APP, false) || want->GetBoolParam(NATIVE_DEBUG, false))) {
|
||||
if (want != nullptr && (want->GetBoolParam(DEBUG_APP, false) || want->GetBoolParam(NATIVE_DEBUG, false) ||
|
||||
want->GetBoolParam(DEBUG_FROM, false))) {
|
||||
if (appInfo != nullptr && appInfo->appProvisionType != AppExecFwk::Constants::APP_PROVISION_TYPE_DEBUG) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "release app not support debug");
|
||||
return nullptr;
|
||||
@@ -2744,6 +2746,7 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(
|
||||
if (want) {
|
||||
appRecord->SetDebugApp(want->GetBoolParam(DEBUG_APP, false));
|
||||
appRecord->SetNativeDebug(want->GetBoolParam("nativeDebug", false));
|
||||
appRecord->SetDebugFromLocal(want->GetBoolParam(DEBUG_FROM, false));
|
||||
if (want->GetBoolParam(COLD_START, false)) {
|
||||
appRecord->SetDebugApp(true);
|
||||
}
|
||||
@@ -2762,6 +2765,7 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(
|
||||
appRecord->SetCallerTokenId(want->GetIntParam(Want::PARAM_RESV_CALLER_TOKEN, -1));
|
||||
appRecord->SetAssignTokenId(want->GetIntParam("specifyTokenId", 0));
|
||||
appRecord->SetNativeStart(want->GetBoolParam("native", false));
|
||||
appRecord->SetDebugFromLocal(want->GetBoolParam(DEBUG_FROM, false));
|
||||
}
|
||||
return appRecord;
|
||||
}
|
||||
@@ -3979,8 +3983,9 @@ void AppMgrServiceInner::ProcessAppDebug(const std::shared_ptr<AppRunningRecord>
|
||||
}
|
||||
|
||||
auto bundleName = appRecord->GetBundleName();
|
||||
auto isDebugFromLocal = appRecord->GetDebugFromLocal();
|
||||
if (appDebugManager_->IsAttachDebug(bundleName)) {
|
||||
appRecord->SetAttachDebug(true);
|
||||
appRecord->SetAttachDebug(true, isDebugFromLocal);
|
||||
startDebug(false);
|
||||
}
|
||||
}
|
||||
@@ -4884,6 +4889,9 @@ int AppMgrServiceInner::StartEmptyProcess(const AAFwk::Want &want, const sptr<IR
|
||||
auto isDebug = want.GetBoolParam(DEBUG_APP, false);
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "setDebug: %{public}s", (isDebug ? "true" : "false"));
|
||||
appRecord->SetDebugApp(isDebug);
|
||||
bool isDebugFromLocal = want.GetBoolParam(DEBUG_FROM, false);
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "SetDebugFromLocal: %{public}d", isDebugFromLocal);
|
||||
appRecord->SetDebugFromLocal(isDebugFromLocal);
|
||||
if (want.GetBoolParam(COLD_START, false)) {
|
||||
appRecord->SetDebugApp(true);
|
||||
}
|
||||
@@ -5035,6 +5043,7 @@ void AppMgrServiceInner::StartSpecifiedAbility(const AAFwk::Want &want, const Ap
|
||||
appRecord->SetCallerUid(wantPtr->GetIntParam(Want::PARAM_RESV_CALLER_UID, -1));
|
||||
appRecord->SetCallerTokenId(wantPtr->GetIntParam(Want::PARAM_RESV_CALLER_TOKEN, -1));
|
||||
appRecord->SetDebugApp(wantPtr->GetBoolParam(DEBUG_APP, false));
|
||||
appRecord->SetDebugFromLocal(wantPtr->GetBoolParam(DEBUG_FROM, false));
|
||||
if (appRecord->IsDebugApp()) {
|
||||
ProcessAppDebug(appRecord, true);
|
||||
}
|
||||
@@ -7117,7 +7126,7 @@ int32_t AppMgrServiceInner::UnregisterAppDebugListener(const sptr<IAppDebugListe
|
||||
return appDebugManager_->UnregisterAppDebugListener(listener);
|
||||
}
|
||||
|
||||
int32_t AppMgrServiceInner::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AppMgrServiceInner::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
if (!system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
@@ -7135,7 +7144,7 @@ int32_t AppMgrServiceInner::AttachAppDebug(const std::string &bundleName)
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "appRunningManager_ null");
|
||||
return ERR_NO_INIT;
|
||||
}
|
||||
appRunningManager_->SetAttachAppDebug(bundleName, true);
|
||||
appRunningManager_->SetAttachAppDebug(bundleName, true, isDebugFromLocal);
|
||||
|
||||
auto debugInfos = appRunningManager_->GetAppDebugInfosByBundleName(bundleName, false);
|
||||
if (!debugInfos.empty() && appDebugManager_ != nullptr) {
|
||||
@@ -7162,7 +7171,7 @@ int32_t AppMgrServiceInner::DetachAppDebug(const std::string &bundleName)
|
||||
|
||||
auto debugInfos = appRunningManager_->GetAppDebugInfosByBundleName(bundleName, true);
|
||||
if (!debugInfos.empty()) {
|
||||
appRunningManager_->SetAttachAppDebug(bundleName, false);
|
||||
appRunningManager_->SetAttachAppDebug(bundleName, false, false);
|
||||
if (appDebugManager_ != nullptr) {
|
||||
appDebugManager_->StopDebug(debugInfos);
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,8 @@ bool AppRunningManager::IsApplicationUnfocused(const std::string &bundleName)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AppRunningManager::SetAttachAppDebug(const std::string &bundleName, const bool &isAttachDebug)
|
||||
void AppRunningManager::SetAttachAppDebug(const std::string &bundleName, const bool &isAttachDebug,
|
||||
bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
auto appRunningMap = GetAppRunningRecordMap();
|
||||
@@ -1414,7 +1415,7 @@ void AppRunningManager::SetAttachAppDebug(const std::string &bundleName, const b
|
||||
}
|
||||
if (appRecord->GetBundleName() == bundleName) {
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "The application: %{public}s will be set debug mode.", bundleName.c_str());
|
||||
appRecord->SetAttachDebug(isAttachDebug);
|
||||
appRecord->SetAttachDebug(isAttachDebug, isDebugFromLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ void AppRunningRecord::LaunchApplication(const Configuration &config)
|
||||
launchData.SetIsNeedPreloadModule(isNeedPreloadModule_);
|
||||
launchData.SetNWebPreload(isAllowedNWebPreload_);
|
||||
launchData.SetPreloadModuleName(preloadModuleName_);
|
||||
launchData.SetDebugFromLocal(isDebugFromLocal_);
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "%{public}s called,app is %{public}s.", __func__, GetName().c_str());
|
||||
AddAppLifecycleEvent("AppRunningRecord::LaunchApplication");
|
||||
@@ -2107,16 +2108,17 @@ int32_t AppRunningRecord::ChangeAppGcState(int32_t state)
|
||||
return appLifeCycleDeal_->ChangeAppGcState(state);
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetAttachDebug(bool isAttachDebug)
|
||||
void AppRunningRecord::SetAttachDebug(bool isAttachDebug, bool isDebugFromLocal)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
isAttachDebug_ = isAttachDebug;
|
||||
isDebugFromLocal_ = isDebugFromLocal;
|
||||
|
||||
if (appLifeCycleDeal_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "null appLifeCycleDeal_");
|
||||
return;
|
||||
}
|
||||
isAttachDebug_ ? appLifeCycleDeal_->AttachAppDebug() : appLifeCycleDeal_->DetachAppDebug();
|
||||
isAttachDebug_ ? appLifeCycleDeal_->AttachAppDebug(isDebugFromLocal_) : appLifeCycleDeal_->DetachAppDebug();
|
||||
}
|
||||
|
||||
bool AppRunningRecord::IsAttachDebug() const
|
||||
@@ -2609,5 +2611,10 @@ uint32_t AppRunningRecord::GetAddStageTimeout() const
|
||||
}
|
||||
return AMSEventHandler::ADD_ABILITY_STAGE_INFO_TIMEOUT;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetDebugFromLocal(bool isDebugFromLocal)
|
||||
{
|
||||
isDebugFromLocal_ = isDebugFromLocal;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -70,6 +70,7 @@ constexpr const char* PERMISSION_GET_TELEPHONY_STATE = "ohos.permission.GET_TELE
|
||||
constexpr const char* PERMISSION_MANAGE_APP_KEEP_ALIVE = "ohos.permission.MANAGE_APP_KEEP_ALIVE";
|
||||
constexpr const char* PERMISSION_MANAGE_APP_KEEP_ALIVE_INTERNAL = "ohos.permission.MANAGE_APP_KEEP_ALIVE_INTERNAL";
|
||||
constexpr const char* PERMISSION_SET_LAUNCH_REASON_MESSAGE = "ohos.permission.SET_LAUNCH_REASON_MESSAGE";
|
||||
constexpr const char* PERMISSION_PERFORM_LOCAL_DEBUG = "ohos.permission.PERFORM_LOCAL_DEBUG";
|
||||
constexpr const char* PERMISSION_NDK_START_SELF_UI_ABILITY = "ohos.permission.NDK_START_SELF_UI_ABILITY";
|
||||
constexpr const char* PERMISSION_FUSION_ACCESS = "ohos.permission.ACCESS_AMS_FROM_FUSION";
|
||||
} // namespace PermissionConstants
|
||||
|
||||
@@ -117,6 +117,8 @@ struct VerificationInfo {
|
||||
|
||||
bool VerifySuperviseKiaServicePermission() const;
|
||||
|
||||
bool VerifyStartLocalDebug() const;
|
||||
|
||||
bool VerifyStartSelfUIAbility(int tokenId) const;
|
||||
|
||||
bool VerifyFusionAccessPermission() const;
|
||||
|
||||
@@ -567,6 +567,16 @@ bool PermissionVerification::VerifySuperviseKiaServicePermission() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PermissionVerification::VerifyStartLocalDebug() const
|
||||
{
|
||||
if (VerifyCallingPermission(PermissionConstants::PERMISSION_PERFORM_LOCAL_DEBUG)) {
|
||||
TAG_LOGD(AAFwkTag::DEFAULT, "Permission granted");
|
||||
return true;
|
||||
}
|
||||
TAG_LOGE(AAFwkTag::DEFAULT, "Permission denied");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PermissionVerification::VerifyStartSelfUIAbility(int tokenId) const
|
||||
{
|
||||
if (!IsSACall() && VerifyPermissionByTokenId(tokenId, PermissionConstants::PERMISSION_NDK_START_SELF_UI_ABILITY)) {
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ void DoSomethingInterestingWithMyAPIaddb(const char* data, size_t size)
|
||||
manager->IsApplicationFirstFocused(foregroundingRecord);
|
||||
manager->IsApplicationUnfocused(jsonStr);
|
||||
bool isAttachDebug = *data % ENABLE;
|
||||
manager->SetAttachAppDebug(jsonStr, isAttachDebug);
|
||||
manager->SetAttachAppDebug(jsonStr, isAttachDebug, false);
|
||||
bool isDetachDebug = *data % ENABLE;
|
||||
manager->GetAppDebugInfosByBundleName(jsonStr, isDetachDebug);
|
||||
std::vector<sptr<IRemoteObject>> abilityTokens;
|
||||
|
||||
+2
-2
@@ -333,8 +333,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
+2
-2
@@ -294,8 +294,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
+4
-4
@@ -186,8 +186,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
@@ -366,8 +366,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -142,8 +142,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -285,8 +285,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -301,8 +301,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ int32_t AppScheduler::UnregisterAppDebugListener(const sptr<AppExecFwk::IAppDebu
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t AppScheduler::AttachAppDebug(const std::string &bundleName)
|
||||
int32_t AppScheduler::AttachAppDebug(const std::string &bundleName, bool isDebugFromLocal)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
MOCK_METHOD3(GetBundleNameByPid, int32_t(const int pid, std::string &bundleName, int32_t &uid));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(const sptr<IAppDebugListener> &listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(const sptr<IAppDebugListener> &listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(RegisterAbilityDebugResponse, int32_t(const sptr<IAbilityDebugResponse> &response));
|
||||
MOCK_METHOD1(IsAttachDebug, bool(const std::string &bundleName));
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
const sptr<IQuickFixCallback>& callback, const int32_t recordId));
|
||||
MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &faultData));
|
||||
MOCK_METHOD1(ScheduleChangeAppGcState, int32_t(int32_t state));
|
||||
MOCK_METHOD0(AttachAppDebug, void());
|
||||
MOCK_METHOD1(AttachAppDebug, void(bool isDebugFromLocal));
|
||||
MOCK_METHOD0(DetachAppDebug, void());
|
||||
MOCK_METHOD1(ScheduleJsHeapMemory, void(OHOS::AppExecFwk::JsHeapDumpInfo &info));
|
||||
MOCK_METHOD2(SetAppWaitingDebug, int32_t(const std::string &bundleName, bool isPersist));
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
const sptr<IQuickFixCallback>& callback, const int32_t recordId));
|
||||
MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &faultData));
|
||||
MOCK_METHOD1(ScheduleChangeAppGcState, int32_t(int32_t state));
|
||||
MOCK_METHOD0(AttachAppDebug, void());
|
||||
MOCK_METHOD1(AttachAppDebug, void(bool isDebugFromLocal));
|
||||
MOCK_METHOD0(DetachAppDebug, void());
|
||||
MOCK_METHOD1(ScheduleJsHeapMemory, void(OHOS::AppExecFwk::JsHeapDumpInfo &info));
|
||||
MOCK_METHOD2(SetAppWaitingDebug, int32_t(const std::string &bundleName, bool isPersist));
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
MOCK_METHOD3(ScheduleNotifyUnLoadRepairPatch, int32_t(const std::string& bundleName,
|
||||
const sptr<IQuickFixCallback>& callback, const int32_t recordId));
|
||||
MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &faultData));
|
||||
MOCK_METHOD0(AttachAppDebug, void());
|
||||
MOCK_METHOD1(AttachAppDebug, void(bool isDebugFromLocal));
|
||||
MOCK_METHOD0(DetachAppDebug, void());
|
||||
MOCK_METHOD2(SetAppWaitingDebug, int32_t(const std::string &bundleName, bool isPersist));
|
||||
MOCK_METHOD0(CancelAppWaitingDebug, int32_t());
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
MOCK_METHOD3(ScheduleNotifyUnLoadRepairPatch, int32_t(const std::string& bundleName,
|
||||
const sptr<IQuickFixCallback>& callback, const int32_t recordId));
|
||||
MOCK_METHOD1(ScheduleNotifyAppFault, int32_t(const FaultData &faultData));
|
||||
MOCK_METHOD0(AttachAppDebug, void());
|
||||
MOCK_METHOD1(AttachAppDebug, void(bool isDebugFromLocal));
|
||||
MOCK_METHOD0(DetachAppDebug, void());
|
||||
MOCK_METHOD2(SetAppWaitingDebug, int32_t(const std::string &bundleName, bool isPersist));
|
||||
MOCK_METHOD0(CancelAppWaitingDebug, int32_t());
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AttachAppDebug() override
|
||||
void AttachAppDebug(bool isDebugFromLocal) override
|
||||
{}
|
||||
|
||||
void DetachAppDebug() override
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AttachAppDebug() override
|
||||
void AttachAppDebug(bool isDebugFromLocal) override
|
||||
{}
|
||||
|
||||
void DetachAppDebug() override
|
||||
|
||||
@@ -271,8 +271,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
MOCK_METHOD1(ScheduleChangeAppGcState, int32_t(int32_t state));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(const sptr<AppExecFwk::IAppDebugListener> &listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(const sptr<AppExecFwk::IAppDebugListener> &listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(RegisterAbilityDebugResponse, int32_t(const sptr<AppExecFwk::IAbilityDebugResponse> &response));
|
||||
MOCK_METHOD1(ScheduleJsHeapMemory, void(OHOS::AppExecFwk::JsHeapDumpInfo &info));
|
||||
|
||||
+2
-2
@@ -421,8 +421,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -421,8 +421,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -2550,7 +2550,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AttachAppDebug_0100, TestS
|
||||
{
|
||||
EXPECT_NE(proxy_, nullptr);
|
||||
std::string bundleName = "bundleName";
|
||||
auto result = proxy_->AttachAppDebug(bundleName);
|
||||
auto result = proxy_->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(result, NO_ERROR);
|
||||
}
|
||||
|
||||
@@ -2563,7 +2563,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_DetachAppDebug_0100, TestS
|
||||
{
|
||||
EXPECT_NE(proxy_, nullptr);
|
||||
std::string bundleName = "bundleName";
|
||||
auto result = proxy_->DetachAppDebug(bundleName);
|
||||
auto result = proxy_->DetachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(result, NO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -423,8 +423,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD1(IsAbilityControllerStart, bool(const Want& want));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
|
||||
+2
-2
@@ -1428,7 +1428,7 @@ HWTEST_F(AbilityManagerServiceFirstTest, AttachAppDebug_001, TestSize.Level1)
|
||||
{
|
||||
auto abilityMs_ = std::make_shared<AbilityManagerService>();
|
||||
std::string bundleName;
|
||||
abilityMs_->AttachAppDebug(bundleName);
|
||||
abilityMs_->AttachAppDebug(bundleName, false);
|
||||
EXPECT_NE(abilityMs_, nullptr);
|
||||
}
|
||||
|
||||
@@ -1442,7 +1442,7 @@ HWTEST_F(AbilityManagerServiceFirstTest, DetachAppDebug_001, TestSize.Level1)
|
||||
auto abilityMs_ = std::make_shared<AbilityManagerService>();
|
||||
EXPECT_NE(abilityMs_, nullptr);
|
||||
std::string bundleName;
|
||||
auto result = abilityMs_->DetachAppDebug(bundleName);
|
||||
auto result = abilityMs_->DetachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(result, CHECK_PERMISSION_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@@ -433,8 +433,8 @@ public:
|
||||
MOCK_METHOD2(PrepareTerminateAbilityBySCB, int32_t(const sptr<SessionInfo> &sessionInfo, bool &isPrepareTerminate));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD1(IsAbilityControllerStart, bool(const Want& want));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
|
||||
@@ -115,11 +115,11 @@ HWTEST_F(AmsMgrProxyTest, AttachAppDebug_0100, TestSize.Level1)
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
.WillOnce(Return(0));
|
||||
auto result = amsMgrProxy_->AttachAppDebug(STRING_BUNDLE_NAME);
|
||||
auto result = amsMgrProxy_->AttachAppDebug(STRING_BUNDLE_NAME, false);
|
||||
EXPECT_EQ(result, NO_ERROR);
|
||||
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, SendRequest(_, _, _, _)).Times(0);
|
||||
result = amsMgrProxy_->AttachAppDebug(EMPTY_BUNDLE_NAME);
|
||||
result = amsMgrProxy_->AttachAppDebug(EMPTY_BUNDLE_NAME, false);
|
||||
EXPECT_EQ(result, ERR_INVALID_DATA);
|
||||
}
|
||||
|
||||
|
||||
@@ -1267,7 +1267,7 @@ HWTEST_F(AmsMgrSchedulerSecondTest, AmsMgrSchedulerSecondTest_AttachAppDebug_001
|
||||
* @tc.steps: step1. amsMgrScheduler isReady false
|
||||
* @tc.expected: step1. expect ERR_INVALID_OPERATION
|
||||
*/
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("");
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("", false);
|
||||
EXPECT_EQ(ret, ERR_INVALID_OPERATION);
|
||||
TAG_LOGI(AAFwkTag::TEST, "AmsMgrSchedulerSecondTest_AttachAppDebug_001 end");
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ HWTEST_F(AmsMgrSchedulerSecondTest, AmsMgrSchedulerSecondTest_AttachAppDebug_002
|
||||
* @tc.expected: step1. expect ERR_INVALID_OPERATION
|
||||
*/
|
||||
MyFlag::flag_ = 0;
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("");
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("", false);
|
||||
EXPECT_EQ(ret, ERR_INVALID_OPERATION);
|
||||
TAG_LOGI(AAFwkTag::TEST, "AmsMgrSchedulerSecondTest_AttachAppDebug_002 end");
|
||||
}
|
||||
@@ -1311,7 +1311,7 @@ HWTEST_F(AmsMgrSchedulerSecondTest, AmsMgrSchedulerSecondTest_AttachAppDebug_003
|
||||
* @tc.expected: step1. expect ERR_INVALID_OPERATION
|
||||
*/
|
||||
MyFlag::flag_ = MyFlag::IS_SA_CALL;
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("");
|
||||
auto ret = amsMgrScheduler->AttachAppDebug("", false);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
TAG_LOGI(AAFwkTag::TEST, "AmsMgrSchedulerSecondTest_AttachAppDebug_003 end");
|
||||
}
|
||||
|
||||
@@ -907,12 +907,12 @@ HWTEST_F(AmsMgrSchedulerTest, AttachAppDebug_001, TestSize.Level0)
|
||||
auto amsMgrScheduler = std::make_unique<AmsMgrScheduler>(nullptr, nullptr);
|
||||
EXPECT_NE(amsMgrScheduler, nullptr);
|
||||
std::string bundleName = "";
|
||||
int32_t res = amsMgrScheduler->AttachAppDebug(bundleName);
|
||||
int32_t res = amsMgrScheduler->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(res, ERR_INVALID_OPERATION);
|
||||
|
||||
amsMgrScheduler->amsMgrServiceInner_ = GetMockAppMgrServiceInner();
|
||||
amsMgrScheduler->amsHandler_ = GetAmsTaskHandler();
|
||||
res = amsMgrScheduler->AttachAppDebug(bundleName);
|
||||
res = amsMgrScheduler->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(res, ERR_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ HWTEST_F(AmsMgrStubTest, HandleUnregisterAppDebugListener_0200, TestSize.Level1)
|
||||
HWTEST_F(AmsMgrStubTest, HandleAttachAppDebug_0100, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(mockAmsMgrScheduler_, nullptr);
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, AttachAppDebug(_)).Times(1);
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, AttachAppDebug(_, _)).Times(1);
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
@@ -179,7 +179,7 @@ HWTEST_F(AmsMgrStubTest, HandleAttachAppDebug_0100, TestSize.Level1)
|
||||
HWTEST_F(AmsMgrStubTest, HandleAttachAppDebug_0200, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(mockAmsMgrScheduler_, nullptr);
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, AttachAppDebug(_)).Times(0);
|
||||
EXPECT_CALL(*mockAmsMgrScheduler_, AttachAppDebug(_, _)).Times(0);
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
@@ -82,7 +82,7 @@ HWTEST_F(AppLifecycleDealTest, AttachAppDebug_001, TestSize.Level1)
|
||||
{
|
||||
auto appLifeCycle = std::make_shared<AppLifeCycleDeal>();
|
||||
EXPECT_NE(appLifeCycle, nullptr);
|
||||
auto result = appLifeCycle->AttachAppDebug();
|
||||
auto result = appLifeCycle->AttachAppDebug(false);
|
||||
EXPECT_EQ(result, ERR_INVALID_VALUE);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ HWTEST_F(AppLifecycleDealTest, AttachAppDebug_002, TestSize.Level1)
|
||||
EXPECT_NE(appLifeCycle, nullptr);
|
||||
sptr<MockAppScheduler> mockAppScheduler = new (std::nothrow) MockAppScheduler();
|
||||
appLifeCycle->SetApplicationClient(mockAppScheduler);
|
||||
auto result = appLifeCycle->AttachAppDebug();
|
||||
auto result = appLifeCycle->AttachAppDebug(false);
|
||||
EXPECT_EQ(ERR_OK, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -908,7 +908,7 @@ HWTEST_F(AppMgrClientTest, AppMgrClient_AttachAppDebug_001, TestSize.Level1)
|
||||
EXPECT_EQ(result, AppMgrResultCode::RESULT_OK);
|
||||
|
||||
std::string bundleName = "bundleName";
|
||||
auto resultCode = appMgrClient->AttachAppDebug(bundleName);
|
||||
auto resultCode = appMgrClient->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(resultCode, ERR_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -3541,7 +3541,7 @@ HWTEST_F(AppMgrServiceInnerTest, AttachAppDebug_001, TestSize.Level0)
|
||||
std::string bundleName;
|
||||
appMgrServiceInner->appRunningManager_ = std::make_shared<AppRunningManager>();
|
||||
appMgrServiceInner->appDebugManager_ = std::make_shared<AppDebugManager>();
|
||||
auto result = appMgrServiceInner->AttachAppDebug(bundleName);
|
||||
auto result = appMgrServiceInner->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(result, ERR_OK);
|
||||
}
|
||||
|
||||
@@ -3557,7 +3557,7 @@ HWTEST_F(AppMgrServiceInnerTest, AttachAppDebug_002, TestSize.Level0)
|
||||
std::string bundleName;
|
||||
appMgrServiceInner->appRunningManager_ = nullptr;
|
||||
appMgrServiceInner->appDebugManager_ = std::make_shared<AppDebugManager>();
|
||||
auto result = appMgrServiceInner->AttachAppDebug(bundleName);
|
||||
auto result = appMgrServiceInner->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(result, ERR_NO_INIT);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ HWTEST_F(AppRunningManagerTest, AppRunningManager_SetAttachAppDebug_0100, TestSi
|
||||
std::string processName;
|
||||
auto appRunningRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
appRunningManager->appRunningRecordMap_.insert(make_pair(RECORD_ID, appRunningRecord));
|
||||
appRunningManager->SetAttachAppDebug(bundleName, true);
|
||||
appRunningManager->SetAttachAppDebug(bundleName, true, false);
|
||||
for (const auto &item : appRunningManager->appRunningRecordMap_) {
|
||||
const auto &appRecord = item.second;
|
||||
if (appRecord->GetBundleName() == bundleName) {
|
||||
appRecord->SetAttachDebug(true);
|
||||
appRecord->SetAttachDebug(true, false);
|
||||
EXPECT_EQ(appRecord->isAttachDebug_, true);
|
||||
}
|
||||
}
|
||||
@@ -102,11 +102,11 @@ HWTEST_F(AppRunningManagerTest, AppRunningManager_SetAttachAppDebug_0200, TestSi
|
||||
std::string processName;
|
||||
auto appRunningRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
appRunningManager->appRunningRecordMap_.insert(make_pair(RECORD_ID, appRunningRecord));
|
||||
appRunningManager->SetAttachAppDebug(bundleName, isAttachDebug);
|
||||
appRunningManager->SetAttachAppDebug(bundleName, isAttachDebug, false);
|
||||
for (const auto &item : appRunningManager->appRunningRecordMap_) {
|
||||
const auto &appRecord = item.second;
|
||||
if (appRecord->GetBundleName() == bundleName) {
|
||||
appRecord->SetAttachDebug(true);
|
||||
appRecord->SetAttachDebug(true, false);
|
||||
EXPECT_EQ(appRecord->isAttachDebug_, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ HWTEST_F(AppRunningRecordTest, AppRunningRecord_SetAttachDebug_0100, TestSize.Le
|
||||
std::string processName;
|
||||
auto appRunningRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
EXPECT_NE(appRunningRecord, nullptr);
|
||||
appRunningRecord->SetAttachDebug(isAttachDebug);
|
||||
appRunningRecord->SetAttachDebug(isAttachDebug, false);
|
||||
EXPECT_EQ(appRunningRecord->isAttachDebug_, true);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ HWTEST_F(AppRunningRecordTest, AppRunningRecord_SetAttachDebug_0200, TestSize.Le
|
||||
std::string processName;
|
||||
auto appRunningRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
EXPECT_NE(appRunningRecord, nullptr);
|
||||
appRunningRecord->SetAttachDebug(isAttachDebug);
|
||||
appRunningRecord->SetAttachDebug(isAttachDebug, false);
|
||||
EXPECT_EQ(appRunningRecord->isAttachDebug_, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ HWTEST_F(AppSchedulerHostTest, ScheduleChangeAppGcState_001, TestSize.Level1)
|
||||
HWTEST_F(AppSchedulerHostTest, HandleAttachAppDebug_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(mockAppScheduler_, nullptr);
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug()).Times(1);
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug(_)).Times(1);
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@@ -129,7 +129,7 @@ HWTEST_F(AppSchedulerHostTest, HandleAttachAppDebug_001, TestSize.Level1)
|
||||
HWTEST_F(AppSchedulerHostTest, HandleAttachAppDebug_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(mockAppScheduler_, nullptr);
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug()).Times(0);
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug(_)).Times(0);
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
@@ -95,8 +95,8 @@ HWTEST_F(AppSchedulerProxyTest, AttachAppDebug_001, TestSize.Level1)
|
||||
sptr<AppSchedulerProxy> appSchedulerProxy = new AppSchedulerProxy(mockAppScheduler_);
|
||||
EXPECT_NE(appSchedulerProxy, nullptr);
|
||||
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug()).Times(1);
|
||||
appSchedulerProxy->AttachAppDebug();
|
||||
EXPECT_CALL(*mockAppScheduler_, AttachAppDebug(_)).Times(1);
|
||||
appSchedulerProxy->AttachAppDebug(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1111,7 +1111,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_AttachAppDebug_001, TestSize.Level1)
|
||||
{
|
||||
AAFwk::IsMockSaCall::IsMockSpecificSystemAbilityAccessPermission();
|
||||
std::string bundleName = "bundleName";
|
||||
int res = DelayedSingleton<AppScheduler>::GetInstance()->AttachAppDebug(bundleName);
|
||||
int res = DelayedSingleton<AppScheduler>::GetInstance()->AttachAppDebug(bundleName, false);
|
||||
EXPECT_EQ(res, ERR_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,10 @@ HWTEST_F(HdcRegisterTest, HdcRegisterTest_0100, TestSize.Level0)
|
||||
bool debugApp = true;
|
||||
auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
|
||||
|
||||
pHdcRegister.StartHdcRegister(bundleName, processName, debugApp, nullptr);
|
||||
pHdcRegister.StartHdcRegister(bundleName, processName, debugApp,
|
||||
AbilityRuntime::HdcRegister::DebugRegisterMode::HDC_DEBUG_REG, nullptr);
|
||||
|
||||
EXPECT_NE(pHdcRegister.registerHandler_, nullptr);
|
||||
EXPECT_NE(pHdcRegister.registerHdcHandler_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,10 +72,10 @@ HWTEST_F(HdcRegisterTest, HdcRegisterTest_0100, TestSize.Level0)
|
||||
HWTEST_F(HdcRegisterTest, HdcRegisterTest_0200, TestSize.Level0)
|
||||
{
|
||||
auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
|
||||
pHdcRegister.registerHandler_ = nullptr;
|
||||
pHdcRegister.registerHdcHandler_ = nullptr;
|
||||
pHdcRegister.StopHdcRegister();
|
||||
|
||||
EXPECT_EQ(pHdcRegister.registerHandler_, nullptr);
|
||||
EXPECT_EQ(pHdcRegister.registerHdcHandler_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,10 +89,11 @@ HWTEST_F(HdcRegisterTest, HdcRegisterTest_0300, TestSize.Level0)
|
||||
const std::string bundleName = "123";
|
||||
bool debugApp = true;
|
||||
auto &pHdcRegister = AbilityRuntime::HdcRegister::Get();
|
||||
pHdcRegister.StartHdcRegister(bundleName, processName, debugApp, nullptr);
|
||||
pHdcRegister.StartHdcRegister(bundleName, processName, debugApp,
|
||||
AbilityRuntime::HdcRegister::DebugRegisterMode::HDC_DEBUG_REG, nullptr);
|
||||
pHdcRegister.StopHdcRegister();
|
||||
|
||||
EXPECT_EQ(pHdcRegister.registerHandler_, nullptr);
|
||||
EXPECT_EQ(pHdcRegister.registerHdcHandler_, nullptr);
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -397,8 +397,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -276,8 +276,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
@@ -272,8 +272,8 @@ public:
|
||||
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionValidResult>&));
|
||||
MOCK_METHOD1(RegisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(UnregisterAppDebugListener, int32_t(sptr<AppExecFwk::IAppDebugListener> listener));
|
||||
MOCK_METHOD1(AttachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD1(DetachAppDebug, int32_t(const std::string &bundleName));
|
||||
MOCK_METHOD2(AttachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD2(DetachAppDebug, int32_t(const std::string &bundleName, bool isDebugFromLocal));
|
||||
MOCK_METHOD3(ExecuteIntent, int32_t(uint64_t key, const sptr<IRemoteObject> &callerToken,
|
||||
const InsightIntentExecuteParam ¶m));
|
||||
MOCK_METHOD3(ExecuteInsightIntentDone, int32_t(const sptr<IRemoteObject> &token, uint64_t intentId,
|
||||
|
||||
Reference in New Issue
Block a user