From 1a207ebc243aaf4da3b039d78e03fc188cf74290 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 18 Nov 2022 11:39:28 -0800 Subject: [PATCH 001/962] Update properties and FakeVehicleHardware to support multi-display Bug: 255430764 Test: atest CarPropertyManagerTest Test: atest FakeVehicleHardwareTest Change-Id: I7e3db2e9e7e0cb58588b11d064e1fa14f2007a2a --- .../config/DefaultProperties.json | 278 +++++++++++++++--- .../hardware/include/FakeVehicleHardware.h | 4 +- .../hardware/src/FakeVehicleHardware.cpp | 45 ++- .../hardware/test/FakeVehicleHardwareTest.cpp | 131 ++++++--- 4 files changed, 346 insertions(+), 112 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 50e242819c..4b2c75c71b 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1329,22 +1329,26 @@ }, { "property": "VehicleProperty::SEAT_OCCUPANCY", + "defaultValue": { + "int32Values": [ + "VehicleSeatOccupancyState::VACANT" + ] + }, "areas": [ { - "defaultValue": { - "int32Values": [ - "VehicleSeatOccupancyState::VACANT" - ] - }, "areaId": "Constants::SEAT_1_LEFT" }, { - "defaultValue": { - "int32Values": [ - "VehicleSeatOccupancyState::VACANT" - ] - }, "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1854,7 +1858,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1867,7 +1883,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ], "configArray": [ @@ -1918,7 +1946,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1931,7 +1971,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1944,7 +1996,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1957,7 +2021,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1970,7 +2046,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1983,7 +2071,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2009,7 +2109,27 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL", + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_CENTER", "minInt32Value": 1, "maxInt32Value": 7 } @@ -2024,7 +2144,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2043,7 +2175,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2064,6 +2208,21 @@ "areaId": "Constants::SEAT_1_RIGHT", "minInt32Value": 0, "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": 0, + "maxInt32Value": 3 } ], "comment": "0 is off and +ve values indicate ventilation level." @@ -2101,6 +2260,21 @@ "areaId": "Constants::SEAT_1_RIGHT", "minInt32Value": -2, "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -2, + "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -2, + "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -2, + "maxInt32Value": 2 } ], "comment": "+ve values for heating and -ve for cooling" @@ -2122,45 +2296,59 @@ }, { "property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT", + "defaultValue": { + "floatValues": [ + 19.1 + ] + }, "areas": [ { - "defaultValue": { - "floatValues": [ - 17.3 - ] - }, - "areaId": 49 + "areaId": "Constants::SEAT_1_LEFT" }, { - "defaultValue": { - "floatValues": [ - 19.1 - ] - }, - "areaId": 68 + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, { "property": "VehicleProperty::HVAC_TEMPERATURE_SET", + "defaultValue": { + "floatValues": [ + 17.0 + ] + }, "areas": [ { - "defaultValue": { - "floatValues": [ - 16.0 - ] - }, - "areaId": 49, + "areaId": "Constants::SEAT_1_LEFT", "minFloatValue": 16.0, "maxFloatValue": 28.0 }, { - "defaultValue": { - "floatValues": [ - 20.0 - ] - }, - "areaId": 68, + "areaId": "Constants::SEAT_1_RIGHT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_CENTER", "minFloatValue": 16.0, "maxFloatValue": 28.0 } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 956c7c00fe..6fd2367957 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -194,7 +194,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; ValueResultType getEchoReverseBytes( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; - bool isHvacPropAndHvacNotAvailable(int32_t propId) const; + bool isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const; std::unordered_map loadConfigDeclarations(); @@ -236,7 +236,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); std::string genFakeDataCommand(const std::vector& options); - void sendHvacPropertiesCurrentValues(); + void sendHvacPropertiesCurrentValues(int32_t areaId); static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index a9dced9f3a..a1b8d203ac 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -295,16 +295,27 @@ VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropVal return {}; } -bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) const { +bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const { std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), std::end(HVAC_POWER_PROPERTIES)); if (powerProps.count(propId)) { - auto hvacPowerOnResult = - mServerSidePropStore->readValue(toInt(VehicleProperty::HVAC_POWER_ON), HVAC_ALL); - - if (hvacPowerOnResult.ok() && hvacPowerOnResult.value()->value.int32Values.size() == 1 && - hvacPowerOnResult.value()->value.int32Values[0] == 0) { - return true; + auto hvacPowerOnResults = + mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_POWER_ON)); + if (!hvacPowerOnResults.ok()) { + ALOGW("failed to get HVAC_POWER_ON 0x%x, error: %s", + toInt(VehicleProperty::HVAC_POWER_ON), getErrorMsg(hvacPowerOnResults).c_str()); + return false; + } + auto& hvacPowerOnValues = hvacPowerOnResults.value(); + for (size_t j = 0; j < hvacPowerOnValues.size(); j++) { + auto hvacPowerOnValue = std::move(hvacPowerOnValues[j]); + if ((hvacPowerOnValue->areaId & areaId) == areaId) { + if (hvacPowerOnValue->value.int32Values.size() == 1 && + hvacPowerOnValue->value.int32Values[0] == 0) { + return true; + } + break; + } } } return false; @@ -366,7 +377,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( return getUserHalProp(value); } - if (isHvacPropAndHvacNotAvailable(propId)) { + if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; } @@ -413,7 +424,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getEchoReverseBytes( return std::move(gotValue); } -void FakeVehicleHardware::sendHvacPropertiesCurrentValues() { +void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) { for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { int powerPropId = HVAC_POWER_PROPERTIES[i]; auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId); @@ -425,11 +436,13 @@ void FakeVehicleHardware::sendHvacPropertiesCurrentValues() { auto& powerPropValues = powerPropResults.value(); for (size_t j = 0; j < powerPropValues.size(); j++) { auto powerPropValue = std::move(powerPropValues[j]); - powerPropValue->status = VehiclePropertyStatus::AVAILABLE; - powerPropValue->timestamp = elapsedRealtimeNano(); - // This will trigger a property change event for the current hvac property value. - mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, - VehiclePropertyStore::EventMode::ALWAYS); + if ((powerPropValue->areaId & areaId) == powerPropValue->areaId) { + powerPropValue->status = VehiclePropertyStatus::AVAILABLE; + powerPropValue->timestamp = elapsedRealtimeNano(); + // This will trigger a property change event for the current hvac property value. + mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); + } } } } @@ -449,10 +462,10 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu value.value.int32Values[0] == 1) { // If we are turning HVAC power on, send current hvac property values through on change // event. - sendHvacPropertiesCurrentValues(); + sendHvacPropertiesCurrentValues(value.areaId); } - if (isHvacPropAndHvacNotAvailable(propId)) { + if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 67b1aa4c9c..7a59e9e384 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1142,67 +1142,100 @@ TEST_F(FakeVehicleHardwareTest, testSetVehicleMapService) { } TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); - - ASSERT_EQ(status, StatusCode::OK); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + for (int powerDependentAreaId : seatAreaIds) { + auto getValueResult = getValue(VehiclePropValue{ + .prop = powerPropId, + .areaId = powerDependentAreaId, + }); - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - auto getValueResult = getValue(VehiclePropValue{ - .prop = powerPropId, - .areaId = HVAC_ALL, - }); + if (areaId == powerDependentAreaId) { + EXPECT_FALSE(getValueResult.ok()); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + } else { + EXPECT_TRUE(getValueResult.ok()); + } + } + } - EXPECT_FALSE(getValueResult.ok()); - EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence + // on this value from any power dependent property values other than those with the same + // areaId. + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); - - ASSERT_EQ(status, StatusCode::OK); - - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - status = setValue(VehiclePropValue{ - .prop = powerPropId, - .areaId = HVAC_ALL, - }); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + for (int powerDependentAreaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = powerPropId, + .areaId = powerDependentAreaId, + .value.int32Values = {1}}); + + if (areaId == powerDependentAreaId) { + EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + } else { + EXPECT_EQ(status, StatusCode::OK); + } + } + } - EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence + // on this value from any power dependent property values other than those with the same + // areaId. + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); - - ASSERT_EQ(status, StatusCode::OK); - - clearChangedProperties(); - - status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {1}}); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + clearChangedProperties(); + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); + + auto events = getChangedProperties(); + // If we turn HVAC power on, we expect to receive one property event for every HVAC prop + // areas plus one event for HVAC_POWER_ON. + std::vector changedPropIds; + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); + } + changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); - auto events = getChangedProperties(); - // If we turn HVAC power on, we expect to receive one property event for every HVAC prop areas - // plus one event for HVAC_POWER_ON. - std::vector changedPropIds; - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); - } - changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); - ASSERT_EQ(events.size(), changedPropIds.size()); - for (const auto& event : events) { - EXPECT_EQ(event.areaId, HVAC_ALL); - EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + for (const auto& event : events) { + EXPECT_EQ(event.areaId, areaId); + EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + } } } -- GitLab From b9748bad632e92d36f70c8800d388c5f48a7924c Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Wed, 15 Feb 2023 12:48:45 -0800 Subject: [PATCH 002/962] Add PASSENGER_DISPLAY_BRIGHTNESS property - DISPLAY_BRIGHTNESS can send a brightness to be applied on one display. - On multi-display devices, brightness of each display should be communicated separately to VHAL. - PASSENGER_DISPLAY_BRIGHTNESS is added to serve that purpose. Bug: 269186221 Test: build okay Change-Id: I749ecd451afc4f24039f6e594860f1cb0fcf3509 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 36 +++++++++++++++++-- 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index fbd1a3321d..49a950461c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyAccess::READ}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 291fa204b9..d9dfa2b4a2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 3395458ea6..7be8399735 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -111,6 +111,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index e74942f77a..9acffd0e20 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -111,6 +111,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index b075993418..5d3e12ce5e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -117,6 +117,7 @@ enum VehicleProperty { AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475073 */, AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409538 */, DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409539 */, + PER_DISPLAY_BRIGHTNESS = (((0x0A04 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475076 */, HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475088 */, HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004177 */, HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004178 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 267b3dc26d..bf0a71f363 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1252,9 +1252,16 @@ enum VehicleProperty { AP_POWER_BOOTUP_REASON = 0x0A02 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** - * Property to represent brightness of the display. Some cars have single - * control for the brightness of all displays and this property is to share - * change in that control. + * Property to represent brightness of the display. + * + * Some cars have single control for the brightness of all displays and this + * property is to share change in that control. In cars which have displays + * whose brightness is controlled separately, they must use + * PER_DISPLAY_BRIGHTNESS. + * + * Only one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be + * implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by + * AAOS. * * If this is writable, android side can set this value when user changes * display brightness from Settings. If this is read only, user may still @@ -1266,6 +1273,29 @@ enum VehicleProperty { */ DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Property to represent brightness of the displays which are controlled separately. + * + * Some cars have one or more displays whose brightness is controlled + * separately and this property is to inform the brightness of each + * passenger display. In cars where all displays' brightness is controlled + * together, they must use DISPLAY_BRIGHTNESS. + * + * Only one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be + * implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by + * AAOS. + * + * The display port uniquely identifies a physical connector on the device + * for display output, ranging from 0 to 255. + * + * int32Values[0] : display port + * int32Values[1] : brightness + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + PER_DISPLAY_BRIGHTNESS = 0x0A04 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC /** * Property to feed H/W input events to android * -- GitLab From eb47a4729e339645d3e4f7c3701a37a18d30639f Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Wed, 15 Feb 2023 13:19:16 -0800 Subject: [PATCH 003/962] Added Vendor Error Properties Bug: 269501288 Test: atest android.car.apitest.CarPropertyManagerTest Test: atest FakeVehicleHardwareTest Change-Id: Ia5ec83c750095774fe409edd6e3f2f6072987b9c --- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../aidl/impl/default_config/config/TestProperties.json | 5 +++++ .../impl/fake_impl/hardware/src/FakeVehicleHardware.cpp | 9 ++++++++- .../fake_impl/hardware/test/FakeVehicleHardwareTest.cpp | 5 +++++ .../aidl/impl/utils/test/include/TestPropertyUtils.h | 7 +++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 0111c6bc03..3b2aa8cdd2 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -127,6 +127,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES // Following are test properties: {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES}, + {"VENDOR_PROPERTY_ID", VENDOR_PROPERTY_ID}, {"kMixedTypePropertyForTest", kMixedTypePropertyForTest}, {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE}, {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json index 33c6cc2397..fd4b0026bd 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json @@ -181,6 +181,11 @@ "access": "VehiclePropertyAccess::READ_WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, + { + "property": "Constants::VENDOR_PROPERTY_ID", + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, { "property": "VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index a9dced9f3a..00ebdda372 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -85,7 +85,8 @@ constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/"; // overwrite the default configs. constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override"; constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config"; - +// The value to be returned if VENDOR_PROPERTY_ID is set as the property +constexpr int VENDOR_ERROR_CODE = 0x00ab0005; // A list of supported options for "--set" command. const std::unordered_set SET_PROP_OPTIONS = { // integer. @@ -389,6 +390,9 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( case ECHO_REVERSE_BYTES: *isSpecialValue = true; return getEchoReverseBytes(value); + case VENDOR_PROPERTY_ID: + *isSpecialValue = true; + return StatusError((StatusCode)VENDOR_ERROR_CODE); default: // Do nothing. break; @@ -469,6 +473,9 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu case OBD2_FREEZE_FRAME_CLEAR: *isSpecialValue = true; return mFakeObd2Frame->clearObd2FreezeFrames(value); + case VENDOR_PROPERTY_ID: + *isSpecialValue = true; + return StatusError((StatusCode)VENDOR_ERROR_CODE); #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES case toInt(VehicleProperty::CLUSTER_REPORT_STATE): diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 67b1aa4c9c..f3593aa59b 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -409,6 +409,11 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { continue; } + if (propId == VENDOR_PROPERTY_ID) { + // Ignore VENDOR_PROPERTY_ID, it has special logic. + continue; + } + if (isGlobalProp(propId)) { if (config.initialValue == RawPropValues{}) { addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h index e6ea6fef2e..14002884f5 100644 --- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h @@ -84,6 +84,13 @@ constexpr int32_t ECHO_REVERSE_BYTES = 0x2a12 | toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | toInt(testpropertyutils_impl::VehiclePropertyType::BYTES); +// This property is used for testing vendor error codes end to end. +// 0x21402a13 +constexpr int32_t VENDOR_PROPERTY_ID = 0x2a13 | + toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::INT32); + // This property is used for test purpose. End to end tests use this property to test set and get // method for MIXED type properties. constexpr int32_t kMixedTypePropertyForTest = -- GitLab From f68b9a270973151b7f78882db383d81c0c5a9145 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Wed, 15 Feb 2023 20:56:56 +0000 Subject: [PATCH 004/962] Wifi: Add support to query and use driver advertised interface combination Interface combinations in legacy-hal is predefined with 'WIFI_HAL_INTERFACE_COMBINATIONS' build flag. This change allows the WiFi HAL to request all the possible interface concurrency combinations via vendor HAL API, wifi_get_supported_iface_concurrency_matrix(). Thus build time dependency can be removed by querying the combination at runtime. Bug: 249351396 Change-Id: I3bc85ac013490949aab71a00f60028bf5daee68c Test: Build successfully Signed-off-by: Purushottam Kushwaha --- wifi/aidl/default/aidl_struct_util.cpp | 58 +++++++++++++++++++++ wifi/aidl/default/aidl_struct_util.h | 2 + wifi/aidl/default/wifi_chip.cpp | 31 +++++++++++ wifi/aidl/default/wifi_chip.h | 2 + wifi/aidl/default/wifi_legacy_hal.cpp | 8 +++ wifi/aidl/default/wifi_legacy_hal.h | 2 + wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + 7 files changed, 104 insertions(+) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index efd6598d62..d3cf7bf60a 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -3300,6 +3300,64 @@ uint32_t convertAidlChannelCategoryToLegacy(uint32_t aidl_channel_category_mask) return channel_category_mask; } +bool convertLegacyIfaceMaskToIfaceConcurrencyType(u32 mask, + std::vector* types) { + if (!mask) return false; + +#ifndef BIT +#define BIT(x) (1 << (x)) +#endif + if (mask & BIT(WIFI_INTERFACE_TYPE_STA)) types->push_back(IfaceConcurrencyType::STA); + if (mask & BIT(WIFI_INTERFACE_TYPE_AP)) types->push_back(IfaceConcurrencyType::AP); + if (mask & BIT(WIFI_INTERFACE_TYPE_AP_BRIDGED)) + types->push_back(IfaceConcurrencyType::AP_BRIDGED); + if (mask & BIT(WIFI_INTERFACE_TYPE_P2P)) types->push_back(IfaceConcurrencyType::P2P); + if (mask & BIT(WIFI_INTERFACE_TYPE_NAN)) types->push_back(IfaceConcurrencyType::NAN_IFACE); + + return true; +} + +bool convertLegacyIfaceCombinationsMatrixToChipMode( + legacy_hal::wifi_iface_concurrency_matrix& legacy_matrix, IWifiChip::ChipMode* chip_mode) { + if (!chip_mode) { + LOG(ERROR) << "chip_mode is null"; + return false; + } + *chip_mode = {}; + + int num_combinations = legacy_matrix.num_iface_combinations; + std::vector driver_Combinations_vec; + if (!num_combinations) { + LOG(ERROR) << "zero iface combinations"; + return false; + } + + for (int i = 0; i < num_combinations; i++) { + IWifiChip::ChipConcurrencyCombination chipComb; + std::vector limits; + wifi_iface_combination* comb = &legacy_matrix.iface_combinations[i]; + if (!comb->num_iface_limits) continue; + for (u32 j = 0; j < comb->num_iface_limits; j++) { + IWifiChip::ChipConcurrencyCombinationLimit chipLimit; + chipLimit.maxIfaces = comb->iface_limits[j].max_limit; + std::vector types; + if (!convertLegacyIfaceMaskToIfaceConcurrencyType(comb->iface_limits[j].iface_mask, + &types)) { + LOG(ERROR) << "Failed to convert from iface_mask:" + << comb->iface_limits[j].iface_mask; + return false; + } + chipLimit.types = types; + limits.push_back(chipLimit); + } + chipComb.limits = limits; + driver_Combinations_vec.push_back(chipComb); + } + + chip_mode->availableCombinations = driver_Combinations_vec; + return true; +} + } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 904ba81ad1..208b7344da 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -67,6 +67,8 @@ bool convertLegacyRadioCombinationsMatrixToAidl( WifiRadioCombinationMatrix* aidl_matrix); WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); +bool convertLegacyIfaceCombinationsMatrixToChipMode( + legacy_hal::wifi_iface_concurrency_matrix& legacy_matrix, IWifiChip::ChipMode* chip_mode); // STA iface conversion methods. bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index b4c2ccdbb9..bb3eaf0dad 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -377,6 +377,35 @@ WifiChip::WifiChip(int32_t chip_id, bool is_primary, debug_ring_buffer_cb_registered_(false), subsystemCallbackHandler_(handler) { setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); + using_dynamic_iface_combination_ = false; +} + +void WifiChip::retrieveDynamicIfaceCombination() { + if (using_dynamic_iface_combination_) return; + + legacy_hal::wifi_iface_concurrency_matrix legacy_matrix; + legacy_hal::wifi_error legacy_status; + + std::tie(legacy_status, legacy_matrix) = + legacy_hal_.lock()->getSupportedIfaceConcurrencyMatrix(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get SupportedIfaceCombinations matrix from legacy HAL: " + << legacyErrorToString(legacy_status); + return; + } + + IWifiChip::ChipMode aidl_chip_mode; + if (!aidl_struct_util::convertLegacyIfaceCombinationsMatrixToChipMode(legacy_matrix, + &aidl_chip_mode)) { + LOG(ERROR) << "Failed convertLegacyIfaceCombinationsMatrixToChipMode() "; + return; + } + + LOG(INFO) << "Reloading iface concurrency combination from driver"; + aidl_chip_mode.id = feature_flags::chip_mode_ids::kV3; + modes_.clear(); + modes_.push_back(aidl_chip_mode); + using_dynamic_iface_combination_ = true; } std::shared_ptr WifiChip::create( @@ -1509,6 +1538,8 @@ ndk::ScopedAStatus WifiChip::handleChipConfiguration( version_info.first.firmwareDescription.c_str()); property_set("vendor.wlan.driver.version", version_info.first.driverDescription.c_str()); } + // Get the driver supported interface combination. + retrieveDynamicIfaceCombination(); return ndk::ScopedAStatus::ok(); } diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index ff4ee9ce90..def5da0a6d 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -262,6 +262,7 @@ class WifiChip : public BnWifiChip { getSupportedRadioCombinationsMatrixInternal(); std::pair getWifiChipCapabilitiesInternal(); ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); + void retrieveDynamicIfaceCombination(); void setWeakPtr(std::weak_ptr ptr); int32_t chip_id_; @@ -283,6 +284,7 @@ class WifiChip : public BnWifiChip { // registration mechanism. Use this to check if we have already // registered a callback. bool debug_ring_buffer_cb_registered_; + bool using_dynamic_iface_combination_; aidl_callback_util::AidlCallbackHandler event_cb_handler_; std::weak_ptr weak_ptr_this_; diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index dbf5a68967..209670bc69 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1885,6 +1885,14 @@ wifi_error WifiLegacyHal::setMloMode(wifi_mlo_mode mode) { return global_func_table_.wifi_set_mlo_mode(global_handle_, mode); } +std::pair +WifiLegacyHal::getSupportedIfaceConcurrencyMatrix() { + wifi_iface_concurrency_matrix iface_concurrency_matrix; + wifi_error status = global_func_table_.wifi_get_supported_iface_concurrency_matrix( + global_handle_, &iface_concurrency_matrix); + return {status, iface_concurrency_matrix}; +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 1d59b17b8a..5168a8bccf 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -290,6 +290,7 @@ using ::WIFI_ERROR_UNINITIALIZED; using ::WIFI_ERROR_UNKNOWN; using ::wifi_gscan_capabilities; using ::wifi_hal_fn; +using ::wifi_iface_concurrency_matrix; using ::WIFI_INDOOR_CHANNEL; using ::wifi_information_element; using ::WIFI_INTERFACE_IBSS; @@ -779,6 +780,7 @@ class WifiLegacyHal { std::pair getWifiChipCapabilities(); wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); wifi_error setMloMode(wifi_mlo_mode mode); + std::pair getSupportedIfaceConcurrencyMatrix(); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 77d1cb5edc..b5196c9af6 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -178,6 +178,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_resume_request); populateStubFor(&hal_fn->wifi_set_scan_mode); populateStubFor(&hal_fn->wifi_set_mlo_mode); + populateStubFor(&hal_fn->wifi_get_supported_iface_concurrency_matrix); return true; } -- GitLab From 0b7c65255363ce0bfc52f753688152bf7396ae17 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Wed, 15 Feb 2023 15:42:22 -0800 Subject: [PATCH 005/962] Move thermal utils to hardware/interfaces Bug: b/269370789 Test: m Change-Id: I67d035271c177dfee88ac7272baa7cc9cdef3e00 --- thermal/utils/Android.bp | 38 +++ thermal/utils/ThermalHidlWrapper.cpp | 305 ++++++++++++++++++ .../include/thermalutils/ThermalHidlWrapper.h | 106 ++++++ thermal/utils/tests/Android.bp | 40 +++ .../utils/tests/ThermalHidlWrapperTest.cpp | 302 +++++++++++++++++ 5 files changed, 791 insertions(+) create mode 100644 thermal/utils/Android.bp create mode 100644 thermal/utils/ThermalHidlWrapper.cpp create mode 100644 thermal/utils/include/thermalutils/ThermalHidlWrapper.h create mode 100644 thermal/utils/tests/Android.bp create mode 100644 thermal/utils/tests/ThermalHidlWrapperTest.cpp diff --git a/thermal/utils/Android.bp b/thermal/utils/Android.bp new file mode 100644 index 0000000000..72e1e34f9d --- /dev/null +++ b/thermal/utils/Android.bp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_static { + name: "libthermalutils", + vendor_available: true, + export_include_dirs: ["include"], + srcs: [ + "ThermalHidlWrapper.cpp", + ], + + cflags: [ + "-Wall", + "-Werror", + ], + + shared_libs: [ + "android.hardware.thermal@2.0", + "android.hardware.thermal-V1-ndk", + ], +} diff --git a/thermal/utils/ThermalHidlWrapper.cpp b/thermal/utils/ThermalHidlWrapper.cpp new file mode 100644 index 0000000000..05a992a792 --- /dev/null +++ b/thermal/utils/ThermalHidlWrapper.cpp @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2023 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 "include/thermalutils/ThermalHidlWrapper.h" + +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace thermal { + +using ::android::hardware::Void; + +namespace { + +template +Return setFailureAndCallback(T _hidl_cb, hidl_vec data, std::string_view debug_msg) { + ThermalStatus status; + status.code = ThermalStatusCode::FAILURE; + status.debugMessage = debug_msg.data(); + _hidl_cb(status, data); + return Void(); +} + +template +Return setFailureAndCallback(T _hidl_cb, std::string_view debug_msg) { + ThermalStatus status; + status.code = ThermalStatusCode::FAILURE; + status.debugMessage = debug_msg.data(); + _hidl_cb(status); + return Void(); +} + +template +Return setInitFailureAndCallback(T _hidl_cb, hidl_vec data) { + return setFailureAndCallback( + _hidl_cb, data, "Thermal AIDL HAL client used by HIDL wrapper was not initialized"); +} + +template +Return setInitFailureAndCallback(T _hidl_cb) { + return setFailureAndCallback( + _hidl_cb, "Thermal AIDL HAL client used by HIDL wrapper was not initialized"); +} + +template +Return setUnsupportedFailureAndCallback(T _hidl_cb, hidl_vec data) { + return setFailureAndCallback(_hidl_cb, data, "Operation unsupported by Thermal HIDL wrapper"); +} + +TemperatureType_2_0 convertAidlTemperatureType(const TemperatureType& type) { + if (type < TemperatureType::CPU || type > TemperatureType::NPU) { + return TemperatureType_2_0::UNKNOWN; + } + return static_cast(type); +} + +CoolingType_2_0 convertAidlCoolingType(const CoolingType& type) { + if (type < CoolingType::FAN || type > CoolingType::COMPONENT) { + return CoolingType_2_0::COMPONENT; + } + return static_cast(type); +} + +Temperature_2_0 convertAidlTemperature(const Temperature& temperature) { + Temperature_2_0 t = Temperature_2_0{ + convertAidlTemperatureType(temperature.type), temperature.name, temperature.value, + static_cast(temperature.throttlingStatus)}; + return t; +} + +CoolingDevice_2_0 convertAidlCoolingDevice(const CoolingDevice& cooling_device) { + CoolingDevice_2_0 t = + CoolingDevice_2_0{convertAidlCoolingType(cooling_device.type), cooling_device.name, + static_cast(cooling_device.value)}; + return t; +} +TemperatureThreshold_2_0 convertAidlTemperatureThreshold(const TemperatureThreshold& threshold) { + TemperatureThreshold_2_0 t = + TemperatureThreshold_2_0{convertAidlTemperatureType(threshold.type), threshold.name, + threshold.hotThrottlingThresholds.data(), + threshold.coldThrottlingThresholds.data(), NAN}; + return t; +} + +} // namespace + +// Methods from ::android::hardware::thermal::V1_0::IThermal follow. +Return ThermalHidlWrapper::getTemperatures(getTemperatures_cb _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +Return ThermalHidlWrapper::getCpuUsages( + std::function&)> _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +Return ThermalHidlWrapper::getCoolingDevices( + std::function&)> _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +// Methods from ::android::hardware::thermal::V2_0::IThermal follow. +Return ThermalHidlWrapper::getCurrentTemperatures( + bool filterType, TemperatureType_2_0 type, + std::function&)> _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getTemperaturesWithType(static_cast(type), + &ret_aidl); + } else { + a_status = thermal_service_->getTemperatures(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& temperature : ret_aidl) { + ret.push_back(convertAidlTemperature(temperature)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::getTemperatureThresholds( + bool filterType, TemperatureType_2_0 type, + std::function&)> + _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getTemperatureThresholdsWithType( + static_cast(type), &ret_aidl); + } else { + a_status = thermal_service_->getTemperatureThresholds(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& threshold : ret_aidl) { + ret.push_back(convertAidlTemperatureThreshold(threshold)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::registerThermalChangedCallback( + const sp& callback, bool filterType, TemperatureType_2_0 type, + std::function _hidl_cb) { + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb); + } + if (callback == nullptr) { + setFailureAndCallback(_hidl_cb, "Invalid nullptr callback"); + return Void(); + } + std::lock_guard _lock(callback_wrappers_mutex_); + for (const auto& callback_wrapper : callback_wrappers_) { + if (::android::hardware::interfacesEqual(callback_wrapper->callback_2_0_.get(), + callback.get())) { + setFailureAndCallback(_hidl_cb, "The callback was already registered through wrapper"); + return Void(); + } + } + std::shared_ptr callback_wrapper = + ndk::SharedRefBase::make(callback); + ::ndk::ScopedAStatus a_status; + ThermalStatus status; + if (filterType) { + a_status = thermal_service_->registerThermalChangedCallbackWithType( + callback_wrapper, static_cast(type)); + } else { + a_status = thermal_service_->registerThermalChangedCallback(callback_wrapper); + } + if (a_status.isOk()) { + callback_wrappers_.push_back(callback_wrapper); + _hidl_cb(status); + } else { + setFailureAndCallback(_hidl_cb, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::unregisterThermalChangedCallback( + const sp& callback, + std::function _hidl_cb) { + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb); + } + if (callback == nullptr) { + setFailureAndCallback(_hidl_cb, "Invalid nullptr callback"); + return Void(); + } + std::lock_guard _lock(callback_wrappers_mutex_); + for (auto it = callback_wrappers_.begin(); it != callback_wrappers_.end(); it++) { + auto callback_wrapper = *it; + if (::android::hardware::interfacesEqual(callback_wrapper->callback_2_0_.get(), + callback.get())) { + ::ndk::ScopedAStatus a_status; + ThermalStatus status; + a_status = thermal_service_->unregisterThermalChangedCallback(callback_wrapper); + if (a_status.isOk()) { + callback_wrappers_.erase(it); + _hidl_cb(status); + } else { + setFailureAndCallback(_hidl_cb, a_status.getMessage()); + } + return Void(); + } + } + setFailureAndCallback(_hidl_cb, "The callback was not registered through wrapper before"); + return Void(); +} + +Return ThermalHidlWrapper::getCurrentCoolingDevices( + bool filterType, CoolingType_2_0 type, + std::function&)> _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getCoolingDevicesWithType(static_cast(type), + &ret_aidl); + } else { + a_status = thermal_service_->getCoolingDevices(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& cooling_device : ret_aidl) { + ret.push_back(convertAidlCoolingDevice(cooling_device)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +// Methods from ::android::hidl::base::V1_0::IBase follow. +Return ThermalHidlWrapper::debug(const hidl_handle& handle, + const hidl_vec& args) { + if (handle != nullptr && handle->numFds >= 1) { + int fd = handle->data[0]; + char** arr = new char*[args.size()]; + for (size_t i = 0; i < args.size(); i++) { + arr[i] = strdup(args[i].c_str()); + } + thermal_service_->dump(fd, (const char**)arr, args.size()); + } + return Void(); +} + +::ndk::ScopedAStatus ThermalHidlWrapper::IThermalChangedCallbackWrapper::notifyThrottling( + const Temperature& temperature) { + callback_2_0_->notifyThrottling(convertAidlTemperature(temperature)); + return ::ndk::ScopedAStatus::ok(); +} + +} // namespace thermal +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/thermal/utils/include/thermalutils/ThermalHidlWrapper.h b/thermal/utils/include/thermalutils/ThermalHidlWrapper.h new file mode 100644 index 0000000000..1fec10076f --- /dev/null +++ b/thermal/utils/include/thermalutils/ThermalHidlWrapper.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2023 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 +#include +#include +#include +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace thermal { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_handle; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; + +using IThermal_Aidl = ::aidl::android::hardware::thermal::IThermal; +using ::android::hardware::thermal::V1_0::CpuUsage; +using CoolingType_2_0 = ::android::hardware::thermal::V2_0::CoolingType; +using CoolingDevice_1_0 = ::android::hardware::thermal::V1_0::CoolingDevice; +using CoolingDevice_2_0 = ::android::hardware::thermal::V2_0::CoolingDevice; +using IThermal_2_0 = ::android::hardware::thermal::V2_0::IThermal; +using IThermalChangedCallback_2_0 = ::android::hardware::thermal::V2_0::IThermalChangedCallback; +using Temperature_1_0 = ::android::hardware::thermal::V1_0::Temperature; +using Temperature_2_0 = ::android::hardware::thermal::V2_0::Temperature; +using TemperatureType_2_0 = ::android::hardware::thermal::V2_0::TemperatureType; + +using ::android::hardware::thermal::V1_0::ThermalStatus; +using ::android::hardware::thermal::V1_0::ThermalStatusCode; + +using TemperatureThreshold_2_0 = ::android::hardware::thermal::V2_0::TemperatureThreshold; +using ThrottlingSeverity_2_0 = ::android::hardware::thermal::V2_0::ThrottlingSeverity; + +// This wrapper converts all Thermal HIDL 2.0 calls to AIDL calls and converts AIDL response to +// HIDL 2.0 response. +// +// For Thermal HIDL 1.0 calls, it returns unsupported error. +class ThermalHidlWrapper : public IThermal_2_0 { + public: + explicit ThermalHidlWrapper(::std::shared_ptr thermal_service) + : thermal_service_(std::move(thermal_service)) {} + + // Methods from ::android::hardware::thermal::V1_0::IThermal follow. + Return getTemperatures(getTemperatures_cb _hidl_cb) override; + Return getCpuUsages(getCpuUsages_cb _hidl_cb) override; + Return getCoolingDevices(getCoolingDevices_cb _hidl_cb) override; + + // Methods from ::android::hardware::thermal::V2_0::IThermal follow. + Return getCurrentTemperatures(bool filterType, TemperatureType_2_0 type, + getCurrentTemperatures_cb _hidl_cb) override; + Return getTemperatureThresholds(bool filterType, TemperatureType_2_0 type, + getTemperatureThresholds_cb _hidl_cb) override; + Return registerThermalChangedCallback( + const sp& callback, bool filterType, + TemperatureType_2_0 type, registerThermalChangedCallback_cb _hidl_cb) override; + Return unregisterThermalChangedCallback( + const sp& callback, + unregisterThermalChangedCallback_cb _hidl_cb) override; + Return getCurrentCoolingDevices(bool filterType, CoolingType_2_0 type, + getCurrentCoolingDevices_cb _hidl_cb) override; + + // Methods from ::android::hidl::base::V1_0::IBase follow. + Return debug(const hidl_handle& handle, const hidl_vec& args) override; + + private: + class IThermalChangedCallbackWrapper : public BnThermalChangedCallback { + public: + explicit IThermalChangedCallbackWrapper(const sp& callback_2_0) + : callback_2_0_(callback_2_0) {} + ::ndk::ScopedAStatus notifyThrottling(const Temperature& temperature) override; + sp callback_2_0_; + }; + + // Reference to thermal service. + ::std::shared_ptr thermal_service_; + // Mutex lock for read/write on callback wrappers. + std::mutex callback_wrappers_mutex_; + // All thermal changed callback wrappers registered. + ::std::vector> callback_wrappers_; +}; + +} // namespace thermal +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/thermal/utils/tests/Android.bp b/thermal/utils/tests/Android.bp new file mode 100644 index 0000000000..fd74e8b4e8 --- /dev/null +++ b/thermal/utils/tests/Android.bp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "ThermalHidlWrapperTest", + srcs: ["ThermalHidlWrapperTest.cpp"], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + shared_libs: [ + "libbinder_ndk", + "android.hardware.thermal@1.0", + "android.hardware.thermal@2.0", + "android.hardware.thermal-V1-ndk", + ], + static_libs: [ + "libthermalutils", + "libgtest", + ], + test_suites: [ + "device-tests", + ], +} diff --git a/thermal/utils/tests/ThermalHidlWrapperTest.cpp b/thermal/utils/tests/ThermalHidlWrapperTest.cpp new file mode 100644 index 0000000000..1723a1afa8 --- /dev/null +++ b/thermal/utils/tests/ThermalHidlWrapperTest.cpp @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2023 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 "thermal_hidl_wrapper_test" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::thermal { + +namespace { + +using ::android::sp; +using ::android::hardware::hidl_enum_range; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +using ::android::hardware::thermal::V1_0::ThermalStatus; +using ::android::hardware::thermal::V1_0::ThermalStatusCode; +using ::android::hardware::thermal::V2_0::CoolingDevice; +using ::android::hardware::thermal::V2_0::CoolingType; +using IThermal_2_0 = ::android::hardware::thermal::V2_0::IThermal; +using ::android::hardware::thermal::V2_0::IThermalChangedCallback; +using ::android::hardware::thermal::V2_0::Temperature; +using ::android::hardware::thermal::V2_0::TemperatureThreshold; +using ::android::hardware::thermal::V2_0::TemperatureType; +using ::android::hardware::thermal::V2_0::ThrottlingSeverity; + +constexpr char kCallbackNameNotifyThrottling[] = "notifyThrottling"; +static const Temperature kThrottleTemp = { + .type = TemperatureType::SKIN, + .name = "test temperature sensor", + .value = 98.6, + .throttlingStatus = ThrottlingSeverity::CRITICAL, +}; + +class ThermalCallbackArgs { + public: + Temperature temperature; +}; + +// Callback class for receiving thermal event notifications from main class +class ThermalCallback : public ::testing::VtsHalHidlTargetCallbackBase, + public IThermalChangedCallback { + public: + Return notifyThrottling(const Temperature& temperature) override { + ThermalCallbackArgs args; + args.temperature = temperature; + NotifyFromCallback(kCallbackNameNotifyThrottling, args); + return Void(); + } +}; + +// The main test class for THERMAL HIDL HAL 2.0. +class ThermalHidlWrapperTest : public ::testing::TestWithParam { + public: + void SetUp() override { + AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); + ASSERT_NE(binder, nullptr); + mThermal = sp::make(IThermal::fromBinder(ndk::SpAIBinder(binder))); + ASSERT_NE(mThermal, nullptr); + mThermalCallback = new (std::nothrow) ThermalCallback(); + ASSERT_NE(mThermalCallback, nullptr); + auto ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail if register again + ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + } + + void TearDown() override { + auto ret = mThermal->unregisterThermalChangedCallback( + mThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail if unregister again + ret = mThermal->unregisterThermalChangedCallback( + mThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + } + + protected: + sp mThermal; + sp mThermalCallback; +}; // class ThermalHidlWrapperTest + +// Test ThermalChangedCallback::notifyThrottling(). +// This just calls into and back from our local ThermalChangedCallback impl. +TEST_P(ThermalHidlWrapperTest, NotifyThrottlingTest) { + sp thermalCallback = new (std::nothrow) ThermalCallback(); + auto ret = thermalCallback->notifyThrottling(kThrottleTemp); + ASSERT_TRUE(ret.isOk()); + auto res = thermalCallback->WaitForCallback(kCallbackNameNotifyThrottling); + EXPECT_TRUE(res.no_timeout); + ASSERT_TRUE(res.args); + EXPECT_EQ(kThrottleTemp, res.args->temperature); +} + +// Test Thermal->registerThermalChangedCallback. +TEST_P(ThermalHidlWrapperTest, RegisterThermalChangedCallbackTest) { + // Expect to fail with same callback + auto ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail with null callback + ret = mThermal->registerThermalChangedCallback( + nullptr, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); }); + ASSERT_TRUE(ret.isOk()); + sp localThermalCallback = new (std::nothrow) ThermalCallback(); + // Expect to succeed with different callback + ret = mThermal->registerThermalChangedCallback( + localThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Remove the local callback + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail with null callback + ret = mThermal->unregisterThermalChangedCallback(nullptr, [](ThermalStatus status) { + EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); + }); + ASSERT_TRUE(ret.isOk()); +} + +// Test Thermal->unregisterThermalChangedCallback. +TEST_P(ThermalHidlWrapperTest, UnregisterThermalChangedCallbackTest) { + sp localThermalCallback = new (std::nothrow) ThermalCallback(); + // Expect to fail as the callback was not registered before + auto ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Register a local callback + ret = mThermal->registerThermalChangedCallback( + localThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to succeed with callback removed + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail as the callback has been unregistered already + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); +} + +// Sanity test for Thermal::getCurrentTemperatures(). +TEST_P(ThermalHidlWrapperTest, TemperatureTest) { + mThermal->getCurrentTemperatures(false, TemperatureType::SKIN, + [](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_LT(0u, temperatures[i].name.size()); + } + }); + auto types = hidl_enum_range(); + for (const auto& type : types) { + mThermal->getCurrentTemperatures( + true, type, [&type](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_EQ(type, temperatures[i].type); + EXPECT_LT(0u, temperatures[i].name.size()); + } + }); + } +} + +// Sanity test for Thermal::getTemperatureThresholds(). +TEST_P(ThermalHidlWrapperTest, TemperatureThresholdTest) { + mThermal->getTemperatureThresholds( + false, TemperatureType::SKIN, + [](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + }); + for (int i = static_cast(TemperatureType::UNKNOWN); + i <= static_cast(TemperatureType::POWER_AMPLIFIER); ++i) { + auto type = static_cast(i); + mThermal->getTemperatureThresholds( + true, type, + [&type](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_EQ(type, temperatures[i].type); + } + }); + } +} + +// Sanity test for Thermal::getCurrentCoolingDevices(). +TEST_P(ThermalHidlWrapperTest, CoolingDeviceTest) { + mThermal->getCurrentCoolingDevices( + false, CoolingType::CPU, + [](ThermalStatus status, hidl_vec cooling_devices) { + if (cooling_devices.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < cooling_devices.size(); ++i) { + EXPECT_LT(0u, cooling_devices[i].name.size()); + } + }); + for (int i = 0; i <= static_cast(CoolingType::COMPONENT); ++i) { + auto type = static_cast(i); + mThermal->getCurrentCoolingDevices( + true, type, [&type](ThermalStatus status, hidl_vec cooling_devices) { + if (cooling_devices.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < cooling_devices.size(); ++i) { + EXPECT_EQ(type, cooling_devices[i].type); + EXPECT_LT(0u, cooling_devices[i].name.size()); + } + }); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalHidlWrapperTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, ThermalHidlWrapperTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IThermal::descriptor)), + ::android::hardware::PrintInstanceNameToString); + +} // namespace + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} + +} // namespace aidl::android::hardware::thermal -- GitLab From c48b3aed3e4f2211fb601948d99c48af24dcf7d7 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 2 Feb 2023 01:10:33 +0000 Subject: [PATCH 006/962] Added CRUISE_CONTROL_TARGET_SPEED to HAL layer. Bug: 266861469 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ie156bf9df65024bc39e4a1cd40fa870aa69d3a57 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 45 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 1d2d910031..7d2c6b1743 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -263,6 +263,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 613636e81c..21cdf225cf 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -263,6 +263,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index f83f1c260e..90c66820ab 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -255,6 +255,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f0642fe379..b02906514d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -255,6 +255,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index a0e811579a..c383b99b37 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3207,6 +3207,21 @@ } ] }, + { + "property": "VehicleProperty::CRUISE_CONTROL_TARGET_SPEED", + "defaultValue": { + "floatValues": [ + 25.0 + ] + }, + "areas": [ + { + "areaId": 0, + "minFloatValue": 20.0, + "maxFloatValue": 35.0 + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index bbec4bf595..7aac30bcde 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -261,6 +261,7 @@ enum VehicleProperty { CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, + CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 68a1e324ee..cdeed851a3 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3930,6 +3930,25 @@ enum VehicleProperty { CRUISE_CONTROL_COMMAND = 0x1012 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Current target speed for Cruise Control (CC). + * + * OEMs should set the minInt32Value and maxInt32Value values for this property to define the + * min and max target speed values. These values must be non-negative. + * + * The maxFloatValue represents the upper bound of the target speed. + * The minFloatValue represents the lower bound of the target speed. + * + * When this property is not available (for example when CRUISE_CONTROL_ENABLED is false), it + * should return StatusCode.NOT_AVAILABLE_DISABLED. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:METER_PER_SEC + */ + CRUISE_CONTROL_TARGET_SPEED = + 0x1013 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index efbcf47680..f18f9e0cb4 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -534,6 +534,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, -- GitLab From 17cc5164b8e8fb0062b12077d042c1ee2a7f1048 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 2 Feb 2023 19:22:50 +0000 Subject: [PATCH 007/962] Added ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP to HAL layer. Bug: 266866449 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ibe1a9cdcc6a82e20f4c0524b362ea52d3ca02f25 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 16 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++++ 8 files changed, 49 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 7d2c6b1743..ec911369a7 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -264,6 +264,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 21cdf225cf..8817e391f9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -264,6 +264,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 90c66820ab..fe31805272 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -256,6 +256,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b02906514d..e7cb0f19d1 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -256,6 +256,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index c383b99b37..f8278910ef 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3222,6 +3222,22 @@ } ] }, + { + "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP", + "defaultValue": { + "int32Values": [ + 1200 + ] + }, + "configArray": [ + 1200, + 1400, + 1600, + 1800, + 2000, + 2200 + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7aac30bcde..a06e6d0bff 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -262,6 +262,7 @@ enum VehicleProperty { CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, + ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index cdeed851a3..af9259f9f4 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3949,6 +3949,28 @@ enum VehicleProperty { CRUISE_CONTROL_TARGET_SPEED = 0x1013 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, + /** + * Current target time gap for Adaptive Cruise Control (ACC) or Predictive Cruise Control in + * milliseconds. + * + * This property should specify the target time gap to a leading vehicle. This gap is defined as + * the time to travel the distance between the leading vehicle's rear-most point to the ACC + * vehicle's front-most point. The actual time gap from a leading vehicle can be above or below + * this value. + * + * The possible values to set for the target time gap should be specified in configArray in + * ascending order. All values must be positive. If the property is writable, all values must be + * writable. + * + * Writing to this property when it is not available should return StatusCode.NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @unit VehicleUnit:MILLI_SECS + */ + ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = + 0x1014 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index f18f9e0cb4..80fc5db01e 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -540,6 +540,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeGapConfig) { + verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, -- GitLab From c11c13a7749b15d7830a172d25523ffb4b3d8d14 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 3 Feb 2023 00:20:04 +0000 Subject: [PATCH 008/962] Added ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE to HAL. Bug: 266861470 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I586f75dea83f52dda4dd2c776aec1d5af417263b --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 17 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 7 ++++++ 8 files changed, 51 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index ec911369a7..43036a6bf9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 8817e391f9..7839404fa2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index fe31805272..d51b03d649 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -257,6 +257,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index e7cb0f19d1..55c7e69aa0 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -257,6 +257,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f8278910ef..2cf31bc2f2 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3238,6 +3238,23 @@ 2200 ] }, + { + "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE", + "defaultValue": { + "int32Values": [ + 100000 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 200000 + } + ], + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a06e6d0bff..d2c186acb6 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -263,6 +263,7 @@ enum VehicleProperty { CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */, + ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = (((0x1015 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411093 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index af9259f9f4..cf5a074251 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3971,6 +3971,28 @@ enum VehicleProperty { ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = 0x1014 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Measured distance from leading vehicle when using Adaptive Cruise Control (ACC) or + * Predictive Cruise Control. + * + * Returns the measured distance in millimeters between the rear-most point of the leading + * vehicle and the front-most point of the ACC vehicle. + * + * The minInt32Value should be 0. + * The maxInt32Value should be populated with the maximum range the distance sensor can support. + * This value should be non-negative. + * + * When no lead vehicle is detected (that is, when there is no leading vehicle or the leading + * vehicle is too far away for the sensor to detect), this property should return + * StatusCode.NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:MILLIMETER + */ + ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = + 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 80fc5db01e..8b61980870 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -546,6 +546,13 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeG VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, + verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) { + verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, -- GitLab From 59ffe92c9e2c2113b5b26020fd05f8536373c4d5 Mon Sep 17 00:00:00 2001 From: Austin Delgado Date: Thu, 16 Feb 2023 11:34:50 -0800 Subject: [PATCH 009/962] Update fingerprint AIDL for Android U 1. Adds sensor shape and touch detection configuration. 2. Adds onPointerCancelWithContext and setIgnoreDisplayTouches. 3. Adds LIFT_TOO_SOON constant to AcquiredInfo. 4. Deprecates SensorLocation displayId, onPointerDown, and onPointerUp. Bug: 266476972 Test: m android.hardware.biometrics.fingerprint-update-api Test: built locally Change-Id: I3aae3c7f8a65d5805f3dd583330407c255ca1369 --- .../biometrics/fingerprint/AcquiredInfo.aidl | 27 +++---- .../biometrics/fingerprint/Error.aidl | 18 ++--- .../fingerprint/FingerprintSensorType.aidl | 12 ++-- .../biometrics/fingerprint/ISession.aidl | 8 +++ .../fingerprint/PointerContext.aidl | 12 ++-- .../fingerprint/SensorLocation.aidl | 4 ++ .../biometrics/fingerprint/SensorProps.aidl | 1 + .../biometrics/fingerprint/SensorShape.aidl | 40 +++++++++++ .../fingerprint/TouchDetectionParameters.aidl | 40 +++++++++++ .../biometrics/fingerprint/AcquiredInfo.aidl | 5 ++ .../biometrics/fingerprint/ISession.aidl | 70 ++++++++++++++++++- .../fingerprint/SensorLocation.aidl | 11 ++- .../biometrics/fingerprint/SensorProps.aidl | 7 ++ .../biometrics/fingerprint/SensorShape.aidl | 29 ++++++++ .../fingerprint/TouchDetectionParameters.aidl | 36 ++++++++++ .../fingerprint/aidl/default/Fingerprint.cpp | 3 +- .../fingerprint/aidl/default/Session.cpp | 8 +++ .../aidl/default/include/Session.h | 4 ++ 18 files changed, 297 insertions(+), 38 deletions(-) create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 0cc619f991..89f76f437b 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -35,17 +35,18 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum AcquiredInfo { - UNKNOWN = 0, - GOOD = 1, - PARTIAL = 2, - INSUFFICIENT = 3, - SENSOR_DIRTY = 4, - TOO_SLOW = 5, - TOO_FAST = 6, - VENDOR = 7, - START = 8, - TOO_DARK = 9, - TOO_BRIGHT = 10, - IMMOBILE = 11, - RETRYING_CAPTURE = 12, + UNKNOWN, + GOOD, + PARTIAL, + INSUFFICIENT, + SENSOR_DIRTY, + TOO_SLOW, + TOO_FAST, + VENDOR, + START, + TOO_DARK, + TOO_BRIGHT, + IMMOBILE, + RETRYING_CAPTURE, + LIFT_TOO_SOON, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl index 45ce2eb3fe..d3592a1f09 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl @@ -35,13 +35,13 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum Error { - UNKNOWN = 0, - HW_UNAVAILABLE = 1, - UNABLE_TO_PROCESS = 2, - TIMEOUT = 3, - NO_SPACE = 4, - CANCELED = 5, - UNABLE_TO_REMOVE = 6, - VENDOR = 7, - BAD_CALIBRATION = 8, + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + BAD_CALIBRATION, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl index 67af20d872..381aaf7365 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -35,10 +35,10 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum FingerprintSensorType { - UNKNOWN = 0, - REAR = 1, - UNDER_DISPLAY_ULTRASONIC = 2, - UNDER_DISPLAY_OPTICAL = 3, - POWER_BUTTON = 4, - HOME_BUTTON = 5, + UNKNOWN, + REAR, + UNDER_DISPLAY_ULTRASONIC, + UNDER_DISPLAY_OPTICAL, + POWER_BUTTON, + HOME_BUTTON, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index f30585529d..4fdcefc8ff 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -46,7 +46,13 @@ interface ISession { void invalidateAuthenticatorId(); void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); void close(); + /** + * @deprecated use onPointerDownWithContext instead. + */ void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); + /** + * @deprecated use onPointerUpWithContext instead. + */ void onPointerUp(in int pointerId); void onUiReady(); android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); @@ -55,4 +61,6 @@ interface ISession { void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); void onContextChanged(in android.hardware.biometrics.common.OperationContext context); + void onPointerCancelWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void setIgnoreDisplayTouches(in boolean shouldIgnore); } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl index 999b324abd..d9bf0854ca 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -35,12 +35,12 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @JavaDerive(equals=true) @VintfStability parcelable PointerContext { - int pointerId = -1; - float x = 0.000000f; - float y = 0.000000f; - float minor = 0.000000f; - float major = 0.000000f; - float orientation = 0.000000f; + int pointerId = (-1) /* -1 */; + float x = 0f; + float y = 0f; + float minor = 0f; + float major = 0f; + float orientation = 0f; boolean isAod = false; long time = 0; long gestureStart = 0; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl index dc6a62de6b..965576e822 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -35,9 +35,13 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @VintfStability parcelable SensorLocation { + /** + * @deprecated use the display field instead. This field was never used. + */ int displayId; int sensorLocationX; int sensorLocationY; int sensorRadius; String display = ""; + android.hardware.biometrics.fingerprint.SensorShape sensorShape = android.hardware.biometrics.fingerprint.SensorShape.CIRCLE; } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl index a77d5f2eee..a97d819dba 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -42,4 +42,5 @@ parcelable SensorProps { boolean supportsDetectInteraction; boolean halHandlesDisplayTouches; boolean halControlsIllumination; + @nullable android.hardware.biometrics.fingerprint.TouchDetectionParameters touchDetectionParameters; } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl new file mode 100644 index 0000000000..f673b1c806 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 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 -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.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum SensorShape { + SQUARE, + CIRCLE, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl new file mode 100644 index 0000000000..2e3ec4f574 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 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 -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.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable TouchDetectionParameters { + float targetSize = 1.0f; + float minOverlap = 0.0f; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index d3aa98a87d..2cdc196f41 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -98,4 +98,9 @@ enum AcquiredInfo { * However, RETRYING_CAPTURE must not be sent after ACQUIRED_GOOD is sent. */ RETRYING_CAPTURE, + + /** + * Fingerprint was lifted before the capture completed. + */ + LIFT_TOO_SOON, } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index f4f7804f52..83e7bbc43f 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -420,6 +420,8 @@ interface ISession { * @param y The distance in pixels from the top edge of the display. * @param minor See android.view.MotionEvent#getTouchMinor * @param major See android.view.MotionEvent#getTouchMajor + * + * @deprecated use onPointerDownWithContext instead. */ void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); @@ -434,6 +436,8 @@ interface ISession { * ISession#enroll, ISession#detectInteraction. * * @param pointerId See android.view.MotionEvent#getPointerId + * + * @deprecated use onPointerUpWithContext instead. */ void onPointerUp(in int pointerId); @@ -469,15 +473,77 @@ interface ISession { /** See ISession#detectInteraction() */ ICancellationSignal detectInteractionWithContext(in OperationContext context); - /** See ISession#onPointerDown(int, int, int, float, float) */ + /** + * onPointerDownWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked erroneously by the framework for sensors + * of other types, the HAL must treat this as a no-op and return immediately. + * + * Notifies the HAL that a finger entered the sensor area. This operation can be invoked + * regardless of the current state of the HAL. + * + * Note that for sensors which require illumination, for example + * FingerprintSensorType::UNDER_DISPLAY_OPTICAL, this is a good time to start illuminating. + * + * @param context See PointerContext + */ void onPointerDownWithContext(in PointerContext context); - /** See ISession#onPointerUp(int) */ + /** + * onPointerUpWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must + * treat this as a no-op and return immediately. + * + * Notifies the HAL that a finger left the sensor area. This operation can be invoked regardless + * of the current state of the HAL. + * + * @param context See PointerContext + */ void onPointerUpWithContext(in PointerContext context); /** + * onContextChanged: + * * This may be called while an authenticate, detect interaction, or enrollment operation is * running when the context changes. */ void onContextChanged(in OperationContext context); + + /** + * onPointerCancelWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must + * treat this as a no-op and return immediately. + * + * Notifies the HAL that if there were fingers within the sensor area, they are no longer being + * tracked. The fingers may or may not still be on the sensor. This operation can be invoked + * regardless of the current state of the HAL. + * + * @param context See PointerContext + */ + void onPointerCancelWithContext(in PointerContext context); + + /** + * setIgnoreDisplayTouches: + * + * This operation only applies to sensors that have SensorProps#halHandlesDisplayTouches + * set to true. For all other sensors this is a no-op. + * + * Instructs the HAL whether to ignore display touches. This can be useful to avoid unintended + * fingerprint captures during certain UI interactions. For example, when entering a lockscreen + * PIN, some of the touches might overlap with the fingerprint sensor. Those touches should be + * ignored to avoid unintended authentication attempts. + * + * This flag must default to false when the HAL starts. + * + * The framework is responsible for both setting the flag to true and resetting it to false + * whenever it's appropriate. + * + * @param shouldIgnore whether the display touches should be ignored. + */ + void setIgnoreDisplayTouches(in boolean shouldIgnore); } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl index a065a7ce7b..fd8c7fc2d5 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -15,13 +15,16 @@ */ package android.hardware.biometrics.fingerprint; + +import android.hardware.biometrics.fingerprint.SensorShape; + /** * @hide */ @VintfStability parcelable SensorLocation { /** - * Deprecated use the display field instead. This field was never used. + * @deprecated use the display field instead. This field was never used. */ int displayId; @@ -59,4 +62,10 @@ parcelable SensorLocation { * for each display from which the sensor is accessible from. */ String display = ""; + + /** + * The shape of the sensor if applicable. Most useful for the sensor of type + * SensorType::UNDER_DISPLAY_*. + */ + SensorShape sensorShape = SensorShape.CIRCLE; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl index d4e9ec6f38..853aae48ad 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -19,6 +19,8 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.common.CommonProps; import android.hardware.biometrics.fingerprint.FingerprintSensorType; import android.hardware.biometrics.fingerprint.SensorLocation; +import android.hardware.biometrics.fingerprint.TouchDetectionParameters; + /** * @hide */ @@ -72,4 +74,9 @@ parcelable SensorProps { * This value must be ignored for sensors that aren't optical UDFPS. */ boolean halControlsIllumination; + + /** + * Parameters used for fingerprint touch detection. + */ + @nullable TouchDetectionParameters touchDetectionParameters; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl new file mode 100644 index 0000000000..1279332ce0 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2023 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.biometrics.fingerprint; +/** + * This is most useful for sensors configured as FingerprintSensorType::UNDER_DISPLAY_OPTICAL, + * as it's used to compute the on-screen sensor boundaries for the touch detection algorithm. + * + * @hide + */ +@VintfStability +@Backing(type="byte") +enum SensorShape { + SQUARE, + CIRCLE, +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl new file mode 100644 index 0000000000..bf117a33e6 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2023 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.biometrics.fingerprint; + +/** + * @hide + */ +@VintfStability +parcelable TouchDetectionParameters { + /** + * The percentage of the sensor that is considered the target. Value is required to be within + * [0.0, 1.0]. The target area expands outwards from center matching the sensorShape. Some + * portion of the touch must be within the target to be considered a valid touch. + */ + float targetSize = 1.0f; + + /** + * The minimum percentage overlap needed on the sensor to be considered a valid touch. Value is + * required to be within [0.0, 1.0]. + */ + float minOverlap = 0.0f; +} diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index be932246bd..7808a13d16 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -90,7 +90,8 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { navigationGuesture, detectInteraction, displayTouch, - controlIllumination}}; + controlIllumination, + std::nullopt}}; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 7ab5af3c4d..38d6a134e2 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -289,4 +289,12 @@ ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*c return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Session::onPointerCancelWithContext(const PointerContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Session::setIgnoreDisplayTouches(bool /*shouldIgnore*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index 104d819ff0..b596d9e2a9 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -97,6 +97,10 @@ class Session : public BnSession { ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + ndk::ScopedAStatus onPointerCancelWithContext(const PointerContext& context) override; + + ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override; + bool isClosed(); private: -- GitLab From 309d1c22ab6546f47959c4f7584a1661a76506e9 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 14 Feb 2023 02:57:17 +0000 Subject: [PATCH 010/962] Added LOCATION_CHARACTERIZATION to HAL layer. Bug: 269141226 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ia53508f032d905b8f211606238bb6c650f787d2b --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 8 ++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LocationCharacterization.aidl | 46 ++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LocationCharacterization.aidl | 73 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 14 ++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 12 files changed, 156 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 2335d6d564..f4104400d0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -191,6 +191,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a0911c5ca0..83781e0351 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -191,6 +191,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e9670c1e97..c6363fe724 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -183,6 +183,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 2513e4ecd2..f847b2756a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -183,6 +183,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index ff601e0342..9af0eeee3e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -57,6 +57,7 @@ using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; +using ::aidl::android::hardware::automotive::vehicle::LocationCharacterization; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; @@ -199,6 +200,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["VehiclePropertyChangeMode"] = std::make_unique>(); + mConstantParsersByType["LocationCharacterization"] = + std::make_unique>(); mConstantParsersByType["VehicleGear"] = std::make_unique>(); mConstantParsersByType["VehicleAreaWindow"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 85a7486a40..5924c88857 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3129,6 +3129,14 @@ { "property": "VehicleProperty::VEHICLE_MAP_SERVICE" }, + { + "property": "VehicleProperty::LOCATION_CHARACTERIZATION", + "defaultValue": { + "int32Values": [ + "LocationCharacterization::RAW_GNSS_ONLY" + ] + } + }, { "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index fc0c8db1e4..7db4246333 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl new file mode 100644 index 0000000000..27abe417dc --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2023 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 -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.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LocationCharacterization { + PRIOR_LOCATIONS = 0x1, + GYROSCOPE_FUSION = 0x2, + ACCELEROMETER_FUSION = 0x4, + COMPASS_FUSION = 0x8, + WHEEL_SPEED_FUSION = 0x10, + STEERING_ANGLE_FUSION = 0x20, + CAR_SPEED_FUSION = 0x40, + DEAD_RECKONED = 0x80, + RAW_GNSS_ONLY = 0x100, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a525ab0623..9c754e5f25 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -189,6 +189,7 @@ enum VehicleProperty { GLOVE_BOX_DOOR_POS = (((0x0BF0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518896 */, GLOVE_BOX_LOCKED = (((0x0BF1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421745 */, VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, + LOCATION_CHARACTERIZATION = (((0x0C10 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410064 */, OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896066 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl new file mode 100644 index 0000000000..e06df40c90 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2023 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.automotive.vehicle; + +/** + * Used by LOCATION_CHARACTERIZATION to enumerate the supported bit flags. + * + * These flags are used to indicate to what transformations are performed on the + * GNSS data before the location data is sent, so that location processing + * algorithms can take into account prior fusion. + * + * This enum can be extended in future releases to include additional bit flags. + */ +@VintfStability +@Backing(type="int") +enum LocationCharacterization { + /** + * Prior location samples have been used to refine the raw GNSS data (e.g. a + * Kalman Filter). + */ + PRIOR_LOCATIONS = 0x1, + /** + * Gyroscope data has been used to refine the raw GNSS data. + */ + GYROSCOPE_FUSION = 0x2, + /** + * Accelerometer data has been used to refine the raw GNSS data. + */ + ACCELEROMETER_FUSION = 0x4, + /** + * Compass data has been used to refine the raw GNSS data. + */ + COMPASS_FUSION = 0x8, + /** + * Wheel speed has been used to refine the raw GNSS data. + */ + WHEEL_SPEED_FUSION = 0x10, + /** + * Steering angle has been used to refine the raw GNSS data. + */ + STEERING_ANGLE_FUSION = 0x20, + /** + * Car speed has been used to refine the raw GNSS data. + */ + CAR_SPEED_FUSION = 0x40, + /** + * Some effort is made to dead-reckon location. In particular, this means that + * relative changes in location have meaning when no GNSS satellite is + * available. + */ + DEAD_RECKONED = 0x80, + /** + * Location is based on GNSS satellite signals without sufficient fusion of + * other sensors for complete dead reckoning. This flag should be set when + * relative changes to location cannot be relied on when no GNSS satellite is + * available. + */ + RAW_GNSS_ONLY = 0x100, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b350f90a7e..1f535c4c0f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2347,6 +2347,20 @@ enum VehicleProperty { */ VEHICLE_MAP_SERVICE = 0x0C00 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Characterization of inputs used for computing location. + * + * This property must indicate what (if any) data and sensor inputs are considered by the system + * when computing the vehicle's location that is shared with Android through the GNSS HAL. + * + * The value must return a collection of bit flags. The bit flags are defined in + * LocationCharacterization. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + LOCATION_CHARACTERIZATION = + 0x0C10 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * OBD2 Live Sensor Data * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 51cc3765da..ddd8462f1f 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -498,6 +498,12 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, actualPropertyType); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) { + verifyProperty(VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, -- GitLab From 588b958ce1b50d42581e67a664b32e2f25f37712 Mon Sep 17 00:00:00 2001 From: Paul Colta Date: Thu, 23 Feb 2023 10:44:32 +0100 Subject: [PATCH 011/962] Handle portId out of bounds index Bug: 268631136 Test: m && m android.hardware.tv.cec@1.0-impl && m android.hardware.tv.cec@1.0 Change-Id: I454caf56c309aae9667afd0e58da453002458a80 --- tv/cec/1.0/default/HdmiCecDefault.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tv/cec/1.0/default/HdmiCecDefault.cpp b/tv/cec/1.0/default/HdmiCecDefault.cpp index 26ccb7d42e..2a5197cb4a 100644 --- a/tv/cec/1.0/default/HdmiCecDefault.cpp +++ b/tv/cec/1.0/default/HdmiCecDefault.cpp @@ -278,6 +278,10 @@ Return HdmiCecDefault::enableAudioReturnChannel(int32_t /*portId*/, bool / Return HdmiCecDefault::isConnected(int32_t portId) { uint16_t addr; + if (portId < 0 || portId >= mHdmiCecPorts.size()) { + LOG(ERROR) << "Port id is out of bounds, portId = " << portId; + return false; + } int ret = ioctl(mHdmiCecPorts[portId]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr); if (ret) { LOG(ERROR) << "Is connected failed, Error = " << strerror(errno); -- GitLab From 7493bbc999eb653deb36773ca1ff1b6d5877806a Mon Sep 17 00:00:00 2001 From: Dorin Drimus Date: Thu, 23 Feb 2023 17:06:58 +0000 Subject: [PATCH 012/962] Fix VtsHalGraphicsComposer3_TargetTest / GetOverlaySupport Test case is for composer starting with version 2 API, but the test case doesn't check version, so it fails for version 1 API. Bug: 267565265 Test: 1. Push VtsHalGraphicsComposer3_TargetTest to device 2. Run VtsHalGraphicsComposer3_TargetTest Test Command: chmod 777 data/VtsHalGraphicsComposer3_TargetTest ./data/VtsHalGraphicsComposer3_TargetTest Change-Id: I7bf37061aba84dfdfea5fc9dda5a300a1e5ec680 --- .../aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 70c4e4cf39..4974e71636 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -874,6 +874,13 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { } TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version == 1) { + GTEST_SUCCEED() << "Device does not support the new API for overlay support"; + return; + } + const auto& [status, properties] = mComposerClient->getOverlaySupport(); if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { -- GitLab From 39466b2f3a7134d69461ee8c160456d773ab9614 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 24 Feb 2023 19:50:51 -0800 Subject: [PATCH 013/962] audio: Add AudioOffloadMetadata and a method to update it AudioOffloadMetadata contains the same information as 'AUDIO_OFFLOAD_CODEC_*' framework parameters. It is updated via a new method IStreamOut.updateOffloadMetadata which only works for compressed offload streams. Bug: 270731693 Test: atest VtsHalAudioCoreTargetTest Change-Id: I6c8a8853f216438284082f79e3f57e511a2a1f06 --- audio/aidl/Android.bp | 9 ++-- .../audio/common/AudioOffloadMetadata.aidl | 42 ++++++++++++++++++ .../hardware/audio/core/IStreamOut.aidl | 1 + .../audio/common/AudioOffloadMetadata.aidl | 44 +++++++++++++++++++ .../hardware/audio/core/IStreamOut.aidl | 13 ++++++ audio/aidl/default/Stream.cpp | 35 +++++++++++++++ audio/aidl/default/include/core-impl/Stream.h | 4 ++ audio/aidl/vts/ModuleConfig.cpp | 2 +- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 37 ++++++++++++++-- automotive/audiocontrol/aidl/vts/Android.bp | 2 +- 10 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl create mode 100644 audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index e6b0cee401..2c91918d76 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -36,12 +36,13 @@ aidl_interface { "android.hardware.audio_defaults", ], srcs: [ + "android/hardware/audio/common/AudioOffloadMetadata.aidl", "android/hardware/audio/common/PlaybackTrackMetadata.aidl", "android/hardware/audio/common/RecordTrackMetadata.aidl", "android/hardware/audio/common/SinkMetadata.aidl", "android/hardware/audio/common/SourceMetadata.aidl", ], - frozen: true, + frozen: false, imports: [ "android.media.audio.common.types-V2", ], @@ -77,7 +78,7 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_audio_common = "android.hardware.audio.common-V1" +latest_android_hardware_audio_common = "android.hardware.audio.common-V2" // Modules that depend on android.hardware.audio.common directly can include // the following cc_defaults to avoid explicitly managing dependency versions @@ -129,7 +130,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common-V1", + "android.hardware.audio.common-V2", "android.hardware.audio.core.sounddose-V1", "android.hardware.audio.effect-V1", "android.media.audio.common.types-V2", @@ -253,7 +254,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common-V1", + "android.hardware.audio.common-V2", "android.media.audio.common.types-V2", ], backend: { diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl new file mode 100644 index 0000000000..000504bd40 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 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 -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.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioOffloadMetadata { + int sampleRate; + android.media.audio.common.AudioChannelLayout channelMask; + int averageBitRatePerSecond; + int delayFrames; + int paddingFrames; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl index 46acc1156e..ec3078efd7 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl @@ -36,6 +36,7 @@ package android.hardware.audio.core; interface IStreamOut { android.hardware.audio.core.IStreamCommon getStreamCommon(); void updateMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateOffloadMetadata(in android.hardware.audio.common.AudioOffloadMetadata offloadMetadata); float[] getHwVolume(); void setHwVolume(in float[] channelVolumes); float getAudioDescriptionMixLevel(); diff --git a/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl b/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl new file mode 100644 index 0000000000..588165824b --- /dev/null +++ b/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2023 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.audio.common; + +import android.media.audio.common.AudioChannelLayout; + +/** + * Dynamic metadata for offloaded compressed audio. + * For static metadata, see android.media.audio.common.AudioOffloadInfo. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioOffloadMetadata { + int sampleRate; + AudioChannelLayout channelMask; + /** Average bit rate in bits per second. */ + int averageBitRatePerSecond; + /** + * Number of frames to be ignored at the beginning of the stream. + * The value must be non-negative. A value of 0 indicates no delay + * has to be applied. + */ + int delayFrames; + /** + * Number of frames to be ignored at the end of the stream. + * The value must be non-negative. A value of 0 indicates no padding + * has to be applied. + */ + int paddingFrames; +} diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl index 0e58addd7d..54c81621e1 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl @@ -16,6 +16,7 @@ package android.hardware.audio.core; +import android.hardware.audio.common.AudioOffloadMetadata; import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.core.IStreamCommon; import android.media.audio.common.AudioDualMonoMode; @@ -48,6 +49,18 @@ interface IStreamOut { */ void updateMetadata(in SourceMetadata sourceMetadata); + /** + * Update offload metadata for a compressed stream. + * + * Updates the offload metadata initially provided at the stream creation. + * + * @param offloadMetadata Updated offload metadata. + * @throws EX_ILLEGAL_STATE If the stream is closed. + * @throws EX_ILLEGAL_ARGUMENT If the metadata contains invalid values. + * @throws EX_UNSUPPORTED_OPERATION If the stream is not for compressed offload. + */ + void updateOffloadMetadata(in AudioOffloadMetadata offloadMetadata); + const int HW_VOLUME_MIN = 0; const int HW_VOLUME_MAX = 1; /** diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 49ad2f2d74..193c793ba0 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -24,6 +24,7 @@ #include "core-impl/Module.h" #include "core-impl/Stream.h" +using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::media::audio::common::AudioDevice; @@ -785,6 +786,40 @@ StreamOut::StreamOut(const SourceMetadata& sourceMetadata, StreamContext&& conte LOG(DEBUG) << __func__; } +ndk::ScopedAStatus StreamOut::updateOffloadMetadata( + const AudioOffloadMetadata& in_offloadMetadata) { + LOG(DEBUG) << __func__; + if (isClosed()) { + LOG(ERROR) << __func__ << ": stream was closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + if (!mOffloadInfo.has_value()) { + LOG(ERROR) << __func__ << ": not a compressed offload stream"; + return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + } + if (in_offloadMetadata.sampleRate < 0) { + LOG(ERROR) << __func__ << ": invalid sample rate value: " << in_offloadMetadata.sampleRate; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.averageBitRatePerSecond < 0) { + LOG(ERROR) << __func__ + << ": invalid average BPS value: " << in_offloadMetadata.averageBitRatePerSecond; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.delayFrames < 0) { + LOG(ERROR) << __func__ + << ": invalid delay frames value: " << in_offloadMetadata.delayFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.paddingFrames < 0) { + LOG(ERROR) << __func__ + << ": invalid padding frames value: " << in_offloadMetadata.paddingFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + mOffloadMetadata = in_offloadMetadata; + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus StreamOut::getHwVolume(std::vector* _aidl_return) { LOG(DEBUG) << __func__; (void)_aidl_return; diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index 0d4365a3ae..e9b1fbb847 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -463,6 +463,9 @@ class StreamOut : public StreamCommonImpl<::aidl::android::hardware::audio::comm return StreamCommonImpl<::aidl::android::hardware::audio::common::SourceMetadata>:: updateMetadata(in_sourceMetadata); } + ndk::ScopedAStatus updateOffloadMetadata( + const ::aidl::android::hardware::audio::common::AudioOffloadMetadata& + in_offloadMetadata) override; ndk::ScopedAStatus getHwVolume(std::vector* _aidl_return) override; ndk::ScopedAStatus setHwVolume(const std::vector& in_channelVolumes) override; ndk::ScopedAStatus getAudioDescriptionMixLevel(float* _aidl_return) override; @@ -500,6 +503,7 @@ class StreamOut : public StreamCommonImpl<::aidl::android::hardware::audio::comm offloadInfo); std::optional<::aidl::android::media::audio::common::AudioOffloadInfo> mOffloadInfo; + std::optional<::aidl::android::hardware::audio::common::AudioOffloadMetadata> mOffloadMetadata; public: using CreateInstance = std::function ModuleConfig::generateOffloadInfoIfNeeded( offloadInfo.base.sampleRate = portConfig.sampleRate.value().value; offloadInfo.base.channelMask = portConfig.channelMask.value(); offloadInfo.base.format = portConfig.format.value(); - offloadInfo.bitRatePerSecond = 256; // Arbitrary value. + offloadInfo.bitRatePerSecond = 256000; // Arbitrary value. offloadInfo.durationUs = std::chrono::microseconds(1min).count(); // Arbitrary value. offloadInfo.usage = AudioUsage::MEDIA; offloadInfo.encapsulationMode = AudioEncapsulationMode::NONE; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 1222fd5d5a..5bcd0984bd 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -53,6 +53,7 @@ #include "TestUtils.h" using namespace android; +using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::PlaybackTrackMetadata; using aidl::android::hardware::audio::common::RecordTrackMetadata; using aidl::android::hardware::audio::common::SinkMetadata; @@ -400,8 +401,9 @@ void TestSetVendorParameters(Instance* inst, bool* isSupported) { // Can be used as a base for any test here, does not depend on the fixture GTest parameters. class AudioCoreModuleBase { public: - // The default buffer size is used mostly for negative tests. + // Default buffer sizes are used mostly for negative tests. static constexpr int kDefaultBufferSizeFrames = 256; + static constexpr int kDefaultLargeBufferSizeFrames = 48000; void SetUpImpl(const std::string& moduleName) { ASSERT_NO_FATAL_FAILURE(ConnectToService(moduleName)); @@ -2689,7 +2691,7 @@ TEST_P(AudioStreamOut, RequireOffloadInfo) { aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; args.portConfigId = portConfig.getId(); args.sourceMetadata = GenerateSourceMetadata(portConfig.get()); - args.bufferSizeFrames = kDefaultBufferSizeFrames; + args.bufferSizeFrames = kDefaultLargeBufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, module->openOutputStream(args, &ret)) << "when no offload info is provided for a compressed offload mix port"; @@ -2869,7 +2871,7 @@ TEST_P(AudioStreamOut, PlaybackRate) { const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); bool isSupported = false; EXPECT_NO_FATAL_FAILURE(TestAccessors( stream.get(), &IStreamOut::getPlaybackRateParameters, @@ -2894,7 +2896,7 @@ TEST_P(AudioStreamOut, SelectPresentation) { const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); ndk::ScopedAStatus status; EXPECT_STATUS(kStatuses, status = stream.get()->selectPresentation(0, 0)); if (status.getExceptionCode() != EX_UNSUPPORTED_OPERATION) atLeastOneSupports = true; @@ -2904,6 +2906,33 @@ TEST_P(AudioStreamOut, SelectPresentation) { } } +TEST_P(AudioStreamOut, UpdateOffloadMetadata) { + const auto offloadMixPorts = + moduleConfig->getOffloadMixPorts(true /*attachedOnly*/, false /*singlePort*/); + if (offloadMixPorts.empty()) { + GTEST_SKIP() + << "No mix port for compressed offload that could be routed to attached devices"; + } + for (const auto& port : offloadMixPorts) { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); + ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); + AudioOffloadMetadata validMetadata{ + .sampleRate = portConfig.value().sampleRate.value().value, + .channelMask = portConfig.value().channelMask.value(), + .averageBitRatePerSecond = 256000, + .delayFrames = 0, + .paddingFrames = 0}; + EXPECT_IS_OK(stream.get()->updateOffloadMetadata(validMetadata)); + AudioOffloadMetadata invalidMetadata{.sampleRate = -1, + .averageBitRatePerSecond = -1, + .delayFrames = -1, + .paddingFrames = -1}; + EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, stream.get()->updateOffloadMetadata(invalidMetadata)); + } +} + class StreamLogicDefaultDriver : public StreamLogicDriver { public: StreamLogicDefaultDriver(std::shared_ptr commands, size_t frameSizeBytes) diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index a9122ce2d6..cfc2a3e4ec 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -25,7 +25,6 @@ cc_test { name: "VtsAidlHalAudioControlTest", defaults: [ "latest_android_media_audio_common_types_cpp_static", - "latest_android_hardware_audio_common_cpp_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -40,6 +39,7 @@ cc_test { ], static_libs: [ "android.hardware.automotive.audiocontrol-V3-cpp", + "android.hardware.audio.common-V1-cpp", "libgmock", ], test_suites: [ -- GitLab From 9af806fe06a92e67a86ede4b134ca1fec8abe0c6 Mon Sep 17 00:00:00 2001 From: Yuchen He Date: Thu, 2 Mar 2023 00:02:13 +0000 Subject: [PATCH 014/962] Fix epoll leaks: clean up file descriptor and epoll instance properly Bug: 262762412 Test: manual test Change-Id: Ia587f8ba0ce44234a7c00cd820db73258dba19b0 --- .../common/utils/default/DeviceFileReader.cpp | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/gnss/common/utils/default/DeviceFileReader.cpp b/gnss/common/utils/default/DeviceFileReader.cpp index dfc086a8b8..91e75eb460 100644 --- a/gnss/common/utils/default/DeviceFileReader.cpp +++ b/gnss/common/utils/default/DeviceFileReader.cpp @@ -32,40 +32,52 @@ void DeviceFileReader::getDataFromDeviceFile(const std::string& command, int mMi return; } - int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK); - - if (mGnssFd == -1) { + int gnss_fd, epoll_fd; + if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) { + return; + } + if (write(gnss_fd, command.c_str(), command.size()) <= 0) { + close(gnss_fd); return; } - int bytes_write = write(mGnssFd, command.c_str(), command.size()); - if (bytes_write <= 0) { - close(mGnssFd); + // Create an epoll instance. + if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) { + close(gnss_fd); return; } + // Add file descriptor to epoll instance. struct epoll_event ev, events[1]; - ev.data.fd = mGnssFd; + memset(&ev, 0, sizeof(ev)); + ev.data.fd = gnss_fd; ev.events = EPOLLIN; - int epoll_fd = epoll_create1(0); - epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); - int bytes_read = -1; - std::string inputStr = ""; - int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); + if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) { + close(gnss_fd); + close(epoll_fd); + return; + } - if (epoll_ret == -1) { - close(mGnssFd); + // Wait for device file event. + if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) { + close(gnss_fd); + close(epoll_fd); return; } + + // Handle event and write data to string buffer. + int bytes_read = -1; + std::string inputStr = ""; while (true) { memset(inputBuffer, 0, INPUT_BUFFER_SIZE); - bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); + bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE); if (bytes_read <= 0) { break; } s_buffer_ += std::string(inputBuffer, bytes_read); } - close(mGnssFd); + close(gnss_fd); + close(epoll_fd); // Trim end of file mark(\n\n\n\n). auto pos = s_buffer_.find("\n\n\n\n"); -- GitLab From 721a3638aba1b45258604e340fc00b1b08c94455 Mon Sep 17 00:00:00 2001 From: Zhanghao Wen Date: Fri, 6 Jan 2023 14:30:53 -0800 Subject: [PATCH 015/962] Update HAL comment of getReceivedSvTimeNs Added GPS L1C(P), BDS B1C(P) with value: CODE_LOCK(10 ms), STATE_2ND_CODE_LOCK(18000 ms), TOW_KNOWN(1 week). Added BDS B2AQ: Same as E5AQ Added IRNSS: Same as GPS L1 C/A Bug: 264588057 Test: comment only Change-Id: Ia452beb129b791116bf33a8feed6bb0d04238dd2 --- .../hardware/gnss/GnssMeasurement.aidl | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl index db724a49c8..925df1a010 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl @@ -133,50 +133,50 @@ parcelable GnssMeasurement { * zero to the value in the table. The state flag with the widest range indicates the range of * the received GNSS satellite time value. * - * +---------------------------+--------------------+-----+-----------+--------------------+------+ - * | |GPS/QZSS |GLNS |BDS |GAL |SBAS | - * +---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |State Flag |L1 |L5I |L5Q |L1OF |B1I |B1I |E1B |E1C |E5AQ |L1 | - * | |C/A | | | |(D1) |(D2)| | | |C/A | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_CODE_LOCK |1ms |1 ms |1 ms |1 ms |1 ms |1 ms|- |- |1 ms |1 ms | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SYMBOL_SYNC |20ms |10 ms |1 ms |10 ms|20 ms |2 ms|4 ms |4 ms |1 ms |2 ms | - * | |(opt.)| |(opt.)| |(opt.)| |(opt.)|(opt.)|(opt.)| | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BIT_SYNC |20 ms |20 ms |1 ms |20 ms|20 ms |- |8 ms |- |1 ms |4 ms | - * | | | |(opt.)| | | | | |(opt.)| | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SUBFRAME_SYNC |6s |6s |- |2 s |6 s |- |- |- |100 ms|- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_TOW_DECODED |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week| - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_TOW_KNOWN |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week| - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_STRING_SYNC |- |- |- |2 s |- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_TOD_DECODED |- |- |- |1 day|- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_TOD_KNOWN |- |- |- |1 day|- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |2 ms|- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |600 |- |- |- |- | - * | | | | | | |ms | | | | | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |4 ms |4 ms |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |100 ms|- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_2ND_CODE_LOCK |- |10 ms |20 ms |- |- |- |- |100 ms|100 ms|- | - * | | |(opt.)| | | | | |(opt.)| | | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |2 s |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |1s | - * +---------------------------+------+------+------+-----+------+----+------+------+------+------+ + * +---------------------------+---------------------------+-----+---------------------------+--------------------+------+------+ + * | |GPS/QZSS |GLNS |BDS |GAL |SBAS |IRNSS | + * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |State Flag |L1 |L1C |L5I |L5Q |L1OF |B1I |B1I |B1C |B2AQ |E1B |E1C |E5AQ |L1 |L5C | + * | |C/A |(P) | | | |(D1) |(D2) |(P) | | | | |C/A | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_CODE_LOCK |1ms |10 ms |1 ms |1 ms |1 ms |1 ms |1 ms |10 ms |1 ms |- |- |1 ms |1 ms |1ms | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SYMBOL_SYNC |- |- |10 ms |- |10 ms|- |2 ms |- |- |- |- |- |2 ms |- | + * | | | | | | | | | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BIT_SYNC |20 ms |- |20 ms |- |20 ms|20 ms |- |- |- |8 ms |- |- |4 ms |20 ms | + * | | | | | | | | | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SUBFRAME_SYNC |6s |- |6s |- |- |6 s |- |- |100 ms|- |- |100 ms|- |6s | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_TOW_DECODED |1 week|- |1 week|- |- |1 week|1 week|- |- |1 week|1 week|- |1 week|1 week| + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_TOW_KNOWN |1 week|1 week|1 week|1 week|- |1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week| + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_STRING_SYNC |- |- |- |- |2 s |- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_TOD_DECODED |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_TOD_KNOWN |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |- |2 ms |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |- |600 |- |- |- |- |- |- |- | + * | | | | | | | |ms | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |- |- |- |4 ms |4 ms |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |- |- |- |100 ms|- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_2ND_CODE_LOCK |- |18000 |10 ms |20 ms |- |- |- |18000 |100 ms|- |- |100 ms|- |- | + * | | |ms | | | | | |ms | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |- |- |- |2 s |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |- |- |- |1s |- | + * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ * * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has * been determined from other sources. If TOW decoded is set then TOW Known must also be set. -- GitLab From 57ee54b31be70d30b20b9b856df46b8ca5b2961d Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 20 Mar 2023 13:49:25 +0900 Subject: [PATCH 016/962] Set min_sdk_version for the Widevine APEX Bug: 251299786 Test: build WV APEX with V and install it on U device Change-Id: I51e387769631bb6dd821911fdae78f36b04b86c2 --- drm/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp index 6273a38a26..fb04d842ef 100644 --- a/drm/aidl/Android.bp +++ b/drm/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { sdk_version: "module_current", }, ndk: { - min_sdk_version: "current", + min_sdk_version: "UpsideDownCake", }, }, double_loadable: true, -- GitLab From ae7e4b0ee2ffac8104f75bbdb54f6753692ee0a5 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 7 Apr 2023 21:56:57 +0000 Subject: [PATCH 017/962] Disable radio satellite tests. This is causing conflicts with Android U finalization because when it lands, version 3 of radio doesn't exist in Android U yet. The radio interface should have already been frozen. This is a temporary change to land finalization, and we'll follow up to improve it later. Bug: 277379745 Test: finalization compiles, run test on cf Change-Id: I53ba9ee1a2657d3f18913f5fcce817105bb7f357 --- radio/aidl/vts/Android.bp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index f112d6d73a..c816ed4b95 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -58,9 +58,9 @@ cc_test { "radio_network_test.cpp", "radio_sap_callback.cpp", "radio_sap_test.cpp", - "radio_satellite_indication.cpp", - "radio_satellite_response.cpp", - "radio_satellite_test.cpp", + // "radio_satellite_indication.cpp", + // "radio_satellite_response.cpp", + // "radio_satellite_test.cpp", "radio_sim_indication.cpp", "radio_sim_response.cpp", "radio_sim_test.cpp", -- GitLab From 0331772902c70a2987bb583342eb2b241f1f24a9 Mon Sep 17 00:00:00 2001 From: Kevin Jeon Date: Thu, 13 Apr 2023 12:14:11 -0400 Subject: [PATCH 018/962] Add missing newline to health/wifi AIDL interfaces This change adds a missing newline character to the end of dump() for the default health and wifi int Add missing newline to health/wifi AIDL interfaces This change adds a missing newline character to the end of dump() for health and wifi. Test: Take a bugreport and verify that the "X was the duration of dumpsys Y" lines aren't preceded by the final line of the dump. Test: Run "dumpsys android.hardware.health.IHealth/default" and verify that the new line exists. Test: Run "dumpsys android.hardware.wifi.IWifi/default" and verify that the new line exists. Bug: 278081288 Change-Id: I173dd174b5bab808c6296f7163982393e60ba0c6 --- health/aidl/default/Health.cpp | 1 + wifi/aidl/default/wifi.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp index f401643cde..acdd3362b6 100644 --- a/health/aidl/default/Health.cpp +++ b/health/aidl/default/Health.cpp @@ -214,6 +214,7 @@ binder_status_t Health::dump(int fd, const char**, uint32_t) { } else { ::android::base::WriteStringToFd(res.getDescription(), fd); } + ::android::base::WriteStringToFd("\n", fd); fsync(fd); return STATUS_OK; diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp index e30c38abcf..35f27e21d2 100644 --- a/wifi/aidl/default/wifi.cpp +++ b/wifi/aidl/default/wifi.cpp @@ -16,6 +16,7 @@ #include "wifi.h" +#include #include #include "aidl_return_util.h" @@ -88,6 +89,7 @@ binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { if (!chip.get()) continue; chip->dump(fd, args, numArgs); } + ::android::base::WriteStringToFd("\n", fd); return STATUS_OK; } -- GitLab From 771b5c19f3517172682a90c0529ab4ff81f8ffa6 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 11 Apr 2023 21:27:15 +0000 Subject: [PATCH 019/962] Re-enable radio satellite tests. radio to V3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This moves everything to radio-V3. What happened was satellite-V1 was added with changes to the radio HAL in master. When radio-V2 was frozen on goog/master, this showed up as radio-V2 having backwards incompatible changes in goog/master. So I disabled the build files there. Now that radio-V2 is frozen, we can re-enable the usage of radio-V3 types in master (the VTS test was the only thing using these new types). In order to resolve this, I’ve moved all the radio libs over to V3. Ideally, we could have moved one service over at a time, as "satellite" support was needed. Though I’ve done this expecting other radio libs to change in V3, this will mean we don’t expect more radio .bp changes in Android V. One alternative to this would have been to change the other radio libs to import V3, but this is considered somewhat of a hack, and it would be guaranteed to break any vendor-owned builds. With the current change, vendor-owned build configs should still work as-is until they manually add satellite. Test: hal_implementation_test, vts_treble_vintf_vendor_test Bug: 277379745 Change-Id: Iedc3097a9db58c0539e4aa61d089ee9d1986d51f --- .../compatibility_matrix.8.xml | 10 ----- .../compatibility_matrix.9.xml | 18 ++++---- radio/aidl/Android.bp | 43 ++++++------------- radio/aidl/compat/libradiocompat/Android.bp | 18 ++++---- radio/aidl/compat/service/Android.bp | 18 ++++---- radio/aidl/vts/Android.bp | 26 +++++------ 6 files changed, 52 insertions(+), 81 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 314757f477..4ac95f58f4 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -491,16 +491,6 @@ slot3 - - android.hardware.radio.satellite - 1 - - IRadioSatellite - slot1 - slot2 - slot3 - - android.hardware.radio.ims.media 1 diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index 4c24acd766..a4c6ea4c99 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -405,7 +405,7 @@ android.hardware.radio.config - 2 + 3 IRadioConfig default @@ -413,7 +413,7 @@ android.hardware.radio.data - 2 + 3 IRadioData slot1 @@ -423,7 +423,7 @@ android.hardware.radio.messaging - 2 + 3 IRadioMessaging slot1 @@ -433,7 +433,7 @@ android.hardware.radio.modem - 2 + 3 IRadioModem slot1 @@ -443,7 +443,7 @@ android.hardware.radio.network - 2 + 3 IRadioNetwork slot1 @@ -453,7 +453,7 @@ android.hardware.radio.sim - 2 + 3 IRadioSim slot1 @@ -473,7 +473,7 @@ android.hardware.radio.voice - 2 + 3 IRadioVoice slot1 @@ -483,7 +483,7 @@ android.hardware.radio.ims - 1 + 2 IRadioIms slot1 @@ -503,7 +503,7 @@ android.hardware.radio.ims.media - 1 + 2 IImsMedia default diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index d531d7bf22..72aaa0ffc5 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -12,7 +12,6 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/*.aidl"], - frozen: true, stability: "vintf", backend: { cpp: { @@ -41,9 +40,8 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], - frozen: true, stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -72,7 +70,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -92,8 +90,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -102,7 +98,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -122,8 +118,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -132,7 +126,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -152,8 +146,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -162,7 +154,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -182,8 +174,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -212,7 +202,6 @@ aidl_interface { }, ], frozen: true, - } aidl_interface { @@ -222,8 +211,8 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V2", - "android.hardware.radio.config-V2", + "android.hardware.radio-V3", + "android.hardware.radio.config-V3", ], backend: { cpp: { @@ -250,8 +239,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -260,7 +247,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: true, @@ -280,8 +267,6 @@ aidl_interface { }, ], - frozen: true, - } aidl_interface { @@ -290,8 +275,8 @@ aidl_interface { srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V2", - "android.hardware.radio.data-V2", + "android.hardware.radio-V3", + "android.hardware.radio.data-V3", ], backend: { cpp: { @@ -310,8 +295,6 @@ aidl_interface { ], }, ], - frozen: true, - } aidl_interface { @@ -319,7 +302,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: false, @@ -334,8 +317,6 @@ aidl_interface { imports: ["android.hardware.radio-V2"], }, ], - frozen: true, - } aidl_interface { @@ -343,7 +324,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/satellite/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V3"], backend: { cpp: { enabled: false, diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 9aecf78d38..f5000b91d0 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -31,21 +31,21 @@ cc_library { "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], shared_libs: [ - "android.hardware.radio.config-V2-ndk", + "android.hardware.radio.config-V3-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.satellite-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 5d14c85f73..1a6ea48df9 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -34,21 +34,21 @@ cc_binary { ], shared_libs: [ "android.hardware.radio-library.compat", - "android.hardware.radio.config-V2-ndk", + "android.hardware.radio.config-V3-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.satellite-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index c816ed4b95..8301f103bc 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -58,9 +58,9 @@ cc_test { "radio_network_test.cpp", "radio_sap_callback.cpp", "radio_sap_test.cpp", - // "radio_satellite_indication.cpp", - // "radio_satellite_response.cpp", - // "radio_satellite_test.cpp", + "radio_satellite_indication.cpp", + "radio_satellite_response.cpp", + "radio_satellite_test.cpp", "radio_sim_indication.cpp", "radio_sim_response.cpp", "radio_sim_test.cpp", @@ -74,18 +74,18 @@ cc_test { "libvintf", ], static_libs: [ - "android.hardware.radio-V2-ndk", - "android.hardware.radio.config-V2-ndk", - "android.hardware.radio.data-V2-ndk", - "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.ims.media-V1-ndk", - "android.hardware.radio.messaging-V2-ndk", - "android.hardware.radio.modem-V2-ndk", - "android.hardware.radio.network-V2-ndk", + "android.hardware.radio-V3-ndk", + "android.hardware.radio.config-V3-ndk", + "android.hardware.radio.data-V3-ndk", + "android.hardware.radio.ims-V2-ndk", + "android.hardware.radio.ims.media-V2-ndk", + "android.hardware.radio.messaging-V3-ndk", + "android.hardware.radio.modem-V3-ndk", + "android.hardware.radio.network-V3-ndk", "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.satellite-V1-ndk", - "android.hardware.radio.sim-V2-ndk", - "android.hardware.radio.voice-V2-ndk", + "android.hardware.radio.sim-V3-ndk", + "android.hardware.radio.voice-V3-ndk", ], test_suites: [ "general-tests", -- GitLab From 7afc209eb8b1f1d54208c601cb458f95712b1e2f Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Wed, 19 Apr 2023 21:50:00 +0000 Subject: [PATCH 020/962] Revert "android.hardware.media.c2: Move to staging/" This reverts commit a8c9aa31730c0790045d2dd2f0f876261b44ad63. Bug: 254050314 Change-Id: Ia85af4e013529e104c84bc48f84a5daa89a5d9bf --- .../compatibility_matrix.9.xml | 9 +++ .../exclude/fcm_exclude.cpp | 4 -- {staging => media}/c2/aidl/Android.bp | 2 +- .../android/hardware/media/c2/BaseBlock.aidl | 39 +++++++++++ .../android/hardware/media/c2/Block.aidl | 40 +++++++++++ .../android/hardware/media/c2/Buffer.aidl | 39 +++++++++++ .../hardware/media/c2/FieldDescriptor.aidl | 62 +++++++++++++++++ .../android/hardware/media/c2/FieldId.aidl | 39 +++++++++++ .../media/c2/FieldSupportedValues.aidl | 41 ++++++++++++ .../media/c2/FieldSupportedValuesQuery.aidl | 44 +++++++++++++ .../c2/FieldSupportedValuesQueryResult.aidl | 39 +++++++++++ .../android/hardware/media/c2/FrameData.aidl | 47 +++++++++++++ .../android/hardware/media/c2/IComponent.aidl | 53 +++++++++++++++ .../media/c2/IComponentInterface.aidl | 38 +++++++++++ .../hardware/media/c2/IComponentListener.aidl | 53 +++++++++++++++ .../hardware/media/c2/IComponentStore.aidl | 66 +++++++++++++++++++ .../hardware/media/c2/IConfigurable.aidl | 48 ++++++++++++++ .../android/hardware/media/c2/InfoBuffer.aidl | 39 +++++++++++ .../hardware/media/c2/ParamDescriptor.aidl | 48 ++++++++++++++ .../android/hardware/media/c2/ParamField.aidl | 39 +++++++++++ .../hardware/media/c2/ParamFieldValues.aidl | 39 +++++++++++ .../android/hardware/media/c2/Params.aidl | 38 +++++++++++ .../hardware/media/c2/SettingResult.aidl | 53 +++++++++++++++ .../android/hardware/media/c2/Status.aidl | 52 +++++++++++++++ .../hardware/media/c2/StructDescriptor.aidl | 39 +++++++++++ .../hardware/media/c2/SurfaceSyncObj.aidl | 41 ++++++++++++ .../android/hardware/media/c2/ValueRange.aidl | 42 ++++++++++++ .../android/hardware/media/c2/Work.aidl | 42 ++++++++++++ .../android/hardware/media/c2/WorkBundle.aidl | 39 +++++++++++ .../hardware/media/c2/WorkOrdinal.aidl | 40 +++++++++++ .../android/hardware/media/c2/Worklet.aidl | 41 ++++++++++++ .../android/hardware/media/c2/BaseBlock.aidl | 1 + .../aidl/android/hardware/media/c2/Block.aidl | 1 + .../android/hardware/media/c2/Buffer.aidl | 1 + .../hardware/media/c2/FieldDescriptor.aidl | 3 + .../android/hardware/media/c2/FieldId.aidl | 1 + .../media/c2/FieldSupportedValues.aidl | 1 + .../media/c2/FieldSupportedValuesQuery.aidl | 2 + .../c2/FieldSupportedValuesQueryResult.aidl | 1 + .../android/hardware/media/c2/FrameData.aidl | 1 + .../android/hardware/media/c2/IComponent.aidl | 1 + .../media/c2/IComponentInterface.aidl | 1 + .../hardware/media/c2/IComponentListener.aidl | 3 + .../hardware/media/c2/IComponentStore.aidl | 4 ++ .../hardware/media/c2/IConfigurable.aidl | 2 + .../android/hardware/media/c2/InfoBuffer.aidl | 1 + .../hardware/media/c2/ParamDescriptor.aidl | 1 + .../android/hardware/media/c2/ParamField.aidl | 1 + .../hardware/media/c2/ParamFieldValues.aidl | 1 + .../android/hardware/media/c2/Params.aidl | 1 + .../hardware/media/c2/SettingResult.aidl | 2 + .../android/hardware/media/c2/Status.aidl | 1 + .../hardware/media/c2/StructDescriptor.aidl | 1 + .../hardware/media/c2/SurfaceSyncObj.aidl | 1 + .../android/hardware/media/c2/ValueRange.aidl | 1 + .../aidl/android/hardware/media/c2/Work.aidl | 1 + .../android/hardware/media/c2/WorkBundle.aidl | 1 + .../hardware/media/c2/WorkOrdinal.aidl | 1 + .../android/hardware/media/c2/Worklet.aidl | 1 + 59 files changed, 1288 insertions(+), 5 deletions(-) rename {staging => media}/c2/aidl/Android.bp (97%) create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl rename {staging => media}/c2/aidl/android/hardware/media/c2/BaseBlock.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Block.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Buffer.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FieldId.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl (97%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/FrameData.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/IComponent.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/IComponentListener.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/IComponentStore.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/IConfigurable.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/ParamField.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Params.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/SettingResult.aidl (98%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Status.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/ValueRange.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Work.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/WorkBundle.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl (99%) rename {staging => media}/c2/aidl/android/hardware/media/c2/Worklet.aidl (99%) diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index a4c6ea4c99..53d2752155 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -364,6 +364,15 @@ vendor[0-9]*_software + + android.hardware.media.c2 + 1 + + IComponentStore + default[0-9]* + vendor[0-9]*_software + + android.hardware.memtrack 1 diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index 3bc17864c8..f3374c3835 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -103,10 +103,6 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "android.hardware.thermal@1.0", "android.hardware.thermal@1.1", "android.hardware.wifi.offload@1.0", - - // Under hardware/interfaces/staging, still in development - // AIDL - "android.hardware.media.c2", }; auto package_has_prefix = [&](const std::string& prefix) { diff --git a/staging/c2/aidl/Android.bp b/media/c2/aidl/Android.bp similarity index 97% rename from staging/c2/aidl/Android.bp rename to media/c2/aidl/Android.bp index b9da7adb2c..56531db55b 100644 --- a/staging/c2/aidl/Android.bp +++ b/media/c2/aidl/Android.bp @@ -13,7 +13,6 @@ aidl_interface { name: "android.hardware.media.c2", vendor_available: true, double_loadable: true, - unstable: true, srcs: ["android/hardware/media/c2/*.aidl"], include_dirs: [ "frameworks/native/aidl/gui", @@ -22,6 +21,7 @@ aidl_interface { "android.hardware.common-V2", "android.hardware.media.bufferpool2-V1", ], + stability: "vintf", backend: { cpp: { enabled: false, diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl new file mode 100644 index 0000000000..460ff97522 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +union BaseBlock { + android.hardware.common.NativeHandle nativeBlock; + android.hardware.media.bufferpool2.BufferStatusMessage pooledBlock; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl new file mode 100644 index 0000000000..7b3005e22d --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Block { + int index; + android.hardware.media.c2.Params meta; + android.hardware.common.NativeHandle fence; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl new file mode 100644 index 0000000000..b632932cec --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Buffer { + android.hardware.media.c2.Params info; + android.hardware.media.c2.Block[] blocks; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl new file mode 100644 index 0000000000..909476c39e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable FieldDescriptor { + android.hardware.media.c2.FieldId fieldId; + android.hardware.media.c2.FieldDescriptor.Type type; + int structIndex; + int extent; + String name; + android.hardware.media.c2.FieldDescriptor.NamedValue[] namedValues; + @Backing(type="int") @VintfStability + enum Type { + NO_INIT = 0, + INT32, + UINT32, + CNTR32, + INT64, + UINT64, + CNTR64, + FLOAT, + STRING = 0x100, + BLOB, + STRUCT = 0x20000, + } + @VintfStability + parcelable NamedValue { + String name; + long value; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl new file mode 100644 index 0000000000..935b85dbbf --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable FieldId { + int offset; + int sizeBytes; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl new file mode 100644 index 0000000000..69060bea1d --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +union FieldSupportedValues { + boolean empty; + android.hardware.media.c2.ValueRange range; + long[] values; + long[] flags; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl new file mode 100644 index 0000000000..6a5fbe26de --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable FieldSupportedValuesQuery { + android.hardware.media.c2.ParamField field; + android.hardware.media.c2.FieldSupportedValuesQuery.Type type; + @Backing(type="int") @VintfStability + enum Type { + POSSIBLE = 0, + CURRENT, + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl new file mode 100644 index 0000000000..187e3ebfeb --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable FieldSupportedValuesQueryResult { + android.hardware.media.c2.Status status; + android.hardware.media.c2.FieldSupportedValues values; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl new file mode 100644 index 0000000000..07bfb7201a --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable FrameData { + int flags; + android.hardware.media.c2.WorkOrdinal ordinal; + android.hardware.media.c2.Buffer[] buffers; + android.hardware.media.c2.Params configUpdate; + android.hardware.media.c2.InfoBuffer[] infoBuffers; + const int DROP_FRAME = (1 << 0) /* 1 */; + const int END_OF_STREAM = (1 << 1) /* 2 */; + const int DISCARD_FRAME = (1 << 2) /* 4 */; + const int FLAG_INCOMPLETE = (1 << 3) /* 8 */; + const int CODEC_CONFIG = (1 << 31) /* -2147483648 */; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl new file mode 100644 index 0000000000..7ed09afae7 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +interface IComponent { + android.hardware.common.NativeHandle configureVideoTunnel(in int avSyncHwId); + android.hardware.media.c2.IComponent.BlockPool createBlockPool(in int allocatorId); + void destroyBlockPool(in long blockPoolId); + void drain(in boolean withEos); + android.hardware.media.c2.WorkBundle flush(); + android.hardware.media.c2.IComponentInterface getInterface(); + void queue(in android.hardware.media.c2.WorkBundle workBundle); + void release(); + void reset(); + void setOutputSurface(in long blockPoolId, in android.view.Surface surface, in android.hardware.media.c2.SurfaceSyncObj syncObject); + void start(); + void stop(); + parcelable BlockPool { + long blockPoolId; + android.hardware.media.c2.IConfigurable configurable; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl new file mode 100644 index 0000000000..2350daeec2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +interface IComponentInterface { + android.hardware.media.c2.IConfigurable getConfigurable(); +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl new file mode 100644 index 0000000000..f6f2a6391c --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +interface IComponentListener { + oneway void onError(in android.hardware.media.c2.Status status, in int errorCode); + oneway void onFramesRendered(in android.hardware.media.c2.IComponentListener.RenderedFrame[] renderedFrames); + oneway void onInputBuffersReleased(in android.hardware.media.c2.IComponentListener.InputBuffer[] inputBuffers); + oneway void onTripped(in android.hardware.media.c2.SettingResult[] settingResults); + oneway void onWorkDone(in android.hardware.media.c2.WorkBundle workBundle); + @VintfStability + parcelable InputBuffer { + long frameIndex; + int arrayIndex; + } + @VintfStability + parcelable RenderedFrame { + long bufferQueueId; + int slotId; + long timestampNs; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl new file mode 100644 index 0000000000..d1b59157d4 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +interface IComponentStore { + void copyBuffer(in android.hardware.media.c2.Buffer src, in android.hardware.media.c2.Buffer dst); + android.hardware.media.c2.IComponent createComponent(in String name, in android.hardware.media.c2.IComponentListener listener, in android.hardware.media.bufferpool2.IClientManager pool); + android.hardware.media.c2.IComponentInterface createInterface(in String name); + android.hardware.media.c2.IConfigurable getConfigurable(); + android.hardware.media.bufferpool2.IClientManager getPoolClientManager(); + android.hardware.media.c2.StructDescriptor[] getStructDescriptors(in int[] indices); + android.hardware.media.c2.IComponentStore.ComponentTraits[] listComponents(); + @VintfStability + parcelable ComponentTraits { + String name; + android.hardware.media.c2.IComponentStore.ComponentTraits.Domain domain; + android.hardware.media.c2.IComponentStore.ComponentTraits.Kind kind; + int rank; + String mediaType; + String[] aliases; + @Backing(type="int") @VintfStability + enum Kind { + OTHER = 0, + DECODER, + ENCODER, + } + @Backing(type="int") @VintfStability + enum Domain { + OTHER = 0, + VIDEO, + AUDIO, + IMAGE, + } + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl new file mode 100644 index 0000000000..32f5abdb51 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +interface IConfigurable { + android.hardware.media.c2.IConfigurable.ConfigResult config(in android.hardware.media.c2.Params inParams, in boolean mayBlock); + int getId(); + String getName(); + android.hardware.media.c2.Params query(in int[] indices, in boolean mayBlock); + android.hardware.media.c2.ParamDescriptor[] querySupportedParams(in int start, in int count); + android.hardware.media.c2.FieldSupportedValuesQueryResult[] querySupportedValues(in android.hardware.media.c2.FieldSupportedValuesQuery[] inFields, in boolean mayBlock); + @VintfStability + parcelable ConfigResult { + android.hardware.media.c2.Params params; + android.hardware.media.c2.SettingResult[] failures; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl new file mode 100644 index 0000000000..94cd77d925 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable InfoBuffer { + int index; + android.hardware.media.c2.Buffer buffer; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl new file mode 100644 index 0000000000..6f0ac50bed --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable ParamDescriptor { + int index; + int attrib; + String name; + int[] dependencies; + const int ATTRIBUTE_REQUIRED = (1 << 0) /* 1 */; + const int ATTRIBUTE_PERSISTENT = (1 << 1) /* 2 */; + const int ATTRIBUTE_STRICT = (1 << 2) /* 4 */; + const int ATTRIBUTE_READ_ONLY = (1 << 3) /* 8 */; + const int ATTRIBUTE_HIDDEN = (1 << 4) /* 16 */; + const int ATTRIBUTE_INTERNAL = (1 << 5) /* 32 */; + const int ATTRIBUTE_CONST = (1 << 6) /* 64 */; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl new file mode 100644 index 0000000000..13d252257e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable ParamField { + int index; + android.hardware.media.c2.FieldId fieldId; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl new file mode 100644 index 0000000000..5a2821cdb2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable ParamFieldValues { + android.hardware.media.c2.ParamField paramOrField; + android.hardware.media.c2.FieldSupportedValues[] values; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl new file mode 100644 index 0000000000..7d363c06b3 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Params { + byte[] params; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl new file mode 100644 index 0000000000..07fc1f35aa --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable SettingResult { + android.hardware.media.c2.SettingResult.Failure failure; + android.hardware.media.c2.ParamFieldValues field; + android.hardware.media.c2.ParamFieldValues[] conflicts; + @Backing(type="int") @VintfStability + enum Failure { + BAD_TYPE, + BAD_PORT, + BAD_INDEX, + READ_ONLY, + MISMATCH, + BAD_VALUE, + CONFLICT, + UNSUPPORTED, + INFO_BAD_VALUE, + INFO_CONFLICT, + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl new file mode 100644 index 0000000000..8b430d29f2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Status { + int status; + const int OK = 0; + const int BAD_VALUE = (-22) /* -22 */; + const int BAD_INDEX = (-75) /* -75 */; + const int CANNOT_DO = (-2147483646) /* -2147483646 */; + const int DUPLICATE = (-17) /* -17 */; + const int NOT_FOUND = (-2) /* -2 */; + const int BAD_STATE = (-38) /* -38 */; + const int BLOCKING = (-9930) /* -9930 */; + const int NO_MEMORY = (-12) /* -12 */; + const int REFUSED = (-1) /* -1 */; + const int TIMED_OUT = (-110) /* -110 */; + const int OMITTED = (-74) /* -74 */; + const int CORRUPTED = (-2147483648) /* -2147483648 */; + const int NO_INIT = (-19) /* -19 */; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl new file mode 100644 index 0000000000..58268e0b92 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable StructDescriptor { + int type; + android.hardware.media.c2.FieldDescriptor[] fields; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl new file mode 100644 index 0000000000..1c9bf8d989 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable SurfaceSyncObj { + android.hardware.common.NativeHandle syncMemory; + long bqId; + int generationId; + long consumerUsage; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl new file mode 100644 index 0000000000..db71ce044e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable ValueRange { + long min; + long max; + long step; + long num; + long denom; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl new file mode 100644 index 0000000000..a5343488f5 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Work { + byte[] chainInfo; + android.hardware.media.c2.FrameData input; + android.hardware.media.c2.Worklet[] worklets; + int workletsProcessed; + android.hardware.media.c2.Status result; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl new file mode 100644 index 0000000000..84708a8556 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable WorkBundle { + android.hardware.media.c2.Work[] works; + android.hardware.media.c2.BaseBlock[] baseBlocks; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl new file mode 100644 index 0000000000..2833df3a79 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable WorkOrdinal { + long timestampUs; + long frameIndex; + long customOrdinal; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl new file mode 100644 index 0000000000..a79abf202b --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 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 -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.media.c2; +@VintfStability +parcelable Worklet { + int componentId; + byte[] tunings; + android.hardware.media.c2.SettingResult[] failures; + android.hardware.media.c2.FrameData output; +} diff --git a/staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl b/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl rename to media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl index 16e7653736..8b8b8e0e46 100644 --- a/staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl +++ b/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl @@ -25,6 +25,7 @@ import android.hardware.common.NativeHandle; * decoded data, codec-specific data, and other codec-related data are all sent * in the form of BaseBlocks. */ +@VintfStability union BaseBlock { /** * #nativeBlock is the opaque representation of a buffer. diff --git a/staging/c2/aidl/android/hardware/media/c2/Block.aidl b/media/c2/aidl/android/hardware/media/c2/Block.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/Block.aidl rename to media/c2/aidl/android/hardware/media/c2/Block.aidl index 4da849098e..34aa7b173f 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Block.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Block.aidl @@ -26,6 +26,7 @@ import android.hardware.media.c2.Params; * attributes may differ among `Block` objects that refer to the same * `BaseBlock` in the same `WorkBundle`. */ +@VintfStability parcelable Block { /** * Identity of a `BaseBlock` within a `WorkBundle`. This is an index into diff --git a/staging/c2/aidl/android/hardware/media/c2/Buffer.aidl b/media/c2/aidl/android/hardware/media/c2/Buffer.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/Buffer.aidl rename to media/c2/aidl/android/hardware/media/c2/Buffer.aidl index fe01b648a4..d2dcf2dfe0 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Buffer.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Buffer.aidl @@ -24,6 +24,7 @@ import android.hardware.media.c2.Params; * * This is a part of @ref FrameData. */ +@VintfStability parcelable Buffer { /** * Metadata associated with the buffer. diff --git a/staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl rename to media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl index 3dd14cd0ed..a2774ec72e 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl @@ -21,10 +21,12 @@ import android.hardware.media.c2.FieldId; /** * Description of a field inside a C2Param structure. */ +@VintfStability parcelable FieldDescriptor { /** * Possible types of the field. */ + @VintfStability @Backing(type="int") enum Type { NO_INIT = 0, @@ -53,6 +55,7 @@ parcelable FieldDescriptor { * Named value type. This is used for defining an enum value for a numeric * type. */ + @VintfStability parcelable NamedValue { /** * Name of the enum value. This must be unique for each enum value in diff --git a/staging/c2/aidl/android/hardware/media/c2/FieldId.aidl b/media/c2/aidl/android/hardware/media/c2/FieldId.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/FieldId.aidl rename to media/c2/aidl/android/hardware/media/c2/FieldId.aidl index c53f7a5a34..68bf058962 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FieldId.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FieldId.aidl @@ -22,6 +22,7 @@ package android.hardware.media.c2; * Within a given C2Param structure, each field is uniquely identified by @ref * FieldId. */ +@VintfStability parcelable FieldId { /** * Offset of the field in bytes. diff --git a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl rename to media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl index 5f4ad2a921..6c2033b5d8 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl @@ -26,6 +26,7 @@ import android.hardware.media.c2.ValueRange; * The intended type of values must be made clear in the context where * `FieldSupportedValues` is used. */ +@VintfStability union FieldSupportedValues { /** * No supported values diff --git a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl similarity index 97% rename from staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl rename to media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl index 33a8170688..bdaaef6b73 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl @@ -22,7 +22,9 @@ import android.hardware.media.c2.ParamField; * Query information for supported values of a field. This is used as input to * IConfigurable::querySupportedValues(). */ +@VintfStability parcelable FieldSupportedValuesQuery { + @VintfStability @Backing(type="int") enum Type { /** diff --git a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl rename to media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl index 133712a57e..b5c28c6d1c 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl @@ -23,6 +23,7 @@ import android.hardware.media.c2.Status; * This structure is used to hold the result from * IConfigurable::querySupportedValues(). */ +@VintfStability parcelable FieldSupportedValuesQueryResult { /** * Result of the query. Possible values are diff --git a/staging/c2/aidl/android/hardware/media/c2/FrameData.aidl b/media/c2/aidl/android/hardware/media/c2/FrameData.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/FrameData.aidl rename to media/c2/aidl/android/hardware/media/c2/FrameData.aidl index 81c76be278..15c1b6d434 100644 --- a/staging/c2/aidl/android/hardware/media/c2/FrameData.aidl +++ b/media/c2/aidl/android/hardware/media/c2/FrameData.aidl @@ -31,6 +31,7 @@ import android.hardware.media.c2.WorkOrdinal; * @note `FrameData` is the HIDL counterpart of `C2FrameData` in the Codec 2.0 * standard. */ +@VintfStability parcelable FrameData { /** List of frame flags */ /** diff --git a/staging/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/IComponent.aidl rename to media/c2/aidl/android/hardware/media/c2/IComponent.aidl index bea4b70f88..b3390c3f4d 100644 --- a/staging/c2/aidl/android/hardware/media/c2/IComponent.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl @@ -32,6 +32,7 @@ import android.hardware.media.c2.SurfaceSyncObj; * All methods in `IComponent` must not block. If a method call cannot be * completed in a timely manner, it must throw `Status::TIMED_OUT`. */ +@VintfStability interface IComponent { /** * The reference object from framwork to HAL C2BlockPool. diff --git a/staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl rename to media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl index 4589115098..9db81e6139 100644 --- a/staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl @@ -26,6 +26,7 @@ import android.hardware.media.c2.IConfigurable; * * An actual component exposes this interface via IComponent::getInterface(). */ +@VintfStability interface IComponentInterface { /** * Returns the @ref IConfigurable instance associated to this component diff --git a/staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl rename to media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl index 786c8f1651..75500b7271 100644 --- a/staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl @@ -23,11 +23,13 @@ import android.hardware.media.c2.WorkBundle; /** * Callback interface for handling notifications from @ref IComponent. */ +@VintfStability oneway interface IComponentListener { /** * Identifying information for an input buffer previously queued to the * component via IComponent::queue(). */ + @VintfStability parcelable InputBuffer { /** * This value comes from `Work::input.ordinal.frameIndex` in a `Work` @@ -43,6 +45,7 @@ oneway interface IComponentListener { /** * Information about rendering of a frame to a `Surface`. */ + @VintfStability parcelable RenderedFrame { /** * Id of the `BufferQueue` containing the rendered buffer. diff --git a/staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl rename to media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl index d332bd3a1c..1435a7e4bc 100644 --- a/staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl @@ -34,17 +34,21 @@ import android.hardware.media.c2.StructDescriptor; * @note This is an extension of version 1.1 of `IComponentStore`. The purpose * of the extension is to add support for blocking output buffer allocator. */ +@VintfStability interface IComponentStore { /** * Component traits. */ + @VintfStability parcelable ComponentTraits { + @VintfStability @Backing(type="int") enum Kind { OTHER = 0, DECODER, ENCODER, } + @VintfStability @Backing(type="int") enum Domain { OTHER = 0, diff --git a/staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl b/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl rename to media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl index 9f79576ff5..7fdb8259b8 100644 --- a/staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl +++ b/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl @@ -28,6 +28,7 @@ import android.hardware.media.c2.SettingResult; * This interface must be supported in all states of the owning object, and must * not change the state of the owning object. */ +@VintfStability interface IConfigurable { /** * Return parcelable for config() interface. @@ -35,6 +36,7 @@ interface IConfigurable { * This includes the successful config settings along with the failure reasons of * the specified setting. */ + @VintfStability parcelable ConfigResult { Params params; SettingResult[] failures; diff --git a/staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl b/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl rename to media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl index 7cfabcbc42..207c4d0c1a 100644 --- a/staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl +++ b/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl @@ -23,6 +23,7 @@ import android.hardware.media.c2.Buffer; * * This is a part of @ref FrameData. */ +@VintfStability parcelable InfoBuffer { /** * A C2Param structure index. diff --git a/staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl rename to media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl index 716c07e6a4..84c6acc7e4 100644 --- a/staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl +++ b/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl @@ -21,6 +21,7 @@ package android.hardware.media.c2; * * @ref ParamDescriptor is returned by IConfigurable::querySupportedParams(). */ +@VintfStability parcelable ParamDescriptor { /** The list of bit flags for attrib */ /** diff --git a/staging/c2/aidl/android/hardware/media/c2/ParamField.aidl b/media/c2/aidl/android/hardware/media/c2/ParamField.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/ParamField.aidl rename to media/c2/aidl/android/hardware/media/c2/ParamField.aidl index 94f737da33..64a46bbef5 100644 --- a/staging/c2/aidl/android/hardware/media/c2/ParamField.aidl +++ b/media/c2/aidl/android/hardware/media/c2/ParamField.aidl @@ -21,6 +21,7 @@ import android.hardware.media.c2.FieldId; /** * Reference to a field in a C2Param structure. */ +@VintfStability parcelable ParamField { /** * Index of the C2Param structure. diff --git a/staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl b/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl rename to media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl index 4bb9a913a9..7b74c0ec34 100644 --- a/staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl +++ b/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl @@ -26,6 +26,7 @@ import android.hardware.media.c2.ParamField; * values object. This structure is used when reporting parameter configuration * failures and conflicts. */ +@VintfStability parcelable ParamFieldValues { /** * Reference to a field or a C2Param structure. diff --git a/staging/c2/aidl/android/hardware/media/c2/Params.aidl b/media/c2/aidl/android/hardware/media/c2/Params.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/Params.aidl rename to media/c2/aidl/android/hardware/media/c2/Params.aidl index 3c1a321122..53b512cf91 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Params.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Params.aidl @@ -30,6 +30,7 @@ package android.hardware.media.c2; * - 4 bytes: size of the C2Param object (unsigned 4-byte integer). * - (size - 8) bytes: data of the C2Param object. */ +@VintfStability parcelable Params { byte[] params; } diff --git a/staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl b/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl similarity index 98% rename from staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl rename to media/c2/aidl/android/hardware/media/c2/SettingResult.aidl index a27014696c..c2b9574457 100644 --- a/staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl +++ b/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl @@ -22,10 +22,12 @@ import android.hardware.media.c2.ParamFieldValues; * Information describing the reason the parameter settings may fail, or may be * overridden. */ +@VintfStability parcelable SettingResult { /** * Failure code */ + @VintfStability @Backing(type="int") enum Failure { /** diff --git a/staging/c2/aidl/android/hardware/media/c2/Status.aidl b/media/c2/aidl/android/hardware/media/c2/Status.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/Status.aidl rename to media/c2/aidl/android/hardware/media/c2/Status.aidl index 660db57df3..58a24047e7 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Status.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Status.aidl @@ -19,6 +19,7 @@ package android.hardware.media.c2; /** * Common return values for Codec2 operations. */ +@VintfStability parcelable Status { /** * Operation completed successfully. diff --git a/staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl rename to media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl index 5d6d2ebc42..00359041f0 100644 --- a/staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl +++ b/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl @@ -22,6 +22,7 @@ import android.hardware.media.c2.FieldDescriptor; * Description of a C2Param structure. It consists of an index and a list of * `FieldDescriptor`s. */ +@VintfStability parcelable StructDescriptor { /** * Index of the structure. diff --git a/staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl b/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl rename to media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl index 2e7330e90a..d20e10273f 100644 --- a/staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl +++ b/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl @@ -22,6 +22,7 @@ import android.hardware.common.NativeHandle; * output buffers. This keeps # of dequeued buffers from Surface less than * configured max # of dequeued buffers all the time. */ +@VintfStability parcelable SurfaceSyncObj { /** * ASharedMemory for synchronization data. Layout is below diff --git a/staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl b/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl rename to media/c2/aidl/android/hardware/media/c2/ValueRange.aidl index 6707a25d9f..9abcb7da2b 100644 --- a/staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl +++ b/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl @@ -38,6 +38,7 @@ package android.hardware.media.c2; * The division in the formula may truncate the result if the data type of * these values is an integral type. */ +@VintfStability parcelable ValueRange { /** * Lower end of the range (inclusive). diff --git a/staging/c2/aidl/android/hardware/media/c2/Work.aidl b/media/c2/aidl/android/hardware/media/c2/Work.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/Work.aidl rename to media/c2/aidl/android/hardware/media/c2/Work.aidl index 07324795e0..4b8d696871 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Work.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Work.aidl @@ -34,6 +34,7 @@ import android.hardware.media.c2.Worklet; * * `Work` is a part of @ref WorkBundle. */ +@VintfStability parcelable Work { /** * Additional work chain info not part of this work. diff --git a/staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl b/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl rename to media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl index 79b4cdbc6a..2125fdab6c 100644 --- a/staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl +++ b/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl @@ -35,6 +35,7 @@ import android.hardware.media.c2.Work; * Codec 2.0 standard. The presence of #baseBlocks helps with minimizing the * data transferred over an IPC. */ +@VintfStability parcelable WorkBundle { /** * A list of Work items. diff --git a/staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl b/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl rename to media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl index eb8b24427b..5708a90bc8 100644 --- a/staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl +++ b/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl @@ -31,6 +31,7 @@ package android.hardware.media.c2; * @note `WorkOrdinal` is the HIDL counterpart of `C2WorkOrdinalStruct` in the * Codec 2.0 standard. */ +@VintfStability parcelable WorkOrdinal { /** * Timestamp in microseconds. diff --git a/staging/c2/aidl/android/hardware/media/c2/Worklet.aidl b/media/c2/aidl/android/hardware/media/c2/Worklet.aidl similarity index 99% rename from staging/c2/aidl/android/hardware/media/c2/Worklet.aidl rename to media/c2/aidl/android/hardware/media/c2/Worklet.aidl index 04c59c1761..6b3ceac5a0 100644 --- a/staging/c2/aidl/android/hardware/media/c2/Worklet.aidl +++ b/media/c2/aidl/android/hardware/media/c2/Worklet.aidl @@ -28,6 +28,7 @@ import android.hardware.media.c2.SettingResult; * a @ref Work object for each expected output before calling * IComponent::queue(). */ +@VintfStability parcelable Worklet { /** * Component id. (Input) -- GitLab From cd1bf1e5305240af8871e73dbddb0a7df91c099f Mon Sep 17 00:00:00 2001 From: Elie Kheirallah Date: Fri, 14 Apr 2023 17:49:42 +0000 Subject: [PATCH 021/962] Fix null dereference read in android::hardware::bluetooth::hci::H4Protocol::Send Bug: 276375037 Test: atest VtsHalBluetoothTargetTest Change-Id: Ib9f99a75a97538899ac64a3c02fff1ec5804a0e6 --- bluetooth/aidl/default/BluetoothHci.cpp | 28 ++++++++++++++++--------- bluetooth/aidl/default/BluetoothHci.h | 5 +++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp index d4e4b34c6e..940f2adc5b 100644 --- a/bluetooth/aidl/default/BluetoothHci.cpp +++ b/bluetooth/aidl/default/BluetoothHci.cpp @@ -176,7 +176,10 @@ void BluetoothHci::reset() { mFdWatcher.WatchFdForNonBlockingReads(mFd, [this](int) { mH4->OnDataReady(); }); - send(PacketType::COMMAND, reset); + ndk::ScopedAStatus result = send(PacketType::COMMAND, reset); + if (!result.isOk()) { + ALOGE("Error sending reset command"); + } auto status = resetFuture.wait_for(std::chrono::seconds(1)); mFdWatcher.StopWatchingFileDescriptors(); if (status == std::future_status::ready) { @@ -303,30 +306,35 @@ ndk::ScopedAStatus BluetoothHci::close() { ndk::ScopedAStatus BluetoothHci::sendHciCommand( const std::vector& packet) { - send(PacketType::COMMAND, packet); - return ndk::ScopedAStatus::ok(); + return send(PacketType::COMMAND, packet); } ndk::ScopedAStatus BluetoothHci::sendAclData( const std::vector& packet) { - send(PacketType::ACL_DATA, packet); - return ndk::ScopedAStatus::ok(); + return send(PacketType::ACL_DATA, packet); } ndk::ScopedAStatus BluetoothHci::sendScoData( const std::vector& packet) { - send(PacketType::SCO_DATA, packet); - return ndk::ScopedAStatus::ok(); + return send(PacketType::SCO_DATA, packet); } ndk::ScopedAStatus BluetoothHci::sendIsoData( const std::vector& packet) { - send(PacketType::ISO_DATA, packet); - return ndk::ScopedAStatus::ok(); + return send(PacketType::ISO_DATA, packet); } -void BluetoothHci::send(PacketType type, const std::vector& v) { +ndk::ScopedAStatus BluetoothHci::send(PacketType type, + const std::vector& v) { + if (mH4 == nullptr) { + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + if (v.empty()) { + ALOGE("Packet is empty, no data was found to be sent"); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } mH4->Send(type, v); + return ndk::ScopedAStatus::ok(); } } // namespace aidl::android::hardware::bluetooth::impl diff --git a/bluetooth/aidl/default/BluetoothHci.h b/bluetooth/aidl/default/BluetoothHci.h index 85aafc8197..477cc5c907 100644 --- a/bluetooth/aidl/default/BluetoothHci.h +++ b/bluetooth/aidl/default/BluetoothHci.h @@ -66,8 +66,9 @@ class BluetoothHci : public BnBluetoothHci { ::android::hardware::bluetooth::async::AsyncFdWatcher mFdWatcher; int getFdFromDevPath(); - void send(::android::hardware::bluetooth::hci::PacketType type, - const std::vector& packet); + [[nodiscard]] ndk::ScopedAStatus send( + ::android::hardware::bluetooth::hci::PacketType type, + const std::vector& packet); std::unique_ptr management_{}; // Send a reset command and discard all packets until a reset is received. -- GitLab From 0c581a084aad1916bb4fb67542267b6bce6f9b84 Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Thu, 20 Apr 2023 23:10:25 +0000 Subject: [PATCH 022/962] Bluetooth: Enable test Cdd_C_12_1_Bluetooth5Requirements The requirements have been added to RootCanal: - LE Periodic Advertising - LL Privacy - LE 2M Phy Test: atest Bug: 275847929 Change-Id: Ifa49494091727bf162554a658629bc4ec3c3cd63 --- bluetooth/aidl/TEST_MAPPING | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/bluetooth/aidl/TEST_MAPPING b/bluetooth/aidl/TEST_MAPPING index d1de251577..18958d2713 100644 --- a/bluetooth/aidl/TEST_MAPPING +++ b/bluetooth/aidl/TEST_MAPPING @@ -1,24 +1,12 @@ { "presubmit" : [ { - "name" : "VtsHalBluetoothTargetTest", - "options": [ - { - // TODO(b/275847929) - "exclude-filter": "VtsHalBluetoothTargetTest.PerInstance/BluetoothAidlTest#Cdd_C_12_1_Bluetooth5Requirements/0_android_hardware_bluetooth_IBluetoothHci_default" - } - ] + "name" : "VtsHalBluetoothTargetTest" } ], "hwasan-presubmit" : [ { - "name" : "VtsHalBluetoothTargetTest", - "options": [ - { - // TODO(b/275847929) - "exclude-filter": "VtsHalBluetoothTargetTest.PerInstance/BluetoothAidlTest#Cdd_C_12_1_Bluetooth5Requirements/0_android_hardware_bluetooth_IBluetoothHci_default" - } - ] + "name" : "VtsHalBluetoothTargetTest" } ] } -- GitLab From 284530334207809446ed70a5412cd02f426f5aa9 Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Wed, 19 Apr 2023 18:14:03 +0000 Subject: [PATCH 023/962] Fix HCI parser and packetizer Issue found from the test H4ProtocolAsyncTest#TestMultiplePackets. The packetizer does not correctly handle a packet termination at the beginning of a chunk. Test: atest --host bluetooth-vendor-interface-hci-test Bug: 276652301 Change-Id: I1b61efcfa5f817fdb8b5870e81d660be5279fdea --- bluetooth/hci/h4_protocol.cc | 9 +++------ bluetooth/hci/hci_packetizer.cc | 21 +++++++++++++-------- bluetooth/hci/hci_packetizer.h | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bluetooth/hci/h4_protocol.cc b/bluetooth/hci/h4_protocol.cc index 51a624f4a8..5f6d86e0e2 100644 --- a/bluetooth/hci/h4_protocol.cc +++ b/bluetooth/hci/h4_protocol.cc @@ -105,15 +105,12 @@ void H4Protocol::SendDataToPacketizer(uint8_t* buffer, size_t length) { buffer_offset += 1; } else { bool packet_ready = hci_packetizer_.OnDataReady( - hci_packet_type_, input_buffer, buffer_offset); + hci_packet_type_, input_buffer, &buffer_offset); if (packet_ready) { - // Call packet callback and move offset. - buffer_offset += OnPacketReady(hci_packetizer_.GetPacket()); + // Call packet callback. + OnPacketReady(hci_packetizer_.GetPacket()); // Get ready for the next type byte. hci_packet_type_ = PacketType::UNKNOWN; - } else { - // The data was consumed, but there wasn't a packet. - buffer_offset = input_buffer.size(); } } } diff --git a/bluetooth/hci/hci_packetizer.cc b/bluetooth/hci/hci_packetizer.cc index 5b6c4435cc..41359200b4 100644 --- a/bluetooth/hci/hci_packetizer.cc +++ b/bluetooth/hci/hci_packetizer.cc @@ -51,9 +51,10 @@ const std::vector& HciPacketizer::GetPacket() const { return packet_; } bool HciPacketizer::OnDataReady(PacketType packet_type, const std::vector& buffer, - size_t offset) { + size_t* offset) { bool packet_completed = false; - size_t bytes_available = buffer.size() - offset; + size_t bytes_available = buffer.size() - *offset; + switch (state_) { case HCI_HEADER: { size_t header_size = @@ -62,18 +63,20 @@ bool HciPacketizer::OnDataReady(PacketType packet_type, bytes_remaining_ = header_size; packet_.clear(); } + size_t bytes_to_copy = std::min(bytes_remaining_, bytes_available); - packet_.insert(packet_.end(), buffer.begin() + offset, - buffer.begin() + offset + bytes_to_copy); + packet_.insert(packet_.end(), buffer.begin() + *offset, + buffer.begin() + *offset + bytes_to_copy); bytes_remaining_ -= bytes_to_copy; bytes_available -= bytes_to_copy; + *offset += bytes_to_copy; + if (bytes_remaining_ == 0) { bytes_remaining_ = HciGetPacketLengthForType(packet_type, packet_); if (bytes_remaining_ > 0) { state_ = HCI_PAYLOAD; if (bytes_available > 0) { - packet_completed = - OnDataReady(packet_type, buffer, offset + bytes_to_copy); + packet_completed = OnDataReady(packet_type, buffer, offset); } } else { packet_completed = true; @@ -84,9 +87,10 @@ bool HciPacketizer::OnDataReady(PacketType packet_type, case HCI_PAYLOAD: { size_t bytes_to_copy = std::min(bytes_remaining_, bytes_available); - packet_.insert(packet_.end(), buffer.begin() + offset, - buffer.begin() + offset + bytes_to_copy); + packet_.insert(packet_.end(), buffer.begin() + *offset, + buffer.begin() + *offset + bytes_to_copy); bytes_remaining_ -= bytes_to_copy; + *offset += bytes_to_copy; if (bytes_remaining_ == 0) { state_ = HCI_HEADER; packet_completed = true; @@ -94,6 +98,7 @@ bool HciPacketizer::OnDataReady(PacketType packet_type, break; } } + return packet_completed; } diff --git a/bluetooth/hci/hci_packetizer.h b/bluetooth/hci/hci_packetizer.h index ba3e8412bf..0d9319f1e9 100644 --- a/bluetooth/hci/hci_packetizer.h +++ b/bluetooth/hci/hci_packetizer.h @@ -28,7 +28,7 @@ class HciPacketizer { public: HciPacketizer() = default; bool OnDataReady(PacketType packet_type, const std::vector& data, - size_t offset); + size_t* offset); const std::vector& GetPacket() const; protected: -- GitLab From bcc997bdf3329e107b16663d195dcbe50e728044 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Fri, 21 Apr 2023 09:38:03 -0700 Subject: [PATCH 024/962] Bluetooth: Add a test for alignment Bug: 276652301 Test: atest --host bluetooth-vendor-interface-hci-test Change-Id: I3e862dd88aeed65e7a4ef1f9a223cc520a1ccc54 --- bluetooth/hci/test/h4_protocol_unittest.cc | 59 ++++++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/bluetooth/hci/test/h4_protocol_unittest.cc b/bluetooth/hci/test/h4_protocol_unittest.cc index d3fab61d4a..f0c49b5782 100644 --- a/bluetooth/hci/test/h4_protocol_unittest.cc +++ b/bluetooth/hci/test/h4_protocol_unittest.cc @@ -31,7 +31,6 @@ #include #include "async_fd_watcher.h" -#include "log/log.h" using android::hardware::bluetooth::async::AsyncFdWatcher; using namespace android::hardware::bluetooth::hci; @@ -49,6 +48,7 @@ static char sco_data[100] = static char event_data[100] = "The edges of a surface are lines."; static char iso_data[100] = "A plane angle is the inclination to one another of two lines in a ..."; +static char short_payload[10] = "12345"; // 5 seconds. Just don't hang. static constexpr size_t kTimeoutMs = 5000; @@ -225,6 +225,49 @@ class H4ProtocolTest : public ::testing::Test { CallDataReady(); } + void WriteAndExpectManyAclDataPacketsDifferentOffsetsShort() { + std::promise last_packet_promise; + size_t kNumPackets = 30; + // h4 type[1] + handle[2] + size[2] + char preamble[5] = {static_cast(PacketType::ACL_DATA), 19, 92, 0, + 0}; + int length = strlen(short_payload); + preamble[3] = length & 0xFF; + preamble[4] = 0; + + EXPECT_CALL(acl_cb_, Call(PacketMatches(preamble + 1, kAclHeaderSize, + short_payload))) + .Times(kNumPackets); + ExpectInboundEvent(event_data, &last_packet_promise); + + char all_packets[kNumPackets * 10]; + size_t total_bytes = 0; + + for (size_t packet = 0; packet < kNumPackets; packet++) { + for (size_t i = 0; i < sizeof(preamble); i++) { + all_packets[total_bytes++] = preamble[i]; + } + for (size_t i = 0; i < length; i++) { + all_packets[total_bytes++] = short_payload[i]; + } + } + + size_t written_bytes = 0; + size_t partial_size = 1; + while (written_bytes < total_bytes) { + size_t to_write = std::min(partial_size, total_bytes - written_bytes); + TEMP_FAILURE_RETRY( + write(chip_uart_fd_, all_packets + written_bytes, to_write)); + written_bytes += to_write; + CallDataReady(); + partial_size++; + partial_size = partial_size % 5 + 1; + } + WriteInboundEvent(event_data); + CallDataReady(); + WaitForTimeout(&last_packet_promise); + } + testing::MockFunction&)> cmd_cb_; testing::MockFunction&)> event_cb_; testing::MockFunction&)> acl_cb_; @@ -276,6 +319,10 @@ TEST_F(H4ProtocolTest, TestMultiplePackets) { WriteAndExpectManyInboundAclDataPackets(sco_data); } +TEST_F(H4ProtocolTest, TestMultipleWritesPacketsShortWrites) { + WriteAndExpectManyAclDataPacketsDifferentOffsetsShort(); +} + TEST_F(H4ProtocolTest, TestDisconnect) { EXPECT_CALL(disconnect_cb_, Call()); close(chip_uart_fd_); @@ -332,10 +379,8 @@ class H4ProtocolAsyncTest : public H4ProtocolTest { void TearDown() override { fd_watcher_.StopWatchingFileDescriptors(); } - void CallDataReady() override { - // The Async test can't call data ready. - FAIL(); - } + // Calling CallDataReady() has no effect in the AsyncTest + void CallDataReady() override {} void SendAndReadUartOutbound(PacketType type, char* data) { ALOGD("%s sending", __func__); @@ -434,6 +479,10 @@ TEST_F(H4ProtocolAsyncTest, TestMultiplePackets) { WriteAndExpectManyInboundAclDataPackets(sco_data); } +TEST_F(H4ProtocolAsyncTest, TestMultipleWritesPacketsShortWrites) { + WriteAndExpectManyAclDataPacketsDifferentOffsetsShort(); +} + TEST_F(H4ProtocolAsyncTest, TestDisconnect) { std::promise promise; EXPECT_CALL(disconnect_cb_, Call()).WillOnce(Notify(&promise)); -- GitLab From 064051c7826d0e185cc89ca3ce78b2777b800ac7 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 21 Apr 2023 19:53:56 +0000 Subject: [PATCH 025/962] FCM 9: remove renderscript HAL Bug: 205762042 Test: N/A Change-Id: I3ff81b5fb8c01f948fbda2f5fa4a6764ba3c573b --- compatibility_matrices/compatibility_matrix.9.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index 190632551a..9b9506da3c 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -587,14 +587,6 @@ slot1 - - android.hardware.renderscript - 1.0 - - IDevice - default - - android.hardware.rebootescrow 1 -- GitLab From 207322654aa4d0fcc60ba2d19324d7cbda41dc15 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Fri, 21 Apr 2023 16:36:00 -0600 Subject: [PATCH 026/962] Check for MGF1 digests in key characteristics. A bug in the Trusty HAL service caused it to replace MGF1 digest tags with Tag::INVALID. This tests that MGF1 tags are returned properly in the MGF1 success test, and verifies that Tag::INVALID is never returned by any test. Bug: 278157584 Test: adb shell /data/nativetest/VtsAidlKeyMintTargetTest/VtsAidlKeyMintTargetTest Change-Id: I5d391310795c99f37acf3c48310c127a7a31fac3 --- .../aidl/vts/functional/KeyMintAidlTestBase.cpp | 7 +++++++ .../keymint/aidl/vts/functional/KeyMintTest.cpp | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index 5e27bd0e5b..60d8748395 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -71,6 +71,11 @@ const uint32_t kInvalidPatchlevel = 99998877; // additional overhead, for the digest algorithmIdentifier required by PKCS#1. const size_t kPkcs1UndigestedSignaturePaddingOverhead = 11; +size_t count_tag_invalid_entries(const std::vector& authorizations) { + return std::count_if(authorizations.begin(), authorizations.end(), + [](const KeyParameter& e) -> bool { return e.tag == Tag::INVALID; }); +} + typedef KeyMintAidlTestBase::KeyData KeyData; // Predicate for testing basic characteristics validity in generation or import. bool KeyCharacteristicsBasicallyValid(SecurityLevel secLevel, @@ -84,6 +89,8 @@ bool KeyCharacteristicsBasicallyValid(SecurityLevel secLevel, return false; } + EXPECT_EQ(count_tag_invalid_entries(entry.authorizations), 0); + // Just ignore the SecurityLevel::KEYSTORE as the KM won't do any enforcement on this. if (entry.securityLevel == SecurityLevel::KEYSTORE) continue; diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp index e99149bf17..0a70bafb83 100644 --- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp @@ -5314,6 +5314,20 @@ TEST_P(EncryptionOperationsTest, RsaOaepWithMGFDigestSuccess) { .Digest(Digest::SHA_2_256) .SetDefaultValidity())); + std::vector mgf1DigestsInAuths; + mgf1DigestsInAuths.reserve(digests.size()); + const auto& hw_auths = SecLevelAuthorizations(key_characteristics_); + std::for_each(hw_auths.begin(), hw_auths.end(), [&](auto& param) { + if (param.tag == Tag::RSA_OAEP_MGF_DIGEST) { + KeyParameterValue value = param.value; + mgf1DigestsInAuths.push_back(param.value.template get()); + } + }); + + std::sort(digests.begin(), digests.end()); + std::sort(mgf1DigestsInAuths.begin(), mgf1DigestsInAuths.end()); + EXPECT_EQ(digests, mgf1DigestsInAuths); + string message = "Hello"; for (auto digest : digests) { -- GitLab From 23791a9f8757facd294fa15324c37a13bfbc50e8 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 24 Apr 2023 16:30:08 +0000 Subject: [PATCH 027/962] Revert "disable V matrix." This reverts commit c2340359de15f4c363197a5ac32691c131cba2e3. Reason for revert: re-enable on udc-dev-plus-aosp b/c DO NOT| MERGE barrier is configured there. Change-Id: I0602be91d7e26b4cf090700497fde6425b4540c8 --- compatibility_matrices/Android.bp | 12 ++++++++++++ compatibility_matrices/Android.mk | 1 + compatibility_matrices/compatibility_matrix.9.xml | 1 - 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index 93b5380e27..b3ca29309d 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -82,3 +82,15 @@ vintf_compatibility_matrix { "kernel_config_u_6.1", ], } + +vintf_compatibility_matrix { + name: "framework_compatibility_matrix.9.xml", + stem: "compatibility_matrix.9.xml", + srcs: [ + "compatibility_matrix.9.xml", + ], + kernel_configs: [ + "kernel_config_v_5.15", + "kernel_config_v_6.1", + ], +} diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index 6e4c4193f7..a82a421ff4 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -103,6 +103,7 @@ my_system_matrix_deps := \ framework_compatibility_matrix.6.xml \ framework_compatibility_matrix.7.xml \ framework_compatibility_matrix.8.xml \ + framework_compatibility_matrix.9.xml \ framework_compatibility_matrix.device.xml \ my_framework_matrix_deps += \ diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index ac707be256..3f05e9e574 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -1,4 +1,3 @@ - android.hardware.audio -- GitLab From 17427bb7b251bdcde15b67e99977c5721859eda8 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 24 Apr 2023 17:09:19 +0000 Subject: [PATCH 028/962] FCM 9: -= satellite in U Satellite only exists in git_master. Bug: N/A Test: N/A Merged-In: Iedc3097a9db58c0539e4aa61d089ee9d1986d51f Change-Id: Ifac2101b7478c29899567a6ba4679c0f897f0a4e --- compatibility_matrices/compatibility_matrix.9.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index ac707be256..66e79ddfc1 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -492,16 +492,6 @@ slot3 - - android.hardware.radio.satellite - 1 - - IRadioSatellite - slot1 - slot2 - slot3 - - android.hardware.radio.ims.media 1 -- GitLab From f2ae193680d6f02a2394423f805aadd13a7d152b Mon Sep 17 00:00:00 2001 From: Andrew Scull Date: Mon, 24 Apr 2023 19:09:09 +0000 Subject: [PATCH 029/962] Strictly deprecate IRPC test mode key generation It's already documented that IRPC v3 doesn't make use of test mode keys however VTS still required support for their generation. Fix this and simplify implementation of the v3 HAL by expecting an error in all cases that the deprecated test mode keys are seen. IRPC v3 also fully deprecated the EEK meaning a v3 implementation must unconditionally report CURVE_NONE for supportedEekCurve. The VTS tests are enhanced with contextual version constants rather than reusing constants with seemingly unrelated names. Bug: 278013975 Test: atest VtsHalRemotelyProvisionedComponentTargetTest Change-Id: I5709a0b1cd77eb28e677f64bb781fad58d91570a --- .../IRemotelyProvisionedComponent.aidl | 4 ++ .../VtsRemotelyProvisionedComponentTests.cpp | 59 ++++++++++--------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl index 461357d4e3..2a4cba1f0e 100644 --- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl +++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl @@ -134,6 +134,10 @@ interface IRemotelyProvisionedComponent { * are marked (see the definition of PublicKey in the MacedPublicKey structure) to * prevent them from being confused with production keys. * + * This parameter has been deprecated since version 3 of the HAL and will always be + * false. From v3, if this parameter is true, the method must raise a + * ServiceSpecificException with an error of code of STATUS_REMOVED. + * * @param out MacedPublicKey macedPublicKey contains the public key of the generated key pair, * MACed so that generateCertificateRequest can easily verify, without the * privateKeyHandle, that the contained public key is for remote certification. diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 94bfbb48de..8906543e7f 100644 --- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -47,7 +47,11 @@ using ::std::vector; namespace { constexpr int32_t VERSION_WITH_UNIQUE_ID_SUPPORT = 2; + +constexpr int32_t VERSION_WITHOUT_EEK = 3; constexpr int32_t VERSION_WITHOUT_TEST_MODE = 3; +constexpr int32_t VERSION_WITH_CERTIFICATE_REQUEST_V2 = 3; +constexpr int32_t VERSION_WITH_SUPPORTED_NUM_KEYS_IN_CSR = 3; constexpr uint8_t MIN_CHALLENGE_SIZE = 0; constexpr uint8_t MAX_CHALLENGE_SIZE = 64; @@ -226,21 +230,13 @@ TEST_P(GetHardwareInfoTests, supportsValidCurve) { RpcHardwareInfo hwInfo; ASSERT_TRUE(provisionable_->getHardwareInfo(&hwInfo).isOk()); - const std::set validCurves = {RpcHardwareInfo::CURVE_P256, RpcHardwareInfo::CURVE_25519}; - // First check for the implementations that supports only IRPC V3+. - if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { - bytevec keysToSignMac; - DeviceInfo deviceInfo; - ProtectedData protectedData; - auto status = provisionable_->generateCertificateRequest(false, {}, {}, {}, &deviceInfo, - &protectedData, &keysToSignMac); - if (!status.isOk() && - (status.getServiceSpecificError() == BnRemotelyProvisionedComponent::STATUS_REMOVED)) { - ASSERT_EQ(hwInfo.supportedEekCurve, RpcHardwareInfo::CURVE_NONE) - << "Invalid curve: " << hwInfo.supportedEekCurve; - return; - } + if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_EEK) { + ASSERT_EQ(hwInfo.supportedEekCurve, RpcHardwareInfo::CURVE_NONE) + << "Invalid curve: " << hwInfo.supportedEekCurve; + return; } + + const std::set validCurves = {RpcHardwareInfo::CURVE_P256, RpcHardwareInfo::CURVE_25519}; ASSERT_EQ(validCurves.count(hwInfo.supportedEekCurve), 1) << "Invalid curve: " << hwInfo.supportedEekCurve; } @@ -264,7 +260,7 @@ TEST_P(GetHardwareInfoTests, uniqueId) { * Verify implementation supports at least MIN_SUPPORTED_NUM_KEYS_IN_CSR keys in a CSR. */ TEST_P(GetHardwareInfoTests, supportedNumKeysInCsr) { - if (rpcHardwareInfo.versionNumber < VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber < VERSION_WITH_SUPPORTED_NUM_KEYS_IN_CSR) { return; } @@ -365,6 +361,13 @@ TEST_P(GenerateKeyTests, generateEcdsaP256Key_testMode) { bytevec privateKeyBlob; bool testMode = true; auto status = provisionable_->generateEcdsaP256KeyPair(testMode, &macedPubKey, &privateKeyBlob); + + if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { + ASSERT_FALSE(status.isOk()); + EXPECT_EQ(status.getServiceSpecificError(), BnRemotelyProvisionedComponent::STATUS_REMOVED); + return; + } + ASSERT_TRUE(status.isOk()); check_maced_pubkey(macedPubKey, testMode, nullptr); } @@ -410,7 +413,7 @@ class CertificateRequestTest : public CertificateRequestTestBase { CertificateRequestTestBase::SetUp(); ASSERT_FALSE(HasFatalFailure()); - if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber >= VERSION_WITH_CERTIFICATE_REQUEST_V2) { GTEST_SKIP() << "This test case only applies to RKP v1 and v2. " << "RKP version discovered: " << rpcHardwareInfo.versionNumber; } @@ -688,7 +691,7 @@ class CertificateRequestV2Test : public CertificateRequestTestBase { CertificateRequestTestBase::SetUp(); ASSERT_FALSE(HasFatalFailure()); - if (rpcHardwareInfo.versionNumber < VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber < VERSION_WITH_CERTIFICATE_REQUEST_V2) { GTEST_SKIP() << "This test case only applies to RKP v3 and above. " << "RKP version discovered: " << rpcHardwareInfo.versionNumber; } @@ -802,23 +805,23 @@ TEST_P(CertificateRequestV2Test, NonEmptyRequestCorruptMac) { } /** - * Generate a non-empty certificate request in prod mode, with test keys. Must fail with - * STATUS_TEST_KEY_IN_PRODUCTION_REQUEST. + * Call generateCertificateRequest(). Make sure it's removed. */ -TEST_P(CertificateRequestV2Test, NonEmptyRequest_testKeyInProdCert) { - generateKeys(true /* testMode */, 1 /* numKeys */); - - bytevec csr; - auto status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge_, &csr); +TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed_prodMode) { + bytevec keysToSignMac; + DeviceInfo deviceInfo; + ProtectedData protectedData; + auto status = provisionable_->generateCertificateRequest( + false /* testMode */, {} /* keysToSign */, {} /* EEK chain */, challenge_, &deviceInfo, + &protectedData, &keysToSignMac); ASSERT_FALSE(status.isOk()) << status.getMessage(); - ASSERT_EQ(status.getServiceSpecificError(), - BnRemotelyProvisionedComponent::STATUS_TEST_KEY_IN_PRODUCTION_REQUEST); + EXPECT_EQ(status.getServiceSpecificError(), BnRemotelyProvisionedComponent::STATUS_REMOVED); } /** - * Call generateCertificateRequest(). Make sure it's removed. + * Call generateCertificateRequest() in test mode. Make sure it's removed. */ -TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed) { +TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed_testMode) { bytevec keysToSignMac; DeviceInfo deviceInfo; ProtectedData protectedData; -- GitLab From 961b3dccde959dcbeaa02f82cf76881a1c1e2687 Mon Sep 17 00:00:00 2001 From: Zhang Yuan Date: Tue, 11 Apr 2023 16:35:41 +0800 Subject: [PATCH 030/962] Fix fail on RadioConfigTest#checkPortInfoExistsAndPortActive for dual-SIM detection The code currently uses 'dsds' to detect dual-SIM configurations, but it misses 'dsda' configurations, resulting in test failures. Should use the detection mechanism by adding handling for 'dsda', ensuring accurate detection of all dual-SIM configurations. Bug: 277705768 Test: vts -m VtsHalRadioTargetTest -t PerInstance/RadioConfigTest#checkPortInfoExistsAndPortActive/0_android_hardware_radio_config_IRadioConfig_default Change-Id: Ie73a958ff14e86f440831e18291b6599b6eac30b Signed-off-by: Jia Jia --- radio/aidl/vts/radio_aidl_hal_utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp index 6ed8e7d762..f18da55c3f 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.cpp +++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp @@ -85,7 +85,7 @@ bool isSsSsEnabled() { // Do not use checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "") // until b/148904287 is fixed. We need exact matching instead of partial matching. (i.e. // by definition the empty string "" is a substring of any string). - return !isDsDsEnabled() && !isTsTsEnabled(); + return !isDsDsEnabled() && !isTsTsEnabled() && !isDsDaEnabled(); } bool isDsDsEnabled() { @@ -125,8 +125,8 @@ bool isServiceValidForDeviceConfiguration(std::string& serviceName) { ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str()); return false; } - } else if (isDsDsEnabled()) { - // Device is configured as DSDS. + } else if (isDsDsEnabled() || isDsDaEnabled()) { + // Device is configured as DSDS or DSDA. if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) && !stringEndsWith(serviceName, RADIO_SERVICE_SLOT2_NAME)) { ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str()); -- GitLab From 50fcf7d066066dd2434760f44cd6743934867165 Mon Sep 17 00:00:00 2001 From: Subrahmanyaman Date: Thu, 20 Apr 2023 22:48:39 +0000 Subject: [PATCH 031/962] Support for non-factory attestation in Strongbox. Updated the BootLoaderStateTest for strongbox implementations which do not support factory attestation. Test: vts -m VtsAidlKeyMintTarget Change-Id: I8fe176a18fc0b9e2b2d0b012b7b63124d15c9e2f --- .../aidl/vts/functional/AttestKeyTest.cpp | 89 +------------------ .../vts/functional/BootloaderStateTest.cpp | 35 ++++---- .../vts/functional/KeyMintAidlTestBase.cpp | 87 +++++++++++++++++- .../aidl/vts/functional/KeyMintAidlTestBase.h | 14 +++ 4 files changed, 118 insertions(+), 107 deletions(-) diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp index e759123334..c035f1906e 100644 --- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp +++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp @@ -88,96 +88,9 @@ string get_imei(int slot) { class AttestKeyTest : public KeyMintAidlTestBase { public: void SetUp() override { - check_skip_test(); + skipAttestKeyTest(); KeyMintAidlTestBase::SetUp(); } - - protected: - const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key"; - - const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; - - ErrorCode GenerateAttestKey(const AuthorizationSet& key_desc, - const optional& attest_key, - vector* key_blob, - vector* key_characteristics, - vector* cert_chain) { - // The original specification for KeyMint v1 required ATTEST_KEY not be combined - // with any other key purpose, but the original VTS tests incorrectly did exactly that. - // This means that a device that launched prior to Android T (API level 33) may - // accept or even require KeyPurpose::SIGN too. - if (property_get_int32("ro.board.first_api_level", 0) < __ANDROID_API_T__) { - AuthorizationSet key_desc_plus_sign = key_desc; - key_desc_plus_sign.push_back(TAG_PURPOSE, KeyPurpose::SIGN); - - auto result = GenerateKey(key_desc_plus_sign, attest_key, key_blob, key_characteristics, - cert_chain); - if (result == ErrorCode::OK) { - return result; - } - // If the key generation failed, it may be because the device is (correctly) - // rejecting the combination of ATTEST_KEY+SIGN. Fall through to try again with - // just ATTEST_KEY. - } - return GenerateKey(key_desc, attest_key, key_blob, key_characteristics, cert_chain); - } - - // Check if ATTEST_KEY feature is disabled - bool is_attest_key_feature_disabled(void) const { - if (!check_feature(FEATURE_KEYSTORE_APP_ATTEST_KEY)) { - GTEST_LOG_(INFO) << "Feature " + FEATURE_KEYSTORE_APP_ATTEST_KEY + " is disabled"; - return true; - } - - return false; - } - - // Check if StrongBox KeyStore is enabled - bool is_strongbox_enabled(void) const { - if (check_feature(FEATURE_STRONGBOX_KEYSTORE)) { - GTEST_LOG_(INFO) << "Feature " + FEATURE_STRONGBOX_KEYSTORE + " is enabled"; - return true; - } - - return false; - } - - // Check if chipset has received a waiver allowing it to be launched with Android S or T with - // Keymaster 4.0 in StrongBox. - bool is_chipset_allowed_km4_strongbox(void) const { - std::array buffer; - - const int32_t first_api_level = property_get_int32("ro.board.first_api_level", 0); - if (first_api_level <= 0 || first_api_level > __ANDROID_API_T__) return false; - - auto res = property_get("ro.vendor.qti.soc_model", buffer.data(), nullptr); - if (res <= 0) return false; - - const string allowed_soc_models[] = {"SM8450", "SM8475", "SM8550", "SXR2230P"}; - - for (const string model : allowed_soc_models) { - if (model.compare(buffer.data()) == 0) { - GTEST_LOG_(INFO) << "QTI SOC Model " + model + " is allowed SB KM 4.0"; - return true; - } - } - - return false; - } - - // Skip the test if all the following conditions hold: - // 1. ATTEST_KEY feature is disabled - // 2. STRONGBOX is enabled - // 3. The device is running one of the chipsets that have received a waiver - // allowing it to be launched with Android S (or later) with Keymaster 4.0 - // in StrongBox - void check_skip_test(void) const { - // Check the chipset first as that doesn't require a round-trip to Package Manager. - if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() && - is_attest_key_feature_disabled()) { - GTEST_SKIP() << "Test is not applicable"; - } - } }; /* diff --git a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp index 723edeef3d..dff0498ce5 100644 --- a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp +++ b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp @@ -34,20 +34,13 @@ using ::std::vector; // Since this test needs to talk to KeyMint HAL, it can only run as root. Thus, // bootloader can not be locked. -class BootloaderStateTest : public testing::TestWithParam { - public: - virtual void SetUp() override { - ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str())); - keyMint_ = IKeyMintDevice::fromBinder(binder); - ASSERT_TRUE(keyMint_) << "Failed to get KM device"; - } - - std::shared_ptr keyMint_; -}; +class BootloaderStateTest : public KeyMintAidlTestBase {}; // Check that attested bootloader state is set to unlocked. TEST_P(BootloaderStateTest, IsUnlocked) { // Generate a key with attestation. + vector key_blob; + vector key_characteristics; AuthorizationSet keyDesc = AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(EcCurve::P_256) @@ -55,15 +48,23 @@ TEST_P(BootloaderStateTest, IsUnlocked) { .AttestationApplicationId("bar") .Digest(Digest::NONE) .SetDefaultValidity(); - KeyCreationResult creationResult; - auto kmStatus = keyMint_->generateKey(keyDesc.vector_data(), std::nullopt, &creationResult); - ASSERT_TRUE(kmStatus.isOk()); - - vector key_cert_chain = std::move(creationResult.certificateChain); + auto result = GenerateKey(keyDesc, &key_blob, &key_characteristics); + // If factory provisioned attestation key is not supported by Strongbox, + // then create a key with self-signed attestation and use it as the + // attestation key instead. + if (SecLevel() == SecurityLevel::STRONGBOX && + result == ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED) { + result = GenerateKeyWithSelfSignedAttestKey( + AuthorizationSetBuilder() + .EcdsaKey(EcCurve::P_256) + .AttestKey() + .SetDefaultValidity(), /* attest key params */ + keyDesc, &key_blob, &key_characteristics); + } + ASSERT_EQ(ErrorCode::OK, result); // Parse attested AVB values. - const auto& attestation_cert = key_cert_chain[0].encodedCertificate; - X509_Ptr cert(parse_cert_blob(attestation_cert)); + X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate)); ASSERT_TRUE(cert.get()); ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get()); diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index 5e27bd0e5b..a8ea407e44 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -322,12 +322,13 @@ ErrorCode KeyMintAidlTestBase::GenerateKeyWithSelfSignedAttestKey( const AuthorizationSet& attest_key_desc, const AuthorizationSet& key_desc, vector* key_blob, vector* key_characteristics, vector* cert_chain) { + skipAttestKeyTest(); AttestationKey attest_key; vector attest_cert_chain; vector attest_key_characteristics; // Generate a key with self signed attestation. - auto error = GenerateKey(attest_key_desc, std::nullopt, &attest_key.keyBlob, - &attest_key_characteristics, &attest_cert_chain); + auto error = GenerateAttestKey(attest_key_desc, std::nullopt, &attest_key.keyBlob, + &attest_key_characteristics, &attest_cert_chain); if (error != ErrorCode::OK) { return error; } @@ -1548,6 +1549,88 @@ ErrorCode KeyMintAidlTestBase::UseEcdsaKey(const vector& ecdsaKeyBlob) return result; } +ErrorCode KeyMintAidlTestBase::GenerateAttestKey(const AuthorizationSet& key_desc, + const optional& attest_key, + vector* key_blob, + vector* key_characteristics, + vector* cert_chain) { + // The original specification for KeyMint v1 required ATTEST_KEY not be combined + // with any other key purpose, but the original VTS tests incorrectly did exactly that. + // This means that a device that launched prior to Android T (API level 33) may + // accept or even require KeyPurpose::SIGN too. + if (property_get_int32("ro.board.first_api_level", 0) < __ANDROID_API_T__) { + AuthorizationSet key_desc_plus_sign = key_desc; + key_desc_plus_sign.push_back(TAG_PURPOSE, KeyPurpose::SIGN); + + auto result = GenerateKey(key_desc_plus_sign, attest_key, key_blob, key_characteristics, + cert_chain); + if (result == ErrorCode::OK) { + return result; + } + // If the key generation failed, it may be because the device is (correctly) + // rejecting the combination of ATTEST_KEY+SIGN. Fall through to try again with + // just ATTEST_KEY. + } + return GenerateKey(key_desc, attest_key, key_blob, key_characteristics, cert_chain); +} + +// Check if ATTEST_KEY feature is disabled +bool KeyMintAidlTestBase::is_attest_key_feature_disabled(void) const { + if (!check_feature(FEATURE_KEYSTORE_APP_ATTEST_KEY)) { + GTEST_LOG_(INFO) << "Feature " + FEATURE_KEYSTORE_APP_ATTEST_KEY + " is disabled"; + return true; + } + + return false; +} + +// Check if StrongBox KeyStore is enabled +bool KeyMintAidlTestBase::is_strongbox_enabled(void) const { + if (check_feature(FEATURE_STRONGBOX_KEYSTORE)) { + GTEST_LOG_(INFO) << "Feature " + FEATURE_STRONGBOX_KEYSTORE + " is enabled"; + return true; + } + + return false; +} + +// Check if chipset has received a waiver allowing it to be launched with Android S or T with +// Keymaster 4.0 in StrongBox. +bool KeyMintAidlTestBase::is_chipset_allowed_km4_strongbox(void) const { + std::array buffer; + + const int32_t first_api_level = property_get_int32("ro.board.first_api_level", 0); + if (first_api_level <= 0 || first_api_level > __ANDROID_API_T__) return false; + + auto res = property_get("ro.vendor.qti.soc_model", buffer.data(), nullptr); + if (res <= 0) return false; + + const string allowed_soc_models[] = {"SM8450", "SM8475", "SM8550", "SXR2230P"}; + + for (const string model : allowed_soc_models) { + if (model.compare(buffer.data()) == 0) { + GTEST_LOG_(INFO) << "QTI SOC Model " + model + " is allowed SB KM 4.0"; + return true; + } + } + + return false; +} + +// Skip the test if all the following conditions hold: +// 1. ATTEST_KEY feature is disabled +// 2. STRONGBOX is enabled +// 3. The device is running one of the chipsets that have received a waiver +// allowing it to be launched with Android S (or later) with Keymaster 4.0 +// in StrongBox +void KeyMintAidlTestBase::skipAttestKeyTest(void) const { + // Check the chipset first as that doesn't require a round-trip to Package Manager. + if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() && + is_attest_key_feature_disabled()) { + GTEST_SKIP() << "Test is not applicable"; + } +} + void verify_serial(X509* cert, const uint64_t expected_serial) { BIGNUM_Ptr ser(BN_new()); EXPECT_TRUE(ASN1_INTEGER_to_BN(X509_get_serialNumber(cert), ser.get())); diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h index 3245ca98f2..30ac452bab 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h @@ -54,6 +54,9 @@ using ::std::vector; constexpr uint64_t kOpHandleSentinel = 0xFFFFFFFFFFFFFFFF; +const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key"; +const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; + class KeyMintAidlTestBase : public ::testing::TestWithParam { public: struct KeyData { @@ -347,6 +350,17 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam { ErrorCode UseRsaKey(const vector& rsaKeyBlob); ErrorCode UseEcdsaKey(const vector& ecdsaKeyBlob); + ErrorCode GenerateAttestKey(const AuthorizationSet& key_desc, + const optional& attest_key, + vector* key_blob, + vector* key_characteristics, + vector* cert_chain); + + bool is_attest_key_feature_disabled(void) const; + bool is_strongbox_enabled(void) const; + bool is_chipset_allowed_km4_strongbox(void) const; + void skipAttestKeyTest(void) const; + protected: std::shared_ptr keymint_; uint32_t os_version_; -- GitLab From 431a6dd75ebd1c82aca864624cde2e0e6e301681 Mon Sep 17 00:00:00 2001 From: Robert Shih Date: Fri, 21 Apr 2023 21:55:18 +0000 Subject: [PATCH 032/962] Update drm/1.3/vts/OWNERS Bug: 278494162 Change-Id: I3a84dc77f1dff9c1658cdd7c362fbc8a62402a2e --- drm/1.3/vts/OWNERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drm/1.3/vts/OWNERS b/drm/1.3/vts/OWNERS index 3a0672e5c6..744827c164 100644 --- a/drm/1.3/vts/OWNERS +++ b/drm/1.3/vts/OWNERS @@ -1,9 +1,11 @@ +# Bug component: 49079 conglin@google.com -edwinwong@google.com fredgc@google.com -jtinker@google.com juce@google.com +kelzhan@google.com kylealexander@google.com +mattfedd@google.com rfrias@google.com robertshih@google.com sigquit@google.com +vickymin@google.com \ No newline at end of file -- GitLab From 36f5abe27cad3f21884e7809730db8b31927c370 Mon Sep 17 00:00:00 2001 From: Yihan Dong Date: Thu, 27 Apr 2023 09:10:32 +0000 Subject: [PATCH 033/962] Create OWNERS for VtsHalHealthStorageTargetTest Bug: 278494006 Change-Id: I950548feb2673ba8f6c646a4916a4730ef6ce763 --- health/storage/aidl/vts/functional/OWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 health/storage/aidl/vts/functional/OWNERS diff --git a/health/storage/aidl/vts/functional/OWNERS b/health/storage/aidl/vts/functional/OWNERS new file mode 100644 index 0000000000..a15ed7ceef --- /dev/null +++ b/health/storage/aidl/vts/functional/OWNERS @@ -0,0 +1,2 @@ +# Bug component: 30545 +file:platform/hardware/interfaces:/health/aidl/OWNERS \ No newline at end of file -- GitLab From ac1639f227f7edb1ce284adc2a4f48f88d347da1 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Thu, 27 Apr 2023 11:14:11 -0700 Subject: [PATCH 034/962] Add VSR annotations for RKP DICE Bug: 277965670 Test: n/a (comment changes only) Change-Id: I64e34c1f9865811f0967148cad914f7ef77f9448 --- .../vts/functional/VtsRemotelyProvisionedComponentTests.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 94bfbb48de..89ab2c2672 100644 --- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -699,6 +699,7 @@ class CertificateRequestV2Test : public CertificateRequestTestBase { * Generate an empty certificate request with all possible length of challenge, and decrypt and * verify the structure and content. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, EmptyRequest) { bytevec csr; @@ -718,6 +719,7 @@ TEST_P(CertificateRequestV2Test, EmptyRequest) { * Generate a non-empty certificate request with all possible length of challenge. Decrypt, parse * and validate the contents. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequest) { generateKeys(false /* testMode */, 1 /* numKeys */); @@ -750,6 +752,7 @@ TEST_P(CertificateRequestV2Test, EmptyRequestWithInvalidChallengeFail) { * Generate a non-empty certificate request. Make sure contents are reproducible but allow for the * signature to be different since algorithms including ECDSA P-256 can include a random value. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequestReproducible) { generateKeys(false /* testMode */, 1 /* numKeys */); @@ -773,6 +776,7 @@ TEST_P(CertificateRequestV2Test, NonEmptyRequestReproducible) { /** * Generate a non-empty certificate request with multiple keys. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequestMultipleKeys) { generateKeys(false /* testMode */, rpcHardwareInfo.supportedNumKeysInCsr /* numKeys */); @@ -846,6 +850,7 @@ void parse_root_of_trust(const vector& attestation_cert, /** * Generate a CSR and verify DeviceInfo against IDs attested by KeyMint. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, DeviceInfo) { // See if there is a matching IKeyMintDevice for this IRemotelyProvisionedComponent. std::shared_ptr keyMint; -- GitLab From cf210c83b2d29882aa0144a8e52af0d460628b6e Mon Sep 17 00:00:00 2001 From: Jiabin Huang Date: Thu, 27 Apr 2023 23:06:04 +0000 Subject: [PATCH 035/962] AHAL: add more comment for IModule.disconnectExternalDevice Bug: 277955540 Change-Id: I0d6a73884ab4bcfec62da45124024e8680155144 Test: TH --- audio/aidl/android/hardware/audio/core/IModule.aidl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 7622d9a16c..e736c32e98 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -234,6 +234,12 @@ interface IModule { * instance previously instantiated using the 'connectExternalDevice' * method. * + * The framework will call this method before closing streams and resetting + * patches. This call can be used by the HAL module to prepare itself to + * device disconnection. If the HAL module indicates an error after the first + * call, the framework will call this method once again after closing associated + * streams and patches. + * * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port can not be found by the ID. * - If this is not a connected device port. -- GitLab From ddaea2e5a4cca53319a3cb61974c03fc32b50930 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 20 Apr 2023 16:10:37 -0700 Subject: [PATCH 036/962] Fix broken and flaky VTS tests 1. nvResetConfig takes some time to reset the modem, causing subsequent tests to fail with a timeout since the modem is unavailabe. Add a timeout after nvResetConfig to allow the modem to be up again before running the next test. 2. Remove invalid errors for start/stopKeepalive. These tests should fail due to invalid arguments, so remove NONE as a possible error. RADIO_NOT_AVAILABLE should also be removed. 3. Fix incorrect startNetworkScan_InvalidInterval tests, since we only check the interval when the scan type is PERIODIC. 4. Save and reset the previous allowed network type bitmap after the test. Combine get/set into one test that tests both behaviors. 5. Fix checks for MCC/MNC in getDataRegistrationState Bug: 277626718 Bug: 240953393 Bug: 264913330 Bug: 259674407 Bug: 242801688 Test: atest VtsHalRadioTargetTest Change-Id: Ic7188f9d8ccfcd90d844b45e3b370a3be3c515d6 Merged-In: Ic7188f9d8ccfcd90d844b45e3b370a3be3c515d6 --- .../vts/functional/radio_hidl_hal_misc.cpp | 2 + radio/aidl/vts/radio_data_test.cpp | 6 +-- radio/aidl/vts/radio_modem_test.cpp | 2 + radio/aidl/vts/radio_network_test.cpp | 43 ++++++++++--------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp index 624d00381f..ee8b4dcb95 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp @@ -654,6 +654,8 @@ TEST_P(RadioHidlTest, nvResetConfig) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } + // wait until modem reset finishes + sleep(10); LOG(DEBUG) << "nvResetConfig finished"; } diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp index aa6ac88e1f..3eedc146ff 100644 --- a/radio/aidl/vts/radio_data_test.cpp +++ b/radio/aidl/vts/radio_data_test.cpp @@ -531,8 +531,7 @@ TEST_P(RadioDataTest, startKeepalive) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_data->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_ARGUMENTS, - RadioError::REQUEST_NOT_SUPPORTED})); + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } } @@ -549,8 +548,7 @@ TEST_P(RadioDataTest, stopKeepalive) { ASSERT_TRUE( CheckAnyOfErrors(radioRsp_data->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, - RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); + {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } /* diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp index f88da13af1..e86737888f 100644 --- a/radio/aidl/vts/radio_modem_test.cpp +++ b/radio/aidl/vts/radio_modem_test.cpp @@ -264,6 +264,8 @@ TEST_P(RadioModemTest, nvResetConfig) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } + // wait until modem reset finishes + sleep(10); LOG(DEBUG) << "nvResetConfig finished"; } diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 61b34d7db5..86cf2d23dc 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -66,12 +66,20 @@ void RadioNetworkTest::stopNetworkScan() { } /* - * Test IRadioNetwork.setAllowedNetworkTypesBitmap for the response returned. + * Test IRadioNetwork.setAllowedNetworkTypesBitmap and IRadioNetwork.getAllowedNetworkTypesBitmap + * for the response returned. */ -TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) { +TEST_P(RadioNetworkTest, setGetAllowedNetworkTypesBitmap) { serial = GetRandomSerialNumber(); - int32_t allowedNetworkTypesBitmap = static_cast(RadioAccessFamily::LTE); + // save current value + radio_network->getAllowedNetworkTypesBitmap(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + int32_t currentAllowedNetworkTypesBitmap = radioRsp_network->networkTypeBitmapResponse; + + // set new value + int32_t allowedNetworkTypesBitmap = static_cast(RadioAccessFamily::LTE); + serial = GetRandomSerialNumber(); radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -83,20 +91,6 @@ TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) { RadioError::MODE_NOT_SUPPORTED, RadioError::INTERNAL_ERR, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NO_RESOURCES})); -} - -/* - * Test IRadioNetwork.getAllowedNetworkTypesBitmap for the response returned. - */ -TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) { - serial = GetRandomSerialNumber(); - int32_t allowedNetworkTypesBitmap = static_cast(RadioAccessFamily::LTE); - - radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap); - - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); - EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); if (radioRsp_network->rspInfo.error == RadioError::NONE) { sleep(3); // wait for modem @@ -112,7 +106,16 @@ TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) { RadioError::OPERATION_NOT_ALLOWED, RadioError::MODE_NOT_SUPPORTED, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NO_RESOURCES})); + if (radioRsp_network->rspInfo.error == RadioError::NONE) { + // verify we get the value we set + ASSERT_EQ(radioRsp_network->networkTypeBitmapResponse, allowedNetworkTypesBitmap); + } } + + // reset value to previous + serial = GetRandomSerialNumber(); + radio_network->setAllowedNetworkTypesBitmap(serial, currentAllowedNetworkTypesBitmap); + EXPECT_EQ(std::cv_status::no_timeout, wait()); } /* @@ -920,7 +923,7 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval1) { RadioAccessSpecifier specifier850 = { .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}}; - NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, + NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_PERIODIC, .interval = 4, .specifiers = {specifierP900, specifier850}, .maxSearchTime = 60, @@ -961,7 +964,7 @@ TEST_P(RadioNetworkTest, startNetworkScan_InvalidInterval2) { RadioAccessSpecifier specifier850 = { .accessNetwork = AccessNetwork::GERAN, .bands = band850, .channels = {128, 129}}; - NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_ONE_SHOT, + NetworkScanRequest request = {.type = NetworkScanRequest::SCAN_TYPE_PERIODIC, .interval = 301, .specifiers = {specifierP900, specifier850}, .maxSearchTime = 60, @@ -1494,7 +1497,7 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { } // 32 bit system might return invalid mcc and mnc string "\xff\xff..." - if (checkMccMnc && mcc.size() < 4 && mnc.size() < 4) { + if (checkMccMnc && mcc.size() == 3 && (mnc.size() == 2 || mnc.size() == 3)) { int mcc_int = stoi(mcc); int mnc_int = stoi(mnc); EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999); -- GitLab From 658fdaaa2a343aa3486dcc8ef62ce8d919b38abf Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Mon, 17 Apr 2023 16:52:59 -0700 Subject: [PATCH 037/962] Require SIM card for all VTS tests We check SIM card status is PRESENT before running any VTS tests, so ensure that it's enforced in the configs as well. Test: atest VtsHalRadioTargetTest Bug: 237504027 Change-Id: I1b2c317e21db118e4b957804feb76f266d887b20 Merged-In: I1b2c317e21db118e4b957804feb76f266d887b20 --- radio/1.0/vts/functional/vts_hal_radio_target_test.xml | 1 + radio/1.1/vts/functional/AndroidTest.xml | 1 + radio/1.2/vts/functional/AndroidTest.xml | 1 + radio/1.3/vts/functional/AndroidTest.xml | 1 + radio/1.4/vts/functional/AndroidTest.xml | 1 + radio/aidl/vts/AndroidTest.xml | 3 ++- 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/radio/1.0/vts/functional/vts_hal_radio_target_test.xml b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml index 82af2ee388..7aaadff8db 100644 --- a/radio/1.0/vts/functional/vts_hal_radio_target_test.xml +++ b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml @@ -16,6 +16,7 @@