diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h index 9e8fb7252c..52dc49e2bb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h @@ -22,12 +22,24 @@ namespace OHOS { namespace AppExecFwk { +/** + * @class IKiaInterceptor + * IPC interface for KIA. + */ class IKiaInterceptor : public OHOS::IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IKiaInterceptor"); + + /** + * OnIntercept, processing method from KIA. + * + * @param want The param of openning the app. + * @return Error code of calling the function. + */ virtual int OnIntercept(AAFwk::Want &want) = 0; enum { + // ipc code for calling OnIntercept KIA_INTERCEPTOR_ON_INTERCEPT = 0, }; }; diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h index ca579bc05c..328ac436be 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h +++ b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h @@ -22,18 +22,43 @@ namespace OHOS { namespace AppExecFwk { +/** + * @class KiaInterceptorProxy + * IPC proxy of IKiaInterceptor. + */ class KiaInterceptorProxy : public IRemoteProxy { public: + /** + * KiaInterceptorProxy, constructor. + * + * @param impl The implementation of IKiaInterceptor. + */ explicit KiaInterceptorProxy(const sptr &impl) : IRemoteProxy(impl) {} + /** + * KiaInterceptorProxy, destructor. + * + */ virtual ~KiaInterceptorProxy() {} + /** + * OnIntercept, processing method from KIA. + * + * @param want The param of openning the app. + */ virtual int OnIntercept(AAFwk::Want &want) override; private: + /** + * WriteInterfaceToken. + * + * @param data The message parcel data. + * @return Flag whether write is successful. + */ bool WriteInterfaceToken(MessageParcel &data); + static inline BrokerDelegator delegator_; }; } // namespace AppExecFwk diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h index 682f511cab..784a3d80eb 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h +++ b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h @@ -23,15 +23,44 @@ namespace OHOS { namespace AppExecFwk { +/** + * @class KiaInterceptorStub + * IPC stub of IKiaInterceptor. + */ class KiaInterceptorStub : public IRemoteStub { public: + /** + * KiaInterceptorStub, constructor. + * + */ KiaInterceptorStub(); + + /** + * KiaInterceptorStub, destructor. + * + */ virtual ~KiaInterceptorStub(); + /** + * OnRemoteRequest, IPC method. + * + * @param code The IPC code. + * @param data The message parcel data. + * @param reply The message parcel reply. + * @param option The message parcel option. + * @return Error code of calling the function. + */ virtual int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: + /** + * OnInterceptInner, inner processing method from KIA. + * + * @param data The message parcel data. + * @param reply The message parcel reply. + * @return Error code of calling the function. + */ int OnInterceptInner(MessageParcel &data, MessageParcel &reply); }; } // namespace AppExecFwk diff --git a/interfaces/kits/native/ability/native/free_install_observer_proxy.h b/interfaces/kits/native/ability/native/free_install_observer_proxy.h index 3475866f6c..708fbea677 100644 --- a/interfaces/kits/native/ability/native/free_install_observer_proxy.h +++ b/interfaces/kits/native/ability/native/free_install_observer_proxy.h @@ -21,9 +21,22 @@ namespace OHOS { namespace AbilityRuntime { +/** + * @class FreeInstallObserverProxy + * IPC stub of IFreeInstallObserver. + */ class FreeInstallObserverProxy : public IRemoteProxy { public: + /** + * FreeInstallObserverProxy, constructor. + * + */ explicit FreeInstallObserverProxy(const sptr &impl); + + /** + * FreeInstallObserverProxy, destructor. + * + */ virtual ~FreeInstallObserverProxy() = default; /** @@ -48,7 +61,14 @@ public: const int &resultCode) override; private: + /** + * WriteInterfaceToken. + * + * @param data The message parcel data. + * @return Flag whether write is successful. + */ bool WriteInterfaceToken(MessageParcel &data); + static inline BrokerDelegator delegator_; }; } // namespace AbilityRuntime diff --git a/interfaces/kits/native/ability/native/free_install_observer_stub.h b/interfaces/kits/native/ability/native/free_install_observer_stub.h index b23c34bf1f..fefa78a0d7 100644 --- a/interfaces/kits/native/ability/native/free_install_observer_stub.h +++ b/interfaces/kits/native/ability/native/free_install_observer_stub.h @@ -24,17 +24,55 @@ namespace OHOS { namespace AbilityRuntime { +/** + * @class FreeInstallObserverStub + * IPC proxy of IFreeInstallObserver. + */ class FreeInstallObserverStub : public IRemoteStub { public: + /** + * FreeInstallObserverStub, constructor. + * + */ FreeInstallObserverStub(); + + /** + * FreeInstallObserverStub, destructor. + * + */ virtual ~FreeInstallObserverStub(); + /** + * OnRemoteRequest, IPC method. + * + * @param code The IPC code. + * @param data The message parcel data. + * @param reply The message parcel reply. + * @param option The message parcel option. + * @return Error code of calling the function. + */ virtual int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: DISALLOW_COPY_AND_MOVE(FreeInstallObserverStub); + + /** + * OnInstallFinishedInner, inner processing method for OnInstallFinished. + * + * @param data The message parcel data. + * @param reply The message parcel reply. + * @return Error code of calling the function. + */ int OnInstallFinishedInner(MessageParcel &data, MessageParcel &reply); + + /** + * OnInstallFinishedByUrlInner, inner processing method for OnInstallFinishedByUrl. + * + * @param data The message parcel data. + * @param reply The message parcel reply. + * @return Error code of calling the function. + */ int OnInstallFinishedByUrlInner(MessageParcel &data, MessageParcel &reply); }; } // namespace AbilityRuntime diff --git a/interfaces/kits/native/ability/native/js_free_install_observer.h b/interfaces/kits/native/ability/native/js_free_install_observer.h index 5e417cf055..6f0fc6b9df 100644 --- a/interfaces/kits/native/ability/native/js_free_install_observer.h +++ b/interfaces/kits/native/ability/native/js_free_install_observer.h @@ -38,7 +38,16 @@ struct JsFreeInstallObserverObject { class JsFreeInstallObserver : public FreeInstallObserverStub { public: + /** + * JsFreeInstallObserver, constructor. + * + */ explicit JsFreeInstallObserver(napi_env env); + + /** + * JsFreeInstallObserver, destructor. + * + */ ~JsFreeInstallObserver(); /** @@ -97,14 +106,67 @@ public: napi_value jsObserverObject, napi_value* result, bool isAbilityResult = false); private: + /** + * CallPromise, resolve promise. + * + * @param deferred The promise that is to be resolved. + * @param resultCode The result code of the promise. + */ void CallPromise(napi_deferred deferred, int32_t resultCode); + + /** + * CallPromise, resolve promise. + * + * @param deferred The promise that is to be resolved. + * @param abilityResult The ability result of the promise. + */ void CallPromise(napi_deferred deferred, napi_value abilityResult); + + /** + * CallCallback, call callback. + * + * @param callback The callback that is to be called. + * @param resultCode The result code of the promise. + */ void CallCallback(napi_ref callback, int32_t resultCode); + + /** + * CallCallback, call callback. + * + * @param callback The callback that is to be called. + * @param abilityResult The ability result of the promise. + */ void CallCallback(napi_ref callback, napi_value abilityResult); + + /** + * HandleOnInstallFinished, handle the event of free install upon finished. + * + * @param bundleName The bundle name of the app. + * @param abilityName The ability name of the app. + * @param startTime The start time. + * @param resultCode The result code. + */ void HandleOnInstallFinished(const std::string &bundleName, const std::string &abilityName, const std::string &startTime, const int &resultCode); + + /** + * HandleOnInstallFinishedByUrl, handle the event of free install upon finished. + * + * @param startTime The start time. + * @param url The url of the app. + * @param resultCode The result code. + */ void HandleOnInstallFinishedByUrl(const std::string &startTime, const std::string &url, const int &resultCode); + + /** + * AddJsObserverCommon, helper of AddJsObserverObject. + * + * @param object The free install observer object. + * @param jsObserverObject The js observer object. + * @param result The resultant object. + * @param isAbilityResult The flag of whether it is to return ability result. + */ void AddJsObserverCommon(JsFreeInstallObserverObject &object, napi_value jsObserverObject, napi_value* result, bool isAbilityResult); napi_env env_; diff --git a/services/abilitymgr/include/utils/ability_permission_util.h b/services/abilitymgr/include/utils/ability_permission_util.h index 0fe8cbc91d..d41eaeaea4 100644 --- a/services/abilitymgr/include/utils/ability_permission_util.h +++ b/services/abilitymgr/include/utils/ability_permission_util.h @@ -27,29 +27,99 @@ struct RunningProcessInfo; } namespace AAFwk { struct AbilityRequest; + +/** + * @class Want + * the struct to open abilities. + */ class Want; + +/** + * @class AbilityPermissionUtil + * provides ability permission utilities. + */ class AbilityPermissionUtil { public: + /** + * GetInstance, get an instance of AbilityPermissionUtil. + * + * @return An instance of AbilityPermissionUtil. + */ static AbilityPermissionUtil &GetInstance(); - // check caller is delegator + /** + * IsDelegatorCall, check caller is delegator. + * + * @param processInfo The process information. + * @param abilityRequest The ability request. + * @return Whether the caller is delegator. + */ bool IsDelegatorCall(const AppExecFwk::RunningProcessInfo &processInfo, const AbilityRequest &abilityRequest) const; - // check dominate screen + /** + * IsDominateScreen, check dominate screen. + * + * @param want The want. + * @param isPendingWantCaller Flag of whether it is the pending want caller. + * @return Whether it is dominate screen. + */ bool IsDominateScreen(const Want &want, bool isPendingWantCaller); + /** + * CheckMultiInstanceAndAppClone, check if the app is either multi-instance or app-clone. + * + * @param want The want. + * @param userId The user id. + * @param appIndex The app index. + * @param callerToken The caller token. + * @return Whether the app is either multi-instance or app-clone. + */ int32_t CheckMultiInstanceAndAppClone(Want &want, int32_t userId, int32_t appIndex, sptr callerToken); + /** + * CheckMultiInstanceKeyForExtension, check multi-instance key for extension. + * + * @param abilityRequest The ability request. + * @return Whether the key is multi-instance key. + */ int32_t CheckMultiInstanceKeyForExtension(const AbilityRequest &abilityRequest); private: + /** + * AbilityPermissionUtil, the private constructor. + * + */ AbilityPermissionUtil() = default; + + /** + * AbilityPermissionUtil, the private destructor. + * + */ ~AbilityPermissionUtil() = default; + /** + * CheckMultiInstance, check multi-instance. + * + * @param want The want. + * @param callerToken The caller token. + * @param isCreating Whether the app is being created. + * @param instanceKey The instance key. + * @param maxCount The max number of instances. + * @return Whether it is a valid multi-instance instance. + */ int32_t CheckMultiInstance(Want &want, sptr callerToken, bool isCreating, const std::string &instanceKey, int32_t maxCount); + /** + * UpdateInstanceKey, update instance key. + * + * @param want The want. + * @param originInstanceKey The original instance key. + * @param instanceKeyArray Candidate instance keys. + * @param instanceKey The new instance key. + * @return Whether the update is successful. + */ int32_t UpdateInstanceKey(Want &want, const std::string &originInstanceKey, const std::vector &instanceKeyArray, const std::string &instanceKey); diff --git a/services/abilitymgr/include/utils/app_mgr_util.h b/services/abilitymgr/include/utils/app_mgr_util.h index 43b42bbad8..3384d4b42d 100644 --- a/services/abilitymgr/include/utils/app_mgr_util.h +++ b/services/abilitymgr/include/utils/app_mgr_util.h @@ -20,8 +20,17 @@ namespace OHOS { namespace AAFwk { +/** + * @class AppMgrUtil + * provides appmgr utilities. + */ class AppMgrUtil final { public: + /** + * GetAppMgr, get app mgr. + * + * @return AppMgr. + */ static sptr GetAppMgr(); private: diff --git a/services/abilitymgr/include/utils/dump_utils.h b/services/abilitymgr/include/utils/dump_utils.h index 73a265e26a..7d9acab05e 100644 --- a/services/abilitymgr/include/utils/dump_utils.h +++ b/services/abilitymgr/include/utils/dump_utils.h @@ -20,36 +20,103 @@ namespace OHOS { namespace AAFwk { +/** + * @class DumpUtils + * provides dump utilities. + */ class DumpUtils final { public: enum DumpKey { + // dump all KEY_DUMP_ALL = 0, + + // dump stack list KEY_DUMP_STACK_LIST, + + // dump stack KEY_DUMP_STACK, + + // dump mission KEY_DUMP_MISSION, + + // dump top ability KEY_DUMP_TOP_ABILITY, + + // dump wait queue KEY_DUMP_WAIT_QUEUE, + + // dump service KEY_DUMP_SERVICE, + + // dump data KEY_DUMP_DATA, + + // dump focus ability KEY_DUMP_FOCUS_ABILITY, + + // dump window mode KEY_DUMP_WINDOW_MODE, + + // dump mission list KEY_DUMP_MISSION_LIST, + + // dump mission info KEY_DUMP_MISSION_INFOS, }; enum DumpsysKey { + // dump system all KEY_DUMP_SYS_ALL = 0, + + // dump system mission list KEY_DUMP_SYS_MISSION_LIST, + + // dump system ability KEY_DUMP_SYS_ABILITY, + + // dump system service KEY_DUMP_SYS_SERVICE, + + // dump system pending KEY_DUMP_SYS_PENDING, + + // dump system process KEY_DUMP_SYS_PROCESS, + + // dump system data KEY_DUMP_SYS_DATA, }; + /** + * DumpMapOne, dump map first function. + * + * @param argString The argument string. + * @return The pair of the dump result and the dump key. + */ static std::pair DumpMapOne(std::string argString); + + /** + * DumpMapTwo, dump map second function. + * + * @param argString The argument string. + * @return The pair of the dump result and the dump key. + */ static std::pair DumpMapTwo(std::string argString); + + /** + * DumpMap, dump map function. + * + * @param argString The argument string. + * @return The pair of the dump result and the dump key. + */ static std::pair DumpMap(std::string argString); + + /** + * DumpsysMap, dump system map function. + * + * @param argString The argument string. + * @return The pair of the dump result and the dump key. + */ static std::pair DumpsysMap(std::string argString); }; } // namespace AAFwk diff --git a/services/abilitymgr/include/utils/extension_permissions_util.h b/services/abilitymgr/include/utils/extension_permissions_util.h index 750814642b..b8bc1fb7dc 100644 --- a/services/abilitymgr/include/utils/extension_permissions_util.h +++ b/services/abilitymgr/include/utils/extension_permissions_util.h @@ -20,9 +20,26 @@ namespace OHOS { namespace AAFwk { +/** + * @class ExtensionPermissionsUtil + * provides extension permission utilities. + */ class ExtensionPermissionsUtil final { public: + /** + * CheckSAPermission, check if it has SA permissions. + * + * @param extensionType The extension type. + * @return Whether it has SA permissions. + */ static bool CheckSAPermission(const AppExecFwk::ExtensionAbilityType &extensionType); + + /** + * CheckSAPermissionMore, check if it has SA permissions or more. + * + * @param extensionType The extension type. + * @return Whether it has SA permissions or more. + */ static bool CheckSAPermissionMore(const AppExecFwk::ExtensionAbilityType &extensionType); }; diff --git a/services/abilitymgr/include/utils/modal_system_dialog_util.h b/services/abilitymgr/include/utils/modal_system_dialog_util.h index 52cdc93ef5..2105c484dc 100644 --- a/services/abilitymgr/include/utils/modal_system_dialog_util.h +++ b/services/abilitymgr/include/utils/modal_system_dialog_util.h @@ -20,6 +20,10 @@ namespace OHOS { namespace AbilityRuntime { +/** + * @class ModalSystemDialogUtil + * provides modal system dialog utilities. + */ class ModalSystemDialogUtil final { public: /** diff --git a/services/abilitymgr/include/utils/multi_app_utils.h b/services/abilitymgr/include/utils/multi_app_utils.h index cca870e799..2bb6ea0e82 100644 --- a/services/abilitymgr/include/utils/multi_app_utils.h +++ b/services/abilitymgr/include/utils/multi_app_utils.h @@ -20,8 +20,19 @@ namespace OHOS { namespace AAFwk { +/** + * @class MultiAppUtils + * provides multi-app utilities. + */ class MultiAppUtils { public: + /** + * GetRunningMultiAppIndex, get multi-app running application index. + * + * @param bundleName The bundle name of the app. + * @param uid The calling uid. + * @param appIndex The resultant application index. + */ static void GetRunningMultiAppIndex(const std::string &bundleName, int32_t uid, int32_t &appIndex); }; } // namespace AAFwk diff --git a/services/abilitymgr/include/utils/multi_instance_utils.h b/services/abilitymgr/include/utils/multi_instance_utils.h index 4f75e0758b..e253671ce7 100644 --- a/services/abilitymgr/include/utils/multi_instance_utils.h +++ b/services/abilitymgr/include/utils/multi_instance_utils.h @@ -25,14 +25,67 @@ namespace OHOS { namespace AAFwk { +/** + * @class MultiInstanceUtils + * provides multi-instance utilities. + */ class MultiInstanceUtils { public: + /** + * GetInstanceKey, get instance key of the given want. + * + * @param want The want param. + * @return The instance key. + */ static std::string GetInstanceKey(const Want& want); + + /** + * GetValidExtensionInstanceKey, get valid extension instance key. + * + * @param abilityRequest The ability request. + * @return The instance key. + */ static std::string GetValidExtensionInstanceKey(const AbilityRequest &abilityRequest); + + /** + * GetValidExtensionInstanceKey, get valid extension instance key. + * + * @param abilityRequest The ability request. + * @return The instance key. + */ static std::string GetSelfCallerInstanceKey(const AbilityRequest &abilityRequest); + + /** + * IsDefaultInstanceKey, check if the key is the default instance key. + * + * @param key The key to be queried. + * @return Whether the instance key is the default. + */ static bool IsDefaultInstanceKey(const std::string& key); + + /** + * IsMultiInstanceApp, check if the app is the default multi-instance app. + * + * @param appInfo The app info to be queried. + * @return Whether the app is the default multi-instance app. + */ static bool IsMultiInstanceApp(AppExecFwk::ApplicationInfo appInfo); + + /** + * IsSupportedExtensionType, check if the type supports extension type. + * + * @param type The extension ability type. + * @return Whether the type supports extension type. + */ static bool IsSupportedExtensionType(AppExecFwk::ExtensionAbilityType type); + + /** + * IsInstanceKeyExist, check if the instance key exists. + * + * @param bundleName The bundle name. + * @param key The instance key to be queried. + * @return Whether the instance key exists. + */ static bool IsInstanceKeyExist(const std::string& bundleName, const std::string& key); }; } // namespace AAFwk diff --git a/services/abilitymgr/include/utils/state_utils.h b/services/abilitymgr/include/utils/state_utils.h index 423022c070..d4ab40b021 100644 --- a/services/abilitymgr/include/utils/state_utils.h +++ b/services/abilitymgr/include/utils/state_utils.h @@ -23,10 +23,34 @@ namespace OHOS { namespace AAFwk { +/** + * @class StateUtils + * provides state utilities. + */ class StateUtils final { public: + /** + * StateToStrMap, convert ability state to string. + * + * @param state The ability state. + * @return The string ability state. + */ static std::string StateToStrMap(const AbilityState &state); + + /** + * AppStateToStrMap, convert app state to string. + * + * @param state The app state. + * @return The string app state. + */ static std::string AppStateToStrMap(const AppState &state); + + /** + * ConvertStateMap, convert ability lifecycle state to string. + * + * @param state The ability lifecycle state. + * @return The string ability lifecycle state. + */ static int ConvertStateMap(const AbilityLifeCycleState &state); }; } // namespace AAFwk diff --git a/services/abilitymgr/include/utils/want_utils.h b/services/abilitymgr/include/utils/want_utils.h index ee60cd1d2d..2904422f29 100644 --- a/services/abilitymgr/include/utils/want_utils.h +++ b/services/abilitymgr/include/utils/want_utils.h @@ -25,10 +25,34 @@ namespace OHOS { namespace AAFwk { +/** + * @class WantUtils + * provides want utilities. + */ class WantUtils final { public: + /** + * ConvertToExplicitWant, convert implicit want to explicit want. + * + * @param want The implicit want. + * @return Error code of calling the function. + */ static int32_t ConvertToExplicitWant(Want& want); + + /** + * GetCallerBundleName, get caller bundle name. + * + * @param callerBundleName The caller bundle name. + * @return Error code of calling the function. + */ static int32_t GetCallerBundleName(std::string &callerBundleName); + + /** + * IsAtomicServiceUrl, check if the want contains atomic service url. + * + * @param want The implicit want. + * @return Flag if the want contains atomic service url. + */ static bool IsAtomicServiceUrl(const Want& want); }; } // namespace AAFwk diff --git a/services/abilitymgr/include/utils/window_options_utils.h b/services/abilitymgr/include/utils/window_options_utils.h index 8ec5d5be8c..aa28a51862 100644 --- a/services/abilitymgr/include/utils/window_options_utils.h +++ b/services/abilitymgr/include/utils/window_options_utils.h @@ -25,12 +25,44 @@ namespace OHOS { namespace AAFwk { +/** + * @class WindowOptionsUtils + * provides window options utilities. + */ class WindowOptionsUtils final { public: + /** + * SetWindowPositionAndSize, set window position and size. + * + * @param want The want param. + * @param callerToken The caller token. + * @param startOptions The start options. + */ static void SetWindowPositionAndSize(Want& want, const sptr& callerToken, const StartOptions& startOptions); + + /** + * WindowModeMap, get window mode map. + * + * @param windowMode The window mode. + * @return The pair of the window mode result and the supported window mode. + */ static std::pair WindowModeMap(int32_t windowMode); + + /** + * UpdateWantToSetDisplayID, update want to set display id. + * + * @param want The want param. + * @param callerToken The caller token. + */ static void UpdateWantToSetDisplayID(Want &want, const sptr &callerToken); + + /** + * UpdateStartOptionsToSetDisplayID, update start options to set display id. + * + * @param startOptions The start options. + * @param callerToken The caller token. + */ static void UpdateStartOptionsToSetDisplayID(StartOptions &startOptions, const sptr &callerToken); }; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index a0520afc76..8f8cf6b2ac 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -1666,7 +1666,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); // prevent the app from dominating the screen - if (callerToken == nullptr && !IsCallerSceneBoard() && + if (callerToken == nullptr && !IsCallerSceneBoard() && !isCallByShortcut && AbilityPermissionUtil::GetInstance().IsDominateScreen(want, isPendingWantCaller)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "caller invalid"); return ERR_INVALID_CALLER; diff --git a/services/common/include/app_utils.h b/services/common/include/app_utils.h index f4e7ed4118..a740d3b302 100644 --- a/services/common/include/app_utils.h +++ b/services/common/include/app_utils.h @@ -33,44 +33,253 @@ public: T value; }; +/** + * @class AppUtils + * provides app utils. + */ class AppUtils { public: + /** + * GetInstance, get an instance of AppUtils. + * + * @return An instance of AppUtils. + */ static AppUtils &GetInstance(); + + /** + * AppUtils, destructor. + * + */ ~AppUtils(); + + /** + * IsLauncher, check if it is a launcher. + * + * @param bundleName The bundle name. + * @return Whether it is a launcher. + */ bool IsLauncher(const std::string &bundleName) const; + + /** + * IsLauncherAbility, check if it is a launcher ability. + * + * @param abilityName The ability name. + * @return Whether it is a launcher ability. + */ bool IsLauncherAbility(const std::string &abilityName) const; + + /** + * IsInheritWindowSplitScreenMode, check if it is inherit window split screen mode. + * + * @return Whether it is inherit window split screen mode. + */ bool IsInheritWindowSplitScreenMode(); + + /** + * IsSupportAncoApp, check if it supports anco app. + * + * @return Whether it supports anco app. + */ bool IsSupportAncoApp(); + + /** + * GetTimeoutUnitTimeRatio, get timeout unit time ratio. + * + * @return Timeout unit time ratio. + */ int32_t GetTimeoutUnitTimeRatio(); + + /** + * IsSelectorDialogDefaultPossion, check if selector dialog is on the default position. + * + * @return Whether selector dialog is on the default position. + */ bool IsSelectorDialogDefaultPossion(); + + /** + * IsStartSpecifiedProcess, check whether or not to start specified process. + * + * @return Whether or not to start specified process. + */ bool IsStartSpecifiedProcess(); + + /** + * IsUseMultiRenderProcess, check whether uses multi-render process. + * + * @return Whether uses multi-render process. + */ bool IsUseMultiRenderProcess(); + + /** + * IsLimitMaximumOfRenderProcess, check limit maximum of render process. + * + * @return Whether limit maximum of render process. + */ bool IsLimitMaximumOfRenderProcess(); + + /** + * IsGrantPersistUriPermission, check whether to grant persist uri permission. + * + * @return Whether to grant persist uri permission. + */ bool IsGrantPersistUriPermission(); + + /** + * IsStartOptionsWithAnimation, check whether the start options have animation. + * + * @return Whether the start options have animation. + */ bool IsStartOptionsWithAnimation(); + + /** + * IsStartOptionsWithAnimation, check whether it is a multi-process model. + * + * @return Whether it is a multi-process model. + */ bool IsMultiProcessModel(); + + /** + * IsStartOptionsWithProcessOptions, check whether the start options have process options. + * + * @return Whether the start options have process options. + */ bool IsStartOptionsWithProcessOptions(); + + /** + * EnableMoveUIAbilityToBackgroundApi, enable move ui-ability to background api. + * + * @return Whether the enable move ui-ability to background api is successful. + */ bool EnableMoveUIAbilityToBackgroundApi(); + + /** + * IsLaunchEmbededUIAbility, check if it is to launch embedded ui-ability. + * + * @return Whether it is to launch embedded ui-ability. + */ bool IsLaunchEmbededUIAbility(); + + /** + * IsSupportNativeChildProcess, check if it supports native child process. + * + * @return Whether it supports native child process. + */ bool IsSupportNativeChildProcess(); + + /** + * IsSupportMultiInstance, check if it supports multi-instance. + * + * @return Whether it supports multi-instance. + */ bool IsSupportMultiInstance(); + + /** + * IsAllowResidentInExtremeMemory, check if it allows resident in extrem low memory. + * + * @param bundleName The bundle name. + * @param abilityName The ability name. + * @return Whether it allows resident in extrem low memory. + */ bool IsAllowResidentInExtremeMemory(const std::string& bundleName, const std::string& abilityName = ""); + + /** + * IsAllowNativeChildProcess, check if it allows native child process. + * + * @param appIdentifier The app identifier. + * @return Whether it allows native child process. + */ bool IsAllowNativeChildProcess(const std::string &appIdentifier); + + /** + * GetLimitMaximumExtensionsPerProc, get limit max extensions per proc. + * + * @return Limit max extensions per proc. + */ int32_t GetLimitMaximumExtensionsPerProc(); + + /** + * GetLimitMaximumExtensionsPerDevice, get limit max extensions per device. + * + * @return Limit max extensions per device. + */ int32_t GetLimitMaximumExtensionsPerDevice(); + + /** + * GetCacheExtensionTypeList, get cache extension type list. + * + * @return Cache extension type list. + */ std::string GetCacheExtensionTypeList(); + + /** + * IsAllowStartAbilityWithoutCallerToken, check if it allows start ability without caller token. + * + * @param bundleName The bundle name. + * @param abilityName The ability name. + * @return Whether it allows start ability without caller token. + */ bool IsAllowStartAbilityWithoutCallerToken(const std::string& bundleName, const std::string& abilityName); + + /** + * GetBrokerDelegateBundleName, get broker delegate bundle name. + * + * @return Broker delegate bundle name. + */ std::string GetBrokerDelegateBundleName(); + + /** + * GetCollaboratorBrokerUID, get collaborator broker id. + * + * @return Collaborator broker id. + */ int32_t GetCollaboratorBrokerUID(); + + /** + * GetCollaboratorBrokerReserveUID, get collaborator broker reserve uid. + * + * @return Collaborator broker reserve uid. + */ int32_t GetCollaboratorBrokerReserveUID(); + + /** + * MaxChildProcess, get max child process. + * + * @return Max child process. + */ int32_t MaxChildProcess(); + + /** + * GetMigrateClientBundleName, get migrate client bundle name. + * + * @return Migrate client bundle name. + */ std::string GetMigrateClientBundleName(); private: + /** + * LoadResidentProcessInExtremeMemory, load resident process in extreme low memory. + * + */ void LoadResidentProcessInExtremeMemory(); + + /** + * LoadAllowNativeChildProcessApps, load allow native child process apps. + * + */ void LoadAllowNativeChildProcessApps(); + + /** + * LoadStartAbilityWithoutCallerToken, load start ability without caller token. + * + */ void LoadStartAbilityWithoutCallerToken(); + + /** + * AppUtils, private constructor. + * + */ AppUtils(); + volatile bool isSceneBoard_ = false; volatile DeviceConfiguration isInheritWindowSplitScreenMode_ = {false, true}; volatile DeviceConfiguration isSupportAncoApp_ = {false, false};