mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 09:00:55 +00:00
commit
96b1da2634
@ -1526,6 +1526,18 @@ public:
|
||||
{
|
||||
return WMError::WM_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Specific System Bar(include status bar and nav bar) Property
|
||||
*
|
||||
* @param type WINDOW_TYPE_STATUS_BAR or WINDOW_TYPE_NAVIGATION_BAR
|
||||
* @param property system bar prop,include content color, background color
|
||||
* @return WMError
|
||||
*/
|
||||
virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ enum class WindowType : uint32_t {
|
||||
WINDOW_TYPE_SYSTEM_FLOAT,
|
||||
WINDOW_TYPE_PIP,
|
||||
WINDOW_TYPE_THEME_EDITOR,
|
||||
WINDOW_TYPE_NAVIGATION_INDICATOR,
|
||||
ABOVE_APP_SYSTEM_WINDOW_END,
|
||||
|
||||
SYSTEM_SUB_WINDOW_BASE = 2500,
|
||||
|
@ -288,6 +288,13 @@ napi_value JsWindow::SetWindowSystemBarEnable(napi_env env, napi_callback_info i
|
||||
return (me != nullptr) ? me->OnSetWindowSystemBarEnable(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindow::SetSpecificSystemBarEnabled(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGI("SetSystemBarEnable");
|
||||
JsWindow* me = CheckParamsAndGetThis<JsWindow>(env, info);
|
||||
return (me != nullptr) ? me->OnSetSpecificSystemBarEnabled(env, info) : nullptr;
|
||||
}
|
||||
|
||||
napi_value JsWindow::SetSystemBarProperties(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGI("SetSystemBarProperties");
|
||||
@ -2062,6 +2069,56 @@ napi_value JsWindow::OnSetWindowSystemBarEnable(napi_env env, napi_callback_info
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value JsWindow::OnSetSpecificSystemBarEnabled(napi_env env, napi_callback_info info)
|
||||
{
|
||||
std::map<WindowType, SystemBarProperty> systemBarProperties;
|
||||
std::map<WindowType, SystemBarPropertyFlag> systemBarPropertyFlags;
|
||||
WmErrorCode err = (windowToken_ == nullptr) ? WmErrorCode::WM_ERROR_STATE_ABNORMALLY : WmErrorCode::WM_OK;
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
std::string name;
|
||||
if (!ConvertFromJsValue(env, argv[0], name)) {
|
||||
WLOGFE("Failed to convert parameter to SystemBarName");
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
if (err == WmErrorCode::WM_OK && (argc < 1 || // 1: params num
|
||||
!GetSpecificBarStatus(systemBarProperties, env, info, windowToken_))) {
|
||||
return NapiThrowError(env, WmErrorCode::WM_ERROR_INVALID_PARAM);
|
||||
}
|
||||
wptr<Window> weakToken(windowToken_);
|
||||
NapiAsyncTask::CompleteCallback complete = [weakToken, systemBarProperties, systemBarPropertyFlags, name, err]
|
||||
(napi_env env, NapiAsyncTask& task, int32_t status) mutable {
|
||||
auto weakWindow = weakToken.promote();
|
||||
err = (weakWindow == nullptr) ? WmErrorCode::WM_ERROR_STATE_ABNORMALLY : err;
|
||||
if (err != WmErrorCode::WM_OK) {
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(err)));
|
||||
return;
|
||||
}
|
||||
if (name.compare("status") == 0) {
|
||||
err = WM_JS_TO_ERROR_CODE_MAP.at(weakWindow->SetSpecificBarProperty(
|
||||
WindowType::WINDOW_TYPE_STATUS_BAR, systemBarProperties.at(WindowType::WINDOW_TYPE_STATUS_BAR)));
|
||||
} else if (name.compare("navigation") == 0) {
|
||||
err = WM_JS_TO_ERROR_CODE_MAP.at(weakWindow->SetSpecificBarProperty(WindowType::WINDOW_TYPE_NAVIGATION_BAR,
|
||||
systemBarProperties.at(WindowType::WINDOW_TYPE_NAVIGATION_BAR)));
|
||||
} else if (name.compare("navigationIndicator") == 0) {
|
||||
err = WM_JS_TO_ERROR_CODE_MAP.at(weakWindow->SetSpecificBarProperty(
|
||||
WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR,
|
||||
systemBarProperties.at(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR)));
|
||||
}
|
||||
if (err == WmErrorCode::WM_OK) {
|
||||
task.Resolve(env, NapiGetUndefined(env));
|
||||
} else {
|
||||
task.Reject(env, CreateJsError(env, static_cast<int32_t>(err),
|
||||
"JsWindow::OnSetSpecificSystemBarEnabled failed"));
|
||||
}
|
||||
};
|
||||
napi_value result = nullptr;
|
||||
NapiAsyncTask::Schedule("JsWindow::OnSetSpecificSystemBarEnabled",
|
||||
env, CreateAsyncTaskWithLastParam(env, nullptr, nullptr, std::move(complete), &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value JsWindow::OnSetSystemBarProperties(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WMError errCode = WMError::WM_OK;
|
||||
@ -4827,6 +4884,7 @@ void BindFunctions(napi_env env, napi_value object, const char *moduleName)
|
||||
BindNativeFunction(env, object, "keepKeyboardOnFocus", moduleName, JsWindow::KeepKeyboardOnFocus);
|
||||
BindNativeFunction(env, object, "setWindowLimits", moduleName, JsWindow::SetWindowLimits);
|
||||
BindNativeFunction(env, object, "getWindowLimits", moduleName, JsWindow::GetWindowLimits);
|
||||
BindNativeFunction(env, object, "setSpecificSystemBarEnabled", moduleName, JsWindow::SetSpecificSystemBarEnabled);
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
static napi_value KeepKeyboardOnFocus(napi_env env, napi_callback_info info);
|
||||
static napi_value GetWindowLimits(napi_env env, napi_callback_info info);
|
||||
static napi_value SetWindowLimits(napi_env env, napi_callback_info info);
|
||||
static napi_value SetSpecificSystemBarEnabled(napi_env env, napi_callback_info info);
|
||||
|
||||
// colorspace, gamut
|
||||
static napi_value IsSupportWideGamut(napi_env env, napi_callback_info info);
|
||||
@ -185,6 +186,7 @@ private:
|
||||
napi_value OnKeepKeyboardOnFocus(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetWindowLimits(napi_env env, napi_callback_info info);
|
||||
napi_value OnGetWindowLimits(napi_env env, napi_callback_info info);
|
||||
napi_value OnSetSpecificSystemBarEnabled(napi_env env, napi_callback_info info);
|
||||
|
||||
// colorspace, gamut
|
||||
napi_value OnIsSupportWideGamut(napi_env env, napi_callback_info info);
|
||||
|
@ -568,6 +568,43 @@ bool GetSystemBarStatus(std::map<WindowType, SystemBarProperty>& systemBarProper
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetSpecificBarStatus(std::map<WindowType, SystemBarProperty>& systemBarProperties,
|
||||
napi_env env, napi_callback_info info, sptr<Window>& window)
|
||||
{
|
||||
size_t argc = 4;
|
||||
napi_value argv[4] = {nullptr};
|
||||
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
uint32_t paramNumber = 2;
|
||||
if (argc < paramNumber) {
|
||||
WLOGFE("Argc is invalid: %{public}zu", argc);
|
||||
return false;
|
||||
}
|
||||
std::string name;
|
||||
if (!ConvertFromJsValue(env, argv[0], name)) {
|
||||
WLOGFE("Failed to convert parameter to SystemBarName");
|
||||
return false;
|
||||
}
|
||||
bool enable = false;
|
||||
if (!ConvertFromJsValue(env, argv[1], enable)) {
|
||||
WLOGFE("Failed to convert parameter to bool");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
if (name.compare("status") == 0) {
|
||||
auto statusProperty = window->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_STATUS_BAR);
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_STATUS_BAR] = statusProperty;
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_STATUS_BAR].enable_ = enable;
|
||||
} else if (name.compare("navigation") == 0) {
|
||||
auto navProperty = window->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_BAR);
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_NAVIGATION_BAR] = navProperty;
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_NAVIGATION_BAR].enable_ = enable;
|
||||
} else if (name.compare("navigationIndicator") == 0) {
|
||||
auto navIndicatorProperty = window->GetSystemBarPropertyByType(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR);
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR] = navIndicatorProperty;
|
||||
systemBarProperties[WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR].enable_ = enable;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32_t GetColorFromJs(napi_env env, napi_value jsObject,
|
||||
const char* name, uint32_t defaultColor, bool& flag)
|
||||
{
|
||||
|
@ -183,6 +183,8 @@ struct SystemBarPropertyFlag {
|
||||
bool GetSystemBarStatus(std::map<WindowType, SystemBarProperty>& systemBarProperties,
|
||||
std::map<WindowType, SystemBarPropertyFlag>& systemBarpropertyFlags,
|
||||
napi_env env, napi_callback_info info, sptr<Window>& window);
|
||||
bool GetSpecificBarStatus(std::map<WindowType, SystemBarProperty>& systemBarProperties,
|
||||
napi_env env, napi_callback_info info, sptr<Window>& window);
|
||||
napi_value CreateJsSystemBarRegionTintArrayObject(napi_env env,
|
||||
const SystemBarRegionTints& tints);
|
||||
napi_value ConvertAvoidAreaToJsValue(napi_env env, const AvoidArea& avoidArea, AvoidAreaType type);
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
virtual WMError SetWindowFlags(uint32_t flags) = 0;
|
||||
virtual WMError GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea) = 0;
|
||||
virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) = 0;
|
||||
virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) = 0;
|
||||
virtual WMError SetFullScreen(bool status) = 0;
|
||||
virtual WMError SetLayoutFullScreen(bool status) = 0;
|
||||
virtual WMError Destroy() = 0;
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
virtual WMError RemoveWindowFlag(WindowFlag flag) override;
|
||||
virtual WMError SetWindowFlags(uint32_t flags) override;
|
||||
virtual WMError SetSystemBarProperty(WindowType type, const SystemBarProperty& property) override;
|
||||
virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override;
|
||||
virtual WMError SetLayoutFullScreen(bool status) override;
|
||||
virtual WMError SetFullScreen(bool status) override;
|
||||
virtual const Transform& GetTransform() const override;
|
||||
|
@ -74,6 +74,7 @@ enum class WindowType : uint32_t {
|
||||
WINDOW_TYPE_SYSTEM_FLOAT,
|
||||
WINDOW_TYPE_PIP,
|
||||
WINDOW_TYPE_THEME_EDITOR,
|
||||
WINDOW_TYPE_NAVIGATION_INDICATOR,
|
||||
ABOVE_APP_SYSTEM_WINDOW_END,
|
||||
|
||||
SYSTEM_SUB_WINDOW_BASE = 2500,
|
||||
|
@ -306,6 +306,11 @@ WMError WindowImpl::SetSystemBarProperty(WindowType type, const SystemBarPropert
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowImpl::SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowImpl::SetLayoutFullScreen(bool status)
|
||||
{
|
||||
return WMError::WM_OK;
|
||||
|
@ -162,7 +162,9 @@ private:
|
||||
uint32_t sessionGravitySizePercent_ = 0;
|
||||
uint32_t modeSupportInfo_ {WindowModeSupport::WINDOW_MODE_SUPPORT_ALL};
|
||||
std::unordered_map<WindowType, SystemBarProperty> sysBarPropMap_ {
|
||||
{ WindowType::WINDOW_TYPE_STATUS_BAR, SystemBarProperty(true, 0x00FFFFFF, 0xFF000000) },
|
||||
{ WindowType::WINDOW_TYPE_STATUS_BAR, SystemBarProperty(true, 0x00FFFFFF, 0xFF000000) },
|
||||
{ WindowType::WINDOW_TYPE_NAVIGATION_BAR, SystemBarProperty(true, 0x00FFFFFF, 0xFF000000) },
|
||||
{ WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR, SystemBarProperty(true, 0x00FFFFFF, 0xFF000000) },
|
||||
};
|
||||
bool isDecorEnable_ = false;
|
||||
uint32_t animationFlag_ { static_cast<uint32_t>(WindowAnimation::DEFAULT) };
|
||||
|
@ -300,7 +300,9 @@ void WindowSessionProperty::SetMaximizeMode(MaximizeMode mode)
|
||||
|
||||
void WindowSessionProperty::SetSystemBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
if (type == WindowType::WINDOW_TYPE_STATUS_BAR) {
|
||||
if (type == WindowType::WINDOW_TYPE_STATUS_BAR
|
||||
|| type ==WindowType::WINDOW_TYPE_NAVIGATION_BAR
|
||||
|| type == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) {
|
||||
sysBarPropMap_[type] = property;
|
||||
}
|
||||
}
|
||||
@ -438,7 +440,8 @@ void WindowSessionProperty::UnmarshallingWindowLimits(Parcel& parcel, WindowSess
|
||||
bool WindowSessionProperty::MarshallingSystemBarMap(Parcel& parcel) const
|
||||
{
|
||||
auto size = sysBarPropMap_.size();
|
||||
if (size > 1) { // 1 max systembar number
|
||||
uint32_t maxSystemBarNumber = 3;
|
||||
if (size > maxSystemBarNumber) { // max systembar number
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -460,7 +463,8 @@ bool WindowSessionProperty::MarshallingSystemBarMap(Parcel& parcel) const
|
||||
void WindowSessionProperty::UnMarshallingSystemBarMap(Parcel& parcel, WindowSessionProperty* property)
|
||||
{
|
||||
uint32_t size = parcel.ReadUint32();
|
||||
if (size > 1) { // 1 max systembar number
|
||||
uint32_t maxSystemBarNumber = 3;
|
||||
if (size > maxSystemBarNumber) { // max systembar number
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,9 @@ enum class WSPropertyChangeAction : uint32_t {
|
||||
ACTION_UPDATE_RAISEENABLED = 1 << 21,
|
||||
ACTION_UPDATE_HIDE_NON_SYSTEM_FLOATING_WINDOWS = 1 << 22,
|
||||
ACTION_UPDATE_SYSTEM_PRIVACY_MODE = 1 << 23,
|
||||
ACTION_UPDATE_STATUS_PROPS = 1 << 24,
|
||||
ACTION_UPDATE_NAVIGATION_PROPS = 1 << 25,
|
||||
ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS = 1 << 26,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -680,6 +680,7 @@ napi_value SessionTypeInit(napi_env env)
|
||||
SetTypeProperty(objValue, env, "TYPE_SYSTEM_FLOAT", JsSessionType::TYPE_SYSTEM_FLOAT);
|
||||
SetTypeProperty(objValue, env, "TYPE_PIP", JsSessionType::TYPE_PIP);
|
||||
SetTypeProperty(objValue, env, "TYPE_THEME_EDITOR", JsSessionType::TYPE_THEME_EDITOR);
|
||||
SetTypeProperty(objValue, env, "TYPE_NAVIGATION_INDICATOR", JsSessionType::TYPE_NAVIGATION_INDICATOR);
|
||||
return objValue;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -58,6 +58,7 @@ enum class JsSessionType : uint32_t {
|
||||
TYPE_SYSTEM_FLOAT,
|
||||
TYPE_PIP,
|
||||
TYPE_THEME_EDITOR,
|
||||
TYPE_NAVIGATION_INDICATOR,
|
||||
};
|
||||
|
||||
// should same with bundlemanager ability info
|
||||
@ -107,6 +108,7 @@ const std::map<WindowType, JsSessionType> WINDOW_TO_JS_SESSION_TYPE_MAP {
|
||||
{ WindowType::WINDOW_TYPE_SYSTEM_FLOAT, JsSessionType::TYPE_SYSTEM_FLOAT },
|
||||
{ WindowType::WINDOW_TYPE_PIP, JsSessionType::TYPE_PIP },
|
||||
{ WindowType::WINDOW_TYPE_THEME_EDITOR, JsSessionType::TYPE_THEME_EDITOR },
|
||||
{ WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR, JsSessionType::TYPE_NAVIGATION_INDICATOR },
|
||||
};
|
||||
|
||||
const std::map<JsSessionType, WindowType> JS_SESSION_TO_WINDOW_TYPE_MAP {
|
||||
@ -139,6 +141,7 @@ const std::map<JsSessionType, WindowType> JS_SESSION_TO_WINDOW_TYPE_MAP {
|
||||
{ JsSessionType::TYPE_SYSTEM_FLOAT, WindowType::WINDOW_TYPE_SYSTEM_FLOAT, },
|
||||
{ JsSessionType::TYPE_PIP, WindowType::WINDOW_TYPE_PIP, },
|
||||
{ JsSessionType::TYPE_THEME_EDITOR, WindowType::WINDOW_TYPE_THEME_EDITOR },
|
||||
{ JsSessionType::TYPE_NAVIGATION_INDICATOR, WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR },
|
||||
};
|
||||
|
||||
const std::map<Orientation, JsSessionOrientation> WINDOW_ORIENTATION_TO_JS_SESSION_MAP {
|
||||
|
@ -339,6 +339,8 @@ private:
|
||||
WSError UpdateBrightness(int32_t persistentId);
|
||||
void SetDisplayBrightness(float brightness);
|
||||
float GetDisplayBrightness() const;
|
||||
void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property,
|
||||
const sptr<SceneSession>& sceneSession);
|
||||
WMError HandleUpdateProperty(const sptr<WindowSessionProperty>& property, WSPropertyChangeAction action,
|
||||
const sptr<SceneSession>& sceneSession);
|
||||
void UpdateHideNonSystemFloatingWindows(const sptr<WindowSessionProperty>& property,
|
||||
|
@ -2144,6 +2144,20 @@ WMError SceneSessionManager::UpdatePropertyRaiseEnabled(const sptr<WindowSession
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
void SceneSessionManager::HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property,
|
||||
const sptr<SceneSession>& sceneSession)
|
||||
{
|
||||
auto systemBarProperties = property->GetSystemBarProperty();
|
||||
for (auto iter : systemBarProperties) {
|
||||
if (iter.first == type) {
|
||||
sceneSession->SetSystemBarProperty(iter.first, iter.second);
|
||||
WLOGFD("SetSystemBarProperty: %{public}d, enable: %{public}d",
|
||||
static_cast<int32_t>(iter.first), iter.second.enable_);
|
||||
}
|
||||
}
|
||||
NotifyWindowInfoChange(property->GetPersistentId(), WindowUpdateType::WINDOW_UPDATE_PROPERTY);
|
||||
}
|
||||
|
||||
WMError SceneSessionManager::HandleUpdateProperty(const sptr<WindowSessionProperty>& property,
|
||||
WSPropertyChangeAction action, const sptr<SceneSession>& sceneSession)
|
||||
{
|
||||
@ -2207,6 +2221,18 @@ WMError SceneSessionManager::HandleUpdateProperty(const sptr<WindowSessionProper
|
||||
NotifyWindowInfoChange(property->GetPersistentId(), WindowUpdateType::WINDOW_UPDATE_PROPERTY);
|
||||
break;
|
||||
}
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS: {
|
||||
HandleSpecificSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, property, sceneSession);
|
||||
break;
|
||||
}
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS: {
|
||||
HandleSpecificSystemBarProperty(WindowType::WINDOW_TYPE_NAVIGATION_BAR, property, sceneSession);
|
||||
break;
|
||||
}
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS: {
|
||||
HandleSpecificSystemBarProperty(WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR, property, sceneSession);
|
||||
break;
|
||||
}
|
||||
case WSPropertyChangeAction::ACTION_UPDATE_FLAGS: {
|
||||
SetWindowFlags(sceneSession, property->GetWindowFlags());
|
||||
NotifyWindowInfoChange(property->GetPersistentId(), WindowUpdateType::WINDOW_UPDATE_PROPERTY);
|
||||
|
@ -297,6 +297,7 @@ public:
|
||||
void PendingClose();
|
||||
|
||||
WMError SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight) override;
|
||||
virtual WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override;
|
||||
private:
|
||||
template<typename T1, typename T2, typename Ret>
|
||||
using EnableIfSame = typename std::enable_if<std::is_same_v<T1, T2>, Ret>::type;
|
||||
|
@ -133,6 +133,7 @@ public:
|
||||
WMError NotifyPrepareClosePiPWindow() override;
|
||||
WMError RecoveryPullPiPMainWindow(const Rect& rect) override;
|
||||
void UpdateSubWindowState(const WindowType& type);
|
||||
WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override;
|
||||
|
||||
protected:
|
||||
void DestroySubWindow();
|
||||
@ -148,6 +149,7 @@ protected:
|
||||
void UpdateWindowSizeLimits();
|
||||
WindowLimits GetSystemSizeLimits(uint32_t displayWidth, uint32_t displayHeight, float vpr);
|
||||
void GetConfigurationFromAbilityInfo();
|
||||
WMError NotifySpecificWindowSessionProperty(WindowType type, const SystemBarProperty& property);
|
||||
|
||||
private:
|
||||
bool IsValidSystemWindowType(const WindowType& type);
|
||||
|
@ -172,6 +172,7 @@ public:
|
||||
void SetDrawingContentState(bool drawingContentState);
|
||||
WMError RegisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) override;
|
||||
WMError UnregisterWindowStatusChangeListener(const sptr<IWindowStatusChangeListener>& listener) override;
|
||||
WMError SetSpecificBarProperty(WindowType type, const SystemBarProperty& property) override;
|
||||
|
||||
protected:
|
||||
WMError Connect();
|
||||
|
@ -706,6 +706,11 @@ WMError WindowImpl::SetSystemBarProperty(WindowType type, const SystemBarPropert
|
||||
return ret;
|
||||
}
|
||||
|
||||
WMError WindowImpl::SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowImpl::UpdateSystemBarProperty(bool status)
|
||||
{
|
||||
if (!IsWindowValid()) {
|
||||
|
@ -1068,6 +1068,28 @@ WMError WindowSceneSessionImpl::NotifyWindowSessionProperty()
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowSceneSessionImpl::NotifySpecificWindowSessionProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
WLOGFD("NotifySpecificWindowSessionProperty called windowId:%{public}u", GetWindowId());
|
||||
if (IsWindowSessionInvalid()) {
|
||||
WLOGFE("session is invalid");
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
}
|
||||
if ((state_ == WindowState::STATE_CREATED &&
|
||||
property_->GetModeSupportInfo() != WindowModeSupport::WINDOW_MODE_SUPPORT_FULLSCREEN) ||
|
||||
state_ == WindowState::STATE_HIDDEN) {
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
if (type == WindowType::WINDOW_TYPE_STATUS_BAR) {
|
||||
UpdateProperty(WSPropertyChangeAction::ACTION_UPDATE_STATUS_PROPS);
|
||||
} else if (type == WindowType::WINDOW_TYPE_NAVIGATION_BAR) {
|
||||
UpdateProperty(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_PROPS);
|
||||
} else if (type == WindowType::WINDOW_TYPE_NAVIGATION_INDICATOR) {
|
||||
UpdateProperty(WSPropertyChangeAction::ACTION_UPDATE_NAVIGATION_INDICATOR_PROPS);
|
||||
}
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowSceneSessionImpl::SetSystemBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
WLOGFI("SetSystemBarProperty windowId:%{public}u type:%{public}u"
|
||||
@ -1093,6 +1115,31 @@ WMError WindowSceneSessionImpl::SetSystemBarProperty(WindowType type, const Syst
|
||||
return ret;
|
||||
}
|
||||
|
||||
WMError WindowSceneSessionImpl::SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
WLOGFI("SetSystemBarProperty windowId:%{public}u type:%{public}u"
|
||||
"enable:%{public}u bgColor:%{public}x Color:%{public}x",
|
||||
GetWindowId(), static_cast<uint32_t>(type),
|
||||
property.enable_, property.backgroundColor_, property.contentColor_);
|
||||
if (!((state_ > WindowState::STATE_INITIAL) && (state_ < WindowState::STATE_BOTTOM))) {
|
||||
return WMError::WM_ERROR_INVALID_WINDOW;
|
||||
} else if (GetSystemBarPropertyByType(type) == property) {
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
if (property_ == nullptr) {
|
||||
return WMError::WM_ERROR_NULLPTR;
|
||||
}
|
||||
isSystembarPropertiesSet_ = true;
|
||||
property_->SetSystemBarProperty(type, property);
|
||||
WMError ret = NotifySpecificWindowSessionProperty(type, property);
|
||||
if (ret != WMError::WM_OK) {
|
||||
WLOGFE("NotifyWindowSessionProperty winId:%{public}u errCode:%{public}d",
|
||||
GetWindowId(), static_cast<int32_t>(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
WMError WindowSceneSessionImpl::SetFullScreen(bool status)
|
||||
{
|
||||
WLOGFI("winId:%{public}u status:%{public}d", GetWindowId(), static_cast<int32_t>(status));
|
||||
|
@ -1894,6 +1894,11 @@ WMError WindowSessionImpl::SetSystemBarProperty(WindowType type, const SystemBar
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowSessionImpl::SetSpecificBarProperty(WindowType type, const SystemBarProperty& property)
|
||||
{
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
|
||||
WMError WindowSessionImpl::SetTextFieldAvoidInfo(double textFieldPositionY, double textFieldHeight)
|
||||
{
|
||||
property_->SetTextFieldPositionY(textFieldPositionY);
|
||||
|
Loading…
Reference in New Issue
Block a user