Merge "wifi: add wifi TL to vts owners"
diff --git a/audio/common/6.0/Android.bp b/audio/common/6.0/Android.bp
index fc54caf..91721fc 100644
--- a/audio/common/6.0/Android.bp
+++ b/audio/common/6.0/Android.bp
@@ -20,4 +20,8 @@
],
gen_java: true,
gen_java_constants: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/authsecret/1.0/vts/functional/OWNERS b/authsecret/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..ec8c304
--- /dev/null
+++ b/authsecret/1.0/vts/functional/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 186411
+chengyouho@google.com
+frankwoo@google.com
diff --git a/automotive/audiocontrol/1.0/Android.bp b/automotive/audiocontrol/1.0/Android.bp
index 628793b..53ed78b 100644
--- a/automotive/audiocontrol/1.0/Android.bp
+++ b/automotive/audiocontrol/1.0/Android.bp
@@ -20,4 +20,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/automotive/audiocontrol/1.0/vts/functional/OWNERS b/automotive/audiocontrol/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..fb422db
--- /dev/null
+++ b/automotive/audiocontrol/1.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 162915
+zhaomingyin@google.com
diff --git a/automotive/audiocontrol/2.0/Android.bp b/automotive/audiocontrol/2.0/Android.bp
index 4d1fdbc..413cf48 100644
--- a/automotive/audiocontrol/2.0/Android.bp
+++ b/automotive/audiocontrol/2.0/Android.bp
@@ -24,4 +24,8 @@
"android.hidl.safe_union@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/automotive/audiocontrol/2.0/vts/functional/OWNERS b/automotive/audiocontrol/2.0/vts/functional/OWNERS
new file mode 100644
index 0000000..fb422db
--- /dev/null
+++ b/automotive/audiocontrol/2.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 162915
+zhaomingyin@google.com
diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp
index 4acfd82..5e69429 100644
--- a/automotive/audiocontrol/aidl/Android.bp
+++ b/automotive/audiocontrol/aidl/Android.bp
@@ -17,6 +17,11 @@
backend: {
java: {
sdk_version: "module_current",
+ min_sdk_version: "31",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
},
},
versions: ["1"],
diff --git a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
index 583a455..58423c8 100644
--- a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
+++ b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <fuzzer/FuzzedDataProvider.h>
#include <cmath>
#include <cstdlib>
#include <cstring>
@@ -21,36 +22,43 @@
#include "FormatConvert.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, std::size_t size) {
- if (size < 256) {
+ // 1 random value (4bytes) + min imagesize = 16*2 times bytes per pixel (worse case 2)
+ if (size < (4 + 16 * 2 * 2)) {
return 0;
}
+ FuzzedDataProvider fdp(data, size);
+ std::size_t image_pixel_size = size - 4;
+ image_pixel_size = (image_pixel_size & INT_MAX) / 2;
- std::srand(std::time(nullptr)); // use current time as seed for random generator
- int random_variable = std::rand() % 10;
- int width = (int)sqrt(size);
- int height = width * ((float)random_variable / 10.0);
+ // API have a requirement that width must be divied by 16 except yuyvtorgb
+ int min_height = 2;
+ int max_height = (image_pixel_size / 16) & ~(1); // must be even number
+ int height = fdp.ConsumeIntegralInRange<uint32_t>(min_height, max_height);
+ int width = (image_pixel_size / height) & ~(16); // must be divisible by 16
- uint8_t* src = (uint8_t*)malloc(sizeof(uint8_t) * size);
- memcpy(src, data, sizeof(uint8_t) * (size));
- uint32_t* tgt = (uint32_t*)malloc(sizeof(uint32_t) * size);
+ uint8_t* src = (uint8_t*)(data + 4);
+ uint32_t* tgt = (uint32_t*)malloc(sizeof(uint32_t) * image_pixel_size);
#ifdef COPY_NV21_TO_RGB32
- android::hardware::automotive::evs::common::Utils::copyNV21toRGB32(width, height, src, tgt, 0);
+ android::hardware::automotive::evs::common::Utils::copyNV21toRGB32(width, height, src, tgt,
+ width);
#elif COPY_NV21_TO_BGR32
- android::hardware::automotive::evs::common::Utils::copyNV21toBGR32(width, height, src, tgt, 0);
+ android::hardware::automotive::evs::common::Utils::copyNV21toBGR32(width, height, src, tgt,
+ width);
#elif COPY_YV12_TO_RGB32
- android::hardware::automotive::evs::common::Utils::copyYV12toRGB32(width, height, src, tgt, 0);
+ android::hardware::automotive::evs::common::Utils::copyYV12toRGB32(width, height, src, tgt,
+ width);
#elif COPY_YV12_TO_BGR32
- android::hardware::automotive::evs::common::Utils::copyYV12toBGR32(width, height, src, tgt, 0);
+ android::hardware::automotive::evs::common::Utils::copyYV12toBGR32(width, height, src, tgt,
+ width);
#elif COPY_YUYV_TO_RGB32
- android::hardware::automotive::evs::common::Utils::copyYUYVtoRGB32(width, height, src, 0, tgt,
- 0);
+ android::hardware::automotive::evs::common::Utils::copyYUYVtoRGB32(width, height, src, width,
+ tgt, width);
#elif COPY_YUYV_TO_BGR32
- android::hardware::automotive::evs::common::Utils::copyYUYVtoBGR32(width, height, src, 0, tgt,
- 0);
+ android::hardware::automotive::evs::common::Utils::copyYUYVtoBGR32(width, height, src, width,
+ tgt, width);
#endif
- free(src);
free(tgt);
return 0;
diff --git a/automotive/occupant_awareness/aidl/Android.bp b/automotive/occupant_awareness/aidl/Android.bp
index 288dc6d..6ddc127 100644
--- a/automotive/occupant_awareness/aidl/Android.bp
+++ b/automotive/occupant_awareness/aidl/Android.bp
@@ -17,6 +17,11 @@
backend: {
java: {
sdk_version: "module_current",
+ min_sdk_version: "31",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
},
ndk: {
vndk: {
diff --git a/automotive/sv/1.0/vts/functional/OWNERS b/automotive/sv/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..2ba00a3
--- /dev/null
+++ b/automotive/sv/1.0/vts/functional/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 821659
+tanmayp@google.com
+ankitarora@google.com
diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp
index e2164b1..5c2e0ea 100644
--- a/automotive/vehicle/2.0/Android.bp
+++ b/automotive/vehicle/2.0/Android.bp
@@ -21,4 +21,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index e025d1e..cfbbbd3 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -1036,7 +1036,7 @@
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {0 /* ClusterHome */, -1 /* ClusterNone */}},
+ .initialValue = {.int32Values = {0 /* ClusterHome */}},
},
{
.config =
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index b964991..7c8e1f5 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -487,8 +487,11 @@
* int64Values[3] = rear right ticks
* int64Values[4] = rear left ticks
*
- * configArray is used to indicate the micrometers-per-wheel-tick value and
- * which wheels are supported. configArray is set as follows:
+ * configArray is used to indicate the micrometers-per-wheel-tick values and
+ * which wheels are supported. Each micrometers-per-wheel-tick value is static (i.e. will not
+ * update based on wheel's status) and a best approximation. For example, if a vehicle has
+ * multiple rim/tire size options, the micrometers-per-wheel-tick values are set to those for
+ * the typically expected rim/tire size. configArray is set as follows:
*
* configArray[0], bits [0:3] = supported wheels. Uses enum Wheel.
* configArray[1] = micrometers per front left wheel tick
diff --git a/automotive/vehicle/2.0/vts/functional/OWNERS b/automotive/vehicle/2.0/vts/functional/OWNERS
new file mode 100644
index 0000000..8a0f2af
--- /dev/null
+++ b/automotive/vehicle/2.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533426
+kwangsudo@google.com
diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp
index ca8afb0..1ca62ac 100644
--- a/automotive/vehicle/aidl/Android.bp
+++ b/automotive/vehicle/aidl/Android.bp
@@ -34,6 +34,11 @@
},
java: {
sdk_version: "module_current",
+ min_sdk_version: "31",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
},
},
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
index 472b23b..7e48eba 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
@@ -36,4 +36,5 @@
enum VehicleApPowerStateConfigFlag {
ENABLE_DEEP_SLEEP_FLAG = 1,
CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2,
+ ENABLE_HIBERNATION_FLAG = 3,
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
index 1ca3b50..fc669ec 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
@@ -42,4 +42,6 @@
ON = 6,
SHUTDOWN_PREPARE = 7,
SHUTDOWN_CANCELLED = 8,
+ HIBERNATION_ENTRY = 9,
+ HIBERNATION_EXIT = 10,
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
index 3e0f4e8..3fde1c7 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
@@ -38,4 +38,6 @@
CAN_SLEEP = 2,
SHUTDOWN_ONLY = 3,
SLEEP_IMMEDIATELY = 4,
+ HIBERNATE_IMMEDIATELY = 5,
+ CAN_HIBERNATE = 6,
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
index 7cb5db3..4d8e2f5 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
@@ -20,8 +20,10 @@
@Backing(type="int")
enum VehicleApPowerStateConfigFlag {
/**
- * AP can enter deep sleep state. If not set, AP will always shutdown from
- * VehicleApPowerState#SHUTDOWN_PREPARE power state.
+ * AP can enter deep sleep state. If not set, AP will shutdown from
+ * VehicleApPowerState#SHUTDOWN_PREPARE power state when deep sleep is requested
+ * (via VehicleApPowerStateShutdownParam#CAN_SLEEP or
+ * VehicleApPowerStateShutdownParam#SLEEP_IMMEDIATELY flags)/
*/
ENABLE_DEEP_SLEEP_FLAG = 0x1,
/**
@@ -29,4 +31,11 @@
* specified in VehicleApPowerSet VEHICLE_AP_POWER_SET_SHUTDOWN_READY message.
*/
CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2,
+ /**
+ * AP can enter hibernation state. If not set, AP will shutdown from
+ * VehicleApPowerState#SHUTDOWN_PREPARE when hibernation is requested
+ * (via VehicleApPowerStateShutdownParam#CAN_HIBERNATE or
+ * VehicleApPowerStateShutdownParam#HIBERNATE_IMMEDIATELY flags)
+ */
+ ENABLE_HIBERNATION_FLAG = 0x3,
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
index f1d741f..e94fc76 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl
@@ -89,4 +89,22 @@
* VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored.
*/
SHUTDOWN_CANCELLED = 0x8,
+ /**
+ * AP is ready to hibernate.
+ * The AP will not send any more state reports after this.
+ * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED.
+ * Other power state requests are ignored.
+ *
+ * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on
+ * AP after the specified time has elapsed, so AP can run tasks like
+ * update. If this value is 0, no wake up is requested. The power
+ * controller may not necessarily support timed wake-up.
+ */
+ HIBERNATION_ENTRY = 0x9,
+ /**
+ * AP is exiting from hibernation state.
+ * After reporting this state, AP will accept VehicleApPowerStateReq#ON or
+ * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored.
+ */
+ HIBERNATION_EXIT = 0xA,
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
index 7b682b5..a863d14 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl
@@ -36,4 +36,13 @@
* Postponing is not allowed.
*/
SLEEP_IMMEDIATELY = 4,
+ /**
+ * AP must hibernate (suspend to disk) immediately. Postponing is not allowed.
+ * Depending on the actual implementation, it may shut down immediately
+ */
+ HIBERNATE_IMMEDIATELY = 5,
+ /**
+ * AP can enter hibernation (suspend to disk) instead of shutting down completely.
+ */
+ CAN_HIBERNATE = 6,
}
diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp
index a97d544..94f590d 100644
--- a/automotive/vehicle/aidl/impl/Android.bp
+++ b/automotive/vehicle/aidl/impl/Android.bp
@@ -21,7 +21,8 @@
cc_defaults {
name: "VehicleHalDefaults",
static_libs: [
- "android.hardware.automotive.vehicle-V1-ndk_platform",
+ "android.hardware.automotive.vehicle-V1-ndk",
+ "libmath",
],
shared_libs: [
"libbase",
diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
index 411075d..12a5691 100644
--- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
+++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
@@ -22,6 +22,7 @@
#include <VehicleHalTypes.h>
#include <map>
+#include <vector>
namespace android {
namespace hardware {
@@ -35,6 +36,7 @@
using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
using ::aidl::android::hardware::automotive::vehicle::EvsServiceType;
using ::aidl::android::hardware::automotive::vehicle::FuelType;
+using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
@@ -52,116 +54,107 @@
using ::aidl::android::hardware::automotive::vehicle::VehicleUnit;
using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission;
-} // namespace defaultconfig_impl
-
struct ConfigDeclaration {
- defaultconfig_impl::VehiclePropConfig config;
+ VehiclePropConfig config;
// This value will be used as an initial value for the property. If this field is specified for
// property that supports multiple areas then it will be used for all areas unless particular
// area is overridden in initialAreaValue field.
- ::aidl::android::hardware::automotive::vehicle::RawPropValues initialValue;
+ RawPropValues initialValue;
// Use initialAreaValues if it is necessary to specify different values per each area.
- std::map<int32_t, ::aidl::android::hardware::automotive::vehicle::RawPropValues>
- initialAreaValues;
+ std::map<int32_t, RawPropValues> initialAreaValues;
};
-const ConfigDeclaration kVehicleProperties[]{
+const std::vector<ConfigDeclaration> kVehicleProperties = {
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_FUEL_CAPACITY),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.floatValues = {15000.0f}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_FUEL_TYPE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_FUEL_TYPE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
- .initialValue = {.int32Values = {toInt(
- defaultconfig_impl::FuelType::FUEL_TYPE_UNLEADED)}}},
+ .initialValue = {.int32Values = {toInt(FuelType::FUEL_TYPE_UNLEADED)}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::INFO_EV_BATTERY_CAPACITY),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.floatValues = {150000.0f}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_EV_CONNECTOR_TYPE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
- .initialValue = {.int32Values = {toInt(
- defaultconfig_impl::EvConnectorType::IEC_TYPE_1_AC)}}},
+ .initialValue = {.int32Values = {toInt(EvConnectorType::IEC_TYPE_1_AC)}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::INFO_FUEL_DOOR_LOCATION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_EV_PORT_LOCATION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MAKE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_MAKE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.stringValue = "Toy Vehicle"}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MODEL),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_MODEL),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.stringValue = "Speedy Model"}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MODEL_YEAR),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_MODEL_YEAR),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.int32Values = {2020}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::INFO_EXTERIOR_DIMENSIONS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_EXTERIOR_DIMENSIONS),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_VEHICLE_SPEED),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
@@ -169,68 +162,61 @@
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray =
- {toInt(defaultconfig_impl::VehicleUnit::METER_PER_SEC),
- toInt(defaultconfig_impl::VehicleUnit::MILES_PER_HOUR),
- toInt(defaultconfig_impl::VehicleUnit::KILOMETERS_PER_HOUR)},
+ .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {toInt(VehicleUnit::METER_PER_SEC),
+ toInt(VehicleUnit::MILES_PER_HOUR),
+ toInt(VehicleUnit::KILOMETERS_PER_HOUR)},
},
- .initialValue = {.int32Values = {toInt(
- defaultconfig_impl::VehicleUnit::KILOMETERS_PER_HOUR)}}},
+ .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::SEAT_OCCUPANCY),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {defaultconfig_impl::VehicleAreaConfig{.areaId = (SEAT_1_LEFT)},
- defaultconfig_impl::VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}},
+ .prop = toInt(VehicleProperty::SEAT_OCCUPANCY),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)},
+ VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}},
},
- .initialAreaValues =
- {{SEAT_1_LEFT,
- {.int32Values = {toInt(defaultconfig_impl::VehicleSeatOccupancyState::VACANT)}}},
- {SEAT_1_RIGHT,
- {.int32Values = {toInt(
- defaultconfig_impl::VehicleSeatOccupancyState::VACANT)}}}}},
+ .initialAreaValues = {{SEAT_1_LEFT,
+ {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}},
+ {SEAT_1_RIGHT,
+ {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_DRIVER_SEAT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
// this was a zoned property on an old vhal, but it is meant to be global
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = (0)}},
+ .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
},
.initialValue = {.int32Values = {SEAT_1_LEFT}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_ODOMETER),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::PERF_ODOMETER),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
.initialValue = {.floatValues = {0.0f}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_STEERING_ANGLE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
.initialValue = {.floatValues = {0.0f}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::PERF_REAR_STEERING_ANGLE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
@@ -238,10 +224,9 @@
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_RPM),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::ENGINE_RPM),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
@@ -250,9 +235,9 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_LEVEL),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::FUEL_LEVEL),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 100.0f,
},
@@ -260,17 +245,17 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_DOOR_OPEN),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::EV_BATTERY_LEVEL),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 100.0f,
},
@@ -278,27 +263,25 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::EV_CHARGE_PORT_OPEN),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::EV_CHARGE_PORT_CONNECTED),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- EV_BATTERY_INSTANTANEOUS_CHARGE_RATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
},
@@ -306,9 +289,9 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::RANGE_REMAINING),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::RANGE_REMAINING),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 2.0f,
},
@@ -316,25 +299,25 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::TIRE_PRESSURE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ .prop = toInt(VehicleProperty::TIRE_PRESSURE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
+ .areaConfigs = {VehicleAreaConfig{
.areaId = WHEEL_FRONT_LEFT,
.minFloatValue = 193.0f,
.maxFloatValue = 300.0f,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = WHEEL_FRONT_RIGHT,
.minFloatValue = 193.0f,
.maxFloatValue = 300.0f,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = WHEEL_REAR_LEFT,
.minFloatValue = 193.0f,
.maxFloatValue = 300.0f,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = WHEEL_REAR_RIGHT,
.minFloatValue = 193.0f,
.maxFloatValue = 300.0f,
@@ -346,10 +329,9 @@
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
+ .prop = toInt(VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
},
.initialAreaValues = {{WHEEL_FRONT_LEFT, {.floatValues = {137.0f}}},
{WHEEL_FRONT_RIGHT, {.floatValues = {137.0f}}},
@@ -358,78 +340,73 @@
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(defaultconfig_impl::VehicleUnit::KILOPASCAL),
- toInt(defaultconfig_impl::VehicleUnit::PSI),
- toInt(defaultconfig_impl::VehicleUnit::BAR)},
+ .prop = toInt(VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {toInt(VehicleUnit::KILOPASCAL), toInt(VehicleUnit::PSI),
+ toInt(VehicleUnit::BAR)},
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::PSI)}}},
+ .initialValue = {.int32Values = {toInt(VehicleUnit::PSI)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::CURRENT_GEAR),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK),
- toInt(defaultconfig_impl::VehicleGear::GEAR_NEUTRAL),
- toInt(defaultconfig_impl::VehicleGear::GEAR_REVERSE),
- toInt(defaultconfig_impl::VehicleGear::GEAR_1),
- toInt(defaultconfig_impl::VehicleGear::GEAR_2),
- toInt(defaultconfig_impl::VehicleGear::GEAR_3),
- toInt(defaultconfig_impl::VehicleGear::GEAR_4),
- toInt(defaultconfig_impl::VehicleGear::GEAR_5)},
+ .prop = toInt(VehicleProperty::CURRENT_GEAR),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {toInt(VehicleGear::GEAR_PARK),
+ toInt(VehicleGear::GEAR_NEUTRAL),
+ toInt(VehicleGear::GEAR_REVERSE),
+ toInt(VehicleGear::GEAR_1), toInt(VehicleGear::GEAR_2),
+ toInt(VehicleGear::GEAR_3), toInt(VehicleGear::GEAR_4),
+ toInt(VehicleGear::GEAR_5)},
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK)}}},
+ .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::PARKING_BRAKE_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::PARKING_BRAKE_ON),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {1}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::PARKING_BRAKE_AUTO_APPLY),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::PARKING_BRAKE_AUTO_APPLY),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {1}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_LEVEL_LOW),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HW_KEY_INPUT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HW_KEY_INPUT),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0, 0, 0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HW_ROTARY_INPUT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HW_ROTARY_INPUT),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0, 0, 0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HW_CUSTOM_INPUT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HW_CUSTOM_INPUT),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {0, 0, 0, 3, 0, 0, 0, 0, 0},
},
.initialValue =
@@ -437,106 +414,98 @@
.int32Values = {0, 0, 0},
}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_POWER_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}},
// TODO(bryaneyler): Ideally, this is generated dynamically from
// kHvacPowerProperties.
- .configArray =
- {toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_SPEED),
- toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION)}},
+ .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED),
+ toInt(VehicleProperty::HVAC_FAN_DIRECTION)}},
.initialValue = {.int32Values = {1}}},
{
- .config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_DEFROSTER),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.areaConfigs =
- {defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- FRONT_WINDSHIELD)},
- defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- REAR_WINDSHIELD)}}},
+ {VehicleAreaConfig{
+ .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)},
+ VehicleAreaConfig{
+ .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}},
.initialValue = {.int32Values = {0}} // Will be used for all areas.
},
{
- .config = {.prop = toInt(
- defaultconfig_impl::VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .config = {.prop = toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.areaConfigs =
- {defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- FRONT_WINDSHIELD)},
- defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- REAR_WINDSHIELD)}}},
+ {VehicleAreaConfig{
+ .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)},
+ VehicleAreaConfig{
+ .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}},
.initialValue = {.int32Values = {0}} // Will be used for all areas.
},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_MAX_DEFROST_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_RECIRC_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {1}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AUTO_RECIRC_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AC_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {1}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_MAX_AC_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AUTO_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {1}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_DUAL_ON),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_SPEED),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{
.areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}},
.initialValue = {.int32Values = {3}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {toInt(
- defaultconfig_impl::VehicleHvacFanDirection::FACE)}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}},
- {.config = {.prop = toInt(
- defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
.initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR,
FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR,
FAN_DIRECTION_DEFROST,
@@ -544,15 +513,15 @@
FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST,
FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST |
FAN_DIRECTION_FACE}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_SEAT_VENTILATION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{
.areaId = SEAT_1_LEFT,
.minInt32Value = 0,
.maxInt32Value = 3,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = SEAT_1_RIGHT,
.minInt32Value = 0,
.maxInt32Value = 3,
@@ -560,38 +529,38 @@
.initialValue =
{.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level.
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_STEERING_WHEEL_HEAT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{
.areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}},
.initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_SEAT_TEMPERATURE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{
.areaId = SEAT_1_LEFT,
.minInt32Value = -2,
.maxInt32Value = 2,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = SEAT_1_RIGHT,
.minInt32Value = -2,
.maxInt32Value = 2,
}}},
.initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_TEMPERATURE_SET),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {160, 280, 5, 605, 825, 10},
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
+ .areaConfigs = {VehicleAreaConfig{
.areaId = HVAC_LEFT,
.minFloatValue = 16,
.maxFloatValue = 32,
},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{
.areaId = HVAC_RIGHT,
.minFloatValue = 16,
.maxFloatValue = 32,
@@ -601,99 +570,90 @@
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- HVAC_TEMPERATURE_VALUE_SUGGESTION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.floatValues = {66.2f, (float)defaultconfig_impl::VehicleUnit::FAHRENHEIT,
- 19.0f, 66.5f}}},
+ .initialValue = {.floatValues = {66.2f, (float)VehicleUnit::FAHRENHEIT, 19.0f, 66.5f}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
+ .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
+ .access = VehiclePropertyAccess::READ,
// TODO(bryaneyler): Support ON_CHANGE as well.
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 1.0f,
.maxSampleRate = 2.0f,
},
.initialValue = {.floatValues = {25.0f}}},
- {.config = {.prop = toInt(
- defaultconfig_impl::VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(defaultconfig_impl::VehicleUnit::FAHRENHEIT),
- toInt(defaultconfig_impl::VehicleUnit::CELSIUS)}},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::FAHRENHEIT)}}},
+ {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {toInt(VehicleUnit::FAHRENHEIT), toInt(VehicleUnit::CELSIUS)}},
+ .initialValue = {.int32Values = {toInt(VehicleUnit::FAHRENHEIT)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::DISTANCE_DISPLAY_UNITS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = (0)}},
- .configArray = {toInt(defaultconfig_impl::VehicleUnit::KILOMETER),
- toInt(defaultconfig_impl::VehicleUnit::MILE)},
+ .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
+ .configArray = {toInt(VehicleUnit::KILOMETER), toInt(VehicleUnit::MILE)},
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::MILE)}}},
+ .initialValue = {.int32Values = {toInt(VehicleUnit::MILE)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::NIGHT_MODE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::NIGHT_MODE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::GEAR_SELECTION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK),
- toInt(defaultconfig_impl::VehicleGear::GEAR_NEUTRAL),
- toInt(defaultconfig_impl::VehicleGear::GEAR_REVERSE),
- toInt(defaultconfig_impl::VehicleGear::GEAR_DRIVE),
- toInt(defaultconfig_impl::VehicleGear::GEAR_1),
- toInt(defaultconfig_impl::VehicleGear::GEAR_2),
- toInt(defaultconfig_impl::VehicleGear::GEAR_3),
- toInt(defaultconfig_impl::VehicleGear::GEAR_4),
- toInt(defaultconfig_impl::VehicleGear::GEAR_5)},
+ .prop = toInt(VehicleProperty::GEAR_SELECTION),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {toInt(VehicleGear::GEAR_PARK),
+ toInt(VehicleGear::GEAR_NEUTRAL),
+ toInt(VehicleGear::GEAR_REVERSE),
+ toInt(VehicleGear::GEAR_DRIVE), toInt(VehicleGear::GEAR_1),
+ toInt(VehicleGear::GEAR_2), toInt(VehicleGear::GEAR_3),
+ toInt(VehicleGear::GEAR_4), toInt(VehicleGear::GEAR_5)},
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK)}}},
+ .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::TURN_SIGNAL_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::TURN_SIGNAL_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleTurnSignal::NONE)}}},
+ .initialValue = {.int32Values = {toInt(VehicleTurnSignal::NONE)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::IGNITION_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::IGNITION_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleIgnitionState::ON)}}},
+ .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_OIL_LEVEL),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleOilLevel::NORMAL)}}},
+ .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_OIL_TEMP),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.minSampleRate = 0.1, // 0.1 Hz, every 10 seconds
.maxSampleRate = 10, // 10 Hz, every 100 ms
},
@@ -701,8 +661,8 @@
{
.config = {.prop = kMixedTypePropertyForTest,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}},
.initialValue =
{
@@ -712,70 +672,69 @@
},
},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DOOR_LOCK),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_LEFT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_LEFT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
+ {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
+ VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
+ VehicleAreaConfig{.areaId = DOOR_2_LEFT},
+ VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
.initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
{DOOR_1_RIGHT, {.int32Values = {1}}},
{DOOR_2_LEFT, {.int32Values = {1}}},
{DOOR_2_RIGHT, {.int32Values = {1}}}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DOOR_POS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ {.config = {.prop = toInt(VehicleProperty::DOOR_POS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.areaConfigs =
- {defaultconfig_impl::VehicleAreaConfig{
+ {VehicleAreaConfig{
.areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 1},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{.areaId = DOOR_1_RIGHT,
+ .minInt32Value = 0,
+ .maxInt32Value = 1},
+ VehicleAreaConfig{
.areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 1},
- defaultconfig_impl::VehicleAreaConfig{
+ VehicleAreaConfig{.areaId = DOOR_2_RIGHT,
+ .minInt32Value = 0,
+ .maxInt32Value = 1},
+ VehicleAreaConfig{
.areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::WINDOW_LOCK),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{
- .areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT}}},
+ {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT |
+ WINDOW_2_RIGHT}}},
.initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT,
{.int32Values = {0}}}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::WINDOW_POS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- defaultconfig_impl::VehicleAreaConfig{
- .areaId = WINDOW_ROOF_TOP_1,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
+ {.config = {.prop = toInt(VehicleProperty::WINDOW_POS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT,
+ .minInt32Value = 0,
+ .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_1_RIGHT,
+ .minInt32Value = 0,
+ .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_2_LEFT,
+ .minInt32Value = 0,
+ .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_2_RIGHT,
+ .minInt32Value = 0,
+ .maxInt32Value = 10},
+ VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1,
+ .minInt32Value = -10,
+ .maxInt32Value = 10}}},
.initialValue = {.int32Values = {0}}},
{.config =
{
.prop = WHEEL_TICK,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
.configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
.minSampleRate = 1.0f,
.maxSampleRate = 10.0f,
@@ -783,371 +742,324 @@
.initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}},
{.config = {.prop = ABS_ACTIVE,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
.initialValue = {.int32Values = {0}}},
{.config = {.prop = TRACTION_CONTROL_ACTIVE,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::AP_POWER_STATE_REQ),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {3}},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleApPowerStateReq::ON),
- 0}}},
+ .initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::AP_POWER_STATE_REPORT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue =
- {.int32Values =
- {toInt(defaultconfig_impl::VehicleApPowerStateReport::WAIT_FOR_VHAL),
- 0}}},
+ {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
+ .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DISPLAY_BRIGHTNESS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.minInt32Value = 0,
- .maxInt32Value = 100}}},
+ {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}},
.initialValue = {.int32Values = {100}}},
{
.config = {.prop = OBD2_LIVE_FRAME,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {0, 0}},
},
{
.config = {.prop = OBD2_FREEZE_FRAME,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {0, 0}},
},
{
.config = {.prop = OBD2_FREEZE_FRAME_INFO,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
},
{
.config = {.prop = OBD2_FREEZE_FRAME_CLEAR,
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {1}},
},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HEADLIGHTS_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HEADLIGHTS_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_STATE_ON}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HIGH_BEAM_LIGHTS_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_STATE_ON}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::FOG_LIGHTS_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_STATE_ON}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HAZARD_LIGHTS_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_STATE_ON}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HEADLIGHTS_SWITCH),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
{.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::FOG_LIGHTS_SWITCH),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::HAZARD_LIGHTS_SWITCH),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::EVS_SERVICE_REQUEST),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {toInt(defaultconfig_impl::EvsServiceType::REARVIEW),
- toInt(defaultconfig_impl::EvsServiceState::OFF)}}},
+ .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW),
+ toInt(EvsServiceState::OFF)}}},
{.config = {.prop = VEHICLE_MAP_SERVICE,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}},
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE}},
// Example Vendor Extension properties for testing
{.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_LEFT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_LEFT},
- defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
+ VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
+ VehicleAreaConfig{.areaId = DOOR_2_LEFT},
+ VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
.initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
{DOOR_1_RIGHT, {.int32Values = {1}}},
{DOOR_2_LEFT, {.int32Values = {0}}},
{DOOR_2_RIGHT, {.int32Values = {0}}}}},
{.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_LEFT,
- .minFloatValue = -10,
- .maxFloatValue = 10},
- defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_RIGHT,
- .minFloatValue = -10,
- .maxFloatValue = 10}}},
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT,
+ .minFloatValue = -10,
+ .maxFloatValue = 10},
+ VehicleAreaConfig{.areaId = HVAC_RIGHT,
+ .minFloatValue = -10,
+ .maxFloatValue = 10}}},
.initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}},
{HVAC_RIGHT, {.floatValues = {2}}}}},
{.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.areaConfigs =
- {defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- FRONT_WINDSHIELD),
- .minInt32Value = -100,
- .maxInt32Value = 100},
- defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(defaultconfig_impl::VehicleAreaWindow::
- REAR_WINDSHIELD),
- .minInt32Value = -100,
- .maxInt32Value = 100},
- defaultconfig_impl::VehicleAreaConfig{
- .areaId = toInt(
- defaultconfig_impl::VehicleAreaWindow::ROOF_TOP_1),
- .minInt32Value = -100,
- .maxInt32Value = 100}}},
- .initialAreaValues = {{toInt(defaultconfig_impl::VehicleAreaWindow::FRONT_WINDSHIELD),
- {.int32Values = {1}}},
- {toInt(defaultconfig_impl::VehicleAreaWindow::REAR_WINDSHIELD),
- {.int32Values = {0}}},
- {toInt(defaultconfig_impl::VehicleAreaWindow::ROOF_TOP_1),
- {.int32Values = {-1}}}}},
+ {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD),
+ .minInt32Value = -100,
+ .maxInt32Value = 100},
+ VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD),
+ .minInt32Value = -100,
+ .maxInt32Value = 100},
+ VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::ROOF_TOP_1),
+ .minInt32Value = -100,
+ .maxInt32Value = 100}}},
+ .initialAreaValues = {{toInt(VehicleAreaWindow::FRONT_WINDSHIELD), {.int32Values = {1}}},
+ {toInt(VehicleAreaWindow::REAR_WINDSHIELD), {.int32Values = {0}}},
+ {toInt(VehicleAreaWindow::ROOF_TOP_1), {.int32Values = {-1}}}}},
{.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
.initialValue = {.stringValue = "Vendor String Property"}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::
- ELECTRONIC_TOLL_COLLECTION_CARD_TYPE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
.initialValue = {.int32Values = {0}}},
- {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::
- ELECTRONIC_TOLL_COLLECTION_CARD_STATUS),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE},
+ {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
.initialValue = {.int32Values = {0}}},
{.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- SUPPORT_CUSTOMIZE_VENDOR_PERMISSION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
- .configArray =
- {kMixedTypePropertyForTest,
- toInt(defaultconfig_impl::
- VehicleVendorPermission::
- PERMISSION_GET_VENDOR_CATEGORY_INFO),
- toInt(defaultconfig_impl::
- VehicleVendorPermission::
- PERMISSION_SET_VENDOR_CATEGORY_INFO),
- VENDOR_EXTENSION_INT_PROPERTY,
- toInt(defaultconfig_impl::
- VehicleVendorPermission::
- PERMISSION_GET_VENDOR_CATEGORY_SEAT),
- toInt(defaultconfig_impl::
- VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE),
- VENDOR_EXTENSION_FLOAT_PROPERTY,
- toInt(defaultconfig_impl::
- VehicleVendorPermission::PERMISSION_DEFAULT),
- toInt(defaultconfig_impl::
- VehicleVendorPermission::PERMISSION_DEFAULT)},
+ .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {kMixedTypePropertyForTest,
+ toInt(VehicleVendorPermission::
+ PERMISSION_GET_VENDOR_CATEGORY_INFO),
+ toInt(VehicleVendorPermission::
+ PERMISSION_SET_VENDOR_CATEGORY_INFO),
+ VENDOR_EXTENSION_INT_PROPERTY,
+ toInt(VehicleVendorPermission::
+ PERMISSION_GET_VENDOR_CATEGORY_SEAT),
+ toInt(VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE),
+ VENDOR_EXTENSION_FLOAT_PROPERTY,
+ toInt(VehicleVendorPermission::PERMISSION_DEFAULT),
+ toInt(VehicleVendorPermission::PERMISSION_DEFAULT)},
},
.initialValue = {.int32Values = {1}}},
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::INITIAL_USER_INFO),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::INITIAL_USER_INFO),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::SWITCH_USER),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::SWITCH_USER),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::CREATE_USER),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CREATE_USER),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::REMOVE_USER),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::REMOVE_USER),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- USER_IDENTIFICATION_ASSOCIATION),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::POWER_POLICY_REQ),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::POWER_POLICY_REQ),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- POWER_POLICY_GROUP_REQ),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::CURRENT_POWER_POLICY),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::EPOCH_TIME),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::EPOCH_TIME),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::WATCHDOG_ALIVE),
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::WATCHDOG_ALIVE),
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- WATCHDOG_TERMINATED_PROCESS),
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::WATCHDOG_TERMINATED_PROCESS),
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::VHAL_HEARTBEAT),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::VHAL_HEARTBEAT),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::CLUSTER_SWITCH_UI),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
- .initialValue = {.int32Values = {0 /* ClusterHome */, -1 /* ClusterNone */}},
+ .initialValue = {.int32Values = {0 /* ClusterHome */}},
},
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::CLUSTER_DISPLAY_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE),
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
-1, -1 /* Insets */}},
@@ -1155,41 +1067,34 @@
{
.config =
{
- .prop = toInt(
- defaultconfig_impl::VehicleProperty::CLUSTER_REPORT_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE),
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16},
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- CLUSTER_REQUEST_DISPLAY),
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY),
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
- .prop = toInt(defaultconfig_impl::VehicleProperty::
- CLUSTER_NAVIGATION_STATE),
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .prop = toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE),
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
.prop = PLACEHOLDER_PROPERTY_INT,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}},
},
@@ -1197,9 +1102,8 @@
.config =
{
.prop = PLACEHOLDER_PROPERTY_FLOAT,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.floatValues = {0.0f}},
},
@@ -1207,9 +1111,8 @@
.config =
{
.prop = PLACEHOLDER_PROPERTY_BOOLEAN,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0 /* false */}},
},
@@ -1217,9 +1120,8 @@
.config =
{
.prop = PLACEHOLDER_PROPERTY_STRING,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.stringValue = {"Test"}},
},
@@ -1229,27 +1131,24 @@
.config =
{
.prop = VENDOR_CLUSTER_SWITCH_UI,
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
.prop = VENDOR_CLUSTER_DISPLAY_STATE,
- .access = defaultconfig_impl::VehiclePropertyAccess::WRITE,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
.prop = VENDOR_CLUSTER_REPORT_STATE,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
.configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16},
},
.initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
@@ -1260,9 +1159,8 @@
.config =
{
.prop = VENDOR_CLUSTER_REQUEST_DISPLAY,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0 /* ClusterHome */}},
},
@@ -1270,14 +1168,26 @@
.config =
{
.prop = VENDOR_CLUSTER_NAVIGATION_STATE,
- .access = defaultconfig_impl::VehiclePropertyAccess::READ,
- .changeMode =
- defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
};
+} // namespace defaultconfig_impl
+
+// public namespace
+namespace defaultconfig {
+
+typedef defaultconfig_impl::ConfigDeclaration ConfigDeclaration;
+
+inline constexpr const std::vector<ConfigDeclaration>& getDefaultConfigs() {
+ return defaultconfig_impl::kVehicleProperties;
+}
+
+} // namespace defaultconfig
+
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
index 6385ac1..baaae75 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
+++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
@@ -22,17 +22,19 @@
namespace hardware {
namespace automotive {
namespace vehicle {
+namespace defaultconfig {
namespace test {
TEST(DefaultConfigTest, loadDefaultConfigs) {
- for (ConfigDeclaration config : kVehicleProperties) {
+ for (ConfigDeclaration config : getDefaultConfigs()) {
ASSERT_NE(0, config.config.prop);
}
}
} // namespace test
+} // namespace defaultconfig
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
new file mode 100644
index 0000000..7670c25
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library {
+ name: "VehicleHalProtoMessageConverter",
+ srcs: [
+ "src/*.cpp",
+ ],
+ vendor: true,
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ shared_libs: ["libprotobuf-cpp-full"],
+ static_libs: [
+ "VehicleHalProtos",
+ "VehicleHalUtils",
+ ],
+ defaults: ["VehicleHalDefaults"],
+ export_static_lib_headers: ["VehicleHalUtils"],
+}
+
+cc_test {
+ name: "VehicleHalProtoMessageConverterTest",
+ srcs: [
+ "test/*.cpp",
+ ],
+ vendor: true,
+ defaults: ["VehicleHalDefaults"],
+ shared_libs: ["libprotobuf-cpp-full"],
+ static_libs: [
+ "VehicleHalProtoMessageConverter",
+ "VehicleHalProtos",
+ "VehicleHalUtils",
+ "libgtest",
+ ],
+ header_libs: ["VehicleHalDefaultConfig"],
+ test_suites: ["device-tests"],
+}
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h
new file mode 100644
index 0000000..1c26fe8
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_
+#define android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_
+
+#include <VehicleHalTypes.h>
+#include <android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropConfig.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropValue.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace proto_msg_converter {
+
+// Convert AIDL VehiclePropConfig to Protobuf VehiclePropConfig.
+void aidlToProto(
+ const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& inAidlConfig,
+ ::android::hardware::automotive::vehicle::proto::VehiclePropConfig* outProtoConfig);
+// Convert Protobuf VehiclePropConfig to AIDL VehiclePropConfig.
+void protoToAidl(
+ const ::android::hardware::automotive::vehicle::proto::VehiclePropConfig& inProtoConfig,
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig* outAidlConfig);
+// Convert AIDL VehiclePropValue to Protobuf VehiclePropValue.
+void aidlToProto(const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& inAidlVal,
+ ::android::hardware::automotive::vehicle::proto::VehiclePropValue* outProtoVal);
+// Convert Protobuf VehiclePropValue to AIDL VehiclePropValue.
+void protoToAidl(
+ const ::android::hardware::automotive::vehicle::proto::VehiclePropValue& inProtoVal,
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* outAidlVal);
+
+} // namespace proto_msg_converter
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp
new file mode 100644
index 0000000..6cbc7e5
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "ProtoMsgConverter"
+
+#include "ProtoMessageConverter.h"
+
+#include <VehicleUtils.h>
+
+#include <memory>
+#include <vector>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace proto_msg_converter {
+
+namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
+namespace proto = ::android::hardware::automotive::vehicle::proto;
+
+// Copy the vector PROTO_VECNAME of protobuf class PROTO_VALUE to
+// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME, every element of PROTO_VECNAME is casted by CAST.
+#define CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \
+ VHAL_TYPE_VECNAME, CAST) \
+ do { \
+ (VHAL_TYPE_VALUE)->VHAL_TYPE_VECNAME.resize(PROTO_VALUE.PROTO_VECNAME##_size()); \
+ size_t idx = 0; \
+ for (auto& value : PROTO_VALUE.PROTO_VECNAME()) { \
+ VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME[idx++] = CAST(value); \
+ } \
+ } while (0)
+
+// Copying the vector PROTO_VECNAME of protobuf class PROTO_VALUE to
+// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME.
+#define COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \
+ VHAL_TYPE_VECNAME) \
+ CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE( \
+ PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, VHAL_TYPE_VECNAME, /*NO CAST*/)
+
+void aidlToProto(const aidl_vehicle::VehiclePropConfig& in, proto::VehiclePropConfig* out) {
+ out->set_prop(in.prop);
+ out->set_access(static_cast<proto::VehiclePropertyAccess>(toInt(in.access)));
+ out->set_change_mode(static_cast<proto::VehiclePropertyChangeMode>(toInt(in.changeMode)));
+ out->set_config_string(in.configString.c_str(), in.configString.size());
+ out->set_min_sample_rate(in.minSampleRate);
+ out->set_max_sample_rate(in.maxSampleRate);
+
+ for (auto& configElement : in.configArray) {
+ out->add_config_array(configElement);
+ }
+
+ out->clear_area_configs();
+ for (auto& areaConfig : in.areaConfigs) {
+ auto* protoACfg = out->add_area_configs();
+ protoACfg->set_area_id(areaConfig.areaId);
+ protoACfg->set_min_int64_value(areaConfig.minInt64Value);
+ protoACfg->set_max_int64_value(areaConfig.maxInt64Value);
+ protoACfg->set_min_float_value(areaConfig.minFloatValue);
+ protoACfg->set_max_float_value(areaConfig.maxFloatValue);
+ protoACfg->set_min_int32_value(areaConfig.minInt32Value);
+ protoACfg->set_max_int32_value(areaConfig.maxInt32Value);
+ }
+}
+
+void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropConfig* out) {
+ out->prop = in.prop();
+ out->access = static_cast<aidl_vehicle::VehiclePropertyAccess>(in.access());
+ out->changeMode = static_cast<aidl_vehicle::VehiclePropertyChangeMode>(in.change_mode());
+ out->configString = in.config_string();
+ out->minSampleRate = in.min_sample_rate();
+ out->maxSampleRate = in.max_sample_rate();
+
+ COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, config_array, out, configArray);
+
+ auto cast_to_acfg = [](const proto::VehicleAreaConfig& protoAcfg) {
+ return aidl_vehicle::VehicleAreaConfig{
+ .areaId = protoAcfg.area_id(),
+ .minInt32Value = protoAcfg.min_int32_value(),
+ .maxInt32Value = protoAcfg.max_int32_value(),
+ .minInt64Value = protoAcfg.min_int64_value(),
+ .maxInt64Value = protoAcfg.max_int64_value(),
+ .minFloatValue = protoAcfg.min_float_value(),
+ .maxFloatValue = protoAcfg.max_float_value(),
+ };
+ };
+ CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_configs, out, areaConfigs, cast_to_acfg);
+}
+
+void aidlToProto(const aidl_vehicle::VehiclePropValue& in, proto::VehiclePropValue* out) {
+ out->set_prop(in.prop);
+ out->set_timestamp(in.timestamp);
+ out->set_status(static_cast<proto::VehiclePropertyStatus>(in.status));
+ out->set_area_id(in.areaId);
+ out->set_string_value(in.value.stringValue);
+ out->set_byte_values(in.value.byteValues.data(), in.value.byteValues.size());
+
+ for (auto& int32Value : in.value.int32Values) {
+ out->add_int32_values(int32Value);
+ }
+
+ for (auto& int64Value : in.value.int64Values) {
+ out->add_int64_values(int64Value);
+ }
+
+ for (auto& floatValue : in.value.floatValues) {
+ out->add_float_values(floatValue);
+ }
+}
+
+void protoToAidl(const proto::VehiclePropValue& in, aidl_vehicle::VehiclePropValue* out) {
+ out->prop = in.prop();
+ out->timestamp = in.timestamp();
+ out->status = static_cast<aidl_vehicle::VehiclePropertyStatus>(in.status());
+ out->areaId = in.area_id();
+ out->value.stringValue = in.string_value();
+ for (const char& byte : in.byte_values()) {
+ out->value.byteValues.push_back(byte);
+ }
+
+ COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int32_values, out, value.int32Values);
+ COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int64_values, out, value.int64Values);
+ COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, float_values, out, value.floatValues);
+}
+
+#undef COPY_PROTOBUF_VEC_TO_VHAL_TYPE
+#undef CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE
+
+} // namespace proto_msg_converter
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp
new file mode 100644
index 0000000..d5f2373
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vector>
+
+#include <DefaultConfig.h>
+#include <ProtoMessageConverter.h>
+#include <VehicleHalTypes.h>
+#include <android-base/format.h>
+#include <android/hardware/automotive/vehicle/VehiclePropConfig.pb.h>
+#include <android/hardware/automotive/vehicle/VehiclePropValue.pb.h>
+#include <gtest/gtest.h>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace proto_msg_converter {
+
+namespace {
+
+namespace proto = ::android::hardware::automotive::vehicle::proto;
+namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
+
+std::vector<aidl_vehicle::VehiclePropConfig> prepareTestConfigs() {
+ std::vector<aidl_vehicle::VehiclePropConfig> configs;
+ for (auto& property : defaultconfig::getDefaultConfigs()) {
+ configs.push_back(property.config);
+ }
+ return configs;
+}
+
+std::vector<aidl_vehicle::VehiclePropValue> prepareTestValues() {
+ std::vector<aidl_vehicle::VehiclePropValue> values;
+ long timestamp = 1;
+ for (auto& property : defaultconfig::getDefaultConfigs()) {
+ values.push_back({
+ .timestamp = timestamp,
+ .areaId = 123,
+ .prop = property.config.prop,
+ .value = property.initialValue,
+ .status = aidl_vehicle::VehiclePropertyStatus::ERROR,
+ });
+ }
+ return values;
+}
+
+class PropConfigConversionTest : public testing::TestWithParam<aidl_vehicle::VehiclePropConfig> {};
+
+class PropValueConversionTest : public testing::TestWithParam<aidl_vehicle::VehiclePropValue> {};
+
+} // namespace
+
+TEST_P(PropConfigConversionTest, testConversion) {
+ proto::VehiclePropConfig protoCfg;
+ aidl_vehicle::VehiclePropConfig aidlCfg;
+
+ aidlToProto(GetParam(), &protoCfg);
+ protoToAidl(protoCfg, &aidlCfg);
+
+ EXPECT_EQ(aidlCfg, GetParam());
+}
+
+TEST_P(PropValueConversionTest, testConversion) {
+ proto::VehiclePropValue protoVal;
+ aidl_vehicle::VehiclePropValue aidlVal;
+
+ aidlToProto(GetParam(), &protoVal);
+ protoToAidl(protoVal, &aidlVal);
+
+ EXPECT_EQ(aidlVal, GetParam());
+}
+
+INSTANTIATE_TEST_SUITE_P(DefaultConfigs, PropConfigConversionTest,
+ ::testing::ValuesIn(prepareTestConfigs()),
+ [](const ::testing::TestParamInfo<aidl_vehicle::VehiclePropConfig>& info) {
+ return ::fmt::format("property_{:d}", info.param.prop);
+ });
+
+INSTANTIATE_TEST_SUITE_P(TestValues, PropValueConversionTest,
+ ::testing::ValuesIn(prepareTestValues()),
+ [](const ::testing::TestParamInfo<aidl_vehicle::VehiclePropValue>& info) {
+ return ::fmt::format("property_{:d}", info.param.prop);
+ });
+
+} // namespace proto_msg_converter
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp
new file mode 100644
index 0000000..709307d
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/Android.bp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+filegroup {
+ name: "VehicleHalProtoFiles",
+ srcs: ["**/*.proto"],
+ visibility: ["//hardware/interfaces/automotive/vehicle:__subpackages__"],
+}
+
+genrule {
+ name: "VehicleProtoStub_h",
+ tools: [
+ "aprotoc",
+ "protoc-gen-grpc-cpp-plugin",
+ ],
+ cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
+ srcs: [
+ ":VehicleHalProtoFiles",
+ ],
+ out: [
+ "android/hardware/automotive/vehicle/DumpResult.pb.h",
+ "android/hardware/automotive/vehicle/StatusCode.pb.h",
+ "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropConfig.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropValue.pb.h",
+ "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h",
+ ],
+}
+
+genrule {
+ name: "VehicleProtoStub_cc",
+ tools: [
+ "aprotoc",
+ "protoc-gen-grpc-cpp-plugin",
+ ],
+ cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
+ srcs: [
+ ":VehicleHalProtoFiles",
+ ],
+ out: [
+ "android/hardware/automotive/vehicle/DumpResult.pb.cc",
+ "android/hardware/automotive/vehicle/StatusCode.pb.cc",
+ "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropConfig.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropValue.pb.cc",
+ "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc",
+ ],
+}
+
+cc_library_static {
+ name: "VehicleHalProtos",
+ vendor: true,
+ host_supported: true,
+ include_dirs: [
+ "external/protobuf/src",
+ ],
+ generated_headers: [
+ "VehicleProtoStub_h",
+ ],
+ export_generated_headers: [
+ "VehicleProtoStub_h",
+ ],
+ generated_sources: [
+ "VehicleProtoStub_cc",
+ ],
+ shared_libs: [
+ "libgrpc++_unsecure",
+ ],
+ cflags: [
+ "-Wno-unused-parameter",
+ ],
+}
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto
new file mode 100644
index 0000000..25bb7d4
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+message DumpResult {
+ /* If callerShouldDumpState is true, caller would print the information in buffer and
+ * continue to dump its state, otherwise would just dump the buffer and skip its own
+ * dumping logic. */
+ bool caller_should_dump_state = 1;
+ /* The dumped information for the caller to print. */
+ string buffer = 2;
+}
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto
new file mode 100644
index 0000000..97cb0f8
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+/* Must be in sync with StatusCode.aidl. */
+enum StatusCode {
+ OK = 0;
+
+ /* Try again. */
+ TRY_AGAIN = 1;
+
+ /* Invalid argument provided. */
+ INVALID_ARG = 2;
+
+ /* This code must be returned when device that associated with the vehicle
+ * property is not available. For example, when client tries to set HVAC
+ * temperature when the whole HVAC unit is turned OFF. */
+ NOT_AVAILABLE = 3;
+
+ /* Access denied */
+ ACCESS_DENIED = 4;
+
+ /* Something unexpected has happened in Vehicle HAL */
+ INTERNAL_ERROR = 5;
+};
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
new file mode 100644
index 0000000..b5b7e80
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+/* Must be in sync with VehicleAreaConfig.aidl. */
+message VehicleAreaConfig {
+ /* Area id is ignored for VehiclePropertyGroup:GLOBAL properties. */
+ int32 area_id = 1;
+
+ /* If the property has @data_enum, leave the range to zero.
+ *
+ * Range will be ignored in the following cases:
+ * - The VehiclePropertyType is not INT32, INT64 or FLOAT.
+ * - Both of min value and max value are zero. */
+ int32 min_int32_value = 2;
+ int32 max_int32_value = 3;
+
+ int64 min_int64_value = 4;
+ int64 max_int64_value = 5;
+
+ float min_float_value = 6;
+ float max_float_value = 7;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto
new file mode 100644
index 0000000..e230d15
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+import "android/hardware/automotive/vehicle/VehicleAreaConfig.proto";
+import "android/hardware/automotive/vehicle/VehiclePropertyAccess.proto";
+import "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto";
+
+/* Must be in sync with VehiclePropConfig.aidl. */
+message VehiclePropConfig {
+ /* Property identifier */
+ int32 prop = 1;
+
+ /* Defines if the property is read or write or both. */
+ VehiclePropertyAccess access = 2;
+
+ /* Defines the change mode of the property. */
+ VehiclePropertyChangeMode change_mode = 3;
+
+ /* Contains per-area configuration. */
+ repeated VehicleAreaConfig area_configs = 4;
+
+ /* Contains additional configuration parameters */
+ repeated int32 config_array = 5;
+
+ /* Some properties may require additional information passed over this
+ * string. Most properties do not need to set this. */
+ bytes config_string = 6;
+
+ /* Min sample rate in Hz.
+ * Must be defined for VehiclePropertyChangeMode::CONTINUOUS */
+ float min_sample_rate = 7;
+
+ /* Must be defined for VehiclePropertyChangeMode::CONTINUOUS
+ * Max sample rate in Hz. */
+ float max_sample_rate = 8;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto
new file mode 100644
index 0000000..80c73cb
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+import "android/hardware/automotive/vehicle/VehiclePropertyStatus.proto";
+
+/* Must be in sync with VehiclePropValue.aidl. */
+message VehiclePropValue {
+ /* Time is elapsed nanoseconds since boot */
+ int64 timestamp = 1;
+
+ /* Area type(s) for non-global property it must be one of the value from
+ * VehicleArea* enums or 0 for global properties. */
+ int32 area_id = 2;
+
+ /* Property identifier */
+ int32 prop = 3;
+
+ /* Status of the property */
+ VehiclePropertyStatus status = 4;
+
+ /* This is used for properties of types VehiclePropertyType#INT
+ * and VehiclePropertyType#INT_VEC */
+ repeated int32 int32_values = 5;
+
+ /* This is used for properties of types VehiclePropertyType#FLOAT
+ * and VehiclePropertyType#FLOAT_VEC */
+ repeated float float_values = 6;
+
+ /* This is used for properties of type VehiclePropertyType#INT64 */
+ repeated int64 int64_values = 7;
+
+ /* This is used for properties of type VehiclePropertyType#BYTES */
+ bytes byte_values = 8;
+
+ /* This is used for properties of type VehiclePropertyType#STRING */
+ string string_value = 9;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto
new file mode 100644
index 0000000..b16daa8
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+import "android/hardware/automotive/vehicle/VehiclePropValue.proto";
+
+message VehiclePropValueRequest {
+ int32 request_id = 1;
+ VehiclePropValue value = 2;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto
new file mode 100644
index 0000000..55840f0
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+/* Must be in sync with VehiclePropertyAccess.aidl. */
+enum VehiclePropertyAccess {
+ NONE = 0;
+ READ = 1;
+ WRITE = 2;
+ READ_WRITE = 3;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto
new file mode 100644
index 0000000..c681e3b
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+/* Must be in sync with VehiclePropertyChangeMode.aidl. */
+enum VehiclePropertyChangeMode {
+ /* Property of this type must never be changed. Subscription is not supported
+ * for these properties. */
+ STATIC = 0;
+
+ /* Properties of this type must report when there is a change.
+ * IVehicle#get call must return the current value.
+ * Set operation for this property is assumed to be asynchronous. When the
+ * property is read (using IVehicle#get) after IVehicle#set, it may still
+ * return old value until underlying H/W backing this property has actually
+ * changed the state. Once state is changed, the property must dispatch
+ * changed value as event. */
+ ON_CHANGE = 1;
+
+ /* Properties of this type change continuously and require a fixed rate of
+ * sampling to retrieve the data. Implementers may choose to send extra
+ * notifications on significant value changes. */
+ CONTINUOUS = 2;
+};
diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto
new file mode 100644
index 0000000..a44c8f0
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package android.hardware.automotive.vehicle.proto;
+
+/* Must be in sync with VehiclePropertyStatus.aidl. */
+enum VehiclePropertyStatus {
+ /* Property is available and behaving normally */
+ AVAILABLE = 0;
+ /* A property in this state is not available for reading and writing. This
+ * is a transient state that depends on the availability of the underlying
+ * implementation (e.g. hardware or driver). It MUST NOT be used to
+ * represent features that this vehicle is always incapable of. A get() of
+ * a property in this state MAY return an undefined value, but MUST
+ * correctly describe its status as UNAVAILABLE A set() of a property in
+ * this state MAY return NOT_AVAILABLE. The HAL implementation MUST ignore
+ * the value of the status field when writing a property value coming from
+ * Android. */
+ UNAVAILABLE = 1;
+ /* There is an error with this property. */
+ ERROR = 2;
+};
diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp
index 001280f..ace505d 100644
--- a/automotive/vehicle/aidl/impl/utils/common/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp
@@ -20,9 +20,7 @@
cc_library {
name: "VehicleHalUtils",
- srcs: [
- "src/*.cpp",
- ],
+ srcs: ["src/*.cpp"],
vendor: true,
local_include_dirs: ["include"],
export_include_dirs: ["include"],
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h
new file mode 100644
index 0000000..61e475a
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h
@@ -0,0 +1,294 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_
+#define android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_
+
+#include <deque>
+#include <map>
+#include <memory>
+#include <mutex>
+
+#include <VehicleHalTypes.h>
+
+#include <android-base/thread_annotations.h>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+// Handy metric mostly for unit tests and debug.
+#define INC_METRIC_IF_DEBUG(val) PoolStats::instance()->val++;
+
+struct PoolStats {
+ std::atomic<uint32_t> Obtained{0};
+ std::atomic<uint32_t> Created{0};
+ std::atomic<uint32_t> Recycled{0};
+ std::atomic<uint32_t> Deleted{0};
+
+ static PoolStats* instance() {
+ static PoolStats inst;
+ return &inst;
+ }
+};
+
+template <typename T>
+struct Deleter {
+ using OnDeleteFunc = std::function<void(T*)>;
+
+ explicit Deleter(const OnDeleteFunc& f) : mOnDelete(f){};
+
+ Deleter() = default;
+ Deleter(const Deleter&) = default;
+
+ void operator()(T* o) { mOnDelete(o); }
+
+ private:
+ OnDeleteFunc mOnDelete;
+};
+
+// This is std::unique_ptr<> with custom delete operation that typically moves the pointer it holds
+// back to ObjectPool.
+template <typename T>
+using recyclable_ptr = typename std::unique_ptr<T, Deleter<T>>;
+
+// Generic abstract object pool class. Users of this class must implement {@Code createObject}.
+//
+// This class is thread-safe. Concurrent calls to {@Code obtain} from multiple threads is OK, also
+// client can obtain an object in one thread and then move ownership to another thread.
+template <typename T>
+class ObjectPool {
+ public:
+ using GetSizeFunc = std::function<size_t(const T&)>;
+
+ ObjectPool(size_t maxPoolObjectsSize, GetSizeFunc getSizeFunc)
+ : mMaxPoolObjectsSize(maxPoolObjectsSize), mGetSizeFunc(getSizeFunc){};
+ virtual ~ObjectPool() = default;
+
+ virtual recyclable_ptr<T> obtain() {
+ std::lock_guard<std::mutex> lock(mLock);
+ INC_METRIC_IF_DEBUG(Obtained)
+ if (mObjects.empty()) {
+ INC_METRIC_IF_DEBUG(Created)
+ return wrap(createObject());
+ }
+
+ auto o = wrap(mObjects.front().release());
+ mObjects.pop_front();
+ mPoolObjectsSize -= mGetSizeFunc(*o);
+ return o;
+ }
+
+ ObjectPool& operator=(const ObjectPool&) = delete;
+ ObjectPool(const ObjectPool&) = delete;
+
+ protected:
+ virtual T* createObject() = 0;
+
+ virtual void recycle(T* o) {
+ std::lock_guard<std::mutex> lock(mLock);
+ size_t objectSize = mGetSizeFunc(*o);
+
+ if (objectSize > mMaxPoolObjectsSize ||
+ mPoolObjectsSize > mMaxPoolObjectsSize - objectSize) {
+ INC_METRIC_IF_DEBUG(Deleted)
+
+ // We have no space left in the pool.
+ delete o;
+ return;
+ }
+
+ INC_METRIC_IF_DEBUG(Recycled)
+
+ mObjects.push_back(std::unique_ptr<T>{o});
+ mPoolObjectsSize += objectSize;
+ }
+
+ const size_t mMaxPoolObjectsSize;
+
+ private:
+ const Deleter<T>& getDeleter() {
+ if (!mDeleter.get()) {
+ Deleter<T>* d =
+ new Deleter<T>(std::bind(&ObjectPool::recycle, this, std::placeholders::_1));
+ mDeleter.reset(d);
+ }
+ return *mDeleter.get();
+ }
+
+ recyclable_ptr<T> wrap(T* raw) { return recyclable_ptr<T>{raw, getDeleter()}; }
+
+ mutable std::mutex mLock;
+ std::deque<std::unique_ptr<T>> mObjects GUARDED_BY(mLock);
+ std::unique_ptr<Deleter<T>> mDeleter;
+ size_t mPoolObjectsSize GUARDED_BY(mLock);
+ GetSizeFunc mGetSizeFunc;
+};
+
+#undef INC_METRIC_IF_DEBUG
+
+// This class provides a pool of recyclable VehiclePropertyValue objects.
+//
+// It has only one overloaded public method - obtain(...), users must call this method when new
+// object is needed with given VehiclePropertyType and vector size (for vector properties). This
+// method returns a recyclable smart pointer to VehiclePropertyValue, essentially this is a
+// std::unique_ptr with custom delete function, so recyclable object has only one owner and
+// developers can safely pass it around. Once this object goes out of scope, it will be returned to
+// the object pool.
+//
+// Some objects are not recyclable: strings and vector data types with vector
+// length > maxRecyclableVectorSize (provided in the constructor). These objects will be deleted
+// immediately once the go out of scope. There's no synchronization penalty for these objects since
+// we do not store them in the pool.
+//
+// This class is thread-safe. Users can obtain an object in one thread and pass it to another.
+//
+// Sample usage:
+//
+// VehiclePropValuePool pool;
+// auto v = pool.obtain(VehiclePropertyType::INT32);
+// v->propId = VehicleProperty::HVAC_FAN_SPEED;
+// v->areaId = VehicleAreaSeat::ROW_1_LEFT;
+// v->timestamp = elapsedRealtimeNano();
+// v->value->int32Values[0] = 42;
+class VehiclePropValuePool {
+ public:
+ using RecyclableType =
+ recyclable_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>;
+
+ // Creates VehiclePropValuePool
+ //
+ // @param maxRecyclableVectorSize - vector value types (e.g. VehiclePropertyType::INT32_VEC)
+ // with size equal or less to this value will be stored in the pool. If users tries to obtain
+ // value with vector size greater than maxRecyclableVectorSize, user will receive a regular
+ // unique pointer instead of a recyclable pointer. The object would not be recycled once it
+ // goes out of scope, but would be deleted.
+ // @param maxPoolObjectsSize - The approximate upper bound of memory each internal recycling
+ // pool could take. We have 4 different type pools, each with 4 different vector size, so
+ // approximately this pool would at-most take 4 * 4 * 10240 = 160k memory.
+ VehiclePropValuePool(size_t maxRecyclableVectorSize = 4, size_t maxPoolObjectsSize = 10240)
+ : mMaxRecyclableVectorSize(maxRecyclableVectorSize),
+ mMaxPoolObjectsSize(maxPoolObjectsSize){};
+
+ // Obtain a recyclable VehiclePropertyValue object from the pool for the given type. If the
+ // given type is not MIXED or STRING, the internal value vector size would be set to 1.
+ // If the given type is MIXED or STRING, all the internal vector sizes would be initialized to
+ // 0.
+ RecyclableType obtain(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type);
+
+ // Obtain a recyclable VehiclePropertyValue object from the pool for the given type. If the
+ // given type is *_VEC or BYTES, the internal value vector size would be set to vectorSize. If
+ // the given type is BOOLEAN, INT32, FLOAT, or INT64, the internal value vector size would be
+ // set to 1. If the given type is MIXED or STRING, all the internal value vector sizes would be
+ // set to 0. vectorSize must be larger than 0.
+ RecyclableType obtain(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ size_t vectorSize);
+ // Obtain a recyclable VehicePropertyValue object that is a copy of src. If src does not contain
+ // any value or the src property type is not valid, this function would return an empty
+ // VehiclePropValue.
+ RecyclableType obtain(
+ const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& src);
+ // Obtain a recyclable boolean object.
+ RecyclableType obtainBoolean(bool value);
+ // Obtain a recyclable int32 object.
+ RecyclableType obtainInt32(int32_t value);
+ // Obtain a recyclable int64 object.
+ RecyclableType obtainInt64(int64_t value);
+ // Obtain a recyclable float object.
+ RecyclableType obtainFloat(float value);
+ // Obtain a recyclable float object.
+ RecyclableType obtainString(const char* cstr);
+ // Obtain a recyclable mixed object.
+ RecyclableType obtainComplex();
+
+ VehiclePropValuePool(VehiclePropValuePool&) = delete;
+ VehiclePropValuePool& operator=(VehiclePropValuePool&) = delete;
+
+ private:
+ static inline bool isSingleValueType(
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ return type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::
+ BOOLEAN ||
+ type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32 ||
+ type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64 ||
+ type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT;
+ }
+
+ static inline bool isComplexType(
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ return type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED ||
+ type == ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING;
+ }
+
+ bool isDisposable(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ size_t vectorSize) const {
+ return vectorSize > mMaxRecyclableVectorSize || isComplexType(type);
+ }
+
+ RecyclableType obtainDisposable(
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType valueType,
+ size_t vectorSize) const;
+ RecyclableType obtainRecyclable(
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ size_t vectorSize);
+
+ class InternalPool
+ : public ObjectPool<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> {
+ public:
+ InternalPool(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ size_t vectorSize, size_t maxPoolObjectsSize,
+ ObjectPool::GetSizeFunc getSizeFunc)
+ : ObjectPool(maxPoolObjectsSize, getSizeFunc),
+ mPropType(type),
+ mVectorSize(vectorSize) {}
+
+ protected:
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* createObject() override;
+ void recycle(::aidl::android::hardware::automotive::vehicle::VehiclePropValue* o) override;
+
+ private:
+ bool check(::aidl::android::hardware::automotive::vehicle::RawPropValues* v);
+
+ template <typename VecType>
+ bool check(std::vector<VecType>* vec, bool isVectorType) {
+ return vec->size() == (isVectorType ? mVectorSize : 0);
+ }
+
+ private:
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType mPropType;
+ size_t mVectorSize;
+ };
+ const Deleter<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+ mDisposableDeleter{
+ [](::aidl::android::hardware::automotive::vehicle::VehiclePropValue* v) {
+ delete v;
+ }};
+
+ mutable std::mutex mLock;
+ const size_t mMaxRecyclableVectorSize;
+ const size_t mMaxPoolObjectsSize;
+ // A map with 'property_type' | 'value_vector_size' as key and a recyclable object pool as
+ // value. We would create a recyclable pool for each property type and vector size combination.
+ std::map<int32_t, std::unique_ptr<InternalPool>> mValueTypePools GUARDED_BY(mLock);
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
index b19ab84..ababf5e 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h
@@ -24,6 +24,7 @@
#include <unordered_map>
#include <VehicleHalTypes.h>
+#include <VehicleObjectPool.h>
#include <android-base/result.h>
#include <android-base/thread_annotations.h>
@@ -41,6 +42,9 @@
// This class is thread-safe, however it uses blocking synchronization across all methods.
class VehiclePropertyStore {
public:
+ explicit VehiclePropertyStore(std::shared_ptr<VehiclePropValuePool> valuePool)
+ : mValuePool(valuePool) {}
+
// Function that used to calculate unique token for given VehiclePropValue.
using TokenFunction = ::std::function<int64_t(
const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& value)>;
@@ -53,10 +57,13 @@
const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config,
TokenFunction tokenFunc = nullptr);
- // Stores provided value. Returns true if value was written returns false if config wasn't
- // registered.
- ::android::base::Result<void> writeValue(
- const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue);
+ // Stores provided value. Returns error if config wasn't registered. If 'updateStatus' is
+ // true, the 'status' in 'propValue' would be stored. Otherwise, if this is a new value,
+ // 'status' would be initialized to {@code VehiclePropertyStatus::AVAILABLE}, if this is to
+ // override an existing value, the status for the existing value would be used for the
+ // overridden value.
+ ::android::base::Result<void> writeValue(VehiclePropValuePool::RecyclableType propValue,
+ bool updateStatus = false);
// Remove a given property value from the property store. The 'propValue' would be used to
// generate the key for the value to remove.
@@ -67,24 +74,19 @@
void removeValuesForProperty(int32_t propId);
// Read all the stored values.
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> readAllValues()
- const;
+ std::vector<VehiclePropValuePool::RecyclableType> readAllValues() const;
// Read all the values for the property.
- ::android::base::Result<
- std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>>
+ ::android::base::Result<std::vector<VehiclePropValuePool::RecyclableType>>
readValuesForProperty(int32_t propId) const;
// Read the value for the requested property.
- ::android::base::Result<
- std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>>
- readValue(
+ ::android::base::Result<VehiclePropValuePool::RecyclableType> readValue(
const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const;
// Read the value for the requested property.
- ::android::base::Result<
- std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>>
- readValue(int32_t prop, int32_t area = 0, int64_t token = 0) const;
+ ::android::base::Result<VehiclePropValuePool::RecyclableType> readValue(
+ int32_t prop, int32_t area = 0, int64_t token = 0) const;
// Get all property configs.
std::vector<::aidl::android::hardware::automotive::vehicle::VehiclePropConfig> getAllConfigs()
@@ -100,20 +102,25 @@
int32_t area;
int64_t token;
- bool operator==(const RecordId& other) const;
- bool operator<(const RecordId& other) const;
-
std::string toString() const;
+
+ bool operator==(const RecordId& other) const;
+ };
+
+ struct RecordIdHash {
+ size_t operator()(RecordId const& recordId) const;
};
struct Record {
::aidl::android::hardware::automotive::vehicle::VehiclePropConfig propConfig;
TokenFunction tokenFunction;
- std::map<RecordId, ::aidl::android::hardware::automotive::vehicle::VehiclePropValue> values;
+ std::unordered_map<RecordId, VehiclePropValuePool::RecyclableType, RecordIdHash> values;
};
mutable std::mutex mLock;
std::unordered_map<int32_t, Record> mRecordsByPropId GUARDED_BY(mLock);
+ // {@code VehiclePropValuePool} is thread-safe.
+ std::shared_ptr<VehiclePropValuePool> mValuePool;
const Record* getRecordLocked(int32_t propId) const;
@@ -123,9 +130,8 @@
const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue,
const Record& record) const;
- ::android::base::Result<
- std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>>
- readValueLocked(const RecordId& recId, const Record& record) const;
+ ::android::base::Result<VehiclePropValuePool::RecyclableType> readValueLocked(
+ const RecordId& recId, const Record& record) const;
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
index c4bf1d3..b02aaf7 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h
@@ -18,6 +18,7 @@
#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleUtils_H_
#include <VehicleHalTypes.h>
+#include <utils/Log.h>
namespace android {
namespace hardware {
@@ -81,6 +82,104 @@
return nullptr;
}
+inline std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+createVehiclePropValueVec(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type,
+ size_t vecSize) {
+ auto val = std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>(
+ new ::aidl::android::hardware::automotive::vehicle::VehiclePropValue);
+ switch (type) {
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32:
+ [[fallthrough]];
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN:
+ vecSize = 1;
+ [[fallthrough]];
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
+ val->value.int32Values.resize(vecSize);
+ break;
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
+ vecSize = 1;
+ [[fallthrough]];
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
+ val->value.floatValues.resize(vecSize);
+ break;
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
+ vecSize = 1;
+ [[fallthrough]];
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
+ val->value.int64Values.resize(vecSize);
+ break;
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
+ val->value.byteValues.resize(vecSize);
+ break;
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING:
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED:
+ break; // Valid, but nothing to do.
+ default:
+ ALOGE("createVehiclePropValue: unknown type: %d", toInt(type));
+ val.reset(nullptr);
+ }
+ return val;
+}
+
+inline std::unique_ptr<::aidl::android::hardware::automotive::vehicle::VehiclePropValue>
+createVehiclePropValue(::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ return createVehiclePropValueVec(type, 1);
+}
+
+inline size_t getVehicleRawValueVectorSize(
+ const ::aidl::android::hardware::automotive::vehicle::RawPropValues& value,
+ ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) {
+ switch (type) {
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32: // fall
+ // through
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::
+ BOOLEAN: // fall through
+ return std::min(value.int32Values.size(), static_cast<size_t>(1));
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT:
+ return std::min(value.floatValues.size(), static_cast<size_t>(1));
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64:
+ return std::min(value.int64Values.size(), static_cast<size_t>(1));
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC:
+ return value.int32Values.size();
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC:
+ return value.floatValues.size();
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC:
+ return value.int64Values.size();
+ case ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES:
+ return value.byteValues.size();
+ default:
+ ALOGE("getVehicleRawValueVectorSize: unknown type: %d", toInt(type));
+ return 0;
+ }
+}
+
+inline void copyVehicleRawValue(
+ ::aidl::android::hardware::automotive::vehicle::RawPropValues* dest,
+ const ::aidl::android::hardware::automotive::vehicle::RawPropValues& src) {
+ dest->int32Values = src.int32Values;
+ dest->floatValues = src.floatValues;
+ dest->int64Values = src.int64Values;
+ dest->byteValues = src.byteValues;
+ dest->stringValue = src.stringValue;
+}
+
+// getVehiclePropValueSize returns approximately how much memory 'value' would take. This should
+// only be used in a limited-size memory pool to set an upper bound for memory consumption.
+inline size_t getVehiclePropValueSize(
+ const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& prop) {
+ size_t size = 0;
+ size += sizeof(prop.timestamp);
+ size += sizeof(prop.areaId);
+ size += sizeof(prop.prop);
+ size += sizeof(prop.status);
+ size += prop.value.int32Values.size() * sizeof(int32_t);
+ size += prop.value.int64Values.size() * sizeof(int64_t);
+ size += prop.value.floatValues.size() * sizeof(float);
+ size += prop.value.byteValues.size() * sizeof(uint8_t);
+ size += prop.value.stringValue.size();
+ return size;
+}
+
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp
new file mode 100644
index 0000000..0ff58f7
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "VehicleObjectPool"
+
+#include <VehicleObjectPool.h>
+
+#include <VehicleUtils.h>
+
+#include <assert.h>
+#include <utils/Log.h>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
+using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(VehiclePropertyType type) {
+ if (isComplexType(type)) {
+ return obtain(type, 0);
+ }
+ return obtain(type, 1);
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(VehiclePropertyType type,
+ size_t vectorSize) {
+ if (isSingleValueType(type)) {
+ vectorSize = 1;
+ } else if (isComplexType(type)) {
+ vectorSize = 0;
+ }
+ return isDisposable(type, vectorSize) ? obtainDisposable(type, vectorSize)
+ : obtainRecyclable(type, vectorSize);
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(const VehiclePropValue& src) {
+ VehiclePropertyType type = getPropType(src.prop);
+ size_t vectorSize = getVehicleRawValueVectorSize(src.value, type);
+ if (vectorSize == 0 && !isComplexType(type)) {
+ ALOGW("empty vehicle prop value, contains no content");
+ // Return any empty VehiclePropValue.
+ return RecyclableType{new VehiclePropValue, mDisposableDeleter};
+ }
+
+ auto dest = obtain(type, vectorSize);
+
+ dest->prop = src.prop;
+ dest->areaId = src.areaId;
+ dest->status = src.status;
+ dest->timestamp = src.timestamp;
+ copyVehicleRawValue(&dest->value, src.value);
+
+ return dest;
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainInt32(int32_t value) {
+ auto val = obtain(VehiclePropertyType::INT32);
+ val->value.int32Values[0] = value;
+ return val;
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainInt64(int64_t value) {
+ auto val = obtain(VehiclePropertyType::INT64);
+ val->value.int64Values[0] = value;
+ return val;
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainFloat(float value) {
+ auto val = obtain(VehiclePropertyType::FLOAT);
+ val->value.floatValues[0] = value;
+ return val;
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainString(const char* cstr) {
+ auto val = obtain(VehiclePropertyType::STRING);
+ val->value.stringValue = cstr;
+ return val;
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainComplex() {
+ return obtain(VehiclePropertyType::MIXED);
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainRecyclable(
+ VehiclePropertyType type, size_t vectorSize) {
+ std::lock_guard<std::mutex> lock(mLock);
+ assert(vectorSize > 0);
+
+ // VehiclePropertyType is not overlapping with vectorSize.
+ int32_t key = static_cast<int32_t>(type) | static_cast<int32_t>(vectorSize);
+ auto it = mValueTypePools.find(key);
+
+ if (it == mValueTypePools.end()) {
+ auto newPool(std::make_unique<InternalPool>(type, vectorSize, mMaxPoolObjectsSize,
+ getVehiclePropValueSize));
+ it = mValueTypePools.emplace(key, std::move(newPool)).first;
+ }
+ return it->second->obtain();
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainBoolean(bool value) {
+ return obtainInt32(value);
+}
+
+VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainDisposable(
+ VehiclePropertyType valueType, size_t vectorSize) const {
+ return RecyclableType{createVehiclePropValueVec(valueType, vectorSize).release(),
+ mDisposableDeleter};
+}
+
+void VehiclePropValuePool::InternalPool::recycle(VehiclePropValue* o) {
+ if (o == nullptr) {
+ ALOGE("Attempt to recycle nullptr");
+ return;
+ }
+
+ if (!check(&o->value)) {
+ ALOGE("Discarding value for prop 0x%x because it contains "
+ "data that is not consistent with this pool. "
+ "Expected type: %d, vector size: %zu",
+ o->prop, toInt(mPropType), mVectorSize);
+ delete o;
+ } else {
+ ObjectPool<VehiclePropValue>::recycle(o);
+ }
+}
+
+bool VehiclePropValuePool::InternalPool::check(RawPropValues* v) {
+ return check(&v->int32Values, (VehiclePropertyType::INT32 == mPropType ||
+ VehiclePropertyType::INT32_VEC == mPropType ||
+ VehiclePropertyType::BOOLEAN == mPropType)) &&
+ check(&v->floatValues, (VehiclePropertyType::FLOAT == mPropType ||
+ VehiclePropertyType::FLOAT_VEC == mPropType)) &&
+ check(&v->int64Values, (VehiclePropertyType::INT64 == mPropType ||
+ VehiclePropertyType::INT64_VEC == mPropType)) &&
+ check(&v->byteValues, VehiclePropertyType::BYTES == mPropType) &&
+ v->stringValue.size() == 0;
+}
+
+VehiclePropValue* VehiclePropValuePool::InternalPool::createObject() {
+ return createVehiclePropValueVec(mPropType, mVectorSize).release();
+}
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp
index b660f36..2869d1d 100644
--- a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp
@@ -21,6 +21,7 @@
#include <VehicleUtils.h>
#include <android-base/format.h>
+#include <math/HashCombine.h>
namespace android {
namespace hardware {
@@ -29,6 +30,7 @@
using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
using ::android::base::Result;
@@ -36,14 +38,17 @@
return area == other.area && token == other.token;
}
-bool VehiclePropertyStore::RecordId::operator<(const VehiclePropertyStore::RecordId& other) const {
- return area < other.area || (area == other.area && token < other.token);
-}
-
std::string VehiclePropertyStore::RecordId::toString() const {
return ::fmt::format("RecordID{{.areaId={:d}, .token={:d}}}", area, token);
}
+size_t VehiclePropertyStore::RecordIdHash::operator()(RecordId const& recordId) const {
+ size_t res = 0;
+ hashCombine(res, recordId.area);
+ hashCombine(res, recordId.token);
+ return res;
+}
+
const VehiclePropertyStore::Record* VehiclePropertyStore::getRecordLocked(int32_t propId) const
REQUIRES(mLock) {
auto RecordIt = mRecordsByPropId.find(propId);
@@ -68,13 +73,13 @@
return recId;
}
-Result<std::unique_ptr<VehiclePropValue>> VehiclePropertyStore::readValueLocked(
+Result<VehiclePropValuePool::RecyclableType> VehiclePropertyStore::readValueLocked(
const RecordId& recId, const Record& record) const REQUIRES(mLock) {
auto it = record.values.find(recId);
if (it == record.values.end()) {
return Errorf("Record ID: {} is not found", recId.toString());
}
- return std::make_unique<VehiclePropValue>(it->second);
+ return mValuePool->obtain(*(it->second));
}
void VehiclePropertyStore::registerProperty(const VehiclePropConfig& config,
@@ -87,36 +92,42 @@
};
}
-Result<void> VehiclePropertyStore::writeValue(const VehiclePropValue& propValue) {
+Result<void> VehiclePropertyStore::writeValue(VehiclePropValuePool::RecyclableType propValue,
+ bool updateStatus) {
std::lock_guard<std::mutex> g(mLock);
- VehiclePropertyStore::Record* record = getRecordLocked(propValue.prop);
+ VehiclePropertyStore::Record* record = getRecordLocked(propValue->prop);
if (record == nullptr) {
- return Errorf("property: {:d} not registered", propValue.prop);
+ return Errorf("property: {:d} not registered", propValue->prop);
}
- if (!isGlobalProp(propValue.prop) && getAreaConfig(propValue, record->propConfig) == nullptr) {
- return Errorf("no config for property: {:d} area: {:d}", propValue.prop, propValue.areaId);
+ if (!isGlobalProp(propValue->prop) &&
+ getAreaConfig(*propValue, record->propConfig) == nullptr) {
+ return Errorf("no config for property: {:d} area: {:d}", propValue->prop,
+ propValue->areaId);
}
- VehiclePropertyStore::RecordId recId = getRecordIdLocked(propValue, *record);
+ VehiclePropertyStore::RecordId recId = getRecordIdLocked(*propValue, *record);
auto it = record->values.find(recId);
if (it == record->values.end()) {
- record->values[recId] = propValue;
+ record->values[recId] = std::move(propValue);
+ if (!updateStatus) {
+ record->values[recId]->status = VehiclePropertyStatus::AVAILABLE;
+ }
return {};
}
- VehiclePropValue* valueToUpdate = &(it->second);
-
+ const VehiclePropValue* valueToUpdate = it->second.get();
+ long oldTimestamp = valueToUpdate->timestamp;
+ VehiclePropertyStatus oldStatus = valueToUpdate->status;
// propValue is outdated and drops it.
- if (valueToUpdate->timestamp > propValue.timestamp) {
- return Errorf("outdated timestamp: {:d}", propValue.timestamp);
+ if (oldTimestamp > propValue->timestamp) {
+ return Errorf("outdated timestamp: {:d}", propValue->timestamp);
}
- // Update the propertyValue.
- // The timestamp in propertyStore should only be updated by the server side. It indicates
- // the time when the event is generated by the server.
- valueToUpdate->timestamp = propValue.timestamp;
- valueToUpdate->value = propValue.value;
- valueToUpdate->status = propValue.status;
+ record->values[recId] = std::move(propValue);
+ if (!updateStatus) {
+ record->values[recId]->status = oldStatus;
+ }
+
return {};
}
@@ -145,25 +156,25 @@
record->values.clear();
}
-std::vector<VehiclePropValue> VehiclePropertyStore::readAllValues() const {
+std::vector<VehiclePropValuePool::RecyclableType> VehiclePropertyStore::readAllValues() const {
std::lock_guard<std::mutex> g(mLock);
- std::vector<VehiclePropValue> allValues;
+ std::vector<VehiclePropValuePool::RecyclableType> allValues;
for (auto const& [_, record] : mRecordsByPropId) {
for (auto const& [_, value] : record.values) {
- allValues.push_back(value);
+ allValues.push_back(std::move(mValuePool->obtain(*value)));
}
}
return allValues;
}
-Result<std::vector<VehiclePropValue>> VehiclePropertyStore::readValuesForProperty(
- int32_t propId) const {
+Result<std::vector<VehiclePropValuePool::RecyclableType>>
+VehiclePropertyStore::readValuesForProperty(int32_t propId) const {
std::lock_guard<std::mutex> g(mLock);
- std::vector<VehiclePropValue> values;
+ std::vector<VehiclePropValuePool::RecyclableType> values;
const VehiclePropertyStore::Record* record = getRecordLocked(propId);
if (record == nullptr) {
@@ -171,12 +182,12 @@
}
for (auto const& [_, value] : record->values) {
- values.push_back(value);
+ values.push_back(std::move(mValuePool->obtain(*value)));
}
return values;
}
-Result<std::unique_ptr<VehiclePropValue>> VehiclePropertyStore::readValue(
+Result<VehiclePropValuePool::RecyclableType> VehiclePropertyStore::readValue(
const VehiclePropValue& propValue) const {
std::lock_guard<std::mutex> g(mLock);
@@ -189,9 +200,9 @@
return readValueLocked(recId, *record);
}
-Result<std::unique_ptr<VehiclePropValue>> VehiclePropertyStore::readValue(int32_t propId,
- int32_t areaId,
- int64_t token) const {
+Result<VehiclePropValuePool::RecyclableType> VehiclePropertyStore::readValue(int32_t propId,
+ int32_t areaId,
+ int64_t token) const {
std::lock_guard<std::mutex> g(mLock);
const VehiclePropertyStore::Record* record = getRecordLocked(propId);
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp
new file mode 100644
index 0000000..a62532c
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <utils/SystemClock.h>
+
+#include <VehicleHalTypes.h>
+#include <VehicleObjectPool.h>
+#include <VehicleUtils.h>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+namespace {
+
+using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
+
+struct TestPropertyTypeInfo {
+ VehiclePropertyType type;
+ bool recyclable;
+ size_t vecSize;
+};
+
+std::vector<TestPropertyTypeInfo> getAllPropertyTypes() {
+ return {
+ {
+ .type = VehiclePropertyType::INT32,
+ .recyclable = true,
+ .vecSize = 1,
+ },
+ {
+ .type = VehiclePropertyType::INT64,
+ .recyclable = true,
+ .vecSize = 1,
+ },
+ {
+ .type = VehiclePropertyType::FLOAT,
+ .recyclable = true,
+ .vecSize = 1,
+ },
+ {
+ .type = VehiclePropertyType::INT32_VEC,
+ .recyclable = true,
+ .vecSize = 4,
+ },
+ {
+ .type = VehiclePropertyType::INT64_VEC,
+ .recyclable = true,
+ .vecSize = 4,
+ },
+ {
+ .type = VehiclePropertyType::FLOAT_VEC,
+ .recyclable = true,
+ .vecSize = 4,
+ },
+ {
+ .type = VehiclePropertyType::BYTES,
+ .recyclable = true,
+ .vecSize = 4,
+ },
+ {
+ .type = VehiclePropertyType::INT32_VEC,
+ .recyclable = false,
+ .vecSize = 5,
+ },
+ {
+ .type = VehiclePropertyType::INT64_VEC,
+ .recyclable = false,
+ .vecSize = 5,
+ },
+ {
+ .type = VehiclePropertyType::FLOAT_VEC,
+ .recyclable = false,
+ .vecSize = 5,
+ },
+ {
+ .type = VehiclePropertyType::BYTES,
+ .recyclable = false,
+ .vecSize = 5,
+ },
+ {
+ .type = VehiclePropertyType::STRING,
+ .recyclable = false,
+ .vecSize = 0,
+ },
+ {
+ .type = VehiclePropertyType::MIXED,
+ .recyclable = false,
+ .vecSize = 0,
+ },
+ };
+}
+
+} // namespace
+
+class VehicleObjectPoolTest : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ mStats = PoolStats::instance();
+ resetStats();
+ mValuePool.reset(new VehiclePropValuePool);
+ }
+
+ void TearDown() override {
+ // At the end, all created objects should be either recycled or deleted.
+ ASSERT_EQ(mStats->Obtained, mStats->Recycled + mStats->Deleted);
+ // Some objects could be recycled multiple times.
+ ASSERT_LE(mStats->Created, mStats->Recycled + mStats->Deleted);
+ }
+
+ PoolStats* mStats;
+ std::unique_ptr<VehiclePropValuePool> mValuePool;
+
+ private:
+ void resetStats() {
+ mStats->Obtained = 0;
+ mStats->Created = 0;
+ mStats->Recycled = 0;
+ mStats->Deleted = 0;
+ }
+};
+
+class VehiclePropertyTypesTest : public VehicleObjectPoolTest,
+ public testing::WithParamInterface<TestPropertyTypeInfo> {};
+
+TEST_P(VehiclePropertyTypesTest, testRecycle) {
+ auto info = GetParam();
+ if (!info.recyclable) {
+ GTEST_SKIP();
+ }
+
+ auto value = mValuePool->obtain(info.type, info.vecSize);
+ void* raw = value.get();
+ value.reset();
+ // At this point, value should be recycled and the only object in the pool.
+ ASSERT_EQ(mValuePool->obtain(info.type, info.vecSize).get(), raw);
+
+ ASSERT_EQ(mStats->Obtained, 2u);
+ ASSERT_EQ(mStats->Created, 1u);
+}
+
+TEST_P(VehiclePropertyTypesTest, testNotRecyclable) {
+ auto info = GetParam();
+ if (info.recyclable) {
+ GTEST_SKIP();
+ }
+
+ auto value = mValuePool->obtain(info.type, info.vecSize);
+
+ ASSERT_EQ(mStats->Obtained, 0u) << "Non recyclable object should not be obtained from the pool";
+ ASSERT_EQ(mStats->Created, 0u) << "Non recyclable object should not be created from the pool";
+}
+
+INSTANTIATE_TEST_SUITE_P(AllPropertyTypes, VehiclePropertyTypesTest,
+ ::testing::ValuesIn(getAllPropertyTypes()));
+
+TEST_F(VehicleObjectPoolTest, testObtainNewObject) {
+ auto value = mValuePool->obtain(VehiclePropertyType::INT32);
+ void* raw = value.get();
+ value.reset();
+ // At this point, value should be recycled and the only object in the pool.
+ ASSERT_EQ(mValuePool->obtain(VehiclePropertyType::INT32).get(), raw);
+ // Obtaining value of another type - should return a new object
+ ASSERT_NE(mValuePool->obtain(VehiclePropertyType::FLOAT).get(), raw);
+
+ ASSERT_EQ(mStats->Obtained, 3u);
+ ASSERT_EQ(mStats->Created, 2u);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainStrings) {
+ mValuePool->obtain(VehiclePropertyType::STRING);
+ auto stringProp = mValuePool->obtain(VehiclePropertyType::STRING);
+ stringProp->value.stringValue = "Hello";
+ void* raw = stringProp.get();
+ stringProp.reset(); // delete the pointer
+
+ auto newStringProp = mValuePool->obtain(VehiclePropertyType::STRING);
+
+ ASSERT_EQ(newStringProp->value.stringValue.size(), 0u);
+ ASSERT_NE(mValuePool->obtain(VehiclePropertyType::STRING).get(), raw);
+ ASSERT_EQ(mStats->Obtained, 0u);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainBoolean) {
+ auto prop = mValuePool->obtainBoolean(true);
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, (VehiclePropValue{
+ .value = {.int32Values = {1}},
+ }));
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainInt32) {
+ auto prop = mValuePool->obtainInt32(1234);
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, (VehiclePropValue{
+ .value = {.int32Values = {1234}},
+ }));
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainInt64) {
+ auto prop = mValuePool->obtainInt64(1234);
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, (VehiclePropValue{
+ .value = {.int64Values = {1234}},
+ }));
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainFloat) {
+ auto prop = mValuePool->obtainFloat(1.234);
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, (VehiclePropValue{
+ .value = {.floatValues = {1.234}},
+ }));
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainString) {
+ auto prop = mValuePool->obtainString("test");
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, (VehiclePropValue{
+ .value = {.stringValue = "test"},
+ }));
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainComplex) {
+ auto prop = mValuePool->obtainComplex();
+
+ ASSERT_NE(prop, nullptr);
+ ASSERT_EQ(*prop, VehiclePropValue{});
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainCopyInt32Values) {
+ VehiclePropValue prop{
+ // INT32_VEC property.
+ .prop = toInt(VehicleProperty::INFO_FUEL_TYPE),
+ .areaId = 2,
+ .timestamp = 3,
+ .value = {.int32Values = {1, 2, 3, 4}},
+ };
+ auto gotValue = mValuePool->obtain(prop);
+
+ ASSERT_NE(gotValue, nullptr);
+ ASSERT_EQ(*gotValue, prop);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainCopyInt64Values) {
+ VehiclePropValue prop{
+ // INT64_VEC property.
+ .prop = toInt(VehicleProperty::WHEEL_TICK),
+ .areaId = 2,
+ .timestamp = 3,
+ .value = {.int64Values = {1, 2, 3, 4}},
+ };
+ auto gotValue = mValuePool->obtain(prop);
+
+ ASSERT_NE(gotValue, nullptr);
+ ASSERT_EQ(*gotValue, prop);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainCopyFloatValues) {
+ VehiclePropValue prop{
+ // FLOAT_VEC property.
+ .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION),
+ .areaId = 2,
+ .timestamp = 3,
+ .value = {.floatValues = {1, 2, 3, 4}},
+ };
+ auto gotValue = mValuePool->obtain(prop);
+
+ ASSERT_NE(gotValue, nullptr);
+ ASSERT_EQ(*gotValue, prop);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainCopyString) {
+ VehiclePropValue prop{
+ // STRING property.
+ .prop = toInt(VehicleProperty::INFO_VIN),
+ .areaId = 2,
+ .timestamp = 3,
+ .value = {.stringValue = "test"},
+ };
+ auto gotValue = mValuePool->obtain(prop);
+
+ ASSERT_NE(gotValue, nullptr);
+ ASSERT_EQ(*gotValue, prop);
+}
+
+TEST_F(VehicleObjectPoolTest, testObtainCopyMixed) {
+ VehiclePropValue prop{
+ // MIxed property.
+ .prop = toInt(VehicleProperty::VEHICLE_MAP_SERVICE),
+ .areaId = 2,
+ .timestamp = 3,
+ .value =
+ {
+ .int32Values = {1, 2, 3},
+ .floatValues = {4.0, 5.0},
+ .stringValue = "test",
+ },
+ };
+ auto gotValue = mValuePool->obtain(prop);
+
+ ASSERT_NE(gotValue, nullptr);
+ ASSERT_EQ(*gotValue, prop);
+}
+
+TEST_F(VehicleObjectPoolTest, testMultithreaded) {
+ // In this test we have T threads that concurrently in C cycles
+ // obtain and release O VehiclePropValue objects of FLOAT / INT32 types.
+
+ const int T = 2;
+ const int C = 500;
+ const int O = 100;
+
+ auto poolPtr = mValuePool.get();
+
+ std::vector<std::thread> threads;
+ for (int i = 0; i < T; i++) {
+ threads.push_back(std::thread([&poolPtr]() {
+ for (int j = 0; j < C; j++) {
+ std::vector<recyclable_ptr<VehiclePropValue>> vec;
+ for (int k = 0; k < O; k++) {
+ vec.push_back(poolPtr->obtain(k % 2 == 0 ? VehiclePropertyType::FLOAT
+ : VehiclePropertyType::INT32));
+ }
+ }
+ }));
+ }
+
+ for (auto& t : threads) {
+ t.join();
+ }
+
+ ASSERT_EQ(mStats->Obtained, static_cast<uint32_t>(T * C * O));
+ ASSERT_EQ(mStats->Recycled + mStats->Deleted, static_cast<uint32_t>(T * C * O));
+ // Created less than obtained in one cycle.
+ ASSERT_LE(mStats->Created, static_cast<uint32_t>(T * O));
+}
+
+TEST_F(VehicleObjectPoolTest, testMemoryLimitation) {
+ std::vector<recyclable_ptr<VehiclePropValue>> vec;
+ for (size_t i = 0; i < 10000; i++) {
+ vec.push_back(mValuePool->obtain(VehiclePropertyType::INT32));
+ }
+ // We have too many values, not all of them would be recycled, some of them will be deleted.
+ vec.clear();
+
+ ASSERT_EQ(mStats->Obtained, 10000u);
+ ASSERT_EQ(mStats->Created, 10000u);
+ ASSERT_GT(mStats->Deleted, 0u) << "expect some values to be deleted, not recycled if too many "
+ "values are in the pool";
+}
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp
index 8c70fea..f1d218d 100644
--- a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp
@@ -32,6 +32,8 @@
using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
using ::android::base::Result;
using ::testing::ElementsAre;
@@ -51,6 +53,17 @@
return value.timestamp;
}
+// A helper function to turn value pointer to value structure for easier comparison.
+std::vector<VehiclePropValue> convertValuePtrsToValues(
+ const std::vector<VehiclePropValuePool::RecyclableType>& values) {
+ std::vector<VehiclePropValue> returnValues;
+ returnValues.reserve(values.size());
+ for (auto& value : values) {
+ returnValues.push_back(*value);
+ }
+ return returnValues;
+}
+
} // namespace
class VehiclePropertyStoreTest : public ::testing::Test {
@@ -70,30 +83,33 @@
VehicleAreaConfig{.areaId = WHEEL_REAR_LEFT},
VehicleAreaConfig{.areaId = WHEEL_REAR_RIGHT}},
};
- mStore.registerProperty(mConfigFuelCapacity);
- mStore.registerProperty(configTirePressure);
+ mValuePool = std::make_shared<VehiclePropValuePool>();
+ mStore.reset(new VehiclePropertyStore(mValuePool));
+ mStore->registerProperty(mConfigFuelCapacity);
+ mStore->registerProperty(configTirePressure);
}
- VehiclePropertyStore mStore;
VehiclePropConfig mConfigFuelCapacity;
+ std::shared_ptr<VehiclePropValuePool> mValuePool;
+ std::unique_ptr<VehiclePropertyStore> mStore;
};
TEST_F(VehiclePropertyStoreTest, testGetAllConfigs) {
- std::vector<VehiclePropConfig> configs = mStore.getAllConfigs();
+ std::vector<VehiclePropConfig> configs = mStore->getAllConfigs();
ASSERT_EQ(configs.size(), static_cast<size_t>(2));
}
TEST_F(VehiclePropertyStoreTest, testGetConfig) {
Result<const VehiclePropConfig*> result =
- mStore.getConfig(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
+ mStore->getConfig(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
ASSERT_RESULT_OK(result);
ASSERT_EQ(*(result.value()), mConfigFuelCapacity);
}
TEST_F(VehiclePropertyStoreTest, testGetConfigWithInvalidPropId) {
- Result<const VehiclePropConfig*> result = mStore.getConfig(INVALID_PROP_ID);
+ Result<const VehiclePropConfig*> result = mStore->getConfig(INVALID_PROP_ID);
ASSERT_FALSE(result.ok()) << "expect error when getting a config for an invalid property ID";
}
@@ -122,46 +138,47 @@
TEST_F(VehiclePropertyStoreTest, testWriteValueOk) {
auto values = getTestPropValues();
- ASSERT_RESULT_OK(mStore.writeValue(values[0]));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(values[0])));
}
TEST_F(VehiclePropertyStoreTest, testReadAllValues) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- auto gotValues = mStore.readAllValues();
+ auto gotValues = mStore->readAllValues();
- ASSERT_THAT(gotValues, WhenSortedBy(propValueCmp, Eq(values)));
+ ASSERT_THAT(convertValuePtrsToValues(gotValues), WhenSortedBy(propValueCmp, Eq(values)));
}
TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyOneValue) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- auto result = mStore.readValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
+ auto result = mStore->readValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
ASSERT_RESULT_OK(result);
- ASSERT_THAT(result.value(), ElementsAre(values[0]));
+ ASSERT_THAT(convertValuePtrsToValues(result.value()), ElementsAre(values[0]));
}
TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyMultipleValues) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- auto result = mStore.readValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE));
+ auto result = mStore->readValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE));
ASSERT_RESULT_OK(result);
- ASSERT_THAT(result.value(), WhenSortedBy(propValueCmp, ElementsAre(values[1], values[2])));
+ ASSERT_THAT(convertValuePtrsToValues(result.value()),
+ WhenSortedBy(propValueCmp, ElementsAre(values[1], values[2])));
}
TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyError) {
- auto result = mStore.readValuesForProperty(INVALID_PROP_ID);
+ auto result = mStore->readValuesForProperty(INVALID_PROP_ID);
ASSERT_FALSE(result.ok()) << "expect error when reading values for an invalid property";
}
@@ -169,7 +186,7 @@
TEST_F(VehiclePropertyStoreTest, testReadValueOk) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
VehiclePropValue requestValue = {
@@ -177,7 +194,7 @@
.areaId = WHEEL_FRONT_LEFT,
};
- auto result = mStore.readValue(requestValue);
+ auto result = mStore->readValue(requestValue);
ASSERT_RESULT_OK(result);
ASSERT_EQ(*(result.value()), values[1]);
@@ -186,10 +203,10 @@
TEST_F(VehiclePropertyStoreTest, testReadValueByPropIdOk) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- auto result = mStore.readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_FRONT_RIGHT);
+ auto result = mStore->readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_FRONT_RIGHT);
ASSERT_EQ(*(result.value()), values[2]);
}
@@ -197,50 +214,47 @@
TEST_F(VehiclePropertyStoreTest, testReadValueError) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- auto result = mStore.readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_REAR_LEFT);
+ auto result = mStore->readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_REAR_LEFT);
ASSERT_FALSE(result.ok()) << "expect error when reading a value that has not been written";
}
TEST_F(VehiclePropertyStoreTest, testWriteValueError) {
- ASSERT_FALSE(mStore.writeValue({
- .prop = INVALID_PROP_ID,
- .value = {.floatValues = {1.0}},
- })
- .ok())
+ auto v = mValuePool->obtain(VehiclePropertyType::FLOAT);
+ v->prop = INVALID_PROP_ID;
+ v->value.floatValues = {1.0};
+ ASSERT_FALSE(mStore->writeValue(std::move(v)).ok())
<< "expect error when writing value for an invalid property ID";
}
TEST_F(VehiclePropertyStoreTest, testWriteValueNoAreaConfig) {
- ASSERT_FALSE(mStore.writeValue({
- .prop = toInt(VehicleProperty::TIRE_PRESSURE),
- .value = {.floatValues = {180.0}},
- // There is no config for ALL_WHEELS.
- .areaId = ALL_WHEELS,
- })
- .ok())
+ auto v = mValuePool->obtain(VehiclePropertyType::FLOAT);
+ v->prop = toInt(VehicleProperty::TIRE_PRESSURE);
+ v->value.floatValues = {1.0};
+ // There is no config for ALL_WHEELS.
+ v->areaId = ALL_WHEELS;
+ ASSERT_FALSE(mStore->writeValue(std::move(v)).ok())
<< "expect error when writing value for an area without config";
}
TEST_F(VehiclePropertyStoreTest, testWriteOutdatedValue) {
- ASSERT_RESULT_OK(mStore.writeValue({
- .timestamp = 1,
- .prop = toInt(VehicleProperty::TIRE_PRESSURE),
- .value = {.floatValues = {180.0}},
- .areaId = WHEEL_FRONT_LEFT,
- }));
+ auto v = mValuePool->obtain(VehiclePropertyType::FLOAT);
+ v->timestamp = 1;
+ v->prop = toInt(VehicleProperty::TIRE_PRESSURE);
+ v->value.floatValues = {180.0};
+ v->areaId = WHEEL_FRONT_LEFT;
+ ASSERT_RESULT_OK(mStore->writeValue(std::move(v)));
// Write an older value.
- ASSERT_FALSE(mStore.writeValue({
- .timestamp = 0,
- .prop = toInt(VehicleProperty::TIRE_PRESSURE),
- .value = {.floatValues = {180.0}},
- .areaId = WHEEL_FRONT_LEFT,
- })
- .ok())
+ auto v2 = mValuePool->obtain(VehiclePropertyType::FLOAT);
+ v2->timestamp = 0;
+ v2->prop = toInt(VehicleProperty::TIRE_PRESSURE);
+ v2->value.floatValues = {180.0};
+ v2->areaId = WHEEL_FRONT_LEFT;
+ ASSERT_FALSE(mStore->writeValue(std::move(v2)).ok())
<< "expect error when writing an outdated value";
}
@@ -251,7 +265,7 @@
};
// Replace existing config.
- mStore.registerProperty(config, timestampToken);
+ mStore->registerProperty(config, timestampToken);
VehiclePropValue fuelCapacityValueToken1 = {
.timestamp = 1,
@@ -265,15 +279,15 @@
.value = {.floatValues = {2.0}},
};
- ASSERT_RESULT_OK(mStore.writeValue(fuelCapacityValueToken1));
- ASSERT_RESULT_OK(mStore.writeValue(fuelCapacityValueToken2));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacityValueToken1)));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacityValueToken2)));
- auto result = mStore.readValuesForProperty(propId);
+ auto result = mStore->readValuesForProperty(propId);
ASSERT_RESULT_OK(result);
ASSERT_EQ(result.value().size(), static_cast<size_t>(2));
- auto tokenResult = mStore.readValue(propId, /*areaId=*/0, /*token=*/2);
+ auto tokenResult = mStore->readValue(propId, /*areaId=*/0, /*token=*/2);
ASSERT_RESULT_OK(tokenResult);
ASSERT_EQ(*(tokenResult.value()), fuelCapacityValueToken2);
@@ -282,14 +296,14 @@
TEST_F(VehiclePropertyStoreTest, testRemoveValue) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value)));
}
- mStore.removeValue(values[0]);
+ mStore->removeValue(values[0]);
- ASSERT_FALSE(mStore.readValue(values[0]).ok()) << "expect error when reading a removed value";
+ ASSERT_FALSE(mStore->readValue(values[0]).ok()) << "expect error when reading a removed value";
- auto leftTirePressureResult = mStore.readValue(values[1]);
+ auto leftTirePressureResult = mStore->readValue(values[1]);
ASSERT_RESULT_OK(leftTirePressureResult);
ASSERT_EQ(*(leftTirePressureResult.value()), values[1]);
@@ -298,16 +312,76 @@
TEST_F(VehiclePropertyStoreTest, testRemoveValuesForProperty) {
auto values = getTestPropValues();
for (const auto& value : values) {
- ASSERT_RESULT_OK(mStore.writeValue(value));
+ ASSERT_RESULT_OK(mStore->writeValue(std::move(mValuePool->obtain(value))));
}
- mStore.removeValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
- mStore.removeValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE));
+ mStore->removeValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY));
+ mStore->removeValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE));
- auto gotValues = mStore.readAllValues();
+ auto gotValues = mStore->readAllValues();
ASSERT_TRUE(gotValues.empty());
}
+TEST_F(VehiclePropertyStoreTest, testWriteValueUpdateStatus) {
+ VehiclePropValue fuelCapacity = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ .value = {.floatValues = {1.0}},
+ };
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true));
+
+ fuelCapacity.status = VehiclePropertyStatus::UNAVAILABLE;
+
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true));
+
+ VehiclePropValue requestValue = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ };
+
+ auto result = mStore->readValue(requestValue);
+
+ ASSERT_RESULT_OK(result);
+ ASSERT_EQ(result.value()->status, VehiclePropertyStatus::UNAVAILABLE);
+}
+
+TEST_F(VehiclePropertyStoreTest, testWriteValueNoUpdateStatus) {
+ VehiclePropValue fuelCapacity = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ .value = {.floatValues = {1.0}},
+ };
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true));
+
+ fuelCapacity.status = VehiclePropertyStatus::UNAVAILABLE;
+
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), false));
+
+ VehiclePropValue requestValue = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ };
+
+ auto result = mStore->readValue(requestValue);
+
+ ASSERT_RESULT_OK(result);
+ ASSERT_EQ(result.value()->status, VehiclePropertyStatus::AVAILABLE);
+}
+
+TEST_F(VehiclePropertyStoreTest, testWriteValueNoUpdateStatusForNewValue) {
+ VehiclePropValue fuelCapacity = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ .value = {.floatValues = {1.0}},
+ .status = VehiclePropertyStatus::UNAVAILABLE,
+ };
+ ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), false));
+
+ VehiclePropValue requestValue = {
+ .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+ };
+
+ auto result = mStore->readValue(requestValue);
+
+ ASSERT_RESULT_OK(result);
+ ASSERT_EQ(result.value()->status, VehiclePropertyStatus::AVAILABLE);
+}
+
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp
index c09b06d..7ad3d31 100644
--- a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp
@@ -16,7 +16,9 @@
#include <PropertyUtils.h>
#include <VehicleUtils.h>
+
#include <gtest/gtest.h>
+#include <vector>
namespace android {
namespace hardware {
@@ -122,6 +124,129 @@
ASSERT_EQ(gotConfig, nullptr);
}
+TEST(VehicleUtilsTest, testCreateVehiclePropValueInt32) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::INT32);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int32Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueInt32Vec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValue(VehiclePropertyType::INT32_VEC);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int32Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueInt64) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::INT64);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int64Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueInt64Vec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValue(VehiclePropertyType::INT64_VEC);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int64Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueFloat) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::FLOAT);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.floatValues.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueFloatVec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValue(VehiclePropertyType::FLOAT_VEC);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.floatValues.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueBytes) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::BYTES);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.byteValues.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueString) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::STRING);
+
+ ASSERT_NE(value, nullptr);
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueMixed) {
+ std::unique_ptr<VehiclePropValue> value = createVehiclePropValue(VehiclePropertyType::MIXED);
+
+ ASSERT_NE(value, nullptr);
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueVecInt32) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::INT32, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int32Values.size())
+ << "vector size should always be 1 for single value type";
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueIntVec32Vec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::INT32_VEC, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(2u, value->value.int32Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueVecInt64) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::INT64, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.int64Values.size())
+ << "vector size should always be 1 for single value type";
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueIntVec64Vec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::INT64_VEC, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(2u, value->value.int64Values.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueVecFloat) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::FLOAT, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(1u, value->value.floatValues.size())
+ << "vector size should always be 1 for single value type";
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueFloVecatVec) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::FLOAT_VEC, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(2u, value->value.floatValues.size());
+}
+
+TEST(VehicleUtilsTest, testCreateVehiclePropValueVecBytes) {
+ std::unique_ptr<VehiclePropValue> value =
+ createVehiclePropValueVec(VehiclePropertyType::BYTES, /*vecSize=*/2);
+
+ ASSERT_NE(value, nullptr);
+ ASSERT_EQ(2u, value->value.byteValues.size());
+}
+
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/bluetooth/a2dp/1.0/vts/OWNERS b/bluetooth/a2dp/1.0/vts/OWNERS
index 58d3a66..4e982a1 100644
--- a/bluetooth/a2dp/1.0/vts/OWNERS
+++ b/bluetooth/a2dp/1.0/vts/OWNERS
@@ -1,8 +1,4 @@
-zachoverflow@google.com
-siyuanh@google.com
-mylesgw@google.com
-jpawlowski@google.com
-apanicke@google.com
-stng@google.com
-hsz@google.com
+# Bug component: 27441
+include platform/system/bt:/OWNERS
+cheneyni@google.com
diff --git a/camera/metadata/3.7/types.hal b/camera/metadata/3.7/types.hal
new file mode 100644
index 0000000..a09bdf9
--- /dev/null
+++ b/camera/metadata/3.7/types.hal
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+
+package android.hardware.camera.metadata@3.7;
+
+import android.hardware.camera.metadata@3.2;
+import android.hardware.camera.metadata@3.3;
+import android.hardware.camera.metadata@3.4;
+import android.hardware.camera.metadata@3.5;
+import android.hardware.camera.metadata@3.6;
+
+// No new metadata sections added in this revision
+
+/**
+ * Main enumeration for defining camera metadata tags added in this revision
+ *
+ * <p>Partial documentation is included for each tag; for complete documentation, reference
+ * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
+ */
+enum CameraMetadataTag : @3.6::CameraMetadataTag {
+ /** android.info.deviceStateOrientations [static, int64[], ndk_public]
+ */
+ ANDROID_INFO_DEVICE_STATE_ORIENTATIONS = android.hardware.camera.metadata@3.4::CameraMetadataTag:ANDROID_INFO_END_3_4,
+
+ ANDROID_INFO_END_3_7,
+
+};
+
+/*
+ * Enumeration definitions for the various entries that need them
+ */
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 7727547..ad3da48 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -8161,6 +8161,20 @@
poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA);
}
+ retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_INFO_DEVICE_STATE_ORIENTATIONS, &entry);
+ if (0 == retcode && entry.count > 0) {
+ ASSERT_TRUE((entry.count % 2) == 0);
+ uint64_t maxPublicState = ((uint64_t) provider::V2_5::DeviceState::FOLDED) << 1;
+ uint64_t vendorStateStart = 1UL << 31; // Reserved for vendor specific states
+ uint64_t stateMask = (1 << vendorStateStart) - 1;
+ stateMask &= ~((1 << maxPublicState) - 1);
+ for (int i = 0; i < entry.count; i += 2){
+ ASSERT_TRUE((entry.data.i64[i] & stateMask) == 0);
+ ASSERT_TRUE((entry.data.i64[i+1] % 90) == 0);
+ }
+ }
+
verifyExtendedSceneModeCharacteristics(metadata);
verifyZoomCharacteristics(metadata);
}
diff --git a/current.txt b/current.txt
index c5d5762..cb91843 100644
--- a/current.txt
+++ b/current.txt
@@ -899,9 +899,14 @@
2123482b69f3b531c88023aa2a007110e130efbf4ed68ac9ce0bc55d5e82bc8b android.hardware.wifi.supplicant@1.4::ISupplicantStaNetworkCallback
0821f516e4d428bc15251969f7e19411c94d8f2ccbd99e1fc8168d8e49e38b0f android.hardware.wifi.supplicant@1.4::types
4a087a308608d146b022ebc15633de989f5f4dfe1491a83fa41763290a82e40d android.hardware.automotive.vehicle@2.0::types
+70eb14415391f835fb218b43a1e25f5d6495f098f96fa2acaea70985e98e1ce8 android.hardware.automotive.vehicle@2.0::types
+
+# HALs released in Android SCv2
+77f6fcf3fd0dd3e424d8a0292094ebd17e4c35454bb9abbd3a6cbed1aba70765 android.hardware.camera.metadata@3.7::types
# ABI preserving changes to HALs during Android T
62ace52d9c3ff1f60f94118557a2aaf0b953513e59dcd34d5f94ae28d4c7e780 android.hardware.fastboot@1.0::IFastboot
+b4a59462aa7d1346ee3eaa06a8e13682462746cf1be62ed2a2bd46bf404d01b7 android.hardware.graphics.composer@2.4::IComposerClient
ca62a2a95d173ed323309e5e00f653ad3cceec82a6e5e4976a249cb5aafe2515 android.hardware.neuralnetworks@1.2::types
fa76bced6b1b71c40fc706c508a9011284c57f57831cd0cf5f45653ed4ea463e android.hardware.neuralnetworks@1.3::types
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl
index 2027350..150215c 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl
@@ -56,4 +56,5 @@
SMPTE2086 = 19,
CTA861_3 = 20,
SMPTE2094_40 = 21,
+ SMPTE2094_10 = 22,
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
index 4e0c5ef..eb87f8d 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl
@@ -25,7 +25,7 @@
/**
* This value may be used in an operation where the format is optional.
*/
- UNSPECIFIED = 0,
+ UNSPECIFIED = 0,
/**
* 32-bit format that has 8-bit R, G, B, and A components, in that order,
* from the lowest memory address to the highest memory address.
@@ -33,7 +33,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- RGBA_8888 = 0x1,
+ RGBA_8888 = 0x1,
/**
* 32-bit format that has 8-bit R, G, B, and unused components, in that
@@ -42,7 +42,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- RGBX_8888 = 0x2,
+ RGBX_8888 = 0x2,
/**
* 24-bit format that has 8-bit R, G, and B components, in that order,
@@ -51,7 +51,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- RGB_888 = 0x3,
+ RGB_888 = 0x3,
/**
* 16-bit packed format that has 5-bit R, 6-bit G, and 5-bit B components,
@@ -61,7 +61,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- RGB_565 = 0x4,
+ RGB_565 = 0x4,
/**
* 32-bit format that has 8-bit B, G, R, and A components, in that order,
@@ -70,14 +70,14 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- BGRA_8888 = 0x5,
+ BGRA_8888 = 0x5,
/**
* Legacy formats deprecated in favor of YCBCR_420_888.
*/
- YCBCR_422_SP = 0x10, // NV16
- YCRCB_420_SP = 0x11, // NV21
- YCBCR_422_I = 0x14, // YUY2
+ YCBCR_422_SP = 0x10, // NV16
+ YCRCB_420_SP = 0x11, // NV21
+ YCBCR_422_I = 0x14, // YUY2
/**
* 64-bit format that has 16-bit R, G, B, and A components, in that order,
@@ -86,7 +86,7 @@
* The component values are signed floats, whose interpretation is defined
* by the dataspace.
*/
- RGBA_FP16 = 0x16,
+ RGBA_FP16 = 0x16,
/**
* RAW16 is a single-channel, 16-bit, little endian format, typically
@@ -129,7 +129,7 @@
* | samples.
* Other | Unsupported
*/
- RAW16 = 0x20,
+ RAW16 = 0x20,
/**
* BLOB is used to carry task-specific data which does not have a standard
@@ -152,7 +152,7 @@
* Dataspace::SENSOR | Sensor event data.
* Other | Unsupported
*/
- BLOB = 0x21,
+ BLOB = 0x21,
/**
* A format indicating that the choice of format is entirely up to the
@@ -168,7 +168,7 @@
*
* The interpretation of the component values is defined by the dataspace.
*/
- IMPLEMENTATION_DEFINED = 0x22,
+ IMPLEMENTATION_DEFINED = 0x22,
/**
* This format allows platforms to use an efficient YCbCr/YCrCb 4:2:0
@@ -185,7 +185,7 @@
*
* The interpretation of the component values is defined by the dataspace.
*/
- YCBCR_420_888 = 0x23,
+ YCBCR_420_888 = 0x23,
/**
* RAW_OPAQUE is a format for unprocessed raw image buffers coming from an
@@ -207,7 +207,7 @@
* Dataspace::ARBITRARY | Raw image sensor data.
* Other | Unsupported
*/
- RAW_OPAQUE = 0x24,
+ RAW_OPAQUE = 0x24,
/**
* RAW10 is a single-channel, 10-bit per pixel, densely packed in each row,
@@ -262,7 +262,7 @@
* Dataspace::ARBITRARY | Raw image sensor data.
* Other | Unsupported
*/
- RAW10 = 0x25,
+ RAW10 = 0x25,
/**
* RAW12 is a single-channel, 12-bit per pixel, densely packed in each row,
@@ -313,7 +313,7 @@
* Dataspace::ARBITRARY | Raw image sensor data.
* Other | Unsupported
*/
- RAW12 = 0x26,
+ RAW12 = 0x26,
/** 0x27 to 0x2A are reserved for flexible formats */
@@ -325,7 +325,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- RGBA_1010102 = 0x2B,
+ RGBA_1010102 = 0x2B,
/**
* 0x100 - 0x1FF
@@ -357,7 +357,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- Y8 = 0x20203859,
+ Y8 = 0x20203859,
/**
* Y16 is a YUV planar format comprised of a WxH Y plane, with each pixel
@@ -384,7 +384,7 @@
* Dataspace::DEPTH, each pixel is a distance value measured by a depth
* camera, plus an associated confidence value.
*/
- Y16 = 0x20363159,
+ Y16 = 0x20363159,
/**
* YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
@@ -413,7 +413,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- YV12 = 0x32315659, // YCrCb 4:2:0 Planar
+ YV12 = 0x32315659, // YCrCb 4:2:0 Planar
/**
* 16-bit format that has a single 16-bit depth component.
@@ -421,7 +421,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- DEPTH_16 = 0x30,
+ DEPTH_16 = 0x30,
/**
* 32-bit format that has a single 24-bit depth component and, optionally,
@@ -430,7 +430,7 @@
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
*/
- DEPTH_24 = 0x31,
+ DEPTH_24 = 0x31,
/**
* 32-bit format that has a 24-bit depth component and an 8-bit stencil
@@ -440,7 +440,7 @@
* whose interpretation is defined by the dataspace. The stencil values are
* unsigned integers, whose interpretation is defined by the dataspace.
*/
- DEPTH_24_STENCIL_8 = 0x32,
+ DEPTH_24_STENCIL_8 = 0x32,
/**
* 32-bit format that has a single 32-bit depth component.
@@ -448,7 +448,7 @@
* The component values are signed floats, whose interpretation is defined
* by the dataspace.
*/
- DEPTH_32F = 0x33,
+ DEPTH_32F = 0x33,
/**
* Two-component format that has a 32-bit depth component, an 8-bit stencil
@@ -458,7 +458,7 @@
* defined by the dataspace. The stencil bits are unsigned integers, whose
* interpretation is defined by the dataspace.
*/
- DEPTH_32F_STENCIL_8 = 0x34,
+ DEPTH_32F_STENCIL_8 = 0x34,
/**
* 8-bit format that has a single 8-bit stencil component.
@@ -466,23 +466,12 @@
* The component values are unsigned integers, whose interpretation is
* defined by the dataspace.
*/
- STENCIL_8 = 0x35,
+ STENCIL_8 = 0x35,
/**
* P010 is a 4:2:0 YCbCr semiplanar format comprised of a WxH Y plane
- * followed immediately by a Wx(H/2) CbCr plane. Each sample is
- * represented by a 16-bit little-endian value, with the lower 6 bits set
- * to zero.
- *
- * This format assumes
- * - an even height
- * - a vertical stride equal to the height
- *
- * stride_in_bytes = stride * 2
- * y_size = stride_in_bytes * height
- * cbcr_size = stride_in_bytes * (height / 2)
- * cb_offset = y_size
- * cr_offset = cb_offset + 2
+ * followed by a Wx(H/2) CbCr plane. Each sample is represented by a 16-bit
+ * little-endian value, with the lower 6 bits set to zero.
*
* This format must be accepted by the allocator when used with the
* following usage flags:
@@ -499,7 +488,7 @@
* Buffers with this format must be locked with IMapper::lockYCbCr
* or with IMapper::lock.
*/
- YCBCR_P010 = 0x36,
+ YCBCR_P010 = 0x36,
/**
* 24-bit format that has 8-bit H, S, and V components, in that order,
@@ -507,6 +496,6 @@
*
* The component values are unsigned normalized to the range [0, 1], whose
* interpretation is defined by the dataspace.
- */
- HSV_888 = 0x37,
+ */
+ HSV_888 = 0x37,
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl
index af6045e..7719d6e 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl
@@ -344,7 +344,7 @@
/**
* Can be used to get or set dynamic HDR metadata specified by SMPTE ST 2094-40:2016.
*
- * This metadata is uint8_t byte array.
+ * This metadata is a uint8_t byte array.
*
* This is not used in tone mapping until it has been set for the first time.
*
@@ -353,4 +353,17 @@
* If this is unset when encoded into a byte stream, the byte stream is empty.
*/
SMPTE2094_40 = 21,
+
+ /**
+ * Can be used to get or set dynamic HDR metadata specified by SMPTE ST 2094-10:2016.
+ *
+ * This metadata is a uint8_t byte array.
+ *
+ * This is not used in tone mapping until it has been set for the first time.
+ *
+ * When it is encoded into a byte stream, the length of the HDR metadata byte array is written
+ * using 8 bytes in little endian. It is followed by the uint8_t byte array.
+ * If this is unset when encoded into a byte stream, the byte stream is empty.
+ */
+ SMPTE2094_10 = 22,
}
diff --git a/graphics/composer/2.4/IComposerClient.hal b/graphics/composer/2.4/IComposerClient.hal
index 1a59bbd..e27fd6e 100644
--- a/graphics/composer/2.4/IComposerClient.hal
+++ b/graphics/composer/2.4/IComposerClient.hal
@@ -307,9 +307,8 @@
* If the display is internally connected (not through HDMI), and such modes are available,
* this method should trigger them.
*
- * This function should only be called if the display reports support for the corresponding
- * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes.
- * ContentType::NONE is supported by default and can always be set.
+ * This function can be called for a content type even if no support for it is
+ * reported from getSupportedContentTypes.
*
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index 9bde220..87a3a50 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -690,9 +690,8 @@
* If the display is internally connected (not through HDMI), and such modes are available,
* this method should trigger them.
*
- * This function should only be called if the display reports support for the corresponding
- * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes.
- * ContentType::NONE is supported by default and can always be set.
+ * This function can be called for a content type even if no support for it is
+ * reported from getSupportedContentTypes.
*
* @exception EX_BAD_DISPLAY when an invalid display handle was passed in.
* @exception EX_UNSUPPORTED when the given content type is not supported by the composer
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp
new file mode 100644
index 0000000..8a36b1d
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/Android.bp
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2021, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalGraphicsComposer3_TargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: ["VtsHalGraphicsComposer3_TargetTest.cpp"],
+
+ // TODO(b/64437680): Assume these libs are always available on the device.
+ shared_libs: [
+ "libbinder_ndk",
+ "libbinder",
+ ],
+ static_libs: [
+ "android.hardware.graphics.composer3-V1-ndk",
+ "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.graphics.common@1.2",
+ "android.hardware.common-V2-ndk",
+ "android.hardware.common.fmq-V1-ndk",
+ ],
+
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/AndroidTest.xml b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/AndroidTest.xml
new file mode 100644
index 0000000..3f9971b
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/AndroidTest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<configuration description="Runs VtsHalGraphicsComposer3_TargetTest.">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-native" />
+
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.StopServicesSetup">
+ </target_preparer>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="VtsHalGraphicsComposer3_TargetTest->/data/local/tmp/VtsHalGraphicsComposer3_TargetTest" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="VtsHalGraphicsComposer3_TargetTest" />
+ <option name="native-test-timeout" value="900000"/>
+ </test>
+</configuration>
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/OWNERS b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/OWNERS
new file mode 100644
index 0000000..d95d98d
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 199413815
+
+# Graphics team
+adyabr@google.com
+alecmouri@google.com
+ramindani@google.com
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
new file mode 100644
index 0000000..d892681
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -0,0 +1,106 @@
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/graphics/composer3/IComposer.h>
+#include <android-base/properties.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <binder/ProcessState.h>
+#include <gtest/gtest.h>
+#include <string>
+
+#pragma push_macro("LOG_TAG")
+#undef LOG_TAG
+#define LOG_TAG "VtsHalGraphicsComposer3_TargetTest"
+
+typedef uint64_t DisplayId;
+
+namespace aidl::android::hardware::graphics::composer3::vts {
+namespace {
+
+class VtsDisplay {
+ public:
+ VtsDisplay(DisplayId displayId, int32_t displayWidth, int32_t displayHeight)
+ : mDisplayId(displayId), mDisplayWidth(displayWidth), mDisplayHeight(displayHeight) {}
+
+ DisplayId get() const { return mDisplayId; }
+
+ void setDimensions(int32_t displayWidth, int32_t displayHeight) {
+ mDisplayWidth = displayWidth;
+ mDisplayHeight = displayHeight;
+ }
+
+ private:
+ const DisplayId mDisplayId;
+ int32_t mDisplayWidth;
+ int32_t mDisplayHeight;
+};
+
+class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
+ protected:
+ void SetUp() override {
+ std::string name = GetParam();
+ ndk::SpAIBinder binder(AServiceManager_waitForService(name.c_str()));
+ ASSERT_NE(binder, nullptr);
+ ASSERT_NO_FATAL_FAILURE(mComposer = IComposer::fromBinder(binder));
+ ASSERT_NE(mComposer, nullptr);
+ ASSERT_NO_FATAL_FAILURE(mComposer->createClient(&mComposerClient));
+ mInvalidDisplayId = GetInvalidDisplayId();
+ }
+
+ // returns an invalid display id (one that has not been registered to a
+ // display. Currently assuming that a device will never have close to
+ // std::numeric_limit<uint64_t>::max() displays registered while running tests
+ DisplayId GetInvalidDisplayId() {
+ uint64_t id = std::numeric_limits<uint64_t>::max();
+ while (id > 0) {
+ if (std::none_of(mDisplays.begin(), mDisplays.end(),
+ [&](const VtsDisplay& display) { return id == display.get(); })) {
+ return id;
+ }
+ id--;
+ }
+
+ return 0;
+ }
+
+ std::shared_ptr<IComposer> mComposer;
+ std::shared_ptr<IComposerClient> mComposerClient{};
+ DisplayId mInvalidDisplayId;
+ std::vector<VtsDisplay>
+ mDisplays; // TODO(b/202401906) populate all the displays available for test.
+};
+
+TEST_P(GraphicsComposerAidlTest, getDisplayCapabilitiesBadDisplay) {
+ std::vector<DisplayCapability> capabilities;
+ const auto error = mComposerClient->getDisplayCapabilities(mInvalidDisplayId, &capabilities);
+ EXPECT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+}
+
+TEST_P(GraphicsComposerAidlTest, getDisplayCapabilities) {
+ for (const auto& display : mDisplays) {
+ std::vector<DisplayCapability> capabilities;
+ const auto error = mComposerClient->getDisplayCapabilities(display.get(), &capabilities);
+
+ EXPECT_NE(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+ }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, GraphicsComposerAidlTest,
+ testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)),
+ ::android::PrintInstanceNameToString);
+} // namespace
+} // namespace aidl::android::hardware::graphics::composer3::vts
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+
+ using namespace std::chrono_literals;
+ if (!android::base::WaitForProperty("init.svc.surfaceflinger", "stopped", 10s)) {
+ ALOGE("Failed to stop init.svc.surfaceflinger");
+ return -1;
+ }
+ return RUN_ALL_TESTS();
+}
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index e18b1fa..2ab9c01 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -1482,6 +1482,18 @@
}
/**
+ * Test IMapper::get(Smpte2094_10)
+ */
+TEST_P(GraphicsMapperHidlTest, GetSmpte2094_10) {
+ testGet(mDummyDescriptorInfo, gralloc4::MetadataType_Smpte2094_10,
+ [](const IMapper::BufferDescriptorInfo& /*info*/, const hidl_vec<uint8_t>& vec) {
+ std::optional<std::vector<uint8_t>> smpte2094_10;
+ ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &smpte2094_10));
+ EXPECT_FALSE(smpte2094_10.has_value());
+ });
+}
+
+/**
* Test IMapper::get(metadata) with a bad buffer
*/
TEST_P(GraphicsMapperHidlTest, GetMetadataBadValue) {
@@ -1545,6 +1557,9 @@
ASSERT_EQ(Error::BAD_BUFFER,
mGralloc->get(bufferHandle, gralloc4::MetadataType_Smpte2094_40, &vec));
ASSERT_EQ(0, vec.size());
+ ASSERT_EQ(Error::BAD_BUFFER,
+ mGralloc->get(bufferHandle, gralloc4::MetadataType_Smpte2094_10, &vec));
+ ASSERT_EQ(0, vec.size());
}
/**
@@ -1937,6 +1952,20 @@
}
/**
+ * Test IMapper::set(Smpte2094_10)
+ */
+TEST_P(GraphicsMapperHidlTest, SetSmpte2094_10) {
+ hidl_vec<uint8_t> vec;
+
+ testSet(mDummyDescriptorInfo, gralloc4::MetadataType_Smpte2094_10, vec,
+ [&](const IMapper::BufferDescriptorInfo& /*info*/, const hidl_vec<uint8_t>& vec) {
+ std::optional<std::vector<uint8_t>> realSmpte2094_10;
+ ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10));
+ EXPECT_FALSE(realSmpte2094_10.has_value());
+ });
+}
+
+/**
* Test IMapper::set(metadata) with a bad buffer
*/
TEST_P(GraphicsMapperHidlTest, SetMetadataNullBuffer) {
@@ -1977,6 +2006,8 @@
ASSERT_EQ(Error::BAD_BUFFER, mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec));
ASSERT_EQ(Error::BAD_BUFFER,
mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2094_40, vec));
+ ASSERT_EQ(Error::BAD_BUFFER,
+ mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2094_10, vec));
}
/**
@@ -2482,6 +2513,24 @@
}
/**
+ * Test IMapper::getFromBufferDescriptorInfo(Smpte2094_10)
+ */
+TEST_P(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoSmpte2094_10) {
+ hidl_vec<uint8_t> vec;
+ auto err = mGralloc->getFromBufferDescriptorInfo(mDummyDescriptorInfo,
+ gralloc4::MetadataType_Smpte2094_10, &vec);
+ if (err == Error::UNSUPPORTED) {
+ GTEST_SUCCEED() << "setting this metadata is unsupported";
+ return;
+ }
+ ASSERT_EQ(err, Error::NONE);
+
+ std::optional<std::vector<uint8_t>> smpte2094_10;
+ ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &smpte2094_10));
+ EXPECT_FALSE(smpte2094_10.has_value());
+}
+
+/**
* Test IMapper::getFromBufferDescriptorInfo(metadata) for unsupported metadata
*/
TEST_P(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoUnsupportedMetadata) {
diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp
index 003b106..e793db6 100644
--- a/health/1.0/Android.bp
+++ b/health/1.0/Android.bp
@@ -20,4 +20,8 @@
],
gen_java: true,
gen_java_constants: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp
index ddd983d..fae25b6 100644
--- a/health/2.0/Android.bp
+++ b/health/2.0/Android.bp
@@ -22,4 +22,8 @@
"android.hidl.base@1.0",
],
gen_java: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.car.framework",
+ ],
}
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index 93fb19d..2c15823 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -3153,6 +3153,49 @@
}
/*
+ * EncryptionOperationsTest.AesCbcZeroInputSuccessb
+ *
+ * Verifies that keymaster generates correct output on zero-input with
+ * NonePadding mode
+ */
+TEST_P(EncryptionOperationsTest, AesCbcZeroInputSuccess) {
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .AesEncryptionKey(128)
+ .BlockMode(BlockMode::CBC)
+ .Padding(PaddingMode::NONE, PaddingMode::PKCS7)));
+
+ // Zero input message
+ string message = "";
+ for (auto padding : {PaddingMode::NONE, PaddingMode::PKCS7}) {
+ auto params = AuthorizationSetBuilder().BlockMode(BlockMode::CBC).Padding(padding);
+ AuthorizationSet out_params;
+ string ciphertext1 = EncryptMessage(message, params, &out_params);
+ HidlBuf iv1 = CopyIv(out_params);
+ if (padding == PaddingMode::NONE)
+ EXPECT_EQ(message.size(), ciphertext1.size()) << "PaddingMode: " << padding;
+ else
+ EXPECT_EQ(message.size(), ciphertext1.size() - 16) << "PaddingMode: " << padding;
+
+ out_params.Clear();
+
+ string ciphertext2 = EncryptMessage(message, params, &out_params);
+ HidlBuf iv2 = CopyIv(out_params);
+ if (padding == PaddingMode::NONE)
+ EXPECT_EQ(message.size(), ciphertext2.size()) << "PaddingMode: " << padding;
+ else
+ EXPECT_EQ(message.size(), ciphertext2.size() - 16) << "PaddingMode: " << padding;
+
+ // IVs should be random
+ EXPECT_NE(iv1, iv2) << "PaddingMode: " << padding;
+
+ params.push_back(TAG_NONCE, iv1);
+ string plaintext = DecryptMessage(ciphertext1, params);
+ EXPECT_EQ(message, plaintext) << "PaddingMode: " << padding;
+ }
+}
+
+/*
* EncryptionOperationsTest.AesCallerNonce
*
* Verifies that AES caller-provided nonces work correctly.
diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp
index b4b6f68..8ce96c4 100644
--- a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp
+++ b/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp
@@ -176,7 +176,10 @@
std::lock_guard guard(mMutex);
const int32_t slot = mMemoryIdToSlot.at(memory);
if (mBurstContext) {
- mBurstContext->freeMemory(slot);
+ const auto ret = mBurstContext->freeMemory(slot);
+ if (!ret.isOk()) {
+ LOG(ERROR) << "IBustContext::freeMemory failed: " << ret.description();
+ }
}
mMemoryIdToSlot.erase(memory);
mMemoryCache[slot] = {};
diff --git a/radio/1.0/vts/OWNERS b/radio/1.0/vts/OWNERS
index 9310f8e..117692a 100644
--- a/radio/1.0/vts/OWNERS
+++ b/radio/1.0/vts/OWNERS
@@ -1,7 +1,5 @@
-# Telephony team
-amitmahajan@google.com
+# Bug component: 20868
+jminjie@google.com
+sarahchin@google.com
shuoq@google.com
jackyu@google.com
-
-# VTS team
-dshi@google.com
diff --git a/radio/1.1/vts/OWNERS b/radio/1.1/vts/OWNERS
index a07c917..4d199ca 100644
--- a/radio/1.1/vts/OWNERS
+++ b/radio/1.1/vts/OWNERS
@@ -1 +1,2 @@
+# Bug component: 20868
include ../../1.0/vts/OWNERS
diff --git a/radio/1.2/vts/OWNERS b/radio/1.2/vts/OWNERS
index a07c917..4d199ca 100644
--- a/radio/1.2/vts/OWNERS
+++ b/radio/1.2/vts/OWNERS
@@ -1 +1,2 @@
+# Bug component: 20868
include ../../1.0/vts/OWNERS
diff --git a/radio/1.3/vts/OWNERS b/radio/1.3/vts/OWNERS
index a07c917..4d199ca 100644
--- a/radio/1.3/vts/OWNERS
+++ b/radio/1.3/vts/OWNERS
@@ -1 +1,2 @@
+# Bug component: 20868
include ../../1.0/vts/OWNERS
diff --git a/radio/1.4/vts/OWNERS b/radio/1.4/vts/OWNERS
index a07c917..4d199ca 100644
--- a/radio/1.4/vts/OWNERS
+++ b/radio/1.4/vts/OWNERS
@@ -1 +1,2 @@
+# Bug component: 20868
include ../../1.0/vts/OWNERS
diff --git a/radio/1.5/vts/OWNERS b/radio/1.5/vts/OWNERS
index a07c917..4d199ca 100644
--- a/radio/1.5/vts/OWNERS
+++ b/radio/1.5/vts/OWNERS
@@ -1 +1,2 @@
+# Bug component: 20868
include ../../1.0/vts/OWNERS
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index 63db370..e07d2ba 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -515,7 +515,8 @@
if (getRadioHalCapabilities()) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
- {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
+ {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
} else {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
@@ -537,7 +538,8 @@
if (getRadioHalCapabilities()) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
- {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
+ {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
} else {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
@@ -559,7 +561,8 @@
if (getRadioHalCapabilities()) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
- {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
+ {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
} else {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
@@ -580,7 +583,8 @@
if (getRadioHalCapabilities()) {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
- {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}));
+ {::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED,
+ ::android::hardware::radio::V1_6::RadioError::NONE}));
} else {
ASSERT_TRUE(CheckAnyOfErrors(
radioRsp_v1_6->rspInfo.error,
diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp
index 88bdc2e..c5a3a8b 100644
--- a/radio/aidl/Android.bp
+++ b/radio/aidl/Android.bp
@@ -137,7 +137,10 @@
vendor_available: true,
srcs: ["android/hardware/radio/sim/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: [
+ "android.hardware.radio",
+ "android.hardware.radio.config",
+ ],
backend: {
cpp: {
enabled: false,
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
index 85106b8..a48a89b 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
@@ -49,5 +49,5 @@
oneway void setNumOfLiveModems(in int serial, in byte numOfLiveModems);
oneway void setPreferredDataModem(in int serial, in byte modemId);
oneway void setResponseFunctions(in android.hardware.radio.config.IRadioConfigResponse radioConfigResponse, in android.hardware.radio.config.IRadioConfigIndication radioConfigIndication);
- oneway void setSimSlotsMapping(in int serial, in int[] slotMap);
+ oneway void setSimSlotsMapping(in int serial, in android.hardware.radio.config.SlotPortMapping[] slotMap);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl
new file mode 100644
index 0000000..2cfb8d0
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.config;
+@VintfStability
+parcelable SimPortInfo {
+ String iccId;
+ int logicalSlotId;
+ int portState;
+ const int PORT_STATE_INACTIVE = 0;
+ const int PORT_STATE_ACTIVE = 1;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl
index 3a716cf..60eabc7 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl
@@ -36,9 +36,7 @@
parcelable SimSlotStatus {
boolean cardActive;
int cardState;
- int slotState;
String atr;
- int logicalSlotId;
- String iccid;
String eid;
+ android.hardware.radio.config.SimPortInfo[] portInfo;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl
new file mode 100644
index 0000000..f38c421
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SlotPortMapping.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.config;
+@VintfStability
+parcelable SlotPortMapping {
+ int physicalSlotId;
+ int portId;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl
index 2d95b97..cf37a0d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl
@@ -40,10 +40,10 @@
int cdmaSubscriptionAppIndex;
int imsSubscriptionAppIndex;
android.hardware.radio.sim.AppStatus[] applications;
- int physicalSlotId;
String atr;
String iccid;
String eid;
+ android.hardware.radio.config.SlotPortMapping slotMap;
const int STATE_ABSENT = 0;
const int STATE_PRESENT = 1;
const int STATE_ERROR = 2;
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
index bfff16a..85c2cee 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
@@ -26,6 +26,7 @@
import android.hardware.radio.config.IRadioConfigIndication;
import android.hardware.radio.config.IRadioConfigResponse;
+import android.hardware.radio.config.SlotPortMapping;
@VintfStability
oneway interface IRadioConfig {
@@ -120,30 +121,57 @@
/**
* Set SIM Slot mapping.
*
- * Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem.
- * Physical slot is the actual physical slot. Request maps the physical slot to logical slot.
- * Logical slots that are already mapped to the requested physical slot are not impacted.
+ * Maps the logical slots to the SlotPortMapping which consist of both physical slot id and port
+ * id. Logical slot is the slot that is seen by modem. Physical slot is the actual physical
+ * slot. PortId is the id (enumerated value) for the associated port available on the SIM. Each
+ * physical slot can have multiple ports which enables multi-enabled profile(MEP). If eUICC
+ * physical slot supports 2 ports, then the portId is numbered 0,1 and if eUICC2 supports 4
+ * ports then the portID is numbered 0,1,2,3. Each portId is unique within a UICC physical slot
+ * but not necessarily unique across UICC’s. SEP(Single enabled profile) eUICC and non-eUICC
+ * will only have portId 0.
*
- * Example no. of logical slots 1 and physical slots 2:
- * The only logical slot (index 0) can be mapped to first physical slot (value 0) or second
- * physical slot(value 1), while the other physical slot remains unmapped and inactive.
- * slotMap[0] = 1 or slotMap[0] = 0
+ * Logical slots that are already mapped to the requested SlotPortMapping are not impacted.
*
- * Example no. of logical slots 2 and physical slots 2:
- * First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot
- * can be mapped to other physical slot. Each logical slot must be mapped to a physical slot.
- * slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0
+ * Example no. of logical slots 1 and physical slots 2 do not support MEP, each physical slot
+ * has one port:
+ * The only logical slot (index 0) can be mapped to first physical slot (value 0), port(index
+ * 0). or second
+ * physical slot(value 1), port (index 0), while the other physical slot remains unmapped and
+ * inactive.
+ * slotMap[0] = SlotPortMapping{0 //physical slot//, 0 //port//}
+ * slotMap[0] = SlotPortMapping{1 //physical slot//, 0 //port//}
+ *
+ * Example no. of logical slots 2 and physical slots 2 supports MEP with 2 ports available:
+ * Each logical slot must be mapped to a port (physical slot and port combination).
+ * First logical slot (index 0) can be mapped to physical slot 1 and the second logical slot
+ * can be mapped to either port from physical slot 2.
+ *
+ * slotMap[0] = SlotPortMapping{0, 0} and slotMap[1] = SlotPortMapping{1, 0} or
+ * slotMap[0] = SlotPortMapping{0, 0} and slotMap[1] = SlotPortMapping{1, 1}
+ *
+ * or the other way around, the second logical slot(index 1) can be mapped to physical slot 1
+ * and the first logical slot can be mapped to either port from physical slot 2.
+ *
+ * slotMap[1] = SlotPortMapping{0, 0} and slotMap[0] = SlotPortMapping{1, 0} or
+ * slotMap[1] = SlotPortMapping{0, 0} and slotMap[0] = SlotPortMapping{1, 1}
+ *
+ * another possible mapping is each logical slot maps to each port of physical slot 2 and there
+ * is no active logical modem mapped to physical slot 1.
+ *
+ * slotMap[0] = SlotPortMapping{1, 0} and slotMap[1] = SlotPortMapping{1, 1} or
+ * slotMap[0] = SlotPortMapping{1, 1} and slotMap[1] = SlotPortMapping{1, 0}
*
* @param serial Serial number of request
- * @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is
- * mapping to logical slot and value to physical slot, need to provide all the slots
- * mapping when sending request in case of multi slot device.
- * EX: uint32_t slotMap[logical slot] = physical slot
+ * @param slotMap Logical to physical slot and port mapping.
+ * Index is mapping to logical slot and value to physical slot and port id, need to
+ * provide all the slots mapping when sending request in case of multi slot device.
+ *
+ * EX: SlotPortMapping(physical slot, port id)
* index 0 is the first logical_slot number of logical slots is equal to number of Radio
* instances and number of physical slots is equal to size of slotStatus in
* getSimSlotsStatusResponse
*
* Response callback is IRadioConfigResponse.setSimSlotsMappingResponse()
*/
- void setSimSlotsMapping(in int serial, in int[] slotMap);
+ void setSimSlotsMapping(in int serial, in SlotPortMapping[] slotMap);
}
diff --git a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
new file mode 100644
index 0000000..78f1309
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.config;
+
+@VintfStability
+parcelable SimPortInfo {
+ /**
+ * Integrated Circuit Card IDentifier (ICCID) is unique identifier of the SIM card. File is
+ * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
+ * the ITU-T recommendation E.118 ISO/IEC 7816.
+ *
+ * This data is applicable only when cardState is CardStatus.STATE_PRESENT.
+ *
+ * This is the ICCID of the currently enabled profile. If no profile is enabled,
+ * then it will contain the default boot profile’s ICCID.
+ * If the EFiccid does not exist in the default boot profile, it will be null.
+ */
+ String iccId;
+ /**
+ * Logical slot id is identifier of the active slot
+ */
+ int logicalSlotId;
+ /*
+ * Port is Inactive
+ * Inactive means logical modem is no longer associated to the port
+ */
+ const int PORT_STATE_INACTIVE = 0;
+ /*
+ * Port is Active
+ * Active means logical modem is associated to the port
+ */
+ const int PORT_STATE_ACTIVE = 1;
+ /**
+ * Port state in the slot. Values are portState.[PORT_STATE_INACTIVE, PORT_STATE_ACTIVE].
+ */
+ int portState;
+}
diff --git a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
index f5ea8f9..4ab955a 100644
--- a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
+++ b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl
@@ -16,6 +16,8 @@
package android.hardware.radio.config;
+import android.hardware.radio.config.SimPortInfo;
+
@VintfStability
parcelable SimSlotStatus {
boolean cardActive;
@@ -25,10 +27,6 @@
*/
int cardState;
/**
- * Slot state Active/Inactive
- */
- int slotState;
- /**
* An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
* standards, following electrical reset of the card's chip. The ATR conveys information about
* the communication parameters proposed by the card, and the card's nature and state.
@@ -36,15 +34,6 @@
* This data is applicable only when cardState is CardStatus.STATE_PRESENT.
*/
String atr;
- int logicalSlotId;
- /**
- * Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is
- * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by
- * the ITU-T recommendation E.118 ISO/IEC 7816.
- *
- * This data is applicable only when cardState is CardStatus.STATE_PRESENT.
- */
- String iccid;
/**
* The EID is the eUICC identifier. The EID shall be stored within the ECASD and can be
* retrieved by the Device at any time using the standard GlobalPlatform GET DATA command.
@@ -53,4 +42,8 @@
* card supports eUICC.
*/
String eid;
+ /**
+ * PortInfo contains the ICCID, logical slot ID, and port state
+ */
+ SimPortInfo[] portInfo;
}
diff --git a/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl
new file mode 100644
index 0000000..3046d4f
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/config/SlotPortMapping.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.radio.config;
+
+@VintfStability
+parcelable SlotPortMapping {
+ /**
+ * Physical slot id is the index of the slots
+ **/
+ int physicalSlotId;
+ /**
+ * PortId is the id (enumerated value) for the associated port available on the SIM.
+ * Example:
+ * if eUICC1 supports 2 ports, then the portId is numbered 0,1.
+ * if eUICC2 supports 4 ports, then the portId is numbered: 0,1,2,3.
+ * Each portId is unique within a UICC, but not necessarily unique across UICC’s.
+ * SEP(Single enabled profile) eUICC and non-eUICC will only have portId 0.
+ **/
+ int portId;
+}
diff --git a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl
index 629f403..3098c4d 100644
--- a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl
+++ b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl
@@ -16,6 +16,7 @@
package android.hardware.radio.sim;
+import android.hardware.radio.config.SlotPortMapping;
import android.hardware.radio.sim.AppStatus;
import android.hardware.radio.sim.PinState;
@@ -61,7 +62,6 @@
* size <= RadioConst::CARD_MAX_APPS
*/
AppStatus[] applications;
- int physicalSlotId;
/**
* An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816
* standards, following electrical reset of the card's chip. The ATR conveys information about
@@ -86,4 +86,10 @@
* supports eUICC.
*/
String eid;
+ /* SlotPortMapping:
+ * SlotPortMapping consists of physical slot id and port id.
+ * Physical slot is the actual physical slot.
+ * PortId is the id (enumerated value) for the associated port available on the SIM.
+ */
+ SlotPortMapping slotMap;
}
diff --git a/radio/config/1.1/vts/OWNERS b/radio/config/1.1/vts/OWNERS
new file mode 100644
index 0000000..4109967
--- /dev/null
+++ b/radio/config/1.1/vts/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 20868
+include /radio/1.0/vts/OWNERS
diff --git a/radio/config/1.2/vts/OWNERS b/radio/config/1.2/vts/OWNERS
new file mode 100644
index 0000000..4109967
--- /dev/null
+++ b/radio/config/1.2/vts/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 20868
+include /radio/1.0/vts/OWNERS
diff --git a/renderscript/1.0/vts/functional/OWNERS b/renderscript/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..d785790
--- /dev/null
+++ b/renderscript/1.0/vts/functional/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 43047
+butlermichael@google.com
+dgross@google.com
+jeanluc@google.com
+miaowang@google.com
+xusongw@google.com
diff --git a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
index d7abf07..6f2f189 100644
--- a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
+++ b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
@@ -64,7 +64,9 @@
* attestation.
*/
TEST_P(DeviceUniqueAttestationTest, RsaNonStrongBoxUnimplemented) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -91,7 +93,9 @@
* attestation.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaNonStrongBoxUnimplemented) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -117,7 +121,9 @@
* attestation correctly, if implemented.
*/
TEST_P(DeviceUniqueAttestationTest, RsaDeviceUniqueAttestation) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -174,7 +180,9 @@
* attestation correctly, if implemented.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestation) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
@@ -226,7 +234,9 @@
* local device.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestationID) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
// Collection of valid attestation ID tags.
auto attestation_id_tags = AuthorizationSetBuilder();
@@ -292,7 +302,9 @@
* don't match the local device.
*/
TEST_P(DeviceUniqueAttestationTest, EcdsaDeviceUniqueAttestationMismatchID) {
- if (SecLevel() != SecurityLevel::STRONGBOX) return;
+ if (SecLevel() != SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to non-StrongBox device";
+ }
// Collection of invalid attestation ID tags.
auto attestation_id_tags =
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index fb720e8..37acfa9 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -1365,11 +1365,16 @@
att_hw_enforced[i].tag == TAG_VENDOR_PATCHLEVEL) {
std::string date =
std::to_string(att_hw_enforced[i].value.get<KeyParameterValue::integer>());
+
// strptime seems to require delimiters, but the tag value will
// be YYYYMMDD
+ if (date.size() != 8) {
+ ADD_FAILURE() << "Tag " << att_hw_enforced[i].tag
+ << " with invalid format (not YYYYMMDD): " << date;
+ return false;
+ }
date.insert(6, "-");
date.insert(4, "-");
- EXPECT_EQ(date.size(), 10);
struct tm time;
strptime(date.c_str(), "%Y-%m-%d", &time);
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index a90ee65..53d980d 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -69,8 +69,6 @@
namespace {
-bool check_patchLevels = false;
-
// The maximum number of times we'll attempt to verify that corruption
// of an ecrypted blob results in an error. Retries are necessary as there
// is a small (roughly 1/256) chance that corrupting ciphertext still results
@@ -529,14 +527,12 @@
EXPECT_TRUE(os_pl);
EXPECT_EQ(*os_pl, os_patch_level());
- if (check_patchLevels) {
- // Should include vendor and boot patchlevels.
- auto vendor_pl = auths.GetTagValue(TAG_VENDOR_PATCHLEVEL);
- EXPECT_TRUE(vendor_pl);
- EXPECT_EQ(*vendor_pl, vendor_patch_level());
- auto boot_pl = auths.GetTagValue(TAG_BOOT_PATCHLEVEL);
- EXPECT_TRUE(boot_pl);
- }
+ // Should include vendor and boot patchlevels.
+ auto vendor_pl = auths.GetTagValue(TAG_VENDOR_PATCHLEVEL);
+ EXPECT_TRUE(vendor_pl);
+ EXPECT_EQ(*vendor_pl, vendor_patch_level());
+ auto boot_pl = auths.GetTagValue(TAG_BOOT_PATCHLEVEL);
+ EXPECT_TRUE(boot_pl);
return auths;
}
@@ -1486,6 +1482,7 @@
.Authorization(TAG_TRUSTED_CONFIRMATION_REQUIRED)
.Authorization(TAG_UNLOCKED_DEVICE_REQUIRED)
.Authorization(TAG_CREATION_DATETIME, 1619621648000);
+
for (const KeyParameter& tag : extra_tags) {
SCOPED_TRACE(testing::Message() << "tag-" << tag);
vector<uint8_t> key_blob;
@@ -1524,19 +1521,19 @@
CheckedDeleteKey(&key_blob);
}
- // Device attestation IDs should be rejected for normal attestation requests; these fields
- // are only used for device unique attestation.
- auto invalid_tags = AuthorizationSetBuilder()
- .Authorization(TAG_ATTESTATION_ID_BRAND, "brand")
- .Authorization(TAG_ATTESTATION_ID_DEVICE, "device")
- .Authorization(TAG_ATTESTATION_ID_PRODUCT, "product")
- .Authorization(TAG_ATTESTATION_ID_SERIAL, "serial")
- .Authorization(TAG_ATTESTATION_ID_IMEI, "imei")
- .Authorization(TAG_ATTESTATION_ID_MEID, "meid")
- .Authorization(TAG_ATTESTATION_ID_MANUFACTURER, "manufacturer")
- .Authorization(TAG_ATTESTATION_ID_MODEL, "model");
+ // Collection of invalid attestation ID tags.
+ auto invalid_tags =
+ AuthorizationSetBuilder()
+ .Authorization(TAG_ATTESTATION_ID_BRAND, "bogus-brand")
+ .Authorization(TAG_ATTESTATION_ID_DEVICE, "devious-device")
+ .Authorization(TAG_ATTESTATION_ID_PRODUCT, "punctured-product")
+ .Authorization(TAG_ATTESTATION_ID_SERIAL, "suspicious-serial")
+ .Authorization(TAG_ATTESTATION_ID_IMEI, "invalid-imei")
+ .Authorization(TAG_ATTESTATION_ID_MEID, "mismatching-meid")
+ .Authorization(TAG_ATTESTATION_ID_MANUFACTURER, "malformed-manufacturer")
+ .Authorization(TAG_ATTESTATION_ID_MODEL, "malicious-model");
for (const KeyParameter& tag : invalid_tags) {
- SCOPED_TRACE(testing::Message() << "tag-" << tag);
+ SCOPED_TRACE(testing::Message() << "-incorrect-tag-" << tag);
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
AuthorizationSetBuilder builder =
@@ -1556,6 +1553,74 @@
}
/*
+ * NewKeyGenerationTest.EcdsaAttestationIdTags
+ *
+ * Verifies that creation of an attested ECDSA key includes various ID tags in the
+ * attestation extension.
+ */
+TEST_P(NewKeyGenerationTest, EcdsaAttestationIdTags) {
+ auto challenge = "hello";
+ auto app_id = "foo";
+ auto subject = "cert subj 2";
+ vector<uint8_t> subject_der(make_name_from_str(subject));
+ uint64_t serial_int = 0x1010;
+ vector<uint8_t> serial_blob(build_serial_blob(serial_int));
+ const AuthorizationSetBuilder base_builder =
+ AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .EcdsaSigningKey(EcCurve::P_256)
+ .Digest(Digest::NONE)
+ .AttestationChallenge(challenge)
+ .AttestationApplicationId(app_id)
+ .Authorization(TAG_CERTIFICATE_SERIAL, serial_blob)
+ .Authorization(TAG_CERTIFICATE_SUBJECT, subject_der)
+ .SetDefaultValidity();
+
+ // Various ATTESTATION_ID_* tags that map to fields in the attestation extension ASN.1 schema.
+ auto extra_tags = AuthorizationSetBuilder();
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_DEVICE, "ro.product.device");
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_SERIAL, "ro.serial");
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MANUFACTURER, "ro.product.manufacturer");
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+
+ for (const KeyParameter& tag : extra_tags) {
+ SCOPED_TRACE(testing::Message() << "tag-" << tag);
+ vector<uint8_t> key_blob;
+ vector<KeyCharacteristics> key_characteristics;
+ AuthorizationSetBuilder builder = base_builder;
+ builder.push_back(tag);
+ auto result = GenerateKey(builder, &key_blob, &key_characteristics);
+ if (result == ErrorCode::CANNOT_ATTEST_IDS) {
+ // Device ID attestation is optional; KeyMint may not support it at all.
+ continue;
+ }
+ ASSERT_EQ(result, ErrorCode::OK);
+ ASSERT_GT(key_blob.size(), 0U);
+
+ EXPECT_TRUE(ChainSignaturesAreValid(cert_chain_));
+ ASSERT_GT(cert_chain_.size(), 0);
+ verify_subject_and_serial(cert_chain_[0], serial_int, subject, /* self_signed = */ false);
+
+ AuthorizationSet hw_enforced = HwEnforcedAuthorizations(key_characteristics);
+ AuthorizationSet sw_enforced = SwEnforcedAuthorizations(key_characteristics);
+
+ // The attested key characteristics will not contain APPLICATION_ID_* fields (their
+ // spec definitions all have "Must never appear in KeyCharacteristics"), but the
+ // attestation extension should contain them, so make sure the extra tag is added.
+ hw_enforced.push_back(tag);
+
+ // Verifying the attestation record will check for the specific tag because
+ // it's included in the authorizations.
+ EXPECT_TRUE(verify_attestation_record(challenge, app_id, sw_enforced, hw_enforced,
+ SecLevel(), cert_chain_[0].encodedCertificate));
+
+ CheckedDeleteKey(&key_blob);
+ }
+}
+
+/*
* NewKeyGenerationTest.EcdsaAttestationTagNoApplicationId
*
* Verifies that creation of an attested ECDSA key does not include APPLICATION_ID.
@@ -1844,7 +1909,9 @@
* INVALID_ARGUMENT.
*/
TEST_P(NewKeyGenerationTest, EcdsaMismatchKeySize) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
auto result = GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_ALGORITHM, Algorithm::EC)
@@ -2071,7 +2138,9 @@
* Verifies that keymint rejects HMAC key generation with multiple specified digest algorithms.
*/
TEST_P(NewKeyGenerationTest, HmacMultipleDigests) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::UNSUPPORTED_DIGEST,
GenerateKey(AuthorizationSetBuilder()
@@ -2295,7 +2364,9 @@
* presented.
*/
TEST_P(SigningOperationsTest, NoUserConfirmation) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.RsaSigningKey(1024, 65537)
.Digest(Digest::NONE)
@@ -2385,7 +2456,9 @@
* for a 1024-bit key.
*/
TEST_P(SigningOperationsTest, RsaPssSha512TooSmallKey) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.RsaSigningKey(1024, 65537)
.Digest(Digest::SHA_2_512)
@@ -3204,7 +3277,9 @@
* Verifies that importing and using an ECDSA P-521 key pair works correctly.
*/
TEST_P(ImportKeyTest, Ecdsa521Success) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.EcdsaSigningKey(EcCurve::P_521)
@@ -3913,7 +3988,9 @@
* with a different digest than was used to encrypt.
*/
TEST_P(EncryptionOperationsTest, RsaOaepDecryptWithWrongDigest) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -4682,6 +4759,49 @@
}
/*
+ * EncryptionOperationsTest.AesCbcZeroInputSuccessb
+ *
+ * Verifies that keymaster generates correct output on zero-input with
+ * NonePadding mode
+ */
+TEST_P(EncryptionOperationsTest, AesCbcZeroInputSuccess) {
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .AesEncryptionKey(128)
+ .BlockMode(BlockMode::CBC)
+ .Padding(PaddingMode::NONE, PaddingMode::PKCS7)));
+
+ // Zero input message
+ string message = "";
+ for (auto padding : {PaddingMode::NONE, PaddingMode::PKCS7}) {
+ auto params = AuthorizationSetBuilder().BlockMode(BlockMode::CBC).Padding(padding);
+ AuthorizationSet out_params;
+ string ciphertext1 = EncryptMessage(message, params, &out_params);
+ vector<uint8_t> iv1 = CopyIv(out_params);
+ if (padding == PaddingMode::NONE)
+ EXPECT_EQ(message.size(), ciphertext1.size()) << "PaddingMode: " << padding;
+ else
+ EXPECT_EQ(message.size(), ciphertext1.size() - 16) << "PaddingMode: " << padding;
+
+ out_params.Clear();
+
+ string ciphertext2 = EncryptMessage(message, params, &out_params);
+ vector<uint8_t> iv2 = CopyIv(out_params);
+ if (padding == PaddingMode::NONE)
+ EXPECT_EQ(message.size(), ciphertext2.size()) << "PaddingMode: " << padding;
+ else
+ EXPECT_EQ(message.size(), ciphertext2.size() - 16) << "PaddingMode: " << padding;
+
+ // IVs should be random
+ EXPECT_NE(iv1, iv2) << "PaddingMode: " << padding;
+
+ params.push_back(TAG_NONCE, iv1);
+ string plaintext = DecryptMessage(ciphertext1, params);
+ EXPECT_EQ(message, plaintext) << "PaddingMode: " << padding;
+ }
+}
+
+/*
* EncryptionOperationsTest.AesCallerNonce
*
* Verifies that AES caller-provided nonces work correctly.
@@ -5784,7 +5904,9 @@
* Verifies that the max uses per boot tag works correctly with AES keys.
*/
TEST_P(MaxOperationsTest, TestLimitAes) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -5811,7 +5933,9 @@
* Verifies that the max uses per boot tag works correctly with RSA keys.
*/
TEST_P(MaxOperationsTest, TestLimitRsa) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -5842,7 +5966,9 @@
* Verifies that the usage count limit tag = 1 works correctly with AES keys.
*/
TEST_P(UsageCountLimitTest, TestSingleUseAes) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -5886,7 +6012,9 @@
* Verifies that the usage count limit tag > 1 works correctly with AES keys.
*/
TEST_P(UsageCountLimitTest, TestLimitedUseAes) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -5931,7 +6059,9 @@
* Verifies that the usage count limit tag = 1 works correctly with RSA keys.
*/
TEST_P(UsageCountLimitTest, TestSingleUseRsa) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -5975,7 +6105,9 @@
* Verifies that the usage count limit tag > 1 works correctly with RSA keys.
*/
TEST_P(UsageCountLimitTest, TestLimitUseRsa) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
@@ -6022,7 +6154,9 @@
* in hardware.
*/
TEST_P(UsageCountLimitTest, TestSingleUseKeyAndRollbackResistance) {
- if (SecLevel() == SecurityLevel::STRONGBOX) return;
+ if (SecLevel() == SecurityLevel::STRONGBOX) {
+ GTEST_SKIP() << "Test not applicable to StrongBox device";
+ }
auto error = GenerateKey(AuthorizationSetBuilder()
.RsaSigningKey(2048, 65537)
@@ -6031,38 +6165,39 @@
.Authorization(TAG_NO_AUTH_REQUIRED)
.Authorization(TAG_ROLLBACK_RESISTANCE)
.SetDefaultValidity());
- ASSERT_TRUE(error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE || error == ErrorCode::OK);
-
- if (error == ErrorCode::OK) {
- // Rollback resistance is supported by KeyMint, verify it is enforced in hardware.
- AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
- ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
- ASSERT_EQ(ErrorCode::OK, DeleteKey());
-
- // The KeyMint should also enforce single use key in hardware when it supports rollback
- // resistance.
- ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
- .Authorization(TAG_NO_AUTH_REQUIRED)
- .RsaSigningKey(1024, 65537)
- .NoDigestOrPadding()
- .Authorization(TAG_USAGE_COUNT_LIMIT, 1)
- .SetDefaultValidity()));
-
- // Check the usage count limit tag appears in the hardware authorizations.
- AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
- EXPECT_TRUE(hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U))
- << "key usage count limit " << 1U << " missing";
-
- string message = "1234567890123456";
- auto params = AuthorizationSetBuilder().NoDigestOrPadding();
-
- // First usage of RSA key should work.
- SignMessage(message, params);
-
- // Usage count limit tag is enforced by hardware. After using the key, the key blob
- // must be invalidated from secure storage (such as RPMB partition).
- EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::SIGN, params));
+ if (error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE) {
+ GTEST_SKIP() << "Rollback resistance not supported";
}
+
+ // Rollback resistance is supported by KeyMint, verify it is enforced in hardware.
+ ASSERT_EQ(ErrorCode::OK, error);
+ AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
+ ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
+ ASSERT_EQ(ErrorCode::OK, DeleteKey());
+
+ // The KeyMint should also enforce single use key in hardware when it supports rollback
+ // resistance.
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .RsaSigningKey(1024, 65537)
+ .NoDigestOrPadding()
+ .Authorization(TAG_USAGE_COUNT_LIMIT, 1)
+ .SetDefaultValidity()));
+
+ // Check the usage count limit tag appears in the hardware authorizations.
+ AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
+ EXPECT_TRUE(hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U))
+ << "key usage count limit " << 1U << " missing";
+
+ string message = "1234567890123456";
+ auto params = AuthorizationSetBuilder().NoDigestOrPadding();
+
+ // First usage of RSA key should work.
+ SignMessage(message, params);
+
+ // Usage count limit tag is enforced by hardware. After using the key, the key blob
+ // must be invalidated from secure storage (such as RPMB partition).
+ EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::SIGN, params));
}
INSTANTIATE_KEYMINT_AIDL_TEST(UsageCountLimitTest);
@@ -6139,24 +6274,25 @@
.Authorization(TAG_NO_AUTH_REQUIRED)
.Authorization(TAG_ROLLBACK_RESISTANCE)
.SetDefaultValidity());
- ASSERT_TRUE(error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE || error == ErrorCode::OK);
+ if (error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE) {
+ GTEST_SKIP() << "Rollback resistance not supported";
+ }
// Delete must work if rollback protection is implemented
- if (error == ErrorCode::OK) {
- AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
- ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
+ ASSERT_EQ(ErrorCode::OK, error);
+ AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
+ ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
- ASSERT_EQ(ErrorCode::OK, DeleteKey(true /* keep key blob */));
+ ASSERT_EQ(ErrorCode::OK, DeleteKey(true /* keep key blob */));
- string message = "12345678901234567890123456789012";
- AuthorizationSet begin_out_params;
- EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
- Begin(KeyPurpose::SIGN, key_blob_,
- AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE),
- &begin_out_params));
- AbortIfNeeded();
- key_blob_ = AidlBuf();
- }
+ string message = "12345678901234567890123456789012";
+ AuthorizationSet begin_out_params;
+ EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
+ Begin(KeyPurpose::SIGN, key_blob_,
+ AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE),
+ &begin_out_params));
+ AbortIfNeeded();
+ key_blob_ = AidlBuf();
}
/**
@@ -6173,21 +6309,22 @@
.Authorization(TAG_NO_AUTH_REQUIRED)
.Authorization(TAG_ROLLBACK_RESISTANCE)
.SetDefaultValidity());
- ASSERT_TRUE(error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE || error == ErrorCode::OK);
+ if (error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE) {
+ GTEST_SKIP() << "Rollback resistance not supported";
+ }
// Delete must work if rollback protection is implemented
- if (error == ErrorCode::OK) {
- AuthorizationSet enforced(SecLevelAuthorizations());
- ASSERT_TRUE(enforced.Contains(TAG_ROLLBACK_RESISTANCE));
+ ASSERT_EQ(ErrorCode::OK, error);
+ AuthorizationSet enforced(SecLevelAuthorizations());
+ ASSERT_TRUE(enforced.Contains(TAG_ROLLBACK_RESISTANCE));
- // Delete the key we don't care about the result at this point.
- DeleteKey();
+ // Delete the key we don't care about the result at this point.
+ DeleteKey();
- // Now create an invalid key blob and delete it.
- key_blob_ = AidlBuf("just some garbage data which is not a valid key blob");
+ // Now create an invalid key blob and delete it.
+ key_blob_ = AidlBuf("just some garbage data which is not a valid key blob");
- ASSERT_EQ(ErrorCode::OK, DeleteKey());
- }
+ ASSERT_EQ(ErrorCode::OK, DeleteKey());
}
/**
@@ -6202,7 +6339,10 @@
* credentials stored in Keystore/Keymint.
*/
TEST_P(KeyDeletionTest, DeleteAllKeys) {
- if (!arm_deleteAllKeys) return;
+ if (!arm_deleteAllKeys) {
+ GTEST_SKIP() << "Option --arm_deleteAllKeys not set";
+ return;
+ }
auto error = GenerateKey(AuthorizationSetBuilder()
.RsaSigningKey(2048, 65537)
.Digest(Digest::NONE)
@@ -6210,25 +6350,26 @@
.Authorization(TAG_NO_AUTH_REQUIRED)
.Authorization(TAG_ROLLBACK_RESISTANCE)
.SetDefaultValidity());
- ASSERT_TRUE(error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE || error == ErrorCode::OK);
+ if (error == ErrorCode::ROLLBACK_RESISTANCE_UNAVAILABLE) {
+ GTEST_SKIP() << "Rollback resistance not supported";
+ }
// Delete must work if rollback protection is implemented
- if (error == ErrorCode::OK) {
- AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
- ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
+ ASSERT_EQ(ErrorCode::OK, error);
+ AuthorizationSet hardwareEnforced(SecLevelAuthorizations());
+ ASSERT_TRUE(hardwareEnforced.Contains(TAG_ROLLBACK_RESISTANCE));
- ASSERT_EQ(ErrorCode::OK, DeleteAllKeys());
+ ASSERT_EQ(ErrorCode::OK, DeleteAllKeys());
- string message = "12345678901234567890123456789012";
- AuthorizationSet begin_out_params;
+ string message = "12345678901234567890123456789012";
+ AuthorizationSet begin_out_params;
- EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
- Begin(KeyPurpose::SIGN, key_blob_,
- AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE),
- &begin_out_params));
- AbortIfNeeded();
- key_blob_ = AidlBuf();
- }
+ EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
+ Begin(KeyPurpose::SIGN, key_blob_,
+ AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE),
+ &begin_out_params));
+ AbortIfNeeded();
+ key_blob_ = AidlBuf();
}
INSTANTIATE_KEYMINT_AIDL_TEST(KeyDeletionTest);
@@ -6301,7 +6442,7 @@
size_t i;
for (i = 0; i < max_operations; i++) {
- result = Begin(KeyPurpose::ENCRYPT, key_blob_, params, &out_params, op_handles[i]);
+ result = Begin(KeyPurpose::DECRYPT, key_blob_, params, &out_params, op_handles[i]);
if (ErrorCode::OK != result) {
break;
}
@@ -6309,12 +6450,12 @@
EXPECT_EQ(ErrorCode::TOO_MANY_OPERATIONS, result);
// Try again just in case there's a weird overflow bug
EXPECT_EQ(ErrorCode::TOO_MANY_OPERATIONS,
- Begin(KeyPurpose::ENCRYPT, key_blob_, params, &out_params));
+ Begin(KeyPurpose::DECRYPT, key_blob_, params, &out_params));
for (size_t j = 0; j < i; j++) {
EXPECT_EQ(ErrorCode::OK, Abort(op_handles[j]))
<< "Aboort failed for i = " << j << std::endl;
}
- EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, key_blob_, params, &out_params));
+ EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, key_blob_, params, &out_params));
AbortIfNeeded();
}
@@ -6677,10 +6818,6 @@
} else {
std::cout << "NOT dumping attestations" << std::endl;
}
- // TODO(drysdale): Remove this flag when available KeyMint devices comply with spec
- if (std::string(argv[i]) == "--check_patchLevels") {
- aidl::android::hardware::security::keymint::test::check_patchLevels = true;
- }
}
}
return RUN_ALL_TESTS();
diff --git a/thermal/1.0/vts/functional/OWNERS b/thermal/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..0c282a0
--- /dev/null
+++ b/thermal/1.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 623506
+wvw@google.com
diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp
index 8e83d06..4385461 100644
--- a/tv/tuner/aidl/default/Demux.cpp
+++ b/tv/tuner/aidl/default/Demux.cpp
@@ -343,6 +343,10 @@
}
void Demux::startFrontendInputLoop() {
+ ALOGD("[Demux] start frontend on demux");
+ // Stop current Frontend thread loop first, in case the user starts a new
+ // tuning before stopping current tuning.
+ stopFrontendInput();
mFrontendInputThreadRunning = true;
mFrontendInputThread = std::thread(&Demux::frontendInputThreadLoop, this);
}
diff --git a/vibrator/aidl/OWNERS b/vibrator/aidl/OWNERS
index 4bd5614..e3d7e6b 100644
--- a/vibrator/aidl/OWNERS
+++ b/vibrator/aidl/OWNERS
@@ -1,4 +1,3 @@
+include platform/frameworks/base:/services/core/java/com/android/server/vibrator/OWNERS
chasewu@google.com
leungv@google.com
-lsandrade@google.com
-michaelwr@google.com
diff --git a/weaver/1.0/vts/functional/OWNERS b/weaver/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..ec8c304
--- /dev/null
+++ b/weaver/1.0/vts/functional/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 186411
+chengyouho@google.com
+frankwoo@google.com
diff --git a/wifi/1.0/vts/OWNERS b/wifi/1.0/vts/OWNERS
index cf81c79..287152d 100644
--- a/wifi/1.0/vts/OWNERS
+++ b/wifi/1.0/vts/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 33618
arabawy@google.com
etancohen@google.com
diff --git a/wifi/1.1/vts/OWNERS b/wifi/1.1/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/1.1/vts/OWNERS
+++ b/wifi/1.1/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/1.2/vts/OWNERS b/wifi/1.2/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/1.2/vts/OWNERS
+++ b/wifi/1.2/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/1.3/vts/OWNERS b/wifi/1.3/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/1.3/vts/OWNERS
+++ b/wifi/1.3/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/1.4/vts/OWNERS b/wifi/1.4/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/1.4/vts/OWNERS
+++ b/wifi/1.4/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/1.5/default/wifi.cpp b/wifi/1.5/default/wifi.cpp
index b9f20a4..a85b242 100644
--- a/wifi/1.5/default/wifi.cpp
+++ b/wifi/1.5/default/wifi.cpp
@@ -131,8 +131,14 @@
WifiStatus wifi_status =
createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error);
for (const auto& callback : event_cb_handler_.getCallbacks()) {
+ LOG(INFO) << "Attempting to invoke onSubsystemRestart "
+ "callback";
if (!callback->onSubsystemRestart(wifi_status).isOk()) {
- LOG(ERROR) << "Failed to invoke onFailure callback";
+ LOG(ERROR)
+ << "Failed to invoke onSubsystemRestart callback";
+ } else {
+ LOG(INFO) << "Succeeded to invoke onSubsystemRestart "
+ "callback";
}
}
};
diff --git a/wifi/1.5/vts/OWNERS b/wifi/1.5/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/1.5/vts/OWNERS
+++ b/wifi/1.5/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/hostapd/1.0/vts/OWNERS b/wifi/hostapd/1.0/vts/OWNERS
index cf81c79..287152d 100644
--- a/wifi/hostapd/1.0/vts/OWNERS
+++ b/wifi/hostapd/1.0/vts/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 33618
arabawy@google.com
etancohen@google.com
diff --git a/wifi/hostapd/1.1/vts/OWNERS b/wifi/hostapd/1.1/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/hostapd/1.1/vts/OWNERS
+++ b/wifi/hostapd/1.1/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/hostapd/1.2/vts/OWNERS b/wifi/hostapd/1.2/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/hostapd/1.2/vts/OWNERS
+++ b/wifi/hostapd/1.2/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/hostapd/1.3/vts/OWNERS b/wifi/hostapd/1.3/vts/OWNERS
index cf81c79..294fc82 100644
--- a/wifi/hostapd/1.3/vts/OWNERS
+++ b/wifi/hostapd/1.3/vts/OWNERS
@@ -1,2 +1,2 @@
-arabawy@google.com
-etancohen@google.com
+# Bug component: 33618
+include ../../1.0/vts/OWNERS
diff --git a/wifi/offload/1.0/vts/OWNERS b/wifi/offload/1.0/vts/OWNERS
new file mode 100644
index 0000000..287152d
--- /dev/null
+++ b/wifi/offload/1.0/vts/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 33618
+arabawy@google.com
+etancohen@google.com
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index 8cb7e22..114fe4f 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -317,7 +317,7 @@
}
bool waitForFrameworkReady() {
- int waitCount = 10;
+ int waitCount = 15;
do {
// Check whether package service is ready or not.
if (!testing::checkSubstringInCommandOutput(