From bebdacf6d871e46267923109fd14572d2cde1e4d Mon Sep 17 00:00:00 2001 From: xuzihan129 Date: Tue, 4 Mar 2025 15:47:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9D=A8=E6=97=AD=E5=85=89-change:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuzihan129 --- AbilityKit/ability_runtime/BUILD.gn | 3 +- .../ability_runtime/ability_runtime_common.h | 39 +- .../ability_runtime/application_context.h | 71 ++- AbilityKit/ability_runtime/context_constant.h | 38 +- .../libability_runtime.ndk.json | 124 +++++ AbilityKit/ability_runtime/start_options.h | 455 ++++++++++++++++++ 6 files changed, 725 insertions(+), 5 deletions(-) create mode 100644 AbilityKit/ability_runtime/start_options.h diff --git a/AbilityKit/ability_runtime/BUILD.gn b/AbilityKit/ability_runtime/BUILD.gn index e96e8afc2..350a42c3c 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 8870470f7..333dcc90b 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,7 +108,42 @@ typedef enum { * @since 15 */ ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY = 16000053, -} AbilityRuntime_ErrorCode; + /** + * @error Setting visibility is disabled. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_SET_VISIBILITY_DISABLED = 16000067, + /** + * @error App clone or multi-instance is not supported. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_CODE_MULTI_APP_NOT_SUPPORTED = 16000072, + /** + * @error The app instance key is invalid. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_CODE_INVALID_APP_INSTANCE_KEY = 16000076, + /** + * @error The number of app instances reaches the limit. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_CODE_UPPER_LIMIT = 16000077, + /** + * @error The multi-instance is not supported. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_MULTI_INSTANCE_NOT_SUPPORTED = 16000078, + /** + * @error The APP_INSTANCE_KEY cannot be specified. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_CODE_APP_INSTANCE_KEY_NOT_SUPPORT = 16000079, + /** + * @error Creating a new instance is not supported. + * @since 18 + */ + ABILITY_RUNTIME_ERROR_CODE_CREATE_NEW_INSTANCE_NOT_SUPPORT = 16000080, + } AbilityRuntime_ErrorCode; #ifdef __cplusplus } diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 7751647d3..bc4f6593b 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" { @@ -234,8 +235,76 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( * For details, see {@link AbilityRuntime_ErrorCode}. * @since 15 */ +/** + * @brief Starts self UIAbility. + * + * @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_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} 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_SUPPORT} if the APP_INSTANCE_KEY cannot be specified. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CREATE_NEW_INSTANCE_NOT_SUPPORT} + * if creating a new instance is not supported. + * For details, see {@link AbilityRuntime_ErrorCode}. + * @since 18 + */ 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_SET_VISIBILITY_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} 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_SUPPORT} if the APP_INSTANCE_KEY cannot be specified. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CREATE_NEW_INSTANCE_NOT_SUPPORT} + * if creating a new instance is not supported. + * For details, see {@link AbilityRuntime_ErrorCode}. + * @since 18 + */ +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 921f407c1..fc8f9b1ab 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,42 @@ typedef enum { ABILITY_RUNTIME_AREA_MODE_EL5 = 4, } AbilityRuntime_AreaMode; +/** +* @brief Window mode. +* +* @since 18 +*/ +typedef enum { + /** + * The window mode is not defined. + */ + ABILITY_RUNTIME_WINDOW_MODE_UNDEFINED = 0, + /** + * Full screen mode. + */ + ABILITY_RUNTIME_WINDOW_MODE_FULLSCREEN = 1, +} AbilityRuntime_WindowMode; + +/** +* Support window mode +* +* @since 18 +*/ +typedef enum { + /** + * Indicates supported window mode of full screen mode + */ + ABILITY_RUNTIME_SUPPORT_WINDOW_MODE_FULL_SCREEN = 0, + /** + * Indicates supported window mode of split mode + */ + ABILITY_RUNTIME_SUPPORT_WINDOW_MODE_SPLIT = 1, + /** + * Indicates supported window mode of floating mode + */ + ABILITY_RUNTIME_SUPPORT_WINDOW_MODE_FLOATING = 2, +} AbilityRuntime_SupportWindowMode; + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 90182407a..26d446948 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -42,5 +42,129 @@ { "first_introduced": "18", "name": "OH_AbilityRuntime_ApplicationContextGetCloudFileDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_CreateStartOptions" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_DestroyStartOptions" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWindowMode" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWindowMode" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsDisplayId" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsDisplayId" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWithAnimation" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWithAnimation" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWindowLeft" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWindowLeft" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWindowTop" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWindowTop" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWindowHeight" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWindowHeight" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsStartWindowIcon" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsStartWindowIcon" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsStartWindowBackgroundColor" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsStartWindowBackgroundColor" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsSupportWindowMode" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsSupportWindowMode" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsMinWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsMinWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsMaxWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsMaxWindowWidth" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsMinWindowHeight" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsMinWindowHeight" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsMaxWindowHeight" + }, + { + "first_introduced": "18", + "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 000000000..1c3ae64e8 --- /dev/null +++ b/AbilityKit/ability_runtime/start_options.h @@ -0,0 +1,455 @@ +/* + * 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 18 + */ + +/** + * @file start_options.h + * + * @brief Defines the start options APIs. + * + * @library libability_runtime.so + * @kit AbilityKit + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 18 + */ + +#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 AbilityBase_StartOptions object. + * + * @since 18 + */ +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 18 + */ +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 wondow 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 18 + */ +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 wondow 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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowWidth(AbilityRuntime_StartOptions *startOptions, + int32_t &windowWidth); + +/** + * @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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 supportWindowModes 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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsSupportWindowMode( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode *supportWindowModes, + size_t size); + +/** + * @brief Get start window modes from start options. + * + * @param startOptions The options to get start window modes from. + * @param supportWindowModes 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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsSupportWindowMode( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode **supportWindowModes, + 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 18 + */ +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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ + 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 18 + */ +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 -- Gitee From cfdc5b44fe6051bc8521495859054e93c220d0f8 Mon Sep 17 00:00:00 2001 From: xuzihan129 Date: Tue, 4 Mar 2025 16:23:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?start=5Foptions=20=E6=B7=BB=E5=8A=A0=20visi?= =?UTF-8?q?bility=20=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuzihan129 --- AbilityKit/ability_runtime/context_constant.h | 16 + .../libability_runtime.ndk.json | 8 + AbilityKit/ability_runtime/start_options.h | 936 +++++++++--------- 3 files changed, 505 insertions(+), 455 deletions(-) diff --git a/AbilityKit/ability_runtime/context_constant.h b/AbilityKit/ability_runtime/context_constant.h index fc8f9b1ab..9a22cb99e 100644 --- a/AbilityKit/ability_runtime/context_constant.h +++ b/AbilityKit/ability_runtime/context_constant.h @@ -74,6 +74,22 @@ typedef enum { ABILITY_RUNTIME_AREA_MODE_EL5 = 4, } AbilityRuntime_AreaMode; +/** + * @brief Start Visibility + * + * @since 18 + */ +typedef enum { + /** + * Indicates that the ability will hide after process startup + */ + ABILITY_RUNTIME_START_HIDE = 0, + /** + * Indicates that the ability will show after process startup + */ + ABILITY_RUNTIME_START_HIDE = 1, +} AbilityRuntime_StartVisibility; + /** * @brief Window mode. * diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 26d446948..9c6cf6711 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -111,6 +111,14 @@ "first_introduced": "18", "name": "OH_AbilityRuntime_GetStartOptionsWindowWidth" }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_SetStartOptionsStartVisibility" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_GetStartOptionsStartVisibility" + }, { "first_introduced": "18", "name": "OH_AbilityRuntime_SetStartOptionsStartWindowIcon" diff --git a/AbilityKit/ability_runtime/start_options.h b/AbilityKit/ability_runtime/start_options.h index 1c3ae64e8..9f8c695b9 100644 --- a/AbilityKit/ability_runtime/start_options.h +++ b/AbilityKit/ability_runtime/start_options.h @@ -1,455 +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 18 - */ - -/** - * @file start_options.h - * - * @brief Defines the start options APIs. - * - * @library libability_runtime.so - * @kit AbilityKit - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 18 - */ - -#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 AbilityBase_StartOptions object. - * - * @since 18 - */ -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 18 - */ -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 wondow 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 18 - */ -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 wondow 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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ - 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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsWindowWidth(AbilityRuntime_StartOptions *startOptions, - int32_t &windowWidth); - -/** - * @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 18 - */ -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 18 - */ -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 18 - */ -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 18 - */ -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 supportWindowModes 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 18 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsSupportWindowMode( - AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode *supportWindowModes, - size_t size); - -/** - * @brief Get start window modes from start options. - * - * @param startOptions The options to get start window modes from. - * @param supportWindowModes 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 18 - */ -AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsSupportWindowMode( - AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode **supportWindowModes, - 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 18 - */ -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 18 - */ -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 18 - */ - 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 18 - */ -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 18 - */ - 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 18 - */ -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 18 - */ - 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 18 - */ -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 +/* + * 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 18 + */ + +/** + * @file start_options.h + * + * @brief Defines the start options APIs. + * + * @library libability_runtime.so + * @kit AbilityKit + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 18 + */ + +#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 18 + */ +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 18 + */ +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 wondow 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 18 + */ +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 wondow 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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 windowWidth 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 18 + */ +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 windowWidth 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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 18 + */ +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 supportWindowModes 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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_SetStartOptionsSupportWindowMode( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode *supportWindowModes, + size_t size); + +/** + * @brief Get start window modes from start options. + * + * @param startOptions The options to get start window modes from. + * @param supportWindowModes 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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsSupportWindowMode( + AbilityRuntime_StartOptions *startOptions, AbilityRuntime_SupportWindowMode **supportWindowModes, + 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 18 + */ +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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ + 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 18 + */ +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 18 + */ + 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 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_GetStartOptionsMaxWindowHeight( + AbilityRuntime_StartOptions *startOptions, int32_t &maxWindowHeight); + +#ifdef __cplusplus +} // extern "C" +#endif + +/** @} */ +#endif // ABILITY_RUNTIME_START_OPTIONS_H -- Gitee