From 05e686bdb07b466761da28361ab77bfae0611cf3 Mon Sep 17 00:00:00 2001 From: xinking129 Date: Fri, 28 Jul 2023 16:09:00 +0800 Subject: [PATCH] configuration add displayId Signed-off-by: xinking129 --- .../simulator/ability_simulator/src/js_data_converter.cpp | 3 +++ frameworks/simulator/common/include/configuration.h | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frameworks/simulator/ability_simulator/src/js_data_converter.cpp b/frameworks/simulator/ability_simulator/src/js_data_converter.cpp index d68c396aec..a36bcdccd9 100644 --- a/frameworks/simulator/ability_simulator/src/js_data_converter.cpp +++ b/frameworks/simulator/ability_simulator/src/js_data_converter.cpp @@ -113,6 +113,9 @@ NativeValue *CreateJsConfiguration(NativeEngine &engine, const AppExecFwk::Confi std::string density = configuration.GetItem(AppExecFwk::ConfigurationInner::APPLICATION_DENSITYDPI); object->SetProperty("screenDensity", CreateJsValue(engine, ConvertDensity(density))); + int32_t displayId = ConvertDisplayId(configuration.GetItem(AppExecFwk::ConfigurationInner::APPLICATION_DISPLAYID)); + object->SetProperty("displayId", CreateJsValue(engine, displayId)); + std::string hasPointerDevice = configuration.GetItem(AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE); object->SetProperty("hasPointerDevice", CreateJsValue(engine, hasPointerDevice == "true" ? true : false)); diff --git a/frameworks/simulator/common/include/configuration.h b/frameworks/simulator/common/include/configuration.h index 62dbeb449f..01b651a318 100644 --- a/frameworks/simulator/common/include/configuration.h +++ b/frameworks/simulator/common/include/configuration.h @@ -42,6 +42,7 @@ constexpr const char* CONNECTION_SYMBOL = "#"; constexpr const char* EMPTY_STRING = ""; constexpr const char* APPLICATION_DIRECTION = "ohos.application.direction"; constexpr const char* APPLICATION_DENSITYDPI = "ohos.application.densitydpi"; +constexpr const char* APPLICATION_DISPLAYID = "ohos.application.displayid"; /* * This must be synchronized with the value in GlobalConfigurationKey @@ -54,6 +55,7 @@ const std::vector SystemConfigurationKeyStore { OHOS::AAFwk::GlobalConfigurationKey::DEVICE_TYPE, OHOS::AppExecFwk::ConfigurationInner::APPLICATION_DIRECTION, OHOS::AppExecFwk::ConfigurationInner::APPLICATION_DENSITYDPI, + OHOS::AppExecFwk::ConfigurationInner::APPLICATION_DISPLAYID, }; constexpr const char* COLOR_MODE_LIGHT = "light"; @@ -65,7 +67,11 @@ constexpr const char* DIRECTION_HORIZONTAL = "horizontal"; class Configuration { public: - Configuration() {} + Configuration() + { + AddItem(AppExecFwk::ConfigurationInner::APPLICATION_DISPLAYID, "0"); + AddItem(AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE, "true"); + } Configuration(const Configuration &other) {