From 15162fdb7ea5f7e714dbc0a67eef663cb66d9939 Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Thu, 26 Feb 2026 17:28:29 +0800 Subject: [PATCH] change the position Signed-off-by: zhangzezhong --- .../include/js_data_converter.h | 2 +- .../include/ability_manager_client.h | 12 +- .../include/ability_manager_interface.h | 66 ++++----- .../include/iability_manager_collaborator.h | 6 +- .../include/appmgr/ams_mgr_interface.h | 1 - .../include/appmgr/app_mgr_client.h | 4 +- .../app_manager/src/appmgr/app_mgr_stub.cpp | 2 +- .../native/ability/native/extension_impl.h | 3 +- ...js_system_configuration_updated_callback.h | 2 +- .../system_configuration_updated_callback.h | 2 +- .../abilitymgr/src/ability_manager_proxy.cpp | 127 +++++++++--------- 11 files changed, 112 insertions(+), 115 deletions(-) diff --git a/frameworks/simulator/ability_simulator/include/js_data_converter.h b/frameworks/simulator/ability_simulator/include/js_data_converter.h index 6210739405..39a7ba90f0 100644 --- a/frameworks/simulator/ability_simulator/include/js_data_converter.h +++ b/frameworks/simulator/ability_simulator/include/js_data_converter.h @@ -27,7 +27,7 @@ namespace OHOS { namespace AbilityRuntime { -constexpr double DPI_BASE = 160.0; // convert density to the base of dpi +constexpr double DPI_BASE = 160.0; Global::Resource::ColorMode ConvertColorMode(const std::string &colormode); Global::Resource::Direction ConvertDirection(const std::string &direction); diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_client.h b/interfaces/inner_api/ability_manager/include/ability_manager_client.h index c178ae3c6d..ae5e55d4f9 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_client.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_client.h @@ -1584,6 +1584,12 @@ public: */ ErrCode UnregisterIAbilityManagerCollaborator(int32_t type); + /** + * @brief get ability manager collaborator. + * @return Returns object pointer on success, others on null. + */ + sptr GetAbilityManagerCollaborator(); + /** * @brief Register session handler. * @param object The handler. @@ -1606,12 +1612,6 @@ public: */ ErrCode UnregisterAppDebugListener(sptr listener); - /** - * @brief get ability manager collaborator. - * @return Returns object pointer on success, others on null. - */ - sptr GetAbilityManagerCollaborator(); - /** * @brief Attach app debug. * @param bundleName The application bundle name. 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 645dd2e7c5..48aa26d116 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -2365,18 +2365,6 @@ public: return 0; } - /** - * StartAbilityWithWait, send want and abilityStartWithWaitObserver to abms. - * - * @param want Ability want. - * @param observer ability foreground notify observer for aa tool. - * @return Returns ERR_OK on success, others on failure. - */ - virtual int32_t StartAbilityWithWait(Want &want, sptr &observer) - { - return 0; - } - /** * Get all insight intent infos. * @param flag, the get type. @@ -2427,11 +2415,44 @@ public: return 0; } + /** + * StartAbilityWithWait, send want and abilityStartWithWaitObserver to abms. + * + * @param want Ability want. + * @param observer ability foreground notify observer for aa tool. + * @return Returns ERR_OK on success, others on failure. + */ + virtual int32_t StartAbilityWithWait(Want &want, sptr &observer) + { + return 0; + } + + /** + * Set keep-alive flag for app service extension under u1 user. + * @param bundleName Bundle name. + * @param flag Keep-alive flag. + * @return Returns ERR_OK on success, others on failure. + */ + virtual int32_t SetAppServiceExtensionKeepAlive(const std::string &bundleName, bool flag) + { + return 0; + } + virtual int32_t UpdateKioskApplicationList(const std::vector &appList) { return 0; } + /** + * Get keep-alive app service extensions. + * @param list List of Keep-alive information. + * @return Returns ERR_OK on success, others on failure. + */ + virtual int32_t QueryKeepAliveAppServiceExtensions(std::vector &list) + { + return 0; + } + virtual int32_t EnterKioskMode(sptr callerToken) { return 0; @@ -2457,27 +2478,6 @@ public: return 0; } - /** - * Set keep-alive flag for app service extension under u1 user. - * @param bundleName Bundle name. - * @param flag Keep-alive flag. - * @return Returns ERR_OK on success, others on failure. - */ - virtual int32_t SetAppServiceExtensionKeepAlive(const std::string &bundleName, bool flag) - { - return 0; - } - - /** - * Get keep-alive app service extensions. - * @param list List of Keep-alive information. - * @return Returns ERR_OK on success, others on failure. - */ - virtual int32_t QueryKeepAliveAppServiceExtensions(std::vector &list) - { - return 0; - } - virtual int32_t SetOnNewWantSkipScenarios(sptr callerToken, int32_t scenarios) { return 0; diff --git a/interfaces/inner_api/ability_manager/include/iability_manager_collaborator.h b/interfaces/inner_api/ability_manager/include/iability_manager_collaborator.h index d282feee5e..e1113a8ffa 100644 --- a/interfaces/inner_api/ability_manager/include/iability_manager_collaborator.h +++ b/interfaces/inner_api/ability_manager/include/iability_manager_collaborator.h @@ -244,10 +244,10 @@ public: } /** - * @brief Notify collaborator grant uri permission started. + * @brief Notify collaborator start grantUriPermission. * @param uris The uri list to grant permission. * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION. - * @param userId The user id of target application. + * @param userId the user id of target application. * @return 0 when on success or else failed. */ virtual int32_t NotifyGrantUriPermissionStart(const std::vector &uris, uint32_t flag, int32_t userId) @@ -256,7 +256,7 @@ public: } /** - * @brief Notify collaborator grant uri Permission finished. + * @brief Notify collaborator start grantUriPermission. * @param uris The uri list to grant permission. * @param flag Want::FLAG_AUTH_READ_URI_PERMISSION or Want::FLAG_AUTH_WRITE_URI_PERMISSION. * @param userId The user id of target application. diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h index fbbe2b1c84..70eee194d2 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h @@ -111,7 +111,6 @@ public: * * @param userId, the user id. * @param isNeedSendAppSpawnMsg, true send appSpawn message otherwise not send. - * @param callback, callback function for logout user. * @return */ virtual void KillProcessesByUserId(int32_t userId, bool isNeedSendAppSpawnMsg = false, diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h index ce29f3d47e..03efb3cd04 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h @@ -890,8 +890,8 @@ public: bool IsMemorySizeSufficient() const; /** - * whether or not requier a big memory - * @return Returens true is no big memory, others return false. + * whether or not require a big memory + * @return Return true if no big memory required, otherwise return false. */ bool IsNoRequireBigMemory() const; diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp index ecd92ee217..c2890497fc 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/app_mgr_stub.cpp @@ -1939,7 +1939,7 @@ int32_t AppMgrStub::HandleCheckCallingIsUserTestMode(MessageParcel &data, Messag #ifdef SUPPORT_CHILD_PROCESS int32_t AppMgrStub::HandleCreateNativeChildProcess(MessageParcel &data, MessageParcel &reply) { - TAG_LOGD(AAFwkTag::APPMGR, "called"); + TAG_LOGD(AAFwkTag::APPMGR, "Called"); std::string libName = data.ReadString(); sptr callback = data.ReadRemoteObject(); std::unique_ptr request(data.ReadParcelable()); diff --git a/interfaces/kits/native/ability/native/extension_impl.h b/interfaces/kits/native/ability/native/extension_impl.h index 6f8c81c739..0b2adad32c 100644 --- a/interfaces/kits/native/ability/native/extension_impl.h +++ b/interfaces/kits/native/ability/native/extension_impl.h @@ -56,10 +56,9 @@ public: /** * @brief Connect the Extension. and Calling information back to Extension. - * * @param want The Want object to connect to. * @param targetState The terget state. - * @param sessionInfo Indicates the sessionInfo. + * @param sessionInfo Indicates the sessionInfo. * */ virtual void HandleExtensionTransaction(const Want &want, const AAFwk::LifeCycleStateInfo &targetState, diff --git a/interfaces/kits/native/appkit/ability_runtime/context/js_system_configuration_updated_callback.h b/interfaces/kits/native/appkit/ability_runtime/context/js_system_configuration_updated_callback.h index 06cfc3367e..f6660cbee7 100644 --- a/interfaces/kits/native/appkit/ability_runtime/context/js_system_configuration_updated_callback.h +++ b/interfaces/kits/native/appkit/ability_runtime/context/js_system_configuration_updated_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2026 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 diff --git a/interfaces/kits/native/appkit/ability_runtime/context/system_configuration_updated_callback.h b/interfaces/kits/native/appkit/ability_runtime/context/system_configuration_updated_callback.h index 83be0c2e63..54437669de 100644 --- a/interfaces/kits/native/appkit/ability_runtime/context/system_configuration_updated_callback.h +++ b/interfaces/kits/native/appkit/ability_runtime/context/system_configuration_updated_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2026 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 diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp index 1fa67b52a9..0a90fb5225 100644 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -1289,15 +1289,15 @@ int AbilityManagerProxy::CloseUIAbilityBySCB(const sptr &sessionInf return INNER_ERR; } } + if (!data.WriteBool(isUserRequestedExit)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "isUserRequestedExit write fail"); + return ERR_IPC_PROXY_WRITE_FAILED; + } if (!data.WriteUint32(sceneFlag)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "sceneFlag write fail"); return INNER_ERR; } - if (!data.WriteBool(isUserRequestedExit)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "isUserRequestedExit write fail"); - return ERR_IPC_PROXY_WRITE_FAILED; - } error = SendRequest(AbilityManagerInterfaceCode::CLOSE_UI_ABILITY_BY_SCB, data, reply, option); if (error != NO_ERROR) { TAG_LOGE(AAFwkTag::ABILITYMGR, "request error:%{public}d", error); @@ -6206,14 +6206,14 @@ int AbilityManagerProxy::CleanUIAbilityBySCB(const sptr &sessionInf return INNER_ERR; } } - if (!data.WriteUint32(sceneFlag)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "sceneFlag write fail"); - return INNER_ERR; - } if (!data.WriteBool(isUserRequestedExit)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "write isUserRequestedExit fail"); return ERR_IPC_PROXY_WRITE_FAILED; } + if (!data.WriteUint32(sceneFlag)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "sceneFlag write fail"); + return INNER_ERR; + } error = SendRequest(AbilityManagerInterfaceCode::CLEAN_UI_ABILITY_BY_SCB, data, reply, option); if (error != NO_ERROR) { @@ -6964,33 +6964,6 @@ int32_t AbilityManagerProxy::RevokeDelegator(sptr token) return reply.ReadInt32(); } -int32_t AbilityManagerProxy::StartAbilityWithWait(Want &want, sptr &observer) -{ - if (AppUtils::GetInstance().IsForbidStart()) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetElement().GetBundleName().c_str()); - return INNER_ERR; - } - CHECK_POINTER_AND_RETURN_LOG(observer, ERR_NULL_OBJECT, "null observer"); - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "writeInterfaceToken failed"); - return INNER_ERR; - } - - PROXY_WRITE_PARCEL_AND_RETURN_IF_FAIL(data, Parcelable, &want); - PROXY_WRITE_PARCEL_AND_RETURN_IF_FAIL(data, RemoteObject, observer->AsObject()); - int32_t error = SendRequest(AbilityManagerInterfaceCode::START_ABILITY_WITH_WAIT, data, reply, option); - if (error != NO_ERROR) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "send err:%{public}d", error); - return error; - } - return reply.ReadInt32(); -} - int32_t AbilityManagerProxy::GetAllInsightIntentInfo( AbilityRuntime::GetInsightIntentFlag flag, std::vector &infos, @@ -7148,6 +7121,32 @@ int32_t AbilityManagerProxy::GetInsightIntentInfoByIntentName( return reply.ReadInt32(); } +int32_t AbilityManagerProxy::StartAbilityWithWait(Want &want, sptr &observer) +{ + if (AppUtils::GetInstance().IsForbidStart()) { + TAG_LOGW(AAFwkTag::ABILITYMGR, "forbid start: %{public}s", want.GetElement().GetBundleName().c_str()); + return INNER_ERR; + } + CHECK_POINTER_AND_RETURN_LOG(observer, ERR_NULL_OBJECT, "null observer"); + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!WriteInterfaceToken(data)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "writeInterfaceToken failed"); + return INNER_ERR; + } + + PROXY_WRITE_PARCEL_AND_RETURN_IF_FAIL(data, Parcelable, &want); + PROXY_WRITE_PARCEL_AND_RETURN_IF_FAIL(data, RemoteObject, observer->AsObject()); + int32_t error = SendRequest(AbilityManagerInterfaceCode::START_ABILITY_WITH_WAIT, data, reply, option); + if (error != NO_ERROR) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "send err:%{public}d", error); + return error; + } + return reply.ReadInt32(); +} int32_t AbilityManagerProxy::SuspendExtensionAbility(sptr connect) { @@ -7227,6 +7226,35 @@ int32_t AbilityManagerProxy::RestartSelfAtomicService(sptr caller return reply.ReadInt32(); } +int32_t AbilityManagerProxy::SetAppServiceExtensionKeepAlive(const std::string &bundleName, bool flag) +{ + MessageParcel data; + if (!WriteInterfaceToken(data)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "writeInterfaceToken fail"); + return INNER_ERR; + } + + if (!data.WriteString(bundleName)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "failed to write bundleName"); + return ERR_INVALID_VALUE; + } + + if (!data.WriteBool(flag)) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "failed to write flag"); + return ERR_INVALID_VALUE; + } + + MessageParcel reply; + MessageOption option; + auto ret = SendRequest(AbilityManagerInterfaceCode::SET_APP_SERVICE_EXTENSION_KEEP_ALIVE, + data, reply, option); + if (ret != NO_ERROR) { + TAG_LOGE(AAFwkTag::ABILITYMGR, "request error: %{public}d", ret); + return ret; + } + return reply.ReadInt32(); +} + int32_t AbilityManagerProxy::UpdateKioskApplicationList(const std::vector &appList) { MessageParcel data; @@ -7372,35 +7400,6 @@ ErrCode AbilityManagerProxy::RegisterSAInterceptor(sptr &list) { MessageParcel data;