From 2779a5533929346e558abb636d3b8098240a9ade Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan.schmidt@huawei.com>
Date: Fri, 15 Sep 2023 18:13:53 +0200
Subject: [PATCH] openharmony-standard: adjust versions and model names for
 correct GetVerionId()

The GetVersionId() API allows ACTS and applications to find out about
details of the device and platform they run on. So far we adjusted only
a few parts of it, and not all of them have been correct.

The basic information is distributed on various code and config files.

With the updates below I can see the following output in the ACTS log
for Qemu:

the value of the deviceinfo versionId is :devboard/Eclipse Oniro Project/Eclipse Oniro/QEMU Arm Cortex-A7/OpenHarmony-3.0.1.0(LTS)/OHOS/Oniro OH/7/****/****

This translates to the following:
device type: devboard
company short name: Eclipse Oniro Project
brand name: Eclipse Oniro
product series name: Raspberry Pi 4
operating system and version number: OpenHarmony-3.0.1.0(LTS)
model: OHOS
internal software submodel: Oniro OH
system software API level: 7
difference version: ****
build type: ****

For Pi 4 it is the same, besides the different product series name.

Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
 .../openharmony/files/ohos.para                |  2 +-
 .../openharmony/openharmony-standard_3.0.bb    | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/recipes-openharmony/openharmony/files/ohos.para b/recipes-openharmony/openharmony/files/ohos.para
index 1897be0..915ad50 100644
--- a/recipes-openharmony/openharmony/files/ohos.para
+++ b/recipes-openharmony/openharmony/files/ohos.para
@@ -25,7 +25,7 @@ ro.secure=1
 security.perf_harden=1
 ro.allow.mock.location=0
 ro.debuggable=1
-ro.build.characteristics=default
+ro.build.characteristics=devboard
 
 # There is some kind of special handling if this is "OHOS"
 ro.product.model=OHOS
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
index 987e630..f745c35 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
@@ -171,21 +171,29 @@ GN_ARGS += 'host_toolchain="//oniro:host_toolchain"'
 GN_ARGS += 'install_oniro_third_party=false'
 
 # Configure HAL system parameters
-OHOS_MANUFACTURE = "Oniro Project"
+OHOS_MANUFACTURE = "Eclipse Oniro Project"
+OHOS_BRAND = "Eclipse Oniro"
 OHOS_SOFTWARE_MODEL = "Oniro OH"
-OHOS_HARDWARE_MODEL = "${MACHINE}"
-OHOS_HARDWARE_MODEL:qemuarma7 = "QEMU Arm Cortex-A7"
-OHOS_HARDWARE_MODEL:raspberrypi4-64 = "Raspberry Pi 4"
+OHOS_PRODUCT_SERIES = "${MACHINE}"
+OHOS_PRODUCT_SERIES:qemuarma7 = "QEMU Arm Cortex-A7"
+OHOS_PRODUCT_SERIES:raspberrypi4-64 = "Raspberry Pi 4"
 OHOS_HARDWARE_PROFILE = "aout:true,display:true"
 OHOS_HARDWARE_PROFILE:qemuarma7 = "aout:false,display:true,camera:false,radio:false,bluetooth:false,WIFI:false,usbhost:false"
 OHOS_HARDWARE_PROFILE:raspberrypi4-64 = "aout:false,display:false,camera:false,radio:false,bluetooth:false,WIFI:true,usbhost:false"
+OHOS_SDK_API_LEVEL = "7"
+OHOS_FEATURE_VERSION = "1"
 do_configure[prefuncs] += "do_configure_sysparam_hal"
 do_configure_sysparam_hal() {
     sed -i ${S}/base/startup/syspara_lite/hals/parameter/src/parameter_hal.cpp \
         -e 's/\(static const char OHOS_MANUFACTURE\[\]\) =.*/\1 = {"${OHOS_MANUFACTURE}"};/' \
+        -e 's/\(static const char OHOS_BRAND\[\]\) =.*/\1 = {"${OHOS_BRAND}"};/' \
+        -e 's/\(static const char OHOS_PRODUCT_SERIES\[\]\) =.*/\1 = {"${OHOS_PRODUCT_SERIES}"};/' \
         -e 's/\(static const char OHOS_SOFTWARE_MODEL\[\]\) =.*/\1 = {"${OHOS_SOFTWARE_MODEL}"};/' \
-        -e 's/\(static const char OHOS_HARDWARE_MODEL\[\]\) =.*/\1 = {"${OHOS_HARDWARE_MODEL}"};/' \
         -e 's/\(static const char OHOS_HARDWARE_PROFILE\[\]\) =.*/\1 = {"${OHOS_HARDWARE_PROFILE}"};/'
+    sed -i ${S}/base/startup/syspara_lite/interfaces/innerkits/native/syspara/src/parameter.c \
+        -e 's/\(static const int OHOS_SDK_API_LEVEL\) =.*/\1 = ${OHOS_SDK_API_LEVEL};/'
+    sed -i ${S}/base/startup/syspara_lite/interfaces/innerkits/native/syspara/src/sysversion.c \
+        -e 's/\(static int g_featureVersion\) =.*/\1 = ${OHOS_FEATURE_VERSION};/'
 }
 
 # OpenHarmony build system needs a bit of help to be able to find the right
-- 
GitLab