Added access field to VehicleAreaConfig.aidl

Changed VHAL version from V2 to V3 for VehicleAreaConfig changes

Bug: 290801790
Test: manual build
Change-Id: I20c85f2144b088ef2e70def32602c0d41c602d29
diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp
index f0abbcf..3549519 100644
--- a/automotive/vehicle/Android.bp
+++ b/automotive/vehicle/Android.bp
@@ -21,7 +21,7 @@
 cc_defaults {
     name: "VehicleHalInterfaceDefaults",
     static_libs: [
-        "android.hardware.automotive.vehicle-V2-ndk",
+        "android.hardware.automotive.vehicle-V3-ndk",
         "android.hardware.automotive.vehicle.property-V3-ndk",
     ],
 }
diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp
index 3b93bca..3be0f28 100644
--- a/automotive/vehicle/aidl/Android.bp
+++ b/automotive/vehicle/aidl/Android.bp
@@ -27,7 +27,7 @@
     srcs: [
         "android/hardware/automotive/vehicle/*.aidl",
     ],
-    frozen: true,
+    frozen: false,
     stability: "vintf",
     backend: {
         cpp: {
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
index 6960894..3322769 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
@@ -42,4 +42,5 @@
   float minFloatValue;
   float maxFloatValue;
   @nullable long[] supportedEnumValues;
+  android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE;
 }
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index b8f797f..bb976af 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -51,7 +51,7 @@
         ":IVehicleGeneratedJavaFiles",
     ],
     static_libs: [
-        "android.hardware.automotive.vehicle-V2-java",
+        "android.hardware.automotive.vehicle-V3-java",
         "android.hardware.automotive.vehicle.property-V3-java",
         "androidx.test.runner",
         "truth",
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
index 20c046d..9fd9bda 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
@@ -16,6 +16,8 @@
 
 package android.hardware.automotive.vehicle;
 
+import android.hardware.automotive.vehicle.VehiclePropertyAccess;
+
 @VintfStability
 @JavaDerive(equals=true, toString=true)
 parcelable VehicleAreaConfig {
@@ -47,4 +49,25 @@
      * assumed all @data_enum values are supported unless specified through another mechanism.
      */
     @nullable long[] supportedEnumValues;
+
+    /**
+     * Defines if the area ID for this property is READ, WRITE or READ_WRITE. This only applies if
+     * the property is defined in the framework as a READ_WRITE property. Access (if set) should be
+     * equal to, or a superset of, the VehiclePropConfig.access of the property.
+     *
+     * For example, if a property is defined as READ_WRITE, but the OEM wants to specify certain
+     * area Ids as READ-only, the corresponding areaIds should have an access set to READ, while the
+     * others must be set to READ_WRITE. We do not support setting specific area Ids to WRITE-only
+     * when the property is READ-WRITE.
+     *
+     * Exclusively one of VehiclePropConfig and the VehicleAreaConfigs should be specified for a
+     * single property. If VehiclePropConfig.access is populated, none of the
+     * VehicleAreaConfig.access values should be populated. If VehicleAreaConfig.access values are
+     * populated, VehiclePropConfig.access must not be populated.
+     *
+     * VehicleAreaConfigs should not be partially populated with access. If the OEM wants to specify
+     * access for one area Id, all other configs should be populated with their access levels as
+     * well.
+     */
+    VehiclePropertyAccess access = VehiclePropertyAccess.NONE;
 }
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
index 61b9369..1135b26 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
@@ -28,6 +28,10 @@
 
     /**
      * Defines if the property is read or write or both.
+     *
+     * If populating VehicleAreaConfig.access fields for this property, this field should not be
+     * populated. If the OEM decides to populate this field, none of the VehicleAreaConfig.access
+     * fields should be populated.
      */
     VehiclePropertyAccess access = VehiclePropertyAccess.NONE;
 
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto
index ddc64d9..04b7dd4 100644
--- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto
@@ -43,4 +43,5 @@
      * assumed all @data_enum values are supported unless specified through another mechanism.
      */
     repeated int64 supported_enum_values = 8;
+    int32 access = 9;
 };
diff --git a/automotive/vehicle/vhal_static_cpp_lib.mk b/automotive/vehicle/vhal_static_cpp_lib.mk
index bffa076..6b3d486 100644
--- a/automotive/vehicle/vhal_static_cpp_lib.mk
+++ b/automotive/vehicle/vhal_static_cpp_lib.mk
@@ -16,5 +16,5 @@
 # interface and VHAL properties.
 
 LOCAL_STATIC_LIBRARIES += \
-    android.hardware.automotive.vehicle-V2-ndk \
+    android.hardware.automotive.vehicle-V3-ndk \
     android.hardware.automotive.vehicle.property-V3-ndk