diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 1399bc36a1..4665831bc5 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -119,6 +119,7 @@ ohos_shared_library("app_manager") { "src/appmgr/start_specified_ability_response_proxy.cpp", "src/appmgr/start_specified_ability_response_stub.cpp", "src/appmgr/system_memory_attr.cpp", + "src/appmgr/process_bind_data.cpp", ] public_configs = [ diff --git a/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_proxy.h index 3ddf984b05..e9c663dc3e 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_proxy.h +++ b/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_proxy.h @@ -142,6 +142,12 @@ public: */ virtual void OnAppCacheStateChanged(const AppStateData &appStateData) override; + /** + * Will be called when bindingRelation change. + * + * @param processBindData Process bind data. + */ + virtual void OnProcessBindingRelationChanged(const ProcessBindData &processBindData) override; private: bool WriteInterfaceToken(MessageParcel &data); static inline BrokerDelegator delegator_; diff --git a/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_stub.h b/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_stub.h index e4fa2bf22a..36bc2939b0 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_stub.h +++ b/interfaces/inner_api/app_manager/include/appmgr/application_state_observer_stub.h @@ -144,6 +144,12 @@ public: */ virtual void OnAppCacheStateChanged(const AppStateData &appStateData) override; + /** + * Will be called when bindingRelation change. + * + * @param processBindData Process bind data. + */ + virtual void OnProcessBindingRelationChanged(const ProcessBindData &processBindData) override; private: int32_t HandleOnForegroundApplicationChanged(MessageParcel &data, MessageParcel &reply); @@ -177,6 +183,8 @@ private: int32_t HandleOnAppCacheStateChanged(MessageParcel &data, MessageParcel &reply); + int32_t HandleOnProcessBindingRelationChanged(MessageParcel &data, MessageParcel &reply); + static std::mutex callbackMutex_; DISALLOW_COPY_AND_MOVE(ApplicationStateObserverStub); diff --git a/interfaces/inner_api/app_manager/include/appmgr/iapplication_state_observer.h b/interfaces/inner_api/app_manager/include/appmgr/iapplication_state_observer.h index 71a415efb0..34772b8c15 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/iapplication_state_observer.h +++ b/interfaces/inner_api/app_manager/include/appmgr/iapplication_state_observer.h @@ -20,6 +20,7 @@ #include "app_state_data.h" #include "page_state_data.h" #include "process_data.h" +#include "process_bind_data.h" #include "iremote_broker.h" #include "iremote_object.h" @@ -143,6 +144,13 @@ public: */ virtual void OnAppCacheStateChanged(const AppStateData &appStateData) {}; + /** + * Will be called when bindingRelation change. + * + * @param processBindData Process bind data. + */ + virtual void OnProcessBindingRelationChanged(const ProcessBindData &processBindData) {}; + enum class Message { TRANSACT_ON_FOREGROUND_APPLICATION_CHANGED = 0, TRANSACT_ON_ABILITY_STATE_CHANGED, @@ -160,6 +168,7 @@ public: TRANSACT_ON_APP_CACHE_STATE_CHANGED, TRANSACT_ON_WINDOW_SHOW, TRANSACT_ON_WINDOW_HIDDEN, + TRANSACT_ON_PROCESS_BINDINGRELATION_CHANGED, }; }; } // namespace AppExecFwk diff --git a/interfaces/inner_api/app_manager/include/appmgr/process_bind_data.h b/interfaces/inner_api/app_manager/include/appmgr/process_bind_data.h new file mode 100644 index 0000000000..ae1c0c8c75 --- /dev/null +++ b/interfaces/inner_api/app_manager/include/appmgr/process_bind_data.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2025 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_PROCESS_BIND_DATA_H +#define OHOS_ABILITY_RUNTIME_PROCESS_BIND_DATA_H + +#include + +#include "iremote_object.h" +#include "parcel.h" +#include "running_process_info.h" + +namespace OHOS { +namespace AppExecFwk { +struct UIExtensionProcessBindInfo { + std::string bundleName; + int32_t pid = 0; + int32_t uid = 0; + bool isKeepAlive = false; + ProcessType processType = ProcessType::NORMAL; + ExtensionAbilityType extensionType = ExtensionAbilityType::UNSPECIFIED; + int32_t callerPid = -1; + int32_t callerUid = -1; + std::string callerBundleName; + int32_t notifyProcessBind = -1; +}; +struct ProcessBindData : public Parcelable { + /** + * @brief read this Sequenceable object from a Parcel. + * + * @param inParcel Indicates the Parcel object into which the Sequenceable + * object has been marshaled. + * @return Returns true if read successed; returns false otherwise. + */ + bool ReadFromParcel(Parcel &parcel); + + /** + * @brief Marshals this Sequenceable object into a Parcel. + * + * @param outParcel Indicates the Parcel object to which the Sequenceable + * object will be marshaled. + */ + virtual bool Marshalling(Parcel &parcel) const override; + + /** + * @brief Unmarshals this Sequenceable object from a Parcel. + * + * @param inParcel Indicates the Parcel object into which the Sequenceable + * object has been marshaled. + */ + static ProcessBindData *Unmarshalling(Parcel &parcel); + + std::string bundleName; + int32_t pid = 0; + int32_t uid = 0; + bool isKeepAlive = false; + ProcessType processType = ProcessType::NORMAL; + ExtensionAbilityType extensionType = ExtensionAbilityType::UNSPECIFIED; + int32_t callerPid = -1; + int32_t callerUid = -1; + std::string callerBundleName; + std::vector bindInfos; + // 0:unBind 1:Bind + int32_t bindingRelation; +}; +} // namespace AppExecFwk +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_PROCESS_BIND_DATA_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_proxy.cpp index 06a9985b0d..4ea43e3bfb 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_proxy.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_proxy.cpp @@ -394,5 +394,26 @@ int32_t ApplicationStateObserverProxy::SendTransactCmd(uint32_t code, MessagePar return remote->SendRequest(code, data, reply, option); } + +void ApplicationStateObserverProxy::OnProcessBindingRelationChanged(const ProcessBindData &processBindData) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); + if (!WriteInterfaceToken(data)) { + return; + } + if (!data.WriteParcelable(&processBindData)) { + TAG_LOGE(AAFwkTag::APPMGR, "write processData failed"); + return; + } + int32_t ret = SendTransactCmd( + static_cast(IApplicationStateObserver::Message::TRANSACT_ON_PROCESS_BINDINGRELATION_CHANGED), + data, reply, option); + if (ret != NO_ERROR && ret != ERR_INVALID_STUB) { + TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is wrong, error code: %{public}d, bundleName:%{public}s.", + ret, processBindData.bundleName.c_str()); + } +} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_stub.cpp index af7049b986..19cdf6d8a0 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/application_state_observer_stub.cpp @@ -65,6 +65,8 @@ int ApplicationStateObserverStub::OnRemoteRequest( return HandleOnWindowShow(data, reply); case Message::TRANSACT_ON_WINDOW_HIDDEN: return HandleOnWindowHidden(data, reply); + case Message::TRANSACT_ON_PROCESS_BINDINGRELATION_CHANGED: + return HandleOnProcessBindingRelationChanged(data, reply); } TAG_LOGW(AAFwkTag::APPMGR, "ApplicationStateObserverStub::OnRemoteRequest, default case, need check"); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); @@ -124,6 +126,9 @@ void ApplicationStateObserverStub::OnPageHide(const PageStateData &pageStateData void ApplicationStateObserverStub::OnAppCacheStateChanged(const AppStateData &appStateData) {} +void ApplicationStateObserverStub::OnProcessBindingRelationChanged(const ProcessBindData &processBindData) +{} + int32_t ApplicationStateObserverStub::HandleOnForegroundApplicationChanged(MessageParcel &data, MessageParcel &reply) { std::unique_ptr processData(data.ReadParcelable()); @@ -340,6 +345,18 @@ int32_t ApplicationStateObserverStub::HandleOnAppCacheStateChanged(MessageParcel return NO_ERROR; } +int32_t ApplicationStateObserverStub::HandleOnProcessBindingRelationChanged(MessageParcel &data, MessageParcel &reply) +{ + std::unique_ptr processBindData(data.ReadParcelable()); + if (!processBindData) { + TAG_LOGE(AAFwkTag::APPMGR, "ReadParcelable failed"); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + + OnProcessBindingRelationChanged(*processBindData); + return NO_ERROR; +} + ApplicationStateObserverRecipient::ApplicationStateObserverRecipient(RemoteDiedHandler handler) : handler_(handler) {} diff --git a/interfaces/inner_api/app_manager/src/appmgr/process_bind_data.cpp b/interfaces/inner_api/app_manager/src/appmgr/process_bind_data.cpp new file mode 100644 index 0000000000..0ed372b2db --- /dev/null +++ b/interfaces/inner_api/app_manager/src/appmgr/process_bind_data.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021-2025 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 "process_bind_data.h" + +#include "hilog_tag_wrapper.h" +#include "parcel_macro_base.h" +#include "string_ex.h" + +namespace OHOS { +namespace AppExecFwk { +bool ProcessBindData::Marshalling(Parcel &parcel) const +{ + return (parcel.WriteString(bundleName) && parcel.WriteInt32(pid) && + parcel.WriteInt32(uid) && parcel.WriteBool(isKeepAlive) && + parcel.WriteInt32(static_cast(processType)) && + parcel.WriteInt32(static_cast(extensionType)) && + parcel.WriteInt32(callerPid) && parcel.WriteInt32(callerUid) && + parcel.WriteString(callerBundleName) && + parcel.WriteInt32(bindingRelation)); +} + +bool ProcessBindData::ReadFromParcel(Parcel &parcel) +{ + bundleName = parcel.ReadString(); + pid = parcel.ReadInt32(); + uid = parcel.ReadInt32(); + isKeepAlive = parcel.ReadBool(); + processType = static_cast(parcel.ReadInt32()); + extensionType = static_cast(parcel.ReadInt32()); + callerPid = parcel.ReadInt32(); + callerUid = parcel.ReadInt32(); + callerBundleName = parcel.ReadString(); + bindingRelation = parcel.ReadInt32(); + return true; +} + +ProcessBindData *ProcessBindData::Unmarshalling(Parcel &parcel) +{ + ProcessBindData *processBindData = new (std::nothrow) ProcessBindData(); + if (processBindData && !processBindData->ReadFromParcel(parcel)) { + TAG_LOGW(AAFwkTag::APPMGR, + "processBindData failed, because ReadFromParcel failed"); + delete processBindData; + processBindData = nullptr; + } + return processBindData; +} +} // namespace AppExecFwk +} // namespace OHOS + \ No newline at end of file diff --git a/services/abilitymgr/include/ability_connect_manager.h b/services/abilitymgr/include/ability_connect_manager.h index 90d2f34f51..bb7b93c35d 100644 --- a/services/abilitymgr/include/ability_connect_manager.h +++ b/services/abilitymgr/include/ability_connect_manager.h @@ -670,6 +670,8 @@ private: bool NeedExtensionControl(std::shared_ptr abilityRecord); bool GetTimeoutMsgContent(uint32_t msgId, std::string &msgContent, int &typeId); + void UpdateUIExtensionBindInfo(const std::shared_ptr &abilityRecord, + std::string callerBundleName, int32_t notifyProcessBind); private: const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask"; const std::string TASK_ON_ABILITY_DIED = "OnAbilityDiedTask"; diff --git a/services/abilitymgr/include/ability_record.h b/services/abilitymgr/include/ability_record.h index bd1c1a38d7..9d9494218b 100644 --- a/services/abilitymgr/include/ability_record.h +++ b/services/abilitymgr/include/ability_record.h @@ -1216,8 +1216,8 @@ public: void SendEvent(uint32_t msg, uint32_t timeOut, int32_t param = -1, bool isExtension = false, const std::string &taskName = ""); + void UpdateUIExtensionBindInfo(const WantParams &wantParams); protected: - sptr token_ = {}; // used to interact with kit and wms std::unique_ptr lifecycleDeal_ = {}; // life manager used to schedule life AbilityState currentState_ = AbilityState::INITIAL; // current life state diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index bbcb8a41eb..7e27ca64d8 100644 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -39,6 +39,7 @@ #include "cache_extension_utils.h" #include "datetime_ex.h" #include "init_reboot.h" +#include "string_wrapper.h" namespace OHOS { namespace AAFwk { @@ -53,6 +54,11 @@ const std::string FRS_APP_INDEX = "ohos.extra.param.key.frs_index"; const std::string FRS_BUNDLE_NAME = "com.ohos.formrenderservice"; const std::string UIEXTENSION_ABILITY_ID = "ability.want.params.uiExtensionAbilityId"; const std::string UIEXTENSION_ROOT_HOST_PID = "ability.want.params.uiExtensionRootHostPid"; +const std::string UIEXTENSION_HOST_PID = "ability.want.params.uiExtensionHostPid"; +const std::string UIEXTENSION_HOST_UID = "ability.want.params.uiExtensionHostPid"; +const std::string UIEXTENSION_HOST_BUNDLENAME = "ability.want.params.uiExtensionHostBundleName"; +const std::string UIEXTENSION_BIND_ABILITY_ID = "ability.want.params.uiExtensionBindAbilityId"; +const std::string UIEXTENSION_NOTIFY_BIND = "ohos.uiextension.params.uiExtensioNotifyBind"; const std::string MAX_UINT64_VALUE = "18446744073709551615"; const std::string IS_PRELOAD_UIEXTENSION_ABILITY = "ability.want.params.is_preload_uiextension_ability"; const std::string SEPARATOR = ":"; @@ -167,13 +173,14 @@ int AbilityConnectManager::StartAbilityLocked(const AbilityRequest &abilityReque std::shared_ptr targetService; bool isLoadedAbility = false; + std::string hostBundleName; if (UIExtensionUtils::IsUIExtension(abilityRequest.abilityInfo.extensionAbilityType)) { auto callerAbilityRecord = AAFwk::Token::GetAbilityRecordByToken(abilityRequest.callerToken); if (callerAbilityRecord == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "null callerAbilityRecord"); return ERR_NULL_OBJECT; } - std::string hostBundleName = callerAbilityRecord->GetAbilityInfo().bundleName; + hostBundleName = callerAbilityRecord->GetAbilityInfo().bundleName; ret = GetOrCreateExtensionRecord(abilityRequest, false, hostBundleName, targetService, isLoadedAbility); if (ret != ERR_OK) { TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, ret: %{public}d", ret); @@ -224,6 +231,9 @@ int AbilityConnectManager::StartAbilityLocked(const AbilityRequest &abilityReque mgr->UpdateUIExtensionInfo(targetService, AAFwk::DEFAULT_INVAL_VALUE); } }; + UpdateUIExtensionBindInfo( + targetService, hostBundleName, + abilityRequest.want.GetIntParam(UIEXTENSION_NOTIFY_BIND, -1)); LoadAbility(targetService, updateRecordCallback); } else if (targetService->IsAbilityState(AbilityState::ACTIVE) && !IsUIExtensionAbility(targetService)) { // It may have been started through connect @@ -566,6 +576,9 @@ int AbilityConnectManager::PreloadUIExtensionAbilityInner(const AbilityRequest & mgr->UpdateUIExtensionInfo(targetService, hostPid); } }; + UpdateUIExtensionBindInfo( + targetService, hostBundleName, + abilityRequest.want.GetIntParam(UIEXTENSION_NOTIFY_BIND, -1)); LoadAbility(targetService, updateRecordCallback); return ERR_OK; } @@ -3583,5 +3596,31 @@ std::shared_ptr AbilityConnectManager::GetUIExtensionBySessionFro } return nullptr; } + +void AbilityConnectManager::UpdateUIExtensionBindInfo( + const std::shared_ptr &abilityRecord, + std::string callerBundleName, int32_t notifyProcessBind) +{ + if (abilityRecord == nullptr || + !UIExtensionUtils::IsUIExtension( + abilityRecord->GetAbilityInfo().extensionAbilityType)) { + TAG_LOGE(AAFwkTag::UI_EXT, "record null or type error"); + return; + } + + WantParams wantParams; + auto uiExtensionBindAbilityId = abilityRecord->GetUIExtensionAbilityId(); + wantParams.SetParam(UIEXTENSION_BIND_ABILITY_ID, + AAFwk::Integer::Box(uiExtensionBindAbilityId)); + wantParams.SetParam(UIEXTENSION_NOTIFY_BIND, + AAFwk::Integer::Box(notifyProcessBind)); + wantParams.SetParam(UIEXTENSION_HOST_PID, + AAFwk::Integer::Box(IPCSkeleton::GetCallingPid())); + wantParams.SetParam(UIEXTENSION_HOST_UID, + AAFwk::Integer::Box(IPCSkeleton::GetCallingUid())); + wantParams.SetParam(UIEXTENSION_HOST_BUNDLENAME, + String ::Box(callerBundleName)); + abilityRecord->UpdateUIExtensionBindInfo(wantParams); +} } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 061254fe31..c6a5d713a3 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -88,6 +88,11 @@ const std::string PARAM_MISSION_AFFINITY_KEY = "ohos.anco.param.missionAffinity" const std::string DISTRIBUTED_FILES_PATH = "/data/storage/el2/distributedfiles/"; const std::string UIEXTENSION_ABILITY_ID = "ability.want.params.uiExtensionAbilityId"; const std::string UIEXTENSION_ROOT_HOST_PID = "ability.want.params.uiExtensionRootHostPid"; +const std::string UIEXTENSION_HOST_PID = "ability.want.params.uiExtensionHostPid"; +const std::string UIEXTENSION_HOST_UID = "ability.want.params.uiExtensionHostPid"; +const std::string UIEXTENSION_HOST_BUNDLENAME = "ability.want.params.uiExtensionHostBundleName"; +const std::string UIEXTENSION_BIND_ABILITY_ID = "ability.want.params.uiExtensionBindAbilityId"; +const std::string UIEXTENSION_NOTIFY_BIND = "ohos.uiextension.params.uiExtensioNotifyBind"; constexpr const char* PARAM_SEND_RESULT_CALLER_BUNDLENAME = "ohos.anco.param.sendResultCallderBundleName"; constexpr const char* PARAM_SEND_RESULT_CALLER_TOKENID = "ohos.anco.param.sendResultCallerTokenId"; constexpr const char* PARAM_RESV_ANCO_IS_NEED_UPDATE_NAME = "ohos.anco.param.isNeedUpdateName"; @@ -3850,5 +3855,41 @@ void AbilityRecord::NotifyAbilityRequestSuccess(const std::string &requestId, co CHECK_POINTER(lifecycleDeal_); lifecycleDeal_->NotifyAbilityRequestSuccess(requestId, element); } + +void AbilityRecord::UpdateUIExtensionBindInfo(const WantParams &wantParams) +{ + if (!UIExtensionUtils::IsUIExtension(GetAbilityInfo().extensionAbilityType)) { + return; + } + + std::lock_guard guard(wantLock_); + if (want_.HasParameter(UIEXTENSION_BIND_ABILITY_ID)) { + want_.RemoveParam(UIEXTENSION_BIND_ABILITY_ID); + } + want_.SetParam(UIEXTENSION_BIND_ABILITY_ID, + wantParams.GetIntParam(UIEXTENSION_BIND_ABILITY_ID, -1)); + + if (want_.HasParameter(UIEXTENSION_NOTIFY_BIND)) { + want_.RemoveParam(UIEXTENSION_NOTIFY_BIND); + } + want_.SetParam(UIEXTENSION_NOTIFY_BIND, + wantParams.GetIntParam(UIEXTENSION_NOTIFY_BIND, -1)); + if (want_.HasParameter(UIEXTENSION_HOST_PID)) { + want_.RemoveParam(UIEXTENSION_HOST_PID); + } + want_.SetParam(UIEXTENSION_HOST_PID, + wantParams.GetIntParam(UIEXTENSION_HOST_PID, -1)); + + if (want_.HasParameter(UIEXTENSION_HOST_UID)) { + want_.RemoveParam(UIEXTENSION_HOST_UID); + } + want_.SetParam(UIEXTENSION_HOST_UID, + wantParams.GetIntParam(UIEXTENSION_HOST_UID, -1)); + if (want_.HasParameter(UIEXTENSION_HOST_BUNDLENAME)) { + want_.RemoveParam(UIEXTENSION_HOST_BUNDLENAME); + } + want_.SetParam(UIEXTENSION_HOST_BUNDLENAME, + wantParams.GetStringParam(UIEXTENSION_HOST_BUNDLENAME)); +} } // namespace AAFwk } // namespace OHOS diff --git a/services/appmgr/include/ability_running_record.h b/services/appmgr/include/ability_running_record.h index 189833f856..5b13146f77 100644 --- a/services/appmgr/include/ability_running_record.h +++ b/services/appmgr/include/ability_running_record.h @@ -151,6 +151,8 @@ public: bool IsHook() const; + void SetUIExtensionBindAbilityId(const int32_t uiExtensionBindAbilityId); + int32_t GetUIExtensionBindAbilityId() const; private: bool isTerminating_ = false; bool isFocused_ = false; @@ -165,6 +167,7 @@ private: std::shared_ptr want_ = nullptr; sptr token_; sptr preToken_; + int32_t uiExtensionBindAbilityId_ = 0; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 706b986c74..165e393675 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -1978,6 +1978,13 @@ private: void SendAppSpawnUninstallDebugHapMsg(int32_t userId); std::shared_ptr CreateAppRunningRecord(std::shared_ptr appInfo, const std::string &processName, const BundleInfo &bundleInfo); + void AddUIExtensionBindItem(std::shared_ptr want, std::shared_ptr appRecord, + sptr token); + void RemoveUIExtensionBindItem(std::shared_ptr appRecord, sptr token); + void BindUIExtensionProcess(const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo); + void UnBindUIExtensionProcess(const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo); bool isInitAppWaitingDebugListExecuted_ = false; std::atomic sceneBoardAttachFlag_ = true; @@ -2037,6 +2044,9 @@ private: std::mutex screenOffSubscriberMutex_; std::mutex childProcessRecordMapMutex_; + + std::mutex uiExtensionBindReleationsLock_; + std::map> uiExtensionBindReleations_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/include/app_running_manager.h b/services/appmgr/include/app_running_manager.h index e29f443661..5b488ae019 100644 --- a/services/appmgr/include/app_running_manager.h +++ b/services/appmgr/include/app_running_manager.h @@ -37,6 +37,7 @@ #include "refbase.h" #include "running_process_info.h" #include "simple_process_info.h" +#include "process_bind_data.h" namespace OHOS { namespace Rosen { @@ -374,6 +375,11 @@ public: void UpdateInstanceKeyBySpecifiedId(int32_t specifiedId, std::string &instanceKey); std::shared_ptr QueryAppRecordPlus(int32_t pid, int32_t uid); + UIExtensionProcessBindInfo WarpBindInfo(int32_t pid, int32_t uid, int32_t callerPid, int32_t callerUid, + std::string callerBundleName, int32_t notifyProcessBind); + int32_t AddUIExtensionBindItem(int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo); + int32_t QueryUIExtensionBindItemById(int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo); + int32_t RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId); private: std::shared_ptr GetAbilityRunningRecord(const int64_t eventId); int32_t AssignRunningProcessInfoByAppRecord( @@ -394,6 +400,9 @@ private: std::mutex updateConfigurationDelayedLock_; std::map updateConfigurationDelayedMap_; + + std::mutex uiExtensionBindMapLock_; + std::map uiExtensionBindMap_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/include/app_state_observer_manager.h b/services/appmgr/include/app_state_observer_manager.h index eefee3b3ee..d2d60e6f81 100644 --- a/services/appmgr/include/app_state_observer_manager.h +++ b/services/appmgr/include/app_state_observer_manager.h @@ -72,6 +72,8 @@ public: void OnAppStopped(const std::shared_ptr &appRecord); void OnProcessCreated(const std::shared_ptr &appRecord, bool isPreload); void OnProcessStateChanged(const std::shared_ptr &appRecord); + void OnProcessBindingRelationChanged(const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation); void OnWindowShow(const std::shared_ptr &appRecord); void OnWindowHidden(const std::shared_ptr &appRecord); void OnRenderProcessCreated(const std::shared_ptr &RenderRecord, const bool isPreload); @@ -116,6 +118,8 @@ private: AbilityForegroundObserverMap GetAbilityForegroundObserverMapCopy(); ProcessData WrapProcessData(const std::shared_ptr &appRecord); ProcessData WrapRenderProcessData(const std::shared_ptr &renderRecord); + ProcessBindData WrapProcessBindData(const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation); #ifdef SUPPORT_CHILD_PROCESS int32_t WrapChildProcessData(ProcessData &processData, std::shared_ptr childRecord); #endif // SUPPORT_CHILD_PROCESS @@ -131,6 +135,8 @@ private: void HandleOnAppCacheStateChanged(const std::shared_ptr &appRecord, ApplicationState state); void AddObserverCount(int32_t uid); void DecreaseObserverCount(int32_t uid); + void HandleOnProcessBindingRelationChanged(const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation); private: std::shared_ptr handler_; diff --git a/services/appmgr/src/ability_running_record.cpp b/services/appmgr/src/ability_running_record.cpp index 0716c088f8..7de17bb765 100644 --- a/services/appmgr/src/ability_running_record.cpp +++ b/services/appmgr/src/ability_running_record.cpp @@ -171,5 +171,15 @@ bool AbilityRunningRecord::IsHook() const { return want_ && want_->GetBoolParam(IS_HOOK, false); } + +void AbilityRunningRecord::SetUIExtensionBindAbilityId(const int32_t uiExtensionBindAbilityId) +{ + uiExtensionBindAbilityId_ = uiExtensionBindAbilityId; +} + +int32_t AbilityRunningRecord::GetUIExtensionBindAbilityId() const +{ + return uiExtensionBindAbilityId_; +} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 0b58f9ff66..d682ccc682 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -206,6 +206,11 @@ constexpr const char* HWASAN_FLAG_NAME = "hwasanEnabled"; constexpr const char* UBSAN_FLAG_NAME = "ubsanEnabled"; constexpr const char* UIEXTENSION_ABILITY_ID = "ability.want.params.uiExtensionAbilityId"; constexpr const char* UIEXTENSION_ROOT_HOST_PID = "ability.want.params.uiExtensionRootHostPid"; +constexpr const char* UIEXTENSION_HOST_PID = "ability.want.params.uiExtensionHostPid"; +constexpr const char* UIEXTENSION_HOST_UID = "ability.want.params.uiExtensionHostUid"; +constexpr const char* UIEXTENSION_HOST_BUNDLENAME = "ability.want.params.uiExtensionHostBundleName"; +constexpr const char* UIEXTENSION_BIND_ABILITY_ID = "ability.want.params.uiExtensionBindAbilityId"; +constexpr const char* UIEXTENSION_NOTIFY_BIND = "ohos.uiextension.params.notifyProcessBind"; constexpr const char* MEMMGR_PROC_NAME = "memmgrservice"; constexpr const char* ISOLATED_SANDBOX = "isolatedSandbox"; constexpr const char* RENDER_PROCESS_NAME = ":render"; @@ -814,6 +819,7 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr abilityInfo, s StartAbility(loadParam->token, loadParam->preToken, abilityInfo, appRecord, hapModuleInfo, want, loadParam->abilityRecordId); if (AAFwk::UIExtensionUtils::IsUIExtension(abilityInfo->extensionAbilityType)) { + AddUIExtensionBindItem(want, appRecord, loadParam->token); AddUIExtensionLauncherItem(want, appRecord, loadParam->token); } } @@ -822,9 +828,12 @@ void AppMgrServiceInner::LoadAbility(std::shared_ptr abilityInfo, s appRecord != nullptr && want != nullptr) { auto abilityRunningRecord = appRecord->GetAbilityRunningRecordByToken(loadParam->token); auto uiExtensionAbilityId = want->GetIntParam(UIEXTENSION_ABILITY_ID, -1); + auto uiExtensionBindAbilityId = want->GetIntParam(UIEXTENSION_BIND_ABILITY_ID, -1); if (abilityRunningRecord != nullptr) { abilityRunningRecord->SetUIExtensionAbilityId(uiExtensionAbilityId); + abilityRunningRecord->SetUIExtensionBindAbilityId(uiExtensionBindAbilityId); } + want->RemoveParam(UIEXTENSION_BIND_ABILITY_ID); } AfterLoadAbility(appRecord, abilityInfo, loadParam); } @@ -2857,6 +2866,7 @@ void AppMgrServiceInner::TerminateAbility(const sptr &token, bool return; } + RemoveUIExtensionBindItem(appRecord, token); RemoveUIExtensionLauncherItem(appRecord, token); if (appRunningManager_) { @@ -4009,6 +4019,9 @@ int32_t AppMgrServiceInner::StartProcess(const std::string &appName, const std:: } OnAppStateChanged(appRecord, ApplicationState::APP_STATE_CREATE, false, false); DelayedSingleton::GetInstance()->OnProcessCreated(appRecord, isPreload); + if (AAFwk::UIExtensionUtils::IsUIExtension(extensionAbilityType)) { + AddUIExtensionBindItem(want, appRecord, token); + } if (!appExistFlag) { OnAppStarted(appRecord); } @@ -9385,5 +9398,142 @@ int32_t AppMgrServiceInner::LaunchAbility(sptr token) appRecord->LaunchAbility(ability); return ERR_OK; } + +void AppMgrServiceInner::AddUIExtensionBindItem( + std::shared_ptr want, + std::shared_ptr appRecord, sptr token) +{ + auto notifyProcessBind = want->GetIntParam(UIEXTENSION_NOTIFY_BIND, -1); + if (notifyProcessBind != 1) { + TAG_LOGE(AAFwkTag::APPMGR, "no bind permission"); + return; + } + if (want == nullptr || appRecord == nullptr || token == nullptr || + appRunningManager_ == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "invalid input params"); + return; + } + auto uiExtensionBindAbilityId = + want->GetIntParam(UIEXTENSION_BIND_ABILITY_ID, -1); + auto callerPid = want->GetIntParam(UIEXTENSION_HOST_PID, -1); + auto callerUid = want->GetIntParam(UIEXTENSION_HOST_UID, -1); + auto callerBundleName = want->GetStringParam(UIEXTENSION_HOST_BUNDLENAME); + pid_t providerPid = -1; + pid_t providerUid = -1; + if (appRecord->GetPriorityObject() != nullptr) { + providerPid = appRecord->GetPid(); + providerUid = appRecord->GetUid(); + } + if (uiExtensionBindAbilityId == -1 || providerPid == -1 || + providerUid == -1 || callerPid == -1 || callerUid == -1 || + callerBundleName.empty()) { + TAG_LOGE(AAFwkTag::APPMGR, "invalid want params"); + return; + } + + TAG_LOGI(AAFwkTag::APPMGR, + "uiExtensionBindAbilityId: %{public}d, providerUid: " + "%{public}d,providerPid: %{public}d,callerUid: %{public}d, " + "callerPid: %{public}d,callerBundleName: %{public}s", + uiExtensionBindAbilityId, providerUid, providerPid, callerUid, + callerPid, callerBundleName.c_str()); + UIExtensionProcessBindInfo bindInfo = appRunningManager_->WarpBindInfo( + providerPid, providerUid, callerPid, callerUid, callerBundleName, + notifyProcessBind); + appRunningManager_->AddUIExtensionBindItem(uiExtensionBindAbilityId, + bindInfo); + BindUIExtensionProcess(appRecord, bindInfo); + want->RemoveParam(UIEXTENSION_HOST_PID); + want->RemoveParam(UIEXTENSION_HOST_UID); + want->RemoveParam(UIEXTENSION_HOST_BUNDLENAME); + want->RemoveParam(UIEXTENSION_NOTIFY_BIND); +} + +void AppMgrServiceInner::RemoveUIExtensionBindItem( + std::shared_ptr appRecord, sptr token) +{ + if (appRecord == nullptr || token == nullptr || + appRunningManager_ == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "invalid input params"); + return; + } + + auto abilityRunningRecord = appRecord->GetAbilityRunningRecordByToken(token); + if (abilityRunningRecord == nullptr) { + TAG_LOGW(AAFwkTag::APPMGR, "invalid ability"); + return; + } + + auto abilityInfo = abilityRunningRecord->GetAbilityInfo(); + if (abilityInfo == nullptr) { + TAG_LOGW(AAFwkTag::APPMGR, "invalid ability"); + return; + } + + if (!AAFwk::UIExtensionUtils::IsUIExtension( + abilityInfo->extensionAbilityType)) { + return; + } + + auto uiExtensionBindAbilityId = + abilityRunningRecord->GetUIExtensionBindAbilityId(); + UIExtensionProcessBindInfo bindInfo; + auto result = appRunningManager_->QueryUIExtensionBindItemById( + uiExtensionBindAbilityId, bindInfo); + if (result != ERR_OK) { + return; + } + if (bindInfo.notifyProcessBind != 1) { + TAG_LOGE(AAFwkTag::APPMGR, "no bind permission"); + return; + } + UnBindUIExtensionProcess(appRecord, bindInfo); + appRunningManager_->RemoveUIExtensionBindItemById(uiExtensionBindAbilityId); +} + +void AppMgrServiceInner::BindUIExtensionProcess( + const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo) +{ + std::lock_guard guard(uiExtensionBindReleationsLock_); + auto pid = bindInfo.pid; + auto callerPid = bindInfo.callerPid; + auto it = uiExtensionBindReleations_.find(pid); + + if (it == uiExtensionBindReleations_.end() || + it->second.find(callerPid) == it->second.end()) { + uiExtensionBindReleations_[pid][callerPid] = 1; + DelayedSingleton::GetInstance() + ->OnProcessBindingRelationChanged(appRecord, bindInfo, 1); + } else { + it->second[callerPid]++; + } +} + +void AppMgrServiceInner::UnBindUIExtensionProcess( + const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo) +{ + std::lock_guard guard(uiExtensionBindReleationsLock_); + auto pid = bindInfo.pid; + auto callerPid = bindInfo.callerPid; + auto it = uiExtensionBindReleations_.find(pid); + + if (it != uiExtensionBindReleations_.end()) { + auto &innerMap = it->second; + auto innerIt = innerMap.find(callerPid); + if (innerIt != innerMap.end()) { + innerIt->second--; + if (innerIt->second == 0) { + DelayedSingleton::GetInstance() + ->OnProcessBindingRelationChanged(appRecord, bindInfo, 0); + innerMap.erase(innerIt); + } + } + if (innerMap.empty()) { + uiExtensionBindReleations_.erase(it); + } + } +} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/src/app_running_manager.cpp b/services/appmgr/src/app_running_manager.cpp index af0111b757..5f9d21f882 100644 --- a/services/appmgr/src/app_running_manager.cpp +++ b/services/appmgr/src/app_running_manager.cpp @@ -1956,5 +1956,49 @@ void AppRunningManager::RemoveTimeoutDeadAppRecord() }, DEAD_APP_RECORD_CLEAR_TIME); } } + +UIExtensionProcessBindInfo AppRunningManager::WarpBindInfo(int32_t pid, int32_t uid, int32_t callerPid, + int32_t callerUid, std::string callerBundleName, + int32_t notifyProcessBind) +{ + UIExtensionProcessBindInfo uiExtensionProcessBindInfo; + uiExtensionProcessBindInfo.pid = pid; + uiExtensionProcessBindInfo.uid = uid; + uiExtensionProcessBindInfo.callerPid = callerPid; + uiExtensionProcessBindInfo.callerUid = callerUid; + uiExtensionProcessBindInfo.callerBundleName = callerBundleName; + uiExtensionProcessBindInfo.notifyProcessBind = notifyProcessBind; + return uiExtensionProcessBindInfo; +} + +int32_t AppRunningManager::AddUIExtensionBindItem( + int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo) +{ + std::lock_guard guard(uiExtensionBindMapLock_); + uiExtensionBindMap_.emplace(uiExtensionBindAbilityId, bindInfo); + return ERR_OK; +} + +int32_t AppRunningManager::RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId) +{ + std::lock_guard guard(uiExtensionBindMapLock_); + auto it = uiExtensionBindMap_.find(uiExtensionBindAbilityId); + if (it != uiExtensionBindMap_.end()) { + uiExtensionBindMap_.erase(it); + } + return ERR_OK; +} + +int32_t AppRunningManager::QueryUIExtensionBindItemById( + int32_t uiExtensionBindAbilityId, UIExtensionProcessBindInfo &bindInfo) +{ + std::lock_guard guard(uiExtensionBindMapLock_); + auto it = uiExtensionBindMap_.find(uiExtensionBindAbilityId); + if (it != uiExtensionBindMap_.end()) { + bindInfo = it->second; + return ERR_OK; + } + return ERR_INVALID_VALUE; +} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/src/app_state_observer_manager.cpp b/services/appmgr/src/app_state_observer_manager.cpp index a565282818..b30769c9b2 100644 --- a/services/appmgr/src/app_state_observer_manager.cpp +++ b/services/appmgr/src/app_state_observer_manager.cpp @@ -1249,5 +1249,70 @@ void AppStateObserverManager::HandleOnAppCacheStateChanged(const std::shared_ptr } } } + +ProcessBindData AppStateObserverManager::WrapProcessBindData( + const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation) +{ + ProcessBindData processBindData; + processBindData.bundleName = appRecord->GetBundleName(); + processBindData.pid = appRecord->GetPid(); + processBindData.uid = appRecord->GetUid(); + processBindData.isKeepAlive = appRecord->IsKeepAliveApp(); + processBindData.extensionType = appRecord->GetExtensionType(); + processBindData.processType = appRecord->GetProcessType(); + processBindData.callerPid = bindInfo.callerPid; + processBindData.callerUid = bindInfo.callerUid; + processBindData.callerBundleName = bindInfo.callerBundleName; + processBindData.bindingRelation = bindingRelation; + return processBindData; +} + +void AppStateObserverManager::OnProcessBindingRelationChanged( + const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation) +{ + if (handler_ == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "null handler"); + return; + } + + auto task = + [weak = weak_from_this(), appRecord, bindInfo, bindingRelation]() { + auto self = weak.lock(); + if (self == nullptr){ + TAG_LOGE(AAFwkTag::APPMGR, "null self"); + return; + } + TAG_LOGD(AAFwkTag::APPMGR, "OnProcessBindingRelationChanged come."); + self->HandleOnProcessBindingRelationChanged(appRecord, bindInfo, bindingRelation); + }; + handler_->SubmitTask(task); +} + +void AppStateObserverManager::HandleOnProcessBindingRelationChanged( + const std::shared_ptr &appRecord, + const UIExtensionProcessBindInfo &bindInfo, int32_t bindingRelation) +{ + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); + if (appRecord == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "null appRecord"); + return; + } + + ProcessBindData data = + WrapProcessBindData(appRecord, bindInfo, bindingRelation); + auto appStateObserverMapCopy = GetAppStateObserverMapCopy(); + for (auto it = appStateObserverMapCopy.begin(); + it != appStateObserverMapCopy.end(); ++it) { + const auto &bundleNames = it->second.bundleNames; + auto iter = + std::find(bundleNames.begin(), bundleNames.end(), data.bundleName); + if ((bundleNames.empty() || iter != bundleNames.end()) && + it->first != nullptr) { + it->first->OnProcessBindingRelationChanged(data); + } + } +} } // namespace AppExecFwk } // namespace OHOS diff --git a/test/fuzztest/abilitymgrpreloaduiextstateobserver_fuzzer/BUILD.gn b/test/fuzztest/abilitymgrpreloaduiextstateobserver_fuzzer/BUILD.gn index 8ce8890656..cb03d810da 100644 --- a/test/fuzztest/abilitymgrpreloaduiextstateobserver_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitymgrpreloaduiextstateobserver_fuzzer/BUILD.gn @@ -42,6 +42,7 @@ ohos_fuzztest("AbilitymgrPreloadUiextStateObserverFuzzTest") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${bundlefwk_inner_api_path}/appexecfwk_base/src/application_info.cpp", diff --git a/test/fuzztest/disposedobserver_fuzzer/BUILD.gn b/test/fuzztest/disposedobserver_fuzzer/BUILD.gn index c01c9bd4c4..8bb56d954d 100644 --- a/test/fuzztest/disposedobserver_fuzzer/BUILD.gn +++ b/test/fuzztest/disposedobserver_fuzzer/BUILD.gn @@ -41,6 +41,7 @@ ohos_fuzztest("DisposedObserverFuzzTest") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/disposed_observer.cpp", "disposedobserver_fuzzer.cpp", ] diff --git a/test/fuzztest/extensionrecordmanager_fuzzer/BUILD.gn b/test/fuzztest/extensionrecordmanager_fuzzer/BUILD.gn index 0e9385180a..3c74ede6d8 100644 --- a/test/fuzztest/extensionrecordmanager_fuzzer/BUILD.gn +++ b/test/fuzztest/extensionrecordmanager_fuzzer/BUILD.gn @@ -43,6 +43,7 @@ ohos_fuzztest("ExtensionRecordManagerFuzzTest") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_manager.cpp", diff --git a/test/fuzztest/extensionrecordmanagera_fuzzer/BUILD.gn b/test/fuzztest/extensionrecordmanagera_fuzzer/BUILD.gn index ac07de9a58..e931c46e90 100755 --- a/test/fuzztest/extensionrecordmanagera_fuzzer/BUILD.gn +++ b/test/fuzztest/extensionrecordmanagera_fuzzer/BUILD.gn @@ -43,6 +43,7 @@ ohos_fuzztest("ExtensionRecordManageraFuzzTest") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_manager.cpp", diff --git a/test/unittest/ui_extension/extension_record_manager_second_test/BUILD.gn b/test/unittest/ui_extension/extension_record_manager_second_test/BUILD.gn index 734ffe5968..1fd9584209 100644 --- a/test/unittest/ui_extension/extension_record_manager_second_test/BUILD.gn +++ b/test/unittest/ui_extension/extension_record_manager_second_test/BUILD.gn @@ -43,6 +43,7 @@ ohos_unittest("extension_record_manager_second_test") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_manager.cpp", diff --git a/test/unittest/ui_extension/extension_record_manager_test/BUILD.gn b/test/unittest/ui_extension/extension_record_manager_test/BUILD.gn index 9305d179ad..8619df37f7 100755 --- a/test/unittest/ui_extension/extension_record_manager_test/BUILD.gn +++ b/test/unittest/ui_extension/extension_record_manager_test/BUILD.gn @@ -40,6 +40,7 @@ ohos_unittest("extension_record_manager_test") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/application_state_observer_stub.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/page_state_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_data.cpp", + "${ability_runtime_innerkits_path}/app_manager/src/appmgr/process_bind_data.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/extension_record/extension_record_manager.cpp",