diff --git a/AbilityKit/ability_runtime/BUILD.gn b/AbilityKit/ability_runtime/BUILD.gn index e96e8afc2f01082308d3f5d85f308c27f011bbe5..350a42c3ccaa47e6294493316460a3fef85fd62d 100644 --- a/AbilityKit/ability_runtime/BUILD.gn +++ b/AbilityKit/ability_runtime/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -19,6 +19,7 @@ ohos_ndk_headers("ability_runtime_ndk_header") { "./ability_runtime_common.h", "./application_context.h", "./context_constant.h", + "./start_options.h", ] } diff --git a/AbilityKit/ability_runtime/ability_runtime_common.h b/AbilityKit/ability_runtime/ability_runtime_common.h index 8870470f7d857101d573ec74fa9b7575e8bc60e5..704d6c80fb98a2a918510be289f3a1c486635144 100644 --- a/AbilityKit/ability_runtime/ability_runtime_common.h +++ b/AbilityKit/ability_runtime/ability_runtime_common.h @@ -1,5 +1,5 @@ /* -* Copyright (C) 2024 Huawei Device Co., Ltd. +* Copyright (C) 2024-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 @@ -108,6 +108,36 @@ typedef enum { * @since 15 */ ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY = 16000053, + /** + * @error Setting visibility is disabled. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED = 16000067, + /** + * @error App clone or multi-instance is not supported. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED = 16000072, + /** + * @error The app instance key is invalid. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY = 16000076, + /** + * @error The number of app instances reaches the limit. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED = 16000077, + /** + * @error The multi-instance is not supported. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED = 16000078, + /** + * @error The APP_INSTANCE_KEY cannot be specified. + * @since 17 + */ + ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED = 16000079, } AbilityRuntime_ErrorCode; #ifdef __cplusplus diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 20ae96209c8041169392728858cedd04213458da..8053b32ad18caee533e8c85615cbf028b3f86178 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -42,6 +42,7 @@ #include #include "ability_runtime_common.h" #include "context_constant.h" +#include "start_options.h" #ifdef __cplusplus extern "C" { @@ -112,11 +113,50 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} if the caller tries to start a different application. * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if internal error occurs. * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} if the caller is not top ability. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} + * if the number of app instances reached the limit (since 17). + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} + * if the APP_INSTANCE_KEY cannot be specified (since 17). * For details, see {@link AbilityRuntime_ErrorCode}. * @since 15 */ AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbility(AbilityBase_Want *want); +/** + * @brief Starts self UIAbility with start options. + * + * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} + * @param want The arguments passed to start self UIAbility. + * For details, see {@link AbilityBase_Want}. + * @param options The start options passed to start self UIAbility. + * For details, see {@link AbilityRuntime_StartOptions}. + * @return Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the call is successful. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} if the caller has no correct permission. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the arguments provided is invalid. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} if the device does not support starting self uiability. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} if the target ability does not exist. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} if the ability type is incorrect. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} if the crowdtesting application expires. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} if the ability cannot be started in Wukong mode. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} if the app is controlled. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} if the app is controlled by EDM. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} if the caller tries to start a different application. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if internal error occurs. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} if the caller is not foreground process. + * Returns {@link ABILITY_RUNTIME_ERROR_VISIBILITY_SETTING_DISABLED} if setting visibility is disabled. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED} + * if the app clone or multi-instance is not supported. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY} if the app instance key is invalid. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT_REACHED} if the number of app instances reached the limit. + * Returns {@link ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED} if the multi-instance is not supported. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORTED} + * if the APP_INSTANCE_KEY cannot be specified. + * For details, see {@link AbilityRuntime_ErrorCode}. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions(AbilityBase_Want *want, + AbilityRuntime_StartOptions *options); + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/context_constant.h b/AbilityKit/ability_runtime/context_constant.h index 921f407c1aaf3c9201eb79fe7749f9cb4e48ca40..10f32672dd6403d4f35e84b9fc39578d3a64b03d 100644 --- a/AbilityKit/ability_runtime/context_constant.h +++ b/AbilityKit/ability_runtime/context_constant.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -74,6 +74,58 @@ typedef enum { ABILITY_RUNTIME_AREA_MODE_EL5 = 4, } AbilityRuntime_AreaMode; +/** +* @brief Start Visibility. +* +* @since 17 +*/ +typedef enum { + /** + * Indicates that the ability will hide after process startup. + */ + ABILITY_RUNTIME_HIDE_UPON_START = 0, + /** + * Indicates that the ability will show after process startup. + */ + ABILITY_RUNTIME_SHOW_UPON_START = 1, +} AbilityRuntime_StartVisibility; + +/** +* @brief Window mode. +* +* @since 17 +*/ +typedef enum { + /** + * The window mode is not defined. + */ + ABILITY_RUNTIME_WINDOW_MODE_UNDEFINED = 0, + /** + * Full screen mode. + */ + ABILITY_RUNTIME_WINDOW_MODE_FULL_SCREEN = 1, +} AbilityRuntime_WindowMode; + +/** +* Support window mode +* +* @since 17 +*/ +typedef enum { + /** + * Indicates supported window mode of full screen mode + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FULL_SCREEN = 0, + /** + * Indicates supported window mode of split mode + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_SPLIT = 1, + /** + * Indicates supported window mode of floating mode + */ + ABILITY_RUNTIME_SUPPORTED_WINDOW_MODE_FLOATING = 2, +} AbilityRuntime_SupportedWindowMode; + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 9001aefdf8e28909835efecfcea4fceb11b31e26..d61686907691ae10e9050441b82e551c356b1d73 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -14,5 +14,137 @@ { "first_introduced": "15", "name": "OH_AbilityRuntime_StartSelfUIAbility" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_CreateStartOptions" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_DestroyStartOptions" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWindowMode" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWindowMode" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsDisplayId" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsDisplayId" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWithAnimation" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWithAnimation" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWindowLeft" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWindowLeft" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWindowTop" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWindowTop" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWindowHeight" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWindowHeight" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsStartVisibility" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsStartVisibility" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsStartWindowIcon" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsStartWindowIcon" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsStartWindowBackgroundColor" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsStartWindowBackgroundColor" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsSupportedWindowModes" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsSupportedWindowModes" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsMinWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsMinWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsMaxWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsMaxWindowWidth" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsMinWindowHeight" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsMinWindowHeight" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_SetStartOptionsMaxWindowHeight" + }, + { + "first_introduced": "17", + "name": "OH_AbilityRuntime_GetStartOptionsMaxWindowHeight" } ] \ No newline at end of file diff --git a/AbilityKit/ability_runtime/start_options.h b/AbilityKit/ability_runtime/start_options.h new file mode 100644 index 0000000000000000000000000000000000000000..4b89ca90f0bace220a5bb58946c35b74acb801b5 --- /dev/null +++ b/AbilityKit/ability_runtime/start_options.h @@ -0,0 +1,481 @@ +/* + * 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. + */ + +/** + * @addtogroup AbilityRuntime + * @{ + * + * @brief Describe the functions provided by the start options. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 17 + */ + +/** + * @file start_options.h + * + * @brief Defines the start options APIs. + * + * @library libability_runtime.so + * @kit AbilityKit + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 17 + */ + +#ifndef ABILITY_RUNTIME_START_OPTIONS_H +#define ABILITY_RUNTIME_START_OPTIONS_H + +#include +#include +#include "ability_runtime_common.h" +#include "context_constant.h" +#include "multimedia/image_framework/image/pixelmap_native.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct AbilityRuntime_StartOptions; +typedef struct AbilityRuntime_StartOptions AbilityRuntime_StartOptions; + +/** + * @brief Create start options. + * + * @return Returns the newly created AbilityRuntime_StartOptions object. + * + * @since 17 + */ +AbilityRuntime_StartOptions* OH_AbilityRuntime_CreateStartOptions(void); + +/** + * @brief Destroy input start options. + * + * @param startOptions The options to be deleted. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_DestroyStartOptions(AbilityRuntime_StartOptions **startOptions); + +/** + * @brief Set window mode for start options. + * + * @param startOptions The options to set window mode for. + * @param windowMode The window mode. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions or windowMode is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWindowMode(AbilityRuntime_StartOptions *startOptions, + AbilityRuntime_WindowMode windowMode); + +/** + * @brief Get window mode from start options. + * + * @param startOptions The options to get window mode from. + * @param windowMode The obtained window mode. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowMode(AbilityRuntime_StartOptions *startOptions, + AbilityRuntime_WindowMode &windowMode); + +/** + * @brief Set display id for start options. + * + * @param startOptions The options to set display id for. + * @param displayId The display id. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsDisplayId(AbilityRuntime_StartOptions *startOptions, + int32_t displayId); + +/** + * @brief Get display id from start options. + * + * @param startOptions The options to get display id from. + * @param displayId The obtained display id. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsDisplayId(AbilityRuntime_StartOptions *startOptions, + int32_t &displayId); + +/** + * @brief Set with animation flag for start options. + * + * @param startOptions The options to set with animation for. + * @param withAnimation The with animation. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWithAnimation(AbilityRuntime_StartOptions *startOptions, + bool withAnimation); + +/** + * @brief Get with animation from start options. + * + * @param startOptions The options to get with animation from. + * @param withAnimation The obtained with animation. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWithAnimation(AbilityRuntime_StartOptions *startOptions, + bool &withAnimation); + +/** + * @brief Set window left for start options. + * + * @param startOptions The options to set window left for. + * @param windowLeft The window left. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWindowLeft(AbilityRuntime_StartOptions *startOptions, + int32_t windowLeft); + +/** + * @brief Get window left from start options. + * + * @param startOptions The options to get window left from. + * @param windowLeft The obtained window left. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowLeft(AbilityRuntime_StartOptions *startOptions, + int32_t &windowLeft); + +/** + * @brief Set window top for start options. + * + * @param startOptions The options to set window top for. + * @param windowTop The window top. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWindowTop(AbilityRuntime_StartOptions *startOptions, + int32_t windowTop); + +/** + * @brief Get window top from start options. + * + * @param startOptions The options to get window top from. + * @param windowTop The obtained window top. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowTop(AbilityRuntime_StartOptions *startOptions, + int32_t &windowTop); + +/** + * @brief Set window height for start options. + * + * @param startOptions The options to set window height for. + * @param windowHeight The window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWindowHeight(AbilityRuntime_StartOptions *startOptions, + int32_t windowHeight); + +/** + * @brief Get window height from start options. + * + * @param startOptions The options to get window height from. + * @param windowHeight The obtained window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowHeight(AbilityRuntime_StartOptions *startOptions, + int32_t &windowHeight); + +/** + * @brief Set window width for start options. + * + * @param startOptions The options to set window width for. + * @param windowWidth The window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsWindowWidth(AbilityRuntime_StartOptions *startOptions, + int32_t windowWidth); + +/** + * @brief Get window width from start options. + * + * @param startOptions The options to get window width from. + * @param windowWidth The obtained window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowWidth(AbilityRuntime_StartOptions *startOptions, + int32_t &windowWidth); + +/** + * @brief Set start visibility for start options. + * + * @param startOptions The options to set start visibility for. + * @param startVisibility The start visibility. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsStartVisibility(AbilityRuntime_StartOptions *startOptions, + AbilityRuntime_StartVisibility startVisibility); + +/** + * @brief Get start visibility from start options. + * + * @param startOptions The options to get start visibility from. + * @param startVisibility The obtained start visibility. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsStartVisibility(AbilityRuntime_StartOptions *startOptions, + AbilityRuntime_StartVisibility &startVisibility); + +/** + * @brief Set start window icon for start options. + * + * @param startOptions The options to set start window icon for. + * @param startWindowIcon The start window icon. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid + * or startWindowIcon is nullptr. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsStartWindowIcon(AbilityRuntime_StartOptions *startOptions, + OH_PixelmapNative *startWindowIcon); + +/** + * @brief Get start window icon from start options. + * + * @param startOptions The options to get start window icon from. + * @param startWindowIcon The obtained start window icon. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid + * or startWindowIcon is NOT nullptr. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsStartWindowIcon(AbilityRuntime_StartOptions *startOptions, + OH_PixelmapNative **startWindowIcon); + +/** + * @brief Set start window background color for start options. + * + * @param startOptions The options to set start window background color for. + * @param startWindowBackgroundColor The start window background color. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid + * or startWindowBackgroundColor is nullptr. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsStartWindowBackgroundColor( + AbilityRuntime_StartOptions *startOptions, const char *startWindowBackgroundColor); + +/** + * @brief Get start window background color from start options. + * + * @param startOptions The options to get start window background color from. + * @param startWindowBackgroundColor The obtained start window background color. + * @param size The size of start window background color. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid + * or startWindowBackgroundColor is NOT nullptr. + * {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if error occurred in malloc. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsStartWindowBackgroundColor( + AbilityRuntime_StartOptions *startOptions, char **startWindowBackgroundColor, size_t &size); + +/** + * @brief Set start window modes for start options. + * + * @param startOptions The options to set start window modes for. + * @param supportedWindowModes The start window modes. + * @param size The size of start window modes. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions or supportWindowMode + * or size is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsSupportedWindowModes( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportedWindowMode *supportedWindowModes, + size_t size); + +/** + * @brief Get start window modes from start options. + * + * @param startOptions The options to get start window modes from. + * @param supportedWindowModes The obtained start window modes. + * @param size The size of the returned start window modes. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invallid + * or supportWindowMode is NOT nullptr + * {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if error occurred in malloc. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsSupportedWindowModes( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportedWindowMode **supportedWindowModes, + size_t &size); + +/** + * @brief Set min window width for start options. + * + * @param startOptions The options to set min window width for. + * @param minWindowWidth The min window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsMinWindowWidth( + AbilityRuntime_StartOptions *startOptions, int32_t minWindowWidth); + +/** + * @brief Get min window width from start options. + * + * @param startOptions The options to get min window width from. + * @param minWindowWidth The obtained min window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsMinWindowWidth( + AbilityRuntime_StartOptions *startOptions, int32_t &minWindowWidth); + +/** + * @brief Set max window width for start options. + * + * @param startOptions The options to set max window width for. + * @param maxWindowWidth The max window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsMaxWindowWidth( + AbilityRuntime_StartOptions *startOptions, int32_t maxWindowWidth); + +/** + * @brief Get max window width from start options. + * + * @param startOptions The options to get max window width from. + * @param maxWindowWidth The obtained max window width. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsMaxWindowWidth( + AbilityRuntime_StartOptions *startOptions, int32_t &maxWindowWidth); + +/** + * @brief Set min window height for start options. + * + * @param startOptions The options to set min window height for. + * @param minWindowHeight The min window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsMinWindowHeight( + AbilityRuntime_StartOptions *startOptions, int32_t minWindowHeight); + +/** + * @brief Get min window height from start options. + * + * @param startOptions The options to get min window height from. + * @param minWindowHeight The obtained min window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsMinWindowHeight( + AbilityRuntime_StartOptions *startOptions, int32_t &minWindowHeight); + +/** + * @brief Set max window height for start options. + * + * @param startOptions The options to set max window height for. + * @param maxWindowHeight The max window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsMaxWindowHeight( + AbilityRuntime_StartOptions *startOptions, int32_t maxWindowHeight); + +/** + * @brief Get max window height from start options. + * + * @param startOptions The options to get max window height from. + * @param maxWindowHeight The obtained max window height. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the startOptions is invalid. + * @since 17 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsMaxWindowHeight( + AbilityRuntime_StartOptions *startOptions, int32_t &maxWindowHeight); + +#ifdef __cplusplus +} // extern "C" +#endif + +/** @} */ +#endif // ABILITY_RUNTIME_START_OPTIONS_H \ No newline at end of file