diff --git a/dmserver/include/display_manager_interface_code.h b/dmserver/include/display_manager_interface_code.h index 2c5dbdfac0..cb7c76b3f7 100644 --- a/dmserver/include/display_manager_interface_code.h +++ b/dmserver/include/display_manager_interface_code.h @@ -137,6 +137,7 @@ enum class DisplayManagerMessage : unsigned int { TRANS_ID_GET_DISPLAY_CAPTURE, TRANS_ID_GET_PRIMARY_DISPLAY_INFO, TRANS_ID_GET_DISPLAY_SNAPSHOT_WITH_OPTION, + TRANS_ID_SET_CAMERA_STATUS, }; } #endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_INTERFACE_CODE_H diff --git a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session.cpp b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session.cpp index 55318ccc89..8eef5b311a 100644 --- a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session.cpp +++ b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session.cpp @@ -40,6 +40,7 @@ const std::string ON_SCREEN_EXTEND_CHANGE = "screenExtendChange"; const std::string ON_HOVER_STATUS_CHANGE_CALLBACK = "hoverStatusChange"; const std::string ON_SCREEN_CAPTURE_NOTIFY = "screenCaptureNotify"; const std::string ON_SUPER_FOLD_STATUS_CHANGE_CALLBACK = "superFoldStatusChange"; +const std::string ON_CAMERA_FOLD_STATUS_CHANGE_CALLBACK = "cameraStatusChange"; constexpr size_t ARGC_ONE = 1; } // namespace @@ -285,7 +286,7 @@ void JsScreenSession::UnRegisterScreenChangeListener() WLOGFE("Failed to unregister screen change listener, session is null!"); return; } - + screenSession_->UnregisterScreenChangeListener(this); WLOGFI("unregister screen change listener success."); } diff --git a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.cpp b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.cpp index b37baee066..8cfc7555c2 100644 --- a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.cpp @@ -92,12 +92,12 @@ napi_value JsScreenSessionManager::Init(napi_env env, napi_value exportObj) JsScreenSessionManager::SetScreenOffDelayTime); BindNativeFunction(env, exportObj, "notifyFoldToExpandCompletion", moduleName, JsScreenSessionManager::NotifyFoldToExpandCompletion); - BindNativeFunction(env, exportObj, "getFoldStatus", moduleName, - JsScreenSessionManager::GetFoldStatus); + BindNativeFunction(env, exportObj, "getFoldStatus", moduleName, JsScreenSessionManager::GetFoldStatus); BindNativeFunction(env, exportObj, "getScreenSnapshot", moduleName, JsScreenSessionManager::GetScreenSnapshot); BindNativeFunction(env, exportObj, "getDeviceScreenConfig", moduleName, JsScreenSessionManager::GetDeviceScreenConfig); + BindNativeFunction(env, exportObj, "setCameraStatus", moduleName, JsScreenSessionManager::SetCameraStatus); return NapiGetUndefined(env); } @@ -247,6 +247,13 @@ void JsScreenSessionManager::OnScreenConnected(const sptr& screen } } +napi_value JsScreenSessionManager::SetCameraStatus(napi_env env, napi_callback_info info) +{ + TLOGD(WmsLogTag::DMS, "[NAPI]SetCameraStatus"); + JsScreenSessionManager* me = CheckParamsAndGetThis(env, info); + return (me != nullptr) ? me->OnSetCameraStatus(env, info) : nullptr; +} + void JsScreenSessionManager::OnScreenDisconnected(const sptr& screenSession) { if (screenConnectionCallback_ == nullptr) { @@ -674,4 +681,41 @@ napi_value JsScreenSessionManager::OnGetDeviceScreenConfig(napi_env env, const n } return jsDeviceScreenConfigObj; } + +napi_value JsScreenSessionManager::OnSetCameraStatus(napi_env env, const napi_callback_info info) +{ + WLOGFD("[NAPI]OnSetCameraStatus"); + size_t argc = 2; + napi_handle_scope scope = nullptr; + napi_open_handle_scope(env, &scope); + napi_value argv[2] = {nullptr, nullptr}; + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + if (argc < 2) { // 2: params num + TLOGE(WmsLogTag::DMS, "[NAPI]Argc is invalid: %{public}zu", argc); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + napi_close_handle_scope(env, scope); + return NapiGetUndefined(env); + } + int32_t cameraStatus; + int32_t cameraPosition; + if (!ConvertFromJsValue(env, argv[0], cameraStatus)) { + TLOGE(WmsLogTag::DMS, "[NAPI]Failed to convert parameter to cameraStatus"); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + napi_close_handle_scope(env, scope); + return NapiGetUndefined(env); + } + if (!ConvertFromJsValue(env, argv[1], cameraPosition)) { + TLOGE(WmsLogTag::DMS, "[NAPI]Failed to convert parameter to cameraPosition"); + napi_throw(env, CreateJsError(env, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), + "Input parameter is missing or invalid")); + napi_close_handle_scope(env, scope); + return NapiGetUndefined(env); + } + ScreenSessionManagerClient::GetInstance().SetCameraStatus(cameraStatus, cameraPosition); + napi_close_handle_scope(env, scope); + return NapiGetUndefined(env); +} + } // namespace OHOS::Rosen diff --git a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.h b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.h index ac82db5224..ed610b109f 100644 --- a/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.h +++ b/window_scene/interfaces/kits/napi/screen_session_manager/js_screen_session_manager.h @@ -51,6 +51,7 @@ private: static napi_value UpdateAvailableArea(napi_env env, napi_callback_info info); static napi_value SetScreenOffDelayTime(napi_env env, napi_callback_info info); static napi_value NotifyFoldToExpandCompletion(napi_env env, napi_callback_info info); + static napi_value SetCameraStatus(napi_env env, napi_callback_info info); static napi_value GetFoldStatus(napi_env env, napi_callback_info info); static napi_value GetScreenSnapshot(napi_env env, napi_callback_info info); static napi_value GetDeviceScreenConfig(napi_env env, napi_callback_info info); @@ -64,6 +65,7 @@ private: napi_value OnNotifyScreenLockEvent(napi_env env, const napi_callback_info info); napi_value OnUpdateAvailableArea(napi_env env, const napi_callback_info info); napi_value OnSetScreenOffDelayTime(napi_env env, const napi_callback_info info); + napi_value OnSetCameraStatus(napi_env env, napi_callback_info info); napi_value OnNotifyFoldToExpandCompletion(napi_env env, const napi_callback_info info); napi_value OnGetFoldStatus(napi_env env, const napi_callback_info info); napi_value OnGetScreenSnapshot(napi_env env, const napi_callback_info info); diff --git a/window_scene/screen_session_manager/include/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.h b/window_scene/screen_session_manager/include/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.h index a9bafcf2e5..5b0d310edb 100644 --- a/window_scene/screen_session_manager/include/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.h +++ b/window_scene/screen_session_manager/include/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.h @@ -65,10 +65,10 @@ private: FoldStatus GetNextFoldState(float angle, int hall); void UpdateSwitchScreenBoundaryForLargeFoldDevice(float, int); void SetCameraFoldStrategy(float angle); - void SetCameraStatusChange(float angle, int hall); + void SetCameraRotationStatusChange(float angle, int hall); sptr applicationStateObserver_; bool isInCameraFoldStrategy_ = false; - bool isCameraStatus_ = false; + bool isCameraRotationStrategy_ = false; std::vector hallSwitchPackageNameList_; int allowUserSensorForLargeFoldDevice = 0; bool TriggerTentExit(float angle, int hall); diff --git a/window_scene/screen_session_manager/include/screen_session_manager.h b/window_scene/screen_session_manager/include/screen_session_manager.h index 872179adc2..f086c2b551 100644 --- a/window_scene/screen_session_manager/include/screen_session_manager.h +++ b/window_scene/screen_session_manager/include/screen_session_manager.h @@ -282,7 +282,10 @@ public: DMError GetAvailableArea(DisplayId displayId, DMRect& area) override; void NotifyAvailableAreaChanged(DMRect area); void NotifyFoldToExpandCompletion(bool foldToExpand) override; + void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override; bool GetSnapshotArea(Media::Rect &rect, DmErrorCode* errorCode, ScreenId &screenId); + int32_t GetCameraStatus(); + int32_t GetCameraPosition(); VirtualScreenFlag GetVirtualScreenFlag(ScreenId screenId) override; DMError SetVirtualScreenFlag(ScreenId screenId, VirtualScreenFlag screenFlag) override; @@ -512,6 +515,8 @@ private: std::atomic isScreenLockSuspend_ = false; std::atomic gotScreenlockFingerprint_ = false; std::atomic isPhyScreenConnected_ = false; + int32_t cameraStatus_ = {0}; + int32_t cameraPosition_ = {0}; // Fold Screen std::map phyScreenPropMap_; diff --git a/window_scene/screen_session_manager/include/zidl/screen_session_manager_interface.h b/window_scene/screen_session_manager/include/zidl/screen_session_manager_interface.h index c40a98fd84..fdace8b93f 100644 --- a/window_scene/screen_session_manager/include/zidl/screen_session_manager_interface.h +++ b/window_scene/screen_session_manager/include/zidl/screen_session_manager_interface.h @@ -166,6 +166,7 @@ public: ScreenPropertyChangeType screenPropertyChangeType) {} virtual void UpdateAvailableArea(ScreenId screenId, DMRect area) {} virtual int32_t SetScreenOffDelayTime(int32_t delay) { return 0; } + virtual void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) {} virtual uint32_t GetCurvedCompressionArea() { return 0; } virtual ScreenProperty GetPhyScreenProperty(ScreenId screenId) { return ScreenProperty(); } virtual void NotifyDisplayChangeInfoChanged(const sptr& info) {} diff --git a/window_scene/screen_session_manager/include/zidl/screen_session_manager_proxy.h b/window_scene/screen_session_manager/include/zidl/screen_session_manager_proxy.h index 7244204048..4ef3e7c8c2 100644 --- a/window_scene/screen_session_manager/include/zidl/screen_session_manager_proxy.h +++ b/window_scene/screen_session_manager/include/zidl/screen_session_manager_proxy.h @@ -148,6 +148,8 @@ public: sptr GetCurrentFoldCreaseRegion() override; + void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) override; + // unique screen DMError MakeUniqueScreen(const std::vector& screenIds) override; diff --git a/window_scene/screen_session_manager/src/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.cpp b/window_scene/screen_session_manager/src/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.cpp index 2b0f8dc1bf..b3d4126ace 100644 --- a/window_scene/screen_session_manager/src/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.cpp +++ b/window_scene/screen_session_manager/src/fold_screen_controller/sensor_fold_state_manager/single_display_sensor_pocket_fold_state_manager.cpp @@ -25,6 +25,7 @@ #include "window_manager_hilog.h" #include "app_mgr_client.h" #include "screen_session_manager/include/screen_rotation_property.h" +#include "screen_session_manager.h" #ifdef POWER_MANAGER_ENABLE #include @@ -34,7 +35,6 @@ namespace OHOS::Rosen { using OHOS::AppExecFwk::AppStateData; using OHOS::AppExecFwk::ApplicationState; namespace { -const std::string CAMERA_NAME = "camera"; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "SingleDisplaySensorPocketFoldStateManager"}; constexpr float ANGLE_MIN_VAL = 0.0F; constexpr float ALTA_HALF_FOLDED_MAX_THRESHOLD = 140.0F; @@ -51,6 +51,8 @@ constexpr float TENT_MODE_EXIT_MIN_THRESHOLD = 5.0F; constexpr float TENT_MODE_EXIT_MAX_THRESHOLD = 175.0F; constexpr float HOVER_STATUS_EXIT_MIN_THRESHOLD = 5.0F; constexpr float HOVER_STATUS_EXIT_MAX_THRESHOLD = 175.0F; +constexpr int32_t CAMERA_STATUS_UNAVAILABLE = 3; +constexpr int32_t CAMERA_POSITION_FRONT = 2; } // namespace SingleDisplaySensorPocketFoldStateManager::SingleDisplaySensorPocketFoldStateManager() @@ -68,10 +70,10 @@ void SingleDisplaySensorPocketFoldStateManager::HandleAngleChange(float angle, i SetCameraFoldStrategy(angle); if (isInCameraFoldStrategy_) { HandleSensorChange(FoldStatus::FOLDED, angle, foldScreenPolicy); - SetCameraStatusChange(angle, hall); + SetCameraRotationStatusChange(angle, hall); return; } - SetCameraStatusChange(angle, hall); + SetCameraRotationStatusChange(angle, hall); if (IsTentMode()) { return TentModeHandleSensorChange(angle, hall, foldScreenPolicy); } @@ -85,10 +87,10 @@ void SingleDisplaySensorPocketFoldStateManager::HandleHallChange(float angle, in SetCameraFoldStrategy(angle); if (isInCameraFoldStrategy_) { HandleSensorChange(FoldStatus::FOLDED, angle, foldScreenPolicy); - SetCameraStatusChange(angle, hall); + SetCameraRotationStatusChange(angle, hall); return; } - SetCameraStatusChange(angle, hall); + SetCameraRotationStatusChange(angle, hall); if (IsTentMode()) { return TentModeHandleSensorChange(angle, hall, foldScreenPolicy); } @@ -108,66 +110,70 @@ void SingleDisplaySensorPocketFoldStateManager::UpdateSwitchScreenBoundaryForLar void SingleDisplaySensorPocketFoldStateManager::SetCameraFoldStrategy(float angle) { FoldStatus currentState = GetCurrentState(); + int32_t cameraStatus = ScreenSessionManager::GetInstance().GetCameraStatus(); + int32_t cameraPosition = ScreenSessionManager::GetInstance().GetCameraPosition(); if (angle >= CAMERA_MAX_VAL) { if (isInCameraFoldStrategy_ != false) { isInCameraFoldStrategy_ = false; - TLOGI(WmsLogTag::DMS, "Disable CameraFoldStrategy."); + TLOGI(WmsLogTag::DMS, "Disable CameraFoldStrategy, angle: %{public}f, currentFoldState: %{public}d, " + "cameraStatus: %{public}d, cameraPosition: %{public}d. ", + angle, currentState, cameraStatus, cameraPosition); } return; } - if (applicationStateObserver_ == nullptr) { - return; - } - if (applicationStateObserver_->GetForegroundApp().empty()) { - return; - } - if (applicationStateObserver_->GetForegroundApp().find(CAMERA_NAME) != std::string::npos && - currentState == FoldStatus::FOLDED) { + if ((cameraStatus == CAMERA_STATUS_UNAVAILABLE) && (cameraPosition == CAMERA_POSITION_FRONT) && + (currentState == FoldStatus::FOLDED)) { if (isInCameraFoldStrategy_ != true) { isInCameraFoldStrategy_ = true; - TLOGI(WmsLogTag::DMS, "Enable CameraFoldStrategy."); + TLOGI(WmsLogTag::DMS, "Enable CameraFoldStrategy, angle: %{public}f, currentFoldState: %{public}d, " + "cameraStatus: %{public}d, cameraPosition: %{public}d. ", + angle, currentState, cameraStatus, cameraPosition); } } } -void SingleDisplaySensorPocketFoldStateManager::SetCameraStatusChange(float angle, int hall) +void SingleDisplaySensorPocketFoldStateManager::SetCameraRotationStatusChange(float angle, int hall) { + FoldStatus currentState = GetCurrentState(); + int32_t cameraStatus = ScreenSessionManager::GetInstance().GetCameraStatus(); + int32_t cameraPosition = ScreenSessionManager::GetInstance().GetCameraPosition(); + if (hall == HALL_FOLDED_THRESHOLD) { - if (isCameraStatus_) { + if (isCameraRotationStrategy_) { TLOGI(WmsLogTag::DMS, "hall is %{public}d, exit cemera status", hall); ScreenRotationProperty::HandleHoverStatusEventInput(DeviceHoverStatus::CAMERA_STATUS_CANCEL); - isCameraStatus_ = false; + isCameraRotationStrategy_ = false; } return; } if ((std::isless(angle, HOVER_STATUS_EXIT_MIN_THRESHOLD)) || (std::isgreater(angle, HOVER_STATUS_EXIT_MAX_THRESHOLD))) { - if (isCameraStatus_) { + if (isCameraRotationStrategy_) { TLOGI(WmsLogTag::DMS, "angle is:%{public}f, exit camera status", angle); ScreenRotationProperty::HandleHoverStatusEventInput(DeviceHoverStatus::CAMERA_STATUS_CANCEL); - isCameraStatus_ = false; + isCameraRotationStrategy_ = false; } return; } - if (applicationStateObserver_ == nullptr) { - return; - } - - if ((angle > ANGLE_MIN_VAL) && (angle < CAMERA_MAX_VAL) && - (applicationStateObserver_->GetForegroundApp().find(CAMERA_NAME) != std::string::npos)) { - if (!isCameraStatus_) { - TLOGI(WmsLogTag::DMS, "angle is:%{public}f and is camera app, into camera status", angle); + if ((angle > ANGLE_MIN_VAL) && (cameraStatus == CAMERA_STATUS_UNAVAILABLE) && + (cameraPosition == CAMERA_POSITION_FRONT) && (currentState == FoldStatus::FOLDED)) { + if (!isCameraRotationStrategy_) { + TLOGI(WmsLogTag::DMS, "angle is:%{public}f , currentFoldState is:%{public}d, " + "cameraStatus is:%{public}d, cameraPosition is:%{public}d, enter camera rotation status.", + angle, static_cast(currentState), cameraStatus, cameraPosition); ScreenRotationProperty::HandleHoverStatusEventInput(DeviceHoverStatus::CAMERA_STATUS); - isCameraStatus_ = true; + isCameraRotationStrategy_ = true; } } else { - if (isCameraStatus_) { - TLOGI(WmsLogTag::DMS, "angle is:%{public}f or is not camera app, exit camera status", angle); + if (isCameraRotationStrategy_) { + TLOGI(WmsLogTag::DMS, "angle is:%{public}f , currentFoldState is:%{public}d, " + "cameraStatus is:%{public}d, cameraPosition is:%{public}d, exit camera rotation status.", + angle, static_cast(currentState), cameraStatus, cameraPosition); ScreenRotationProperty::HandleHoverStatusEventInput(DeviceHoverStatus::CAMERA_STATUS_CANCEL); - isCameraStatus_ = false; + isCameraRotationStrategy_ = false; } } } diff --git a/window_scene/screen_session_manager/src/screen_session_manager.cpp b/window_scene/screen_session_manager/src/screen_session_manager.cpp index b8cb4d9184..304a425af6 100644 --- a/window_scene/screen_session_manager/src/screen_session_manager.cpp +++ b/window_scene/screen_session_manager/src/screen_session_manager.cpp @@ -2086,6 +2086,17 @@ int32_t ScreenSessionManager::SetScreenOffDelayTime(int32_t delay) return screenOffDelay_; } +void ScreenSessionManager::SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) +{ + if ((cameraStatus_ == cameraStatus) && (cameraPosition_ = cameraPosition)) { + return; // no need to update + } + cameraStatus_ = cameraStatus; + cameraPosition_ = cameraPosition; + TLOGI(WmsLogTag::DMS, "SetCameraStatus, cameraStatus:%{public}d, cameraPosition:%{public}d", + cameraStatus, cameraPosition); +} + bool ScreenSessionManager::IsScreenLockSuspend(void) { return isScreenLockSuspend_; @@ -6219,7 +6230,7 @@ void ScreenSessionManager::MultiScreenModeChange(ScreenId mainScreenId, ScreenId } } } - + if (firstSession != nullptr && secondarySession != nullptr) { MultiScreenManager::GetInstance().MultiScreenModeChange(firstSession, secondarySession, operateMode); } else { @@ -6424,4 +6435,14 @@ void ScreenSessionManager::OnSuperFoldStatusChange(ScreenId screenId, SuperFoldS } clientProxy_->OnSuperFoldStatusChanged(screenId, superFoldStatus); } + +int32_t ScreenSessionManager::GetCameraStatus() +{ + return cameraStatus_; +} + +int32_t ScreenSessionManager::GetCameraPosition() +{ + return cameraPosition_; +} } // namespace OHOS::Rosen diff --git a/window_scene/screen_session_manager/src/zidl/screen_session_manager_proxy.cpp b/window_scene/screen_session_manager/src/zidl/screen_session_manager_proxy.cpp index ca8e3d2c14..e31e3d35ca 100644 --- a/window_scene/screen_session_manager/src/zidl/screen_session_manager_proxy.cpp +++ b/window_scene/screen_session_manager/src/zidl/screen_session_manager_proxy.cpp @@ -167,7 +167,7 @@ DMError ScreenSessionManagerProxy::GetDensityInCurResolution(ScreenId screenId, WLOGFW("GetDensityInCurResolution: remote is nullptr"); return DMError::DM_ERROR_IPC_FAILED; } - + MessageParcel data; MessageParcel reply; MessageOption option; @@ -2758,6 +2758,37 @@ int32_t ScreenSessionManagerProxy::SetScreenOffDelayTime(int32_t delay) return reply.ReadInt32(); } +void ScreenSessionManagerProxy::SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) +{ + sptr remote = Remote(); + if (remote == nullptr) { + WLOGFE("SetCameraStatus: remote is null"); + return; + } + + MessageOption option(MessageOption::TF_SYNC); + MessageParcel reply; + MessageParcel data; + if (!data.WriteInterfaceToken(GetDescriptor())) { + WLOGFE("WriteInterfaceToken failed"); + return; + } + if (!data.WriteInt32(cameraStatus)) { + WLOGFE("Write cameraStatus failed"); + return; + } + if (!data.WriteInt32(cameraPosition)) { + WLOGFE("Write cameraPosition failed"); + return; + } + if (remote->SendRequest(static_cast(DisplayManagerMessage::TRANS_ID_SET_CAMERA_STATUS), + data, reply, option) != ERR_NONE) { + WLOGFE("SendRequest failed"); + return; + } +} + + DMError ScreenSessionManagerProxy::GetAvailableArea(DisplayId displayId, DMRect& area) { sptr remote = Remote(); @@ -3112,7 +3143,7 @@ DMError ScreenSessionManagerProxy::SetVirtualScreenSecurityExemption(ScreenId sc WLOGFE("write date: failed"); return DMError::DM_ERROR_WRITE_DATA_FAILED; } - + if (!data.WriteUInt64Vector(windowIdList)) { WLOGFE("write date: failed"); return DMError::DM_ERROR_WRITE_DATA_FAILED; diff --git a/window_scene/screen_session_manager_client/include/screen_session_manager_client.h b/window_scene/screen_session_manager_client/include/screen_session_manager_client.h index e8277fae61..0b958555e7 100644 --- a/window_scene/screen_session_manager_client/include/screen_session_manager_client.h +++ b/window_scene/screen_session_manager_client/include/screen_session_manager_client.h @@ -67,6 +67,7 @@ public: void OnUpdateFoldDisplayMode(FoldDisplayMode displayMode) override; void UpdateAvailableArea(ScreenId screenId, DMRect area); int32_t SetScreenOffDelayTime(int32_t delay); + void SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition); void NotifyFoldToExpandCompletion(bool foldToExpand); FoldStatus GetFoldStatus(); std::shared_ptr GetScreenSnapshot(ScreenId screenId, float scaleX, float scaleY); diff --git a/window_scene/screen_session_manager_client/src/screen_session_manager_client.cpp b/window_scene/screen_session_manager_client/src/screen_session_manager_client.cpp index 1dadeac1ba..4c5e2bfafc 100644 --- a/window_scene/screen_session_manager_client/src/screen_session_manager_client.cpp +++ b/window_scene/screen_session_manager_client/src/screen_session_manager_client.cpp @@ -415,6 +415,15 @@ int32_t ScreenSessionManagerClient::SetScreenOffDelayTime(int32_t delay) return screenSessionManager_->SetScreenOffDelayTime(delay); } +void ScreenSessionManagerClient::SetCameraStatus(int32_t cameraStatus, int32_t cameraPosition) +{ + if (!screenSessionManager_) { + WLOGFE("screenSessionManager_ is null"); + return; + } + return screenSessionManager_->SetCameraStatus(cameraStatus, cameraPosition); +} + void ScreenSessionManagerClient::NotifyFoldToExpandCompletion(bool foldToExpand) { if (!screenSessionManager_) {