diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h index 9b9f80197c..5304806fac 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -27,6 +27,7 @@ #include "ability_start_setting.h" #include "extension_running_info.h" #include "iability_controller.h" +#include "icomponent_interception.h" #include "mission_listener_interface.h" #include "mission_info.h" #include "mission_snapshot.h" @@ -551,6 +552,14 @@ public: virtual int SetAbilityController(const sptr &abilityController, bool imAStabilityTest) = 0; + /** + * Set component interception. + * + * @param componentInterception, component interception. + * @return Returns ERR_OK on success, others on failure. + */ + virtual int SetComponentInterception(const sptr &componentInterception) {}; + /** * Is user a stability test. * @@ -860,6 +869,8 @@ public: // stop extension ability (61) STOP_EXTENSION_ABILITY, + SET_COMPONENT_INTERCEPTION, + // ipc id 1001-2000 for DMS // ipc id for starting ability (1001) START_ABILITY = 1001, diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 99694ee87f..43ea33c7cc 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -69,6 +69,8 @@ ohos_shared_library("app_manager") { "src/appmgr/app_task_info.cpp", "src/appmgr/application_state_observer_proxy.cpp", "src/appmgr/application_state_observer_stub.cpp", + "src/appmgr/component_interception_proxy.cpp", + "src/appmgr/component_interception_stub.cpp", "src/appmgr/configuration_observer_proxy.cpp", "src/appmgr/configuration_observer_stub.cpp", "src/appmgr/priority_object.cpp", diff --git a/interfaces/inner_api/app_manager/include/appmgr/component_interception_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/component_interception_proxy.h new file mode 100755 index 0000000000..06b9ec3104 --- /dev/null +++ b/interfaces/inner_api/app_manager/include/appmgr/component_interception_proxy.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_PROXY_H +#define OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_PROXY_H + +#include "iremote_proxy.h" +#include "icomponent_interception.h" + +namespace OHOS { +namespace AppExecFwk { +/** + * @brief Interface to monitor what is happening in component manager. + */ +class ComponentInterceptionProxy : public IRemoteProxy { +public: + explicit ComponentInterceptionProxy(const sptr &impl); + virtual ~ComponentInterceptionProxy() = default; + + /** + * The system is trying to start an component. + * + * @param want The want of component to start. + * @param callerToken Caller component token. + * @param requestCode the requestCode of the component to start. + * @param componentStatus the status of component. + * @param extraParam The extra param of component to start. + * @return Return true to allow component to start, or false to reject. + */ + virtual bool AllowComponentStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, sptr &extraParam) override; + +private: + bool WriteInterfaceToken(MessageParcel &data); + void SetExtraParam(const sptr &want, sptr &extraParam); + static inline BrokerDelegator delegator_; +}; +} // namespace AppExecFwk +} // namespace OHOS +#endif diff --git a/interfaces/inner_api/app_manager/include/appmgr/component_interception_stub.h b/interfaces/inner_api/app_manager/include/appmgr/component_interception_stub.h new file mode 100755 index 0000000000..b0f9db225a --- /dev/null +++ b/interfaces/inner_api/app_manager/include/appmgr/component_interception_stub.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_STUB_H +#define OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_STUB_H + +#include "iremote_stub.h" +#include "icomponent_interception.h" + +namespace OHOS { +namespace AppExecFwk { +/** + * @brief Interface to monitor what is happening in component manager. + */ +class ComponentInterceptionStub : public IRemoteStub { +public: + ComponentInterceptionStub(); + virtual ~ComponentInterceptionStub(); + + virtual int OnRemoteRequest( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + + /** + * The system is trying to start an component. + * + * @param want The want of component to start. + * @param callerToken Caller component token. + * @param requestCode the requestCode of the component to start. + * @param componentStatus the status of component. + * @param extraParam The extra param of component to start. + * @return Return true to allow component to start, or false to reject. + */ + virtual bool AllowComponentStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, sptr &extraParam) override; + +private: + using ComponentInterceptionFunc = int32_t (ComponentInterceptionStub::*) + (MessageParcel &data, MessageParcel &reply); + std::map requestFuncMap_; + int32_t HandleAllowComponentStart(MessageParcel &data, MessageParcel &reply); + + DISALLOW_COPY_AND_MOVE(ComponentInterceptionStub); +}; +} // namespace AppExecFwk +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_STUB_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/icomponent_interception.h b/interfaces/inner_api/app_manager/include/appmgr/icomponent_interception.h new file mode 100755 index 0000000000..3d746b8e18 --- /dev/null +++ b/interfaces/inner_api/app_manager/include/appmgr/icomponent_interception.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_H +#define OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_H + +#include "iremote_broker.h" +#include "iremote_object.h" +#include "want.h" + +namespace OHOS { +namespace AppExecFwk { +using OHOS::AAFwk::Want; + +/** + * @brief Interface to monitor what is happening in component manager. + */ +class IComponentInterception : public IRemoteBroker { +public: + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IComponentInterception"); + + /** + * The system is trying to start an component. + * + * @param want The want of component to start. + * @param callerToken Caller component token. + * @param requestCode the requestCode of the component to start. + * @param componentStatus the status of component. + * @param extraParam The extra param of component to start. + * @return Return true to allow component to start, or false to reject. + */ + virtual bool AllowComponentStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, sptr &extraParam) = 0; + + enum class Message { + TRANSACT_ON_ALLOW_COMPONENT_START = 1, + }; +}; +} // namespace AppExecFwk +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_COMPONENT_INTERCEPTION_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/component_interception_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/component_interception_proxy.cpp new file mode 100755 index 0000000000..1f9746099e --- /dev/null +++ b/interfaces/inner_api/app_manager/src/appmgr/component_interception_proxy.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "component_interception_proxy.h" + +#include "hilog_wrapper.h" +#include "ipc_types.h" + + +namespace OHOS { +namespace AppExecFwk { +ComponentInterceptionProxy::ComponentInterceptionProxy( + const sptr &impl) : IRemoteProxy(impl) +{} + +bool ComponentInterceptionProxy::WriteInterfaceToken(MessageParcel &data) +{ + if (!data.WriteInterfaceToken(ComponentInterceptionProxy::GetDescriptor())) { + HILOG_ERROR("write interface token failed"); + return false; + } + return true; +} + +bool ComponentInterceptionProxy::AllowComponentStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, sptr &extraParam) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_SYNC); + if (!WriteInterfaceToken(data)) { + return true; + } + data.WriteParcelable(&want); + data.WriteRemoteObject(callerToken); + data.WriteInt32(requestCode); + data.WriteInt32(componentStatus); + sptr remote = Remote(); + if (remote == nullptr) { + HILOG_ERROR("Remote() is NULL"); + return true; + } + int32_t ret = remote->SendRequest( + static_cast(IComponentInterception::Message::TRANSACT_ON_ALLOW_COMPONENT_START), + data, reply, option); + if (ret != NO_ERROR) { + HILOG_WARN("SendRequest is failed, error code: %{public}d", ret); + return true; + } + + bool hasExtraParam = reply.ReadBool(); + if (hasExtraParam) { + sptr tempWant = reply.ReadParcelable(); + if (tempWant != nullptr) { + SetExtraParam(tempWant, extraParam); + } + } + return reply.ReadBool(); +} + +void ComponentInterceptionProxy::SetExtraParam(const sptr &want, sptr &extraParam) +{ + sptr tempCallBack = want->GetRemoteObject(Want::PARAM_RESV_ABILITY_INFO_CALLBACK); + if (tempCallBack == nullptr) { + return; + } + extraParam->SetParam(Want::PARAM_RESV_REQUEST_PROC_CODE, + want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0)); + extraParam->SetParam(Want::PARAM_RESV_REQUEST_TOKEN_CODE, + want->GetIntParam(Want::PARAM_RESV_REQUEST_TOKEN_CODE, 0)); + extraParam->SetParam(Want::PARAM_RESV_ABILITY_INFO_CALLBACK, tempCallBack); +} +} // namespace AppExecFwk +} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/component_interception_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/component_interception_stub.cpp new file mode 100755 index 0000000000..446c30f03e --- /dev/null +++ b/interfaces/inner_api/app_manager/src/appmgr/component_interception_stub.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "component_interception_stub.h" +#include "appexecfwk_errors.h" +#include "hilog_wrapper.h" +#include "ipc_types.h" +#include "iremote_object.h" + +namespace OHOS { +namespace AppExecFwk { +ComponentInterceptionStub::ComponentInterceptionStub() +{ + requestFuncMap_[static_cast( + IComponentInterception::Message::TRANSACT_ON_ALLOW_COMPONENT_START)] = + &ComponentInterceptionStub::HandleAllowComponentStart; +} + +ComponentInterceptionStub::~ComponentInterceptionStub() +{ + requestFuncMap_.clear(); +} + +int ComponentInterceptionStub::OnRemoteRequest( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) +{ + HILOG_INFO("ComponentInterceptionStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + std::u16string descriptor = ComponentInterceptionStub::GetDescriptor(); + std::u16string remoteDescriptor = data.ReadInterfaceToken(); + if (descriptor != remoteDescriptor) { + HILOG_ERROR("local descriptor is not equal to remote"); + return ERR_INVALID_STATE; + } + + auto itFunc = requestFuncMap_.find(code); + if (itFunc != requestFuncMap_.end()) { + auto requestFunc = itFunc->second; + if (requestFunc != nullptr) { + return (this->*requestFunc)(data, reply); + } + } + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); +} + +bool ComponentInterceptionStub::AllowComponentStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, sptr &extraParam) +{ + return true; +} + +int32_t ComponentInterceptionStub::HandleAllowComponentStart(MessageParcel &data, MessageParcel &reply) +{ + HILOG_INFO("HandleAllowComponentStart"); + std::unique_ptr want(data.ReadParcelable()); + if (!want) { + HILOG_ERROR("ReadParcelable failed"); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + sptr token = data.ReadRemoteObject(); + int requestCode = data.ReadInt32(); + int componentStatus = data.ReadInt32(); + + sptr extraParam = new (std::nothrow) Want(); + bool result = AllowComponentStart(*want, token, requestCode, componentStatus, extraParam); + if (want->GetRemoteObject(Want::PARAM_RESV_ABILITY_INFO_CALLBACK)) { + reply.WriteBool(true); + reply.WriteParcelable(extraParam); + } else { + reply.WriteBool(false); + } + reply.WriteBool(result); + return NO_ERROR; +} +} // namespace AppExecFwk +} // namespace OHOS diff --git a/services/abilitymgr/include/ability_manager_proxy.h b/services/abilitymgr/include/ability_manager_proxy.h index b8d3ff4828..5fd932a555 100644 --- a/services/abilitymgr/include/ability_manager_proxy.h +++ b/services/abilitymgr/include/ability_manager_proxy.h @@ -475,6 +475,9 @@ public: virtual int SetAbilityController(const sptr &abilityController, bool imAStabilityTest) override; + virtual int SetComponentInterception( + const sptr &componentInterception) override; + /** * Is user a stability test. * diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 564b4bcb9b..951e108884 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -713,6 +713,14 @@ public: */ virtual int DoAbilityBackground(const sptr &token, uint32_t flag) override; + /** + * Set component interception. + * + * @param componentInterception, component interception. + * @return Returns ERR_OK on success, others on failure. + */ + virtual int SetComponentInterception(const sptr &componentInterception) override; + bool IsAbilityControllerStart(const Want &want, const std::string &bundleName); bool IsAbilityControllerForeground(const std::string &bundleName); @@ -721,6 +729,9 @@ public: void GrantUriPermission(const Want &want, int32_t validUserId, uint32_t targetTokenId); + bool IsComponentInterceptionStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, AbilityRequest &request); + /** * Send not response process ID to ability manager service. * @param pid The not response process ID. @@ -1164,6 +1175,8 @@ private: void InitStartupFlag(); + void UpdateAbilityRequestInfo(const sptr &want, AbilityRequest &request); + constexpr static int REPOLL_TIME_MICRO_SECONDS = 1000000; constexpr static int WAITING_BOOT_ANIMATION_TIMER = 5; @@ -1193,6 +1206,7 @@ private: bool controllerIsAStabilityTest_ = false; std::recursive_mutex globalLock_; std::shared_mutex managersMutex_; + sptr componentInterception_ = nullptr; std::multimap timeoutMap_; diff --git a/services/abilitymgr/include/ability_manager_stub.h b/services/abilitymgr/include/ability_manager_stub.h index 1c9ff1666a..c46c54b7ed 100644 --- a/services/abilitymgr/include/ability_manager_stub.h +++ b/services/abilitymgr/include/ability_manager_stub.h @@ -150,6 +150,7 @@ private: int SendANRProcessIDInner(MessageParcel &data, MessageParcel &reply); int SetAbilityControllerInner(MessageParcel &data, MessageParcel &reply); + int SetComponentInterceptionInner(MessageParcel &data, MessageParcel &reply); int StartUserTestInner(MessageParcel &data, MessageParcel &reply); int FinishUserTestInner(MessageParcel &data, MessageParcel &reply); diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp index 1ac3ca199f..3efef2f6c2 100644 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -2294,6 +2294,30 @@ int AbilityManagerProxy::SetAbilityController(const sptr &componentInterception) +{ + if (!componentInterception) { + HILOG_ERROR("componentInterception nullptr"); + return ERR_INVALID_VALUE; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!WriteInterfaceToken(data)) { + return INNER_ERR; + } + if (!data.WriteRemoteObject(componentInterception->AsObject())) { + HILOG_ERROR("componentInterception write failed."); + return ERR_INVALID_VALUE; + } + auto error = Remote()->SendRequest(IAbilityManager::SET_COMPONENT_INTERCEPTION, data, reply, option); + if (error != NO_ERROR) { + HILOG_ERROR("Send request error: %{public}d", error); + return error; + } + return reply.ReadInt32(); +} + bool AbilityManagerProxy::IsRunningInStabilityTest() { MessageParcel data; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 0bde25d390..29d23fa7bf 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -579,6 +579,10 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptrVerifyMissionPermission(); - if (isPerm) { - sptr abilityInfoCallback = want.GetRemoteObject("abilityInfoCallback"); - if (abilityInfoCallback != nullptr) { + sptr abilityInfoCallback = want.GetRemoteObject(Want::PARAM_RESV_ABILITY_INFO_CALLBACK); + if (abilityInfoCallback != nullptr) { + auto isPerm = AAFwk::PermissionVerification::GetInstance()->IsGatewayCall(); + if (isPerm) { request.abilityInfoCallback = abilityInfoCallback; } } @@ -5706,5 +5710,54 @@ bool AbilityManagerService::JudgeSelfCalled(const std::shared_ptr return true; } + +int AbilityManagerService::SetComponentInterception( + const sptr &componentInterception) +{ + HILOG_DEBUG("%{public}s", __func__); + auto isPerm = AAFwk::PermissionVerification::GetInstance()->IsGatewayCall(); + if (!isPerm) { + HILOG_ERROR("%{public}s: Permission verification failed", __func__); + return CHECK_PERMISSION_FAILED; + } + + std::lock_guard guard(globalLock_); + componentInterception_ = componentInterception; + HILOG_DEBUG("%{public}s, end", __func__); + return ERR_OK; +} + +bool AbilityManagerService::IsComponentInterceptionStart(const Want &want, const sptr &callerToken, + int requestCode, int componentStatus, AbilityRequest &request) +{ + if (componentInterception_ != nullptr) { + HILOG_DEBUG("%{public}s", __func__); + sptr extraParam = new (std::nothrow) Want(); + bool isStart = componentInterception_->AllowComponentStart(want, callerToken, + requestCode, componentStatus, extraParam); + UpdateAbilityRequestInfo(extraParam, request); + if (!isStart) { + HILOG_INFO("not finishing start component because interception"); + return false; + } + } + return true; +} + +void AbilityManagerService::UpdateAbilityRequestInfo(const sptr &want, AbilityRequest &request) +{ + if (want == nullptr) { + return; + } + sptr tempCallBack = want->GetRemoteObject(Want::PARAM_RESV_ABILITY_INFO_CALLBACK); + if (tempCallBack == nullptr) { + return; + } + request.want.SetParam(Want::PARAM_RESV_REQUEST_PROC_CODE, + want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0)); + request.want.SetParam(Want::PARAM_RESV_REQUEST_TOKEN_CODE, + want->GetIntParam(Want::PARAM_RESV_REQUEST_TOKEN_CODE, 0)); + request.abilityInfoCallback = tempCallBack; +} } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/ability_manager_stub.cpp b/services/abilitymgr/src/ability_manager_stub.cpp index 4192d082c4..2eec842444 100644 --- a/services/abilitymgr/src/ability_manager_stub.cpp +++ b/services/abilitymgr/src/ability_manager_stub.cpp @@ -151,6 +151,7 @@ void AbilityManagerStub::ThirdStepInit() requestFuncMap_[REGISTER_WMS_HANDLER] = &AbilityManagerStub::RegisterWindowManagerServiceHandlerInner; requestFuncMap_[COMPLETEFIRSTFRAMEDRAWING] = &AbilityManagerStub::CompleteFirstFrameDrawingInner; #endif + requestFuncMap_[SET_COMPONENT_INTERCEPTION] = &AbilityManagerStub::SetComponentInterceptionInner; } int AbilityManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) @@ -1255,6 +1256,23 @@ int AbilityManagerStub::SetAbilityControllerInner(MessageParcel &data, MessagePa return NO_ERROR; } +int AbilityManagerStub::SetComponentInterceptionInner(MessageParcel &data, MessageParcel &reply) +{ + sptr componentInterception = + iface_cast(data.ReadRemoteObject()); + if (componentInterception == nullptr) { + HILOG_ERROR("AbilityManagerStub: SetComponentInterceptionInner readParcelable failed!"); + return ERR_NULL_OBJECT; + } + int32_t result = SetComponentInterception(componentInterception); + HILOG_INFO("AbilityManagerStub: SetComponentInterceptionInner result = %{public}d", result); + if (!reply.WriteInt32(result)) { + HILOG_ERROR("SetComponentInterceptionInner failed."); + return ERR_INVALID_VALUE; + } + return NO_ERROR; +} + int AbilityManagerStub::IsRunningInStabilityTestInner(MessageParcel &data, MessageParcel &reply) { bool result = IsRunningInStabilityTest(); diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 9f071d4371..29bf0ac385 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -171,7 +171,7 @@ void AppMgrServiceInner::LoadAbility(const sptr &token, const spt StartProcess(abilityInfo->applicationName, processName, startFlags, appRecord, appInfo->uid, appInfo->bundleName, bundleIndex); } else { - appRecord->SetRequestProcCode((want == nullptr) ? 0 : want->GetIntParam("requestProcCode", 0)); + appRecord->SetRequestProcCode((want == nullptr) ? 0 : want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0)); StartAbility(token, preToken, abilityInfo, appRecord, hapModuleInfo, want); } PerfProfile::GetInstance().SetAbilityLoadEndTime(GetTickCount()); @@ -880,7 +880,7 @@ std::shared_ptr AppMgrServiceInner::CreateAppRunningRecord(con } appRecord->SetAppIndex(want->GetIntParam(DLP_PARAMS_INDEX, 0)); appRecord->SetSecurityFlag(want->GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false)); - appRecord->SetRequestProcCode(want->GetIntParam("requestProcCode", 0)); + appRecord->SetRequestProcCode(want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0)); } if (preToken) {