From 46390206e86d022674070eb66f0b2759003d0b41 Mon Sep 17 00:00:00 2001 From: heguokai <275503077@qq.com> Date: Thu, 4 Sep 2025 17:53:35 +0800 Subject: [PATCH] =?UTF-8?q?DoNotDisturbProfile=E4=B8=AD=E7=9A=84name?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=99=90=E5=88=B6=E9=95=BF=E5=BA=A6=E4=B8=BA?= =?UTF-8?q?202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: heguokai <275503077@qq.com> --- frameworks/ets/ani/include/sts_common.h | 1 + frameworks/ets/ani/src/sts_disturb_mode.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frameworks/ets/ani/include/sts_common.h b/frameworks/ets/ani/include/sts_common.h index 0417f15ed..2d5b698b0 100644 --- a/frameworks/ets/ani/include/sts_common.h +++ b/frameworks/ets/ani/include/sts_common.h @@ -25,6 +25,7 @@ namespace OHOS { namespace NotificationSts { constexpr int32_t STR_MAX_SIZE = 204; +constexpr int32_t PROFILE_NAME_SIZE = 202; constexpr int32_t LONG_STR_MAX_SIZE = 1028; constexpr int32_t COMMON_TEXT_SIZE = 3074; constexpr int32_t SHORT_TEXT_SIZE = 1026; diff --git a/frameworks/ets/ani/src/sts_disturb_mode.cpp b/frameworks/ets/ani/src/sts_disturb_mode.cpp index 89dec0327..64de48561 100644 --- a/frameworks/ets/ani/src/sts_disturb_mode.cpp +++ b/frameworks/ets/ani/src/sts_disturb_mode.cpp @@ -40,7 +40,8 @@ bool UnwrapDoNotDisturbProfile(ani_env *env, ani_object param, ANS_LOGE("UnwrapDoNotDisturbProfile: get name failed"); return false; } - profile->SetProfileName(nameStr); + std::string profileName = GetResizeStr(nameStr, PROFILE_NAME_SIZE); + profile->SetProfileName(profileName); ani_ref trustlistRef; if (ANI_OK != GetPropertyRef(env, param, "trustlist", isUndefined, trustlistRef) || isUndefined == ANI_TRUE) { ANS_LOGE("UnwrapDoNotDisturbProfile: get trustlist failed"); -- Gitee