From 14f973d1f6c981c185cc0c05dac020261800a2f0 Mon Sep 17 00:00:00 2001 From: rwx1283129 Date: Thu, 2 Nov 2023 05:12:47 +0000 Subject: [PATCH 1/3] Initial quarantine in macro mode Signed-off-by: rwx1283129 Change-Id: If052499b30c5c1644066fc851d21c3d65cf652f9 --- miscdevice.gni | 8 ++++++++ services/miscdevice_service/BUILD.gn | 18 ++++++++++++++---- .../adapter/src/compatible_connection.cpp | 2 ++ .../src/compatible_light_connection.cpp | 2 ++ .../interface/src/light_hdi_connection.cpp | 6 ++++++ .../interface/src/vibrator_hdi_connection.cpp | 6 ++++++ 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/miscdevice.gni b/miscdevice.gni index a7f6ed3..ced448e 100644 --- a/miscdevice.gni +++ b/miscdevice.gni @@ -37,3 +37,11 @@ if (!defined(global_parts_info) || } else { hdf_drivers_interface_light = false } + +if(build_variant == "eng") { + miscdevice_default_defines += [ "BUILD_VARIANT_ENG" ] + miscdevice_build_eng = true +} +else { + miscdevice_build_eng = false +} diff --git a/services/miscdevice_service/BUILD.gn b/services/miscdevice_service/BUILD.gn index 789b4f2..d24ef15 100644 --- a/services/miscdevice_service/BUILD.gn +++ b/services/miscdevice_service/BUILD.gn @@ -16,8 +16,6 @@ import("./../../miscdevice.gni") ohos_shared_library("libmiscdevice_service") { sources = [ - "hdi_connection/adapter/src/compatible_connection.cpp", - "hdi_connection/adapter/src/compatible_light_connection.cpp", "hdi_connection/adapter/src/hdi_connection.cpp", "hdi_connection/interface/src/light_hdi_connection.cpp", "hdi_connection/interface/src/vibrator_hdi_connection.cpp", @@ -38,6 +36,13 @@ ohos_shared_library("libmiscdevice_service") { "//third_party/cJSON", ] + if(miscdevice_build_eng) { + sources += [ + "hdi_connection/adapter/src/compatible_connection.cpp", + "hdi_connection/adapter/src/compatible_light_connection.cpp", + ] + } + cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ "$SUBSYSTEM_DIR/utils:libmiscdevice_utils" ] @@ -78,8 +83,6 @@ ohos_shared_library("libmiscdevice_service") { ############################################################################# ohos_shared_library("libmiscdevice_service_static") { sources = [ - "hdi_connection/adapter/src/compatible_connection.cpp", - "hdi_connection/adapter/src/compatible_light_connection.cpp", "hdi_connection/adapter/src/hdi_connection.cpp", "hdi_connection/interface/src/light_hdi_connection.cpp", "hdi_connection/interface/src/vibrator_hdi_connection.cpp", @@ -100,6 +103,13 @@ ohos_shared_library("libmiscdevice_service_static") { "//third_party/cJSON", ] + if(miscdevice_build_eng) { + sources += [ + "hdi_connection/adapter/src/compatible_connection.cpp", + "hdi_connection/adapter/src/compatible_light_connection.cpp", + ] + } + cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ "$SUBSYSTEM_DIR/utils:libmiscdevice_utils" ] diff --git a/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp index 2dc8854..3233b34 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/compatible_connection.cpp @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef BUILD_VARIANT_ENG #include "compatible_connection.h" +#endif #include #include diff --git a/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp b/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp index 226884c..ddab426 100644 --- a/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp +++ b/services/miscdevice_service/hdi_connection/adapter/src/compatible_light_connection.cpp @@ -12,7 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef BUILD_VARIANT_ENG #include "compatible_light_connection.h" +#endif #include #include diff --git a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp index 50767c0..f4e4151 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp @@ -16,7 +16,10 @@ #include +#ifdef BUILD_VARIANT_ENG #include "compatible_light_connection.h" +#endif + #ifdef HDF_DRIVERS_INTERFACE_LIGHT #include "hdi_light_connection.h" #endif // HDF_DRIVERS_INTERFACE_LIGHT @@ -41,7 +44,10 @@ int32_t LightHdiConnection::ConnectHdi() return ERR_OK; } #endif // HDF_DRIVERS_INTERFACE_LIGHT +#ifdef BUILD_VARIANT_ENG iLightHdiConnection_ = std::make_unique(); +#endif + MISC_HILOGE("Compatible connection have been blocked"); return ConnectHdiService(); } diff --git a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp index 8090b65..99411bd 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp @@ -16,7 +16,10 @@ #include "hitrace_meter.h" +#ifdef BUILD_VARIANT_ENG #include "compatible_connection.h" +#endif + #include "hdi_connection.h" #include "sensors_errors.h" @@ -34,8 +37,11 @@ int32_t VibratorHdiConnection::ConnectHdi() int32_t ret = iVibratorHdiConnection_->ConnectHdi(); if (ret != ERR_OK) { MISC_HILOGE("Hdi direct failed"); +#ifdef BUILD_VARIANT_ENG iVibratorHdiConnection_ = std::make_unique(); ret = iVibratorHdiConnection_->ConnectHdi(); +#endif + MISC_HILOGE("Compatible connection have been blocked"); } if (ret != ERR_OK) { MISC_HILOGE("Hdi connection failed"); -- Gitee From 223a204baa05fb3dc3d492b994a410a8d8ae17c0 Mon Sep 17 00:00:00 2001 From: rwx1283129 Date: Thu, 2 Nov 2023 06:48:25 +0000 Subject: [PATCH 2/3] Modify the format of gn Signed-off-by: rwx1283129 Change-Id: I86bf1ea9f0cce89ee1b01f6648f3efaa0ca48db5 --- miscdevice.gni | 5 ++--- services/miscdevice_service/BUILD.gn | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/miscdevice.gni b/miscdevice.gni index ced448e..9ad3317 100644 --- a/miscdevice.gni +++ b/miscdevice.gni @@ -38,10 +38,9 @@ if (!defined(global_parts_info) || hdf_drivers_interface_light = false } -if(build_variant == "eng") { +if (build_variant == "eng") { miscdevice_default_defines += [ "BUILD_VARIANT_ENG" ] miscdevice_build_eng = true -} -else { +} else { miscdevice_build_eng = false } diff --git a/services/miscdevice_service/BUILD.gn b/services/miscdevice_service/BUILD.gn index d24ef15..90515ca 100644 --- a/services/miscdevice_service/BUILD.gn +++ b/services/miscdevice_service/BUILD.gn @@ -36,11 +36,11 @@ ohos_shared_library("libmiscdevice_service") { "//third_party/cJSON", ] - if(miscdevice_build_eng) { - sources += [ - "hdi_connection/adapter/src/compatible_connection.cpp", - "hdi_connection/adapter/src/compatible_light_connection.cpp", - ] + if (miscdevice_build_eng) { + sources += [ + "hdi_connection/adapter/src/compatible_connection.cpp", + "hdi_connection/adapter/src/compatible_light_connection.cpp", + ] } cflags = [ "-Wno-error=inconsistent-missing-override" ] @@ -103,11 +103,11 @@ ohos_shared_library("libmiscdevice_service_static") { "//third_party/cJSON", ] - if(miscdevice_build_eng) { - sources += [ - "hdi_connection/adapter/src/compatible_connection.cpp", - "hdi_connection/adapter/src/compatible_light_connection.cpp", - ] + if (miscdevice_build_eng) { + sources += [ + "hdi_connection/adapter/src/compatible_connection.cpp", + "hdi_connection/adapter/src/compatible_light_connection.cpp", + ] } cflags = [ "-Wno-error=inconsistent-missing-override" ] -- Gitee From 4d01bf836399142b5ca87de27ee1b78fbd43b218 Mon Sep 17 00:00:00 2001 From: rwx1283129 Date: Tue, 7 Nov 2023 08:19:18 +0000 Subject: [PATCH 3/3] up exchange Signed-off-by: rwx1283129 Change-Id: I643bd1e5657ded7a952833448d56037977f6b931 --- .../hdi_connection/interface/src/light_hdi_connection.cpp | 1 - .../hdi_connection/interface/src/vibrator_hdi_connection.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp index f4e4151..2d00a75 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/light_hdi_connection.cpp @@ -47,7 +47,6 @@ int32_t LightHdiConnection::ConnectHdi() #ifdef BUILD_VARIANT_ENG iLightHdiConnection_ = std::make_unique(); #endif - MISC_HILOGE("Compatible connection have been blocked"); return ConnectHdiService(); } diff --git a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp index 99411bd..898825c 100644 --- a/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp +++ b/services/miscdevice_service/hdi_connection/interface/src/vibrator_hdi_connection.cpp @@ -41,7 +41,6 @@ int32_t VibratorHdiConnection::ConnectHdi() iVibratorHdiConnection_ = std::make_unique(); ret = iVibratorHdiConnection_->ConnectHdi(); #endif - MISC_HILOGE("Compatible connection have been blocked"); } if (ret != ERR_OK) { MISC_HILOGE("Hdi connection failed"); -- Gitee