chromeos-config: add first-api-level to arc section

Each model will have a different ro.product.first_api_level depending on
what version of Android it used when it first shipped. Use this property
to set the correct value in the model.dtsi files.

TEST=./run_tests.sh and verify that first-api-level shows up
BUG=b:73898157

Change-Id: I37549f0796a4e2de7d4f9a656911146f97bc833a
Reviewed-on: https://chromium-review.googlesource.com/1002215
Commit-Ready: Kenny Root <kroot@google.com>
Tested-by: Kenny Root <kroot@google.com>
Reviewed-by: C Shapiro <shapiroc@google.com>
diff --git a/chromeos-config/README.md b/chromeos-config/README.md
index 2224663..fc1654d 100644
--- a/chromeos-config/README.md
+++ b/chromeos-config/README.md
@@ -110,6 +110,9 @@
                     collation of metrics with different tags into groups, but if
                     this is not supported, this tag can be used to achieve the
                     same end. This is reported in `ro.product.metrics.tag`.
+                *   `first-api-level`: The first [Android API
+                    level](https://source.android.com/setup/build-numbers) that
+                    this model shipped with.
 
     *   `power` (optional): Contains information about power devices used by
         this family. Each subnode is defined as a phandle that can be referenced
@@ -854,6 +857,8 @@
 is often '{product}_cheets' but it can be something else if
 desired.
  |
+| first-api-level | string |  | False | The first Android API level that this model shipped with.
+ |
 | marketing-name | string |  | False | Name of this model as it is called in the
 market, reported in 'ro.product.model'. This often starts
 with '{oem}'.
diff --git a/chromeos-config/cros_config_host/cros_config_schema.yaml b/chromeos-config/cros_config_host/cros_config_schema.yaml
index 620967a..3c2b7a3 100644
--- a/chromeos-config/cros_config_host/cros_config_schema.yaml
+++ b/chromeos-config/cros_config_host/cros_config_schema.yaml
@@ -82,6 +82,10 @@
                         this is not supported, this tag can be used to achieve the
                         same end.  This is reported in 'ro.product.metrics.tag'.
                       type: string
+                    first-api-level:
+                      description: |
+                        The first Android API level that this model shipped with.
+                      type: string
                   additionalProperties: false
                 files:
                   type: array
diff --git a/chromeos-config/cros_config_host/validate_config.py b/chromeos-config/cros_config_host/validate_config.py
index 47d67bb..6f45e20 100755
--- a/chromeos-config/cros_config_host/validate_config.py
+++ b/chromeos-config/cros_config_host/validate_config.py
@@ -486,6 +486,7 @@
     PropString('oem', False),
     PropString('marketing-name', False),
     PropString('metrics-tag', False),
+    PropString('first-api-level', False, '[0-9]+'),
 ]
 
 BASE_AUDIO_NODE = [
diff --git a/chromeos-config/libcros_config/test.json b/chromeos-config/libcros_config/test.json
index ba81492..e749ff5 100644
--- a/chromeos-config/libcros_config/test.json
+++ b/chromeos-config/libcros_config/test.json
@@ -2,7 +2,11 @@
   "chromeos": {
     "models": [
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "audio": {
           "main": {
             "cras-config-dir": "some", 
@@ -22,7 +26,11 @@
         "wallpaper": "some"
       }, 
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "audio": {
           "main": {
             "cras-config-dir": "some", 
@@ -59,7 +67,11 @@
         "wallpaper": "default"
       }, 
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "identity": {
           "customization-id": "whitelabel1", 
           "platform-name": "Some", 
@@ -74,7 +86,11 @@
         "wallpaper": "wallpaper-wl1"
       }, 
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "identity": {
           "customization-id": "whitelabel1", 
           "platform-name": "Some", 
@@ -88,7 +104,11 @@
         "wallpaper": "wallpaper-wl1"
       }, 
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "identity": {
           "customization-id": "whitelabel2", 
           "platform-name": "Some", 
@@ -103,7 +123,11 @@
         "wallpaper": "wallpaper-wl2"
       }, 
       {
-        "arc": {}, 
+        "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }
+        }, 
         "identity": {
           "customization-id": "whitelabel2", 
           "platform-name": "Some", 
diff --git a/chromeos-config/libcros_config/test.yaml b/chromeos-config/libcros_config/test.yaml
index 6c8a3f5..0a8c13e 100644
--- a/chromeos-config/libcros_config/test.yaml
+++ b/chromeos-config/libcros_config/test.yaml
@@ -42,6 +42,8 @@
     files:
       - source: "some/hardware_features"
         destination: "/usr/share/chromeos-config/sbin/some/hardware_features"
+    build-properties:
+      first-api-level: "27"
   firmware:
     bcs-overlay: "overlay-some-private"
     build-targets:
diff --git a/chromeos-config/libcros_config/test_build.json b/chromeos-config/libcros_config/test_build.json
index d30e791..cc174a8 100644
--- a/chromeos-config/libcros_config/test_build.json
+++ b/chromeos-config/libcros_config/test_build.json
@@ -3,6 +3,9 @@
     "models": [
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features", 
@@ -93,6 +96,9 @@
       }, 
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features", 
@@ -258,6 +264,9 @@
       }, 
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features", 
@@ -314,6 +323,9 @@
       }, 
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features", 
@@ -369,6 +381,9 @@
       }, 
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features", 
@@ -425,6 +440,9 @@
       }, 
       {
         "arc": {
+          "build-properties": {
+            "first-api-level": "27"
+          }, 
           "files": [
             {
               "destination": "/usr/share/chromeos-config/sbin/some/hardware_features",