From: xue <2144439972@qq.com> Date: Fri, 17 Apr 2026 10:28:50 +0000 (+0800) Subject: 优化黑脸恢复机制 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e11045101072212bec10c46e475296f17a37efc2;p=mirrors%2FFD230.git 优化黑脸恢复机制 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp index 3a6694ab5..7fed3991f 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp @@ -638,7 +638,8 @@ namespace OHOS // 但是,如果视频线程不存在(videoPlay_ == nullptr 或 isExited_),则强制切换 bool videoThreadExists = (videoPlay_ != nullptr && videoPlay_->isEntered_ && - !videoPlay_->isExited_); + !videoPlay_->isExited_ && + !videoPlay_->playError_); if (currentVideoPath_ == targetPath && videoThreadExists) { diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index b523f65bd..abb4f0e0d 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -2327,11 +2327,13 @@ extern "C" { view->UpdateBatteryProcess(); } - // 检查视频线程是否存在,如果不存在则切换到眨眼表情 + /* 视频健康:线程在且未退出,且未上报播放错误。Surface 连续申请失败会走 EVNET_VIDEO_RUNNING_ERR → playError_=true, + * 此时 isEntered_ 可能仍为 true,旧逻辑会误判为“视频仍在”,不触发眨眼/恢复(黑脸)。 */ if (view != nullptr) { bool videoThreadExists = (view->videoPlay_ != nullptr && view->videoPlay_->isEntered_ && - !view->videoPlay_->isExited_); + !view->videoPlay_->isExited_ && + !view->videoPlay_->playError_); if (!videoThreadExists) { // 视频线程不存在 @@ -3233,13 +3235,15 @@ extern "C" { // 切换到 wink 表情(用于视频切换失败时的回退) void ThunderBirdModel::SwitchToWinkingExpression() { - // 检查 eyesShape_ 和 eyesColor_ 是否已初始化 + const std::string shape = eyesShape_.empty() ? "calm-eyes" : eyesShape_; + const std::string color = eyesColor_.empty() ? "amber" : eyesColor_; if (eyesShape_.empty() || eyesColor_.empty()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchToWinkingExpression: eyesShape_ or eyesColor_ is empty, cannot switch to winking"); - return; + WEARABLE_LOGW(WEARABLE_LOG_MODULE_APP, + "SwitchToWinkingExpression: eyes empty, use default CloseEyes path (%s/%s)", + shape.c_str(), color.c_str()); } - - std::string winkingExpressionPath = "/user/res/video/CloseEyes/" + eyesShape_ + "/" + eyesColor_ + ".mp4"; + + std::string winkingExpressionPath = "/user/res/video/CloseEyes/" + shape + "/" + color + ".mp4"; // 检查文件是否存在 if (access(winkingExpressionPath.c_str(), F_OK) == 0) { @@ -3986,7 +3990,7 @@ extern "C" { // StartStoryAudioPlaybackTimeoutTimer(); /* 先注释:第一句播完不开启5秒超时 */ } else { // 后续音频播放结束,刷新5秒超时定时器 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: 故事模式音频播放结束,刷新5秒超时定时器"); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioPlaybackEnd: 故事模式音频播放结束,刷新5秒超时定时器"); // 停止旧的定时器并重新启动,实现刷新 // StopStoryAudioPlaybackTimeoutTimer(); //StartStoryAudioPlaybackTimeoutTimer();