configuration add displayId

Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
xinking129
2023-07-28 16:09:00 +08:00
parent 2b62fc23d8
commit 05e686bdb0
2 changed files with 10 additions and 1 deletions
@@ -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));
@@ -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<std::string> 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)
{