Merge "Add vintf_fragments to keymaster@4.1-service" into rvc-dev
diff --git a/automotive/can/1.0/tools/canhalsend.cpp b/automotive/can/1.0/tools/canhalsend.cpp
index 7e6833a..18e815d 100644
--- a/automotive/can/1.0/tools/canhalsend.cpp
+++ b/automotive/can/1.0/tools/canhalsend.cpp
@@ -15,6 +15,8 @@
*/
#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/strings.h>
#include <android/hardware/automotive/can/1.0/ICanBus.h>
#include <android/hidl/manager/1.2/IServiceManager.h>
@@ -27,13 +29,13 @@
using Result = V1_0::Result;
static void usage() {
- std::cerr << "cansend - simple command line tool to send raw CAN frames" << std::endl;
+ std::cerr << "canhalsend - simple command line tool to send raw CAN frames" << std::endl;
std::cerr << std::endl << "usage:" << std::endl << std::endl;
std::cerr << "canhalsend <bus name> <can id>#<data>" << std::endl;
std::cerr << "where:" << std::endl;
- std::cerr << " bus name - name under which ICanBus is be published" << std::endl;
- std::cerr << " can id - such as 1a5" << std::endl;
- std::cerr << " data - such as deadbeef or 010203" << std::endl;
+ std::cerr << " bus name - name under which ICanBus is published" << std::endl;
+ std::cerr << " can id - such as 1a5 or 1fab5982" << std::endl;
+ std::cerr << " data - such as deadbeef, 010203, or R for a remote frame" << std::endl;
}
// TODO(b/135918744): extract to a new library
@@ -53,18 +55,13 @@
return ICanBus::castFrom(ret);
}
-static int cansend(const std::string& busname, V1_0::CanMessageId msgid,
- std::vector<uint8_t> payload) {
+static int cansend(const std::string& busname, const V1_0::CanMessage& msg) {
auto bus = tryOpen(busname);
if (bus == nullptr) {
std::cerr << "Bus " << busname << " is not available" << std::endl;
return -1;
}
- V1_0::CanMessage msg = {};
- msg.id = msgid;
- msg.payload = payload;
-
const auto result = bus->send(msg);
if (result != Result::OK) {
std::cerr << "Send call failed: " << toString(result) << std::endl;
@@ -73,8 +70,7 @@
return 0;
}
-static std::optional<std::tuple<V1_0::CanMessageId, std::vector<uint8_t>>> parseCanMessage(
- const std::string& msg) {
+static std::optional<V1_0::CanMessage> parseCanMessage(const std::string& msg) {
const auto hashpos = msg.find("#");
if (hashpos == std::string::npos) return std::nullopt;
@@ -85,6 +81,32 @@
V1_0::CanMessageId msgid = std::stoi(msgidStr, &idx, 16);
if (msgidStr[idx] != '\0') return std::nullopt;
+ V1_0::CanMessage canmsg = {};
+ canmsg.id = msgid;
+ if (msgid > 0x7FF) {
+ canmsg.isExtendedId = true;
+ }
+
+ if (android::base::StartsWith(payloadStr, "R")) {
+ canmsg.remoteTransmissionRequest = true;
+
+ /* The CAN bus HAL doesn't define a data length code (DLC) field, since it is inferrred
+ * from the payload size. RTR messages indicate to the receiver how many bytes they are
+ * expecting to receive back via the DLC sent with the RTR frame. */
+ if (payloadStr.size() <= 1) return canmsg;
+
+ unsigned int dlc = 0;
+
+ /* The maximum DLC for CAN-FD is 64 bytes and CAN 2.0 is 8 bytes. Limit the size of the DLC
+ * to something memory safe and let the HAL determine if the DLC is valid. */
+ if (!android::base::ParseUint(payloadStr.substr(1), &dlc, 10000u)) {
+ std::cerr << "Invalid DLC for RTR frame!" << std::endl;
+ return std::nullopt;
+ }
+ canmsg.payload.resize(dlc);
+ return canmsg;
+ }
+
std::vector<uint8_t> payload;
if (payloadStr.size() % 2 != 0) return std::nullopt;
for (size_t i = 0; i < payloadStr.size(); i += 2) {
@@ -92,8 +114,9 @@
payload.emplace_back(std::stoi(byteStr, &idx, 16));
if (byteStr[idx] != '\0') return std::nullopt;
}
+ canmsg.payload = payload;
- return {{msgid, payload}};
+ return canmsg;
}
static int main(int argc, char* argv[]) {
@@ -117,9 +140,8 @@
std::cerr << "Failed to parse CAN message argument" << std::endl;
return -1;
}
- const auto [msgid, payload] = *canmsg;
- return cansend(busname, msgid, payload);
+ return cansend(busname, *canmsg);
}
} // namespace android::hardware::automotive::can
diff --git a/current.txt b/current.txt
index 339df2f..2e3f198 100644
--- a/current.txt
+++ b/current.txt
@@ -594,11 +594,11 @@
2ce820dc4f3c6d85721b65150ed2157c6e2e2055f866fb6c6ba4790f14408d66 android.hardware.camera.provider@2.4::ICameraProviderCallback
b69a7615c508acf5c5201efd1bfa3262167874fc3594e2db5a3ff93addd8ac75 android.hardware.keymaster@4.0::IKeymasterDevice
eb2fa0c883c2185d514be0b84c179b283753ef0c1b77b45b4f359bd23bba8b75 android.hardware.neuralnetworks@1.0::IPreparedModel
-8eac60e1f724d141c71c69f06d4544acb720a55dfbbcd97fa01bb3d25ee4e2f5 android.hardware.neuralnetworks@1.0::types
+92e101b30e47bdf526a01c52cecfbe730def5997b8260ab497eb949eb2a6dcdf android.hardware.neuralnetworks@1.0::types
5f6d3097ba84cb63c430787123f4de1b31c11f90b531b98eae9a8623a5ae962a android.hardware.neuralnetworks@1.1::types
fb382e986c10b8fbb797a8546e8f9ea6d1107bfe6f3fb7e57f6bbbf1f807a906 android.hardware.neuralnetworks@1.2::IDevice
40e71cd693de5b832325c5d8f081f2ff20a7ba2b89d401cee5b4b3eb0e241681 android.hardware.neuralnetworks@1.2::IPreparedModel
-00649d29680f2c47edf60000c3ae7ae906ba638f0616947147e3676a83cf36fa android.hardware.neuralnetworks@1.2::types
+ee1a0dee5be00a6fe2d4d3270068c78016dcb194d768fe07ed894ea20904037f android.hardware.neuralnetworks@1.2::types
a785a57447a81e9c130eef6904c3a5c256076c6a04588c40620ebd6fa2660d77 android.hardware.radio@1.2::types
1a6e2bd289f22931c526b21916910f1d4c436b7acb9556e4243de4ce8e6cc2e4 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback
fd65298e1e09e0e3c781ab18305920d757dbe55a3b459ce17814ec5cf6dfee99 android.hardware.wifi@1.0::IWifiP2pIface
@@ -715,7 +715,7 @@
6e904be0ddca5ae1de8eba020e6c38ed935ea7d80cd08f47787f137a0ca58555 android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
2b0b10d2ea7a18a4048cd0eb83d35c19a817aeee95f65807fc31f4ef21381397 android.hardware.neuralnetworks@1.3::IPreparedModel
eee3430cc86c97c7b407495863d8fb61da6f1a64b7721e77b9b4909b11b174e9 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
-e442ab1b440327fe4e8a3b0b8ac6874e9bc6342e91fe976eb9fea77c63961ec8 android.hardware.neuralnetworks@1.3::types
+acf84925f8ee0a651f2ec547ac334034de266479b93af5434f6c1f25e66aba96 android.hardware.neuralnetworks@1.3::types
b454df853441c12f6e425e8a60dd29fda20f5e6e39b93d1103e4b37495db38aa android.hardware.radio@1.5::IRadio
fcbb0742a88215ee7a6d7ce0825d253eb2b50391fc6c8c48667f9fd7f6d4549e android.hardware.radio@1.5::IRadioIndication
b809193970a91ca637a4b0184767315601d32e3ef3d5992ffbc7a8d14a14f015 android.hardware.radio@1.5::IRadioResponse
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp
index 88fbff8..52aaa69 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp
@@ -99,7 +99,7 @@
EXPECT_TRUE(result);
}
-bool GnssHalTest::StartAndCheckFirstLocation() {
+bool GnssHalTest::StartAndCheckFirstLocation(bool strict) {
auto result = gnss_hal_->start();
EXPECT_TRUE(result.isOk());
@@ -110,11 +110,14 @@
* so allow time to demodulate ephemeris over the air.
*/
const int kFirstGnssLocationTimeoutSeconds = 75;
+ int locationCalledCount = 0;
- EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
- kFirstGnssLocationTimeoutSeconds));
- int locationCalledCount = gnss_cb_->location_cbq_.calledCount();
- EXPECT_EQ(locationCalledCount, 1);
+ if (strict) {
+ EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
+ kFirstGnssLocationTimeoutSeconds));
+ locationCalledCount = gnss_cb_->location_cbq_.calledCount();
+ EXPECT_EQ(locationCalledCount, 1);
+ }
if (locationCalledCount > 0) {
// don't require speed on first fix
@@ -138,7 +141,7 @@
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
- EXPECT_TRUE(StartAndCheckFirstLocation());
+ EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true));
for (int i = 1; i < count; i++) {
EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h
index 88b7723..75c4216 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.h
+++ b/gnss/1.1/vts/functional/gnss_hal_test.h
@@ -102,9 +102,11 @@
* <p> Note this leaves the Location request active, to enable Stop call vs. other call
* reordering tests.
*
+ * <p> if 'strict' is true, the test will fail if no location is generated.
+ *
* returns true if a location was successfully generated
*/
- bool StartAndCheckFirstLocation();
+ bool StartAndCheckFirstLocation(bool strict);
/*
* CheckLocation:
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
index 8530ffb..e6a51eb 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -93,7 +93,7 @@
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
// Don't expect true - as without AGPS access
- if (!StartAndCheckFirstLocation()) {
+ if (!StartAndCheckFirstLocation(/* strict= */ false)) {
ALOGW("GetLocationLowPower test - no first low power location received.");
}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
index b3a3203..59e18f3 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -97,7 +97,7 @@
EXPECT_TRUE(result);
}
-bool GnssHalTest::StartAndCheckFirstLocation() {
+bool GnssHalTest::StartAndCheckFirstLocation(bool strict) {
const auto result = gnss_hal_->start();
EXPECT_TRUE(result.isOk());
@@ -107,12 +107,14 @@
* so allow time to demodulate ephemeris over the air.
*/
const int kFirstGnssLocationTimeoutSeconds = 75;
+ int locationCalledCount = 0;
- EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
- kFirstGnssLocationTimeoutSeconds));
- int locationCalledCount = gnss_cb_->location_cbq_.calledCount();
- EXPECT_EQ(locationCalledCount, 1);
-
+ if (strict) {
+ EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
+ kFirstGnssLocationTimeoutSeconds));
+ locationCalledCount = gnss_cb_->location_cbq_.calledCount();
+ EXPECT_EQ(locationCalledCount, 1);
+ }
if (locationCalledCount > 0) {
// don't require speed on first fix
CheckLocation(gnss_cb_->last_location_, false);
@@ -135,7 +137,7 @@
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
- EXPECT_TRUE(StartAndCheckFirstLocation());
+ EXPECT_TRUE(StartAndCheckFirstLocation(/* strict= */ true));
for (int i = 1; i < count; i++) {
EXPECT_TRUE(gnss_cb_->location_cbq_.retrieve(gnss_cb_->last_location_,
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
index 55dc1bc..a02a9ff 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.h
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -152,9 +152,11 @@
* <p> Note this leaves the Location request active, to enable Stop call vs. other call
* reordering tests.
*
+ * <p> if 'strict' is true, the test will fail if no location is generated.
+ *
* returns true if a location was successfully generated
*/
- bool StartAndCheckFirstLocation();
+ bool StartAndCheckFirstLocation(bool strict);
/*
* CheckLocation:
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
index 53f5b9e..c93e89b 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -395,7 +395,7 @@
}
TEST_P(GnssHalTest, TestGnssLocationElapsedRealtime) {
- StartAndCheckFirstLocation();
+ StartAndCheckFirstLocation(/* strict= */ true);
ASSERT_TRUE((int)gnss_cb_->last_location_.elapsedRealtime.flags <=
(int)(ElapsedRealtimeFlags::HAS_TIMESTAMP_NS |
@@ -411,7 +411,7 @@
// This test only verify that injectBestLocation_2_0 does not crash.
TEST_P(GnssHalTest, TestInjectBestLocation_2_0) {
- StartAndCheckFirstLocation();
+ StartAndCheckFirstLocation(/* strict= */ true);
gnss_hal_->injectBestLocation_2_0(gnss_cb_->last_location_);
StopAndClearLocations();
}
@@ -455,7 +455,7 @@
SetPositionMode(kMinIntervalMsec, kLowPowerMode);
// Don't expect true - as without AGPS access
- if (!StartAndCheckFirstLocation()) {
+ if (!StartAndCheckFirstLocation(/* strict= */ false)) {
ALOGW("GetLocationLowPower test - no first low power location received.");
}
@@ -854,4 +854,4 @@
result = gnss_configuration_hal->setBlacklist(sources);
ASSERT_TRUE(result.isOk());
EXPECT_TRUE(result);
-}
\ No newline at end of file
+}
diff --git a/graphics/allocator/2.0/default/OWNERS b/graphics/allocator/2.0/default/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/allocator/2.0/default/OWNERS
+++ b/graphics/allocator/2.0/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/allocator/2.0/utils/OWNERS b/graphics/allocator/2.0/utils/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/allocator/2.0/utils/OWNERS
+++ b/graphics/allocator/2.0/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/2.0/default/OWNERS b/graphics/mapper/2.0/default/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/mapper/2.0/default/OWNERS
+++ b/graphics/mapper/2.0/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/2.0/utils/OWNERS b/graphics/mapper/2.0/utils/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/mapper/2.0/utils/OWNERS
+++ b/graphics/mapper/2.0/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/2.0/vts/OWNERS b/graphics/mapper/2.0/vts/OWNERS
index 8e86f64..11b7d21 100644
--- a/graphics/mapper/2.0/vts/OWNERS
+++ b/graphics/mapper/2.0/vts/OWNERS
@@ -1,5 +1,7 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
+stoza@google.com
+vhau@google.com
# VTS team
yim@google.com
diff --git a/graphics/mapper/2.1/default/OWNERS b/graphics/mapper/2.1/default/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/mapper/2.1/default/OWNERS
+++ b/graphics/mapper/2.1/default/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/2.1/utils/OWNERS b/graphics/mapper/2.1/utils/OWNERS
index 273cb4c..2a56b38 100644
--- a/graphics/mapper/2.1/utils/OWNERS
+++ b/graphics/mapper/2.1/utils/OWNERS
@@ -1,4 +1,4 @@
# Graphics team
-jessehall@google.com
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/2.1/vts/OWNERS b/graphics/mapper/2.1/vts/OWNERS
index 8e86f64..11b7d21 100644
--- a/graphics/mapper/2.1/vts/OWNERS
+++ b/graphics/mapper/2.1/vts/OWNERS
@@ -1,5 +1,7 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
+stoza@google.com
+vhau@google.com
# VTS team
yim@google.com
diff --git a/graphics/mapper/3.0/utils/OWNERS b/graphics/mapper/3.0/utils/OWNERS
index 96f6d51..2a56b38 100644
--- a/graphics/mapper/3.0/utils/OWNERS
+++ b/graphics/mapper/3.0/utils/OWNERS
@@ -1,3 +1,4 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/3.0/vts/OWNERS b/graphics/mapper/3.0/vts/OWNERS
index 96f6d51..2a56b38 100644
--- a/graphics/mapper/3.0/vts/OWNERS
+++ b/graphics/mapper/3.0/vts/OWNERS
@@ -1,3 +1,4 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/4.0/utils/OWNERS b/graphics/mapper/4.0/utils/OWNERS
index 96f6d51..2a56b38 100644
--- a/graphics/mapper/4.0/utils/OWNERS
+++ b/graphics/mapper/4.0/utils/OWNERS
@@ -1,3 +1,4 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/graphics/mapper/4.0/vts/OWNERS b/graphics/mapper/4.0/vts/OWNERS
index 96f6d51..2a56b38 100644
--- a/graphics/mapper/4.0/vts/OWNERS
+++ b/graphics/mapper/4.0/vts/OWNERS
@@ -1,3 +1,4 @@
# Graphics team
-marissaw@google.com
+chrisforbes@google.com
stoza@google.com
+vhau@google.com
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal
index 1175a30..620eefb 100644
--- a/neuralnetworks/1.0/types.hal
+++ b/neuralnetworks/1.0/types.hal
@@ -261,7 +261,7 @@
* filter.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32}
- * the bias must be of the same type.
+ * the bias must be of the same type.
* For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM},
* the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint
* of 0 and bias_scale == input_scale * filter_scale.
@@ -289,7 +289,7 @@
* filter.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32}
- * the bias must be of the same
+ * the bias must be of the same
* type.
* For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM},
* the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint
@@ -356,7 +356,7 @@
* specifying the filter.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32}
- * the bias must be of the same type.
+ * the bias must be of the same type.
* For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM},
* the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint
* of 0 and bias_scale == input_scale * filter_scale.
@@ -385,7 +385,7 @@
* specifying the filter.
* * 2: A 1-D tensor, of shape [depth_out], specifying the bias. For input
* tensor of type {@link OperandType::TENSOR_FLOAT32}
- * the bias must be of the same type.
+ * the bias must be of the same type.
* For filter tensor of {@link OperandType::TENSOR_QUANT8_ASYMM},
* the bias should be of {@link OperandType::TENSOR_INT32}, with zeroPoint
* of 0 and bias_scale == input_scale * filter_scale.
@@ -628,7 +628,7 @@
HASHTABLE_LOOKUP = 10,
/**
- * Applies L2 normalization along the depth dimension.
+ * Applies L2 normalization along the axis dimension.
*
* The values in the output tensor are computed as:
*
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index f0fd769..2c3c599 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -846,7 +846,7 @@
HASHTABLE_LOOKUP = @1.1::OperationType:HASHTABLE_LOOKUP,
/**
- * Applies L2 normalization along the depth dimension.
+ * Applies L2 normalization along the axis dimension.
*
* The values in the output tensor are computed as:
*
@@ -854,8 +854,7 @@
* input[batch, row, col, channel] /
* sqrt(sum_{c} pow(input[batch, row, col, c], 2))
*
- * For input tensor with rank less than 4, independently normalizes each
- * 1-D slice along dimension dim.
+ * By default the axis dimension is the last dimension of the input tensor.
*
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since HAL version 1.2)
@@ -3843,7 +3842,8 @@
* * 1: A scalar {@link OperandType::INT32}, specifying the number of
* independent samples to draw for each row slice.
* * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor with shape [2],
- * specifying seeds used to initialize the random distribution.
+ * specifying seeds used to initialize the random distribution. If both
+ * provided seeds are 0, both will be randomly generated.
* Outputs:
* * 0: A 2-D {@link OperandType::TENSOR_INT32} tensor with shape
* [batches, samples], containing the drawn samples.
diff --git a/neuralnetworks/1.3/types.hal b/neuralnetworks/1.3/types.hal
index 25ec915..56930c2 100644
--- a/neuralnetworks/1.3/types.hal
+++ b/neuralnetworks/1.3/types.hal
@@ -833,7 +833,7 @@
HASHTABLE_LOOKUP = @1.2::OperationType:HASHTABLE_LOOKUP,
/**
- * Applies L2 normalization along the depth dimension.
+ * Applies L2 normalization along the axis dimension.
*
* The values in the output tensor are computed as:
*
@@ -841,8 +841,7 @@
* input[batch, row, col, channel] /
* sqrt(sum_{c} pow(input[batch, row, col, c], 2))
*
- * For input tensor with rank less than 4, independently normalizes each
- * 1-D slice along dimension dim.
+ * By default the axis dimension is the last dimension of the input tensor.
*
* Supported tensor {@link OperandType}:
* * {@link OperandType::TENSOR_FLOAT16} (since HAL version 1.2)
@@ -867,6 +866,10 @@
* the scale must be 1.f / 128 and the zeroPoint must be 128.
* For {@link OperandType::TENSOR_QUANT8_ASYMM_SIGNED},
* the scale must be 1.f / 128 and the zeroPoint must be 0.
+ *
+ * NOTE: Before HAL version 1.3, if the elements along an axis are all zeros,
+ * the result is undefined. Since HAL version 1.3, if the elements along an axis
+ * are all zeros, the result is logical zero.
*/
L2_NORMALIZATION = @1.2::OperationType:L2_NORMALIZATION,
@@ -4063,7 +4066,8 @@
* * 1: A scalar {@link OperandType::INT32}, specifying the number of
* independent samples to draw for each row slice.
* * 2: A 1-D {@link OperandType::TENSOR_INT32} tensor with shape [2],
- * specifying seeds used to initialize the random distribution.
+ * specifying seeds used to initialize the random distribution. If both
+ * provided seeds are 0, both will be randomly generated.
* Outputs:
* * 0: A 2-D {@link OperandType::TENSOR_INT32} tensor with shape
* [batches, samples], containing the drawn samples.
diff --git a/tv/tuner/1.0/default/Android.bp b/tv/tuner/1.0/default/Android.bp
index 989e25c..5711889 100644
--- a/tv/tuner/1.0/default/Android.bp
+++ b/tv/tuner/1.0/default/Android.bp
@@ -24,6 +24,7 @@
"libfmq",
"libhidlbase",
"libhidlmemory",
+ "libion",
"liblog",
"libstagefright_foundation",
"libutils",
diff --git a/tv/tuner/1.0/default/Filter.cpp b/tv/tuner/1.0/default/Filter.cpp
index 54d0952..f610c60 100644
--- a/tv/tuner/1.0/default/Filter.cpp
+++ b/tv/tuner/1.0/default/Filter.cpp
@@ -60,6 +60,8 @@
Return<void> Filter::getQueueDesc(getQueueDesc_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
+ mIsUsingFMQ = true;
+
_hidl_cb(Result::SUCCESS, *mFilterMQ->getDesc());
return Void();
}
@@ -120,9 +122,13 @@
return Result::SUCCESS;
}
-Return<Result> Filter::releaseAvHandle(const hidl_handle& /*avMemory*/, uint64_t /*avDataId*/) {
+Return<Result> Filter::releaseAvHandle(const hidl_handle& /*avMemory*/, uint64_t avDataId) {
ALOGV("%s", __FUNCTION__);
+ if (mDataId2Avfd.find(avDataId) == mDataId2Avfd.end()) {
+ return Result::INVALID_ARGUMENT;
+ }
+ ::close(mDataId2Avfd[avDataId]);
return Result::SUCCESS;
}
@@ -174,14 +180,21 @@
// Event Callback without waiting for the DATA_CONSUMED to init the process.
while (mFilterThreadRunning) {
if (mFilterEvent.events.size() == 0) {
- ALOGD("[Filter] wait for filter data output.");
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] wait for filter data output.");
+ }
usleep(1000 * 1000);
continue;
}
// After successfully write, send a callback and wait for the read to be done
mCallback->onFilterEvent(mFilterEvent);
+ freeAvHandle();
mFilterEvent.events.resize(0);
mFilterStatus = DemuxFilterStatus::DATA_READY;
+ if (mCallback == nullptr) {
+ ALOGD("[Filter] filter %d does not hava callback. Ending thread", mFilterId);
+ break;
+ }
mCallback->onFilterStatus(mFilterStatus);
break;
}
@@ -191,7 +204,7 @@
// We do not wait for the last round of written data to be read to finish the thread
// because the VTS can verify the reading itself.
for (int i = 0; i < SECTION_WRITE_COUNT; i++) {
- while (mFilterThreadRunning) {
+ while (mFilterThreadRunning && mIsUsingFMQ) {
status_t status = mFilterEventFlag->wait(
static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_CONSUMED), &efState,
WAIT_TIMEOUT, true /* retry on spurious wake */);
@@ -202,11 +215,6 @@
break;
}
- if (mCallback == nullptr) {
- ALOGD("[Filter] filter %d does not hava callback. Ending thread", mFilterId);
- break;
- }
-
maySendFilterStatusCallback();
while (mFilterThreadRunning) {
@@ -232,7 +240,22 @@
ALOGD("[Filter] filter thread ended.");
}
+void Filter::freeAvHandle() {
+ if (mType.mainType != DemuxFilterMainType::TS ||
+ (mType.subType.tsFilterType() == DemuxTsFilterType::AUDIO &&
+ mType.subType.tsFilterType() == DemuxTsFilterType::VIDEO)) {
+ return;
+ }
+ for (int i = 0; i < mFilterEvent.events.size(); i++) {
+ ::close(mFilterEvent.events[i].media().avMemory.getNativeHandle()->data[0]);
+ native_handle_close(mFilterEvent.events[i].media().avMemory.getNativeHandle());
+ }
+}
+
void Filter::maySendFilterStatusCallback() {
+ if (!mIsUsingFMQ) {
+ return;
+ }
std::lock_guard<std::mutex> lock(mFilterStatusLock);
int availableToRead = mFilterMQ->availableToRead();
int availableToWrite = mFilterMQ->availableToWrite();
@@ -409,19 +432,88 @@
}
Result Filter::startMediaFilterHandler() {
- DemuxFilterMediaEvent mediaEvent;
- mediaEvent = {
- // temp dump meta data
- .pts = 0,
- .dataLength = 530,
- .avMemory = nullptr,
- .isSecureMemory = false,
- };
- mFilterEvent.events.resize(1);
- mFilterEvent.events[0].media(mediaEvent);
+ std::lock_guard<std::mutex> lock(mFilterEventLock);
+ if (mFilterOutput.empty()) {
+ return Result::SUCCESS;
+ }
+
+ for (int i = 0; i < mFilterOutput.size(); i += 188) {
+ if (mPesSizeLeft == 0) {
+ uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) |
+ mFilterOutput[i + 6];
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] prefix %d", prefix);
+ }
+ if (prefix == 0x000001) {
+ // TODO handle mulptiple Pes filters
+ mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9];
+ mPesSizeLeft += 6;
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] pes data length %d", mPesSizeLeft);
+ }
+ } else {
+ continue;
+ }
+ }
+
+ int endPoint = min(184, mPesSizeLeft);
+ // append data and check size
+ vector<uint8_t>::const_iterator first = mFilterOutput.begin() + i + 4;
+ vector<uint8_t>::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint;
+ mPesOutput.insert(mPesOutput.end(), first, last);
+ // size does not match then continue
+ mPesSizeLeft -= endPoint;
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] pes data left %d", mPesSizeLeft);
+ }
+ if (mPesSizeLeft > 0 || mAvBufferCopyCount++ < 10) {
+ continue;
+ }
+
+ int av_fd = createAvIonFd(mPesOutput.size());
+ if (av_fd == -1) {
+ return Result::UNKNOWN_ERROR;
+ }
+ // copy the filtered data to the buffer
+ uint8_t* avBuffer = getIonBuffer(av_fd, mPesOutput.size());
+ if (avBuffer == NULL) {
+ return Result::UNKNOWN_ERROR;
+ }
+ memcpy(avBuffer, mPesOutput.data(), mPesOutput.size() * sizeof(uint8_t));
+
+ native_handle_t* nativeHandle = createNativeHandle(av_fd);
+ if (nativeHandle == NULL) {
+ return Result::UNKNOWN_ERROR;
+ }
+ hidl_handle handle;
+ handle.setTo(nativeHandle, /*shouldOwn=*/true);
+
+ // Create a dataId and add a <dataId, av_fd> pair into the dataId2Avfd map
+ uint64_t dataId = mLastUsedDataId++ /*createdUID*/;
+ mDataId2Avfd[dataId] = dup(av_fd);
+
+ // Create mediaEvent and send callback
+ DemuxFilterMediaEvent mediaEvent;
+ mediaEvent = {
+ .avMemory = std::move(handle),
+ .dataLength = static_cast<uint32_t>(mPesOutput.size()),
+ .avDataId = dataId,
+ };
+ int size = mFilterEvent.events.size();
+ mFilterEvent.events.resize(size + 1);
+ mFilterEvent.events[size].media(mediaEvent);
+
+ // Clear and log
+ mPesOutput.clear();
+ mAvBufferCopyCount = 0;
+ ::close(av_fd);
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] assembled av data length %d", mediaEvent.dataLength);
+ }
+ }
mFilterOutput.clear();
- // TODO handle write FQM for media stream
+
return Result::SUCCESS;
}
@@ -493,6 +585,42 @@
mDvr = nullptr;
}
+int Filter::createAvIonFd(int size) {
+ // Create an ion fd and allocate an av fd mapped to a buffer to it.
+ int ion_fd = ion_open();
+ if (ion_fd == -1) {
+ ALOGE("[Filter] Failed to open ion fd %d", errno);
+ return -1;
+ }
+ int av_fd = -1;
+ ion_alloc_fd(dup(ion_fd), size, 0 /*align*/, ION_HEAP_SYSTEM_MASK, 0 /*flags*/, &av_fd);
+ if (av_fd == -1) {
+ ALOGE("[Filter] Failed to create av fd %d", errno);
+ return -1;
+ }
+ return av_fd;
+}
+
+uint8_t* Filter::getIonBuffer(int fd, int size) {
+ uint8_t* avBuf = static_cast<uint8_t*>(
+ mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 /*offset*/));
+ if (avBuf == MAP_FAILED) {
+ ALOGE("[Filter] fail to allocate buffer %d", errno);
+ return NULL;
+ }
+ return avBuf;
+}
+
+native_handle_t* Filter::createNativeHandle(int fd) {
+ // Create a native handle to pass the av fd via the callback event.
+ native_handle_t* nativeHandle = native_handle_create(/*numFd*/ 1, 0);
+ if (nativeHandle == NULL) {
+ ALOGE("[Filter] Failed to create native_handle %d", errno);
+ return NULL;
+ }
+ nativeHandle->data[0] = dup(fd);
+ return nativeHandle;
+}
} // namespace implementation
} // namespace V1_0
} // namespace tuner
diff --git a/tv/tuner/1.0/default/Filter.h b/tv/tuner/1.0/default/Filter.h
index 0dc992a..afed98e 100644
--- a/tv/tuner/1.0/default/Filter.h
+++ b/tv/tuner/1.0/default/Filter.h
@@ -19,6 +19,7 @@
#include <android/hardware/tv/tuner/1.0/IFilter.h>
#include <fmq/MessageQueue.h>
+#include <ion/ion.h>
#include <math.h>
#include <set>
#include "Demux.h"
@@ -87,6 +88,7 @@
Result startRecordFilterHandler();
void attachFilterToRecord(const sp<Dvr> dvr);
void detachFilterFromRecord();
+ void freeAvHandle();
private:
// Tuner service
@@ -109,6 +111,7 @@
vector<uint8_t> mFilterOutput;
vector<uint8_t> mRecordFilterOutput;
unique_ptr<FilterMQ> mFilterMQ;
+ bool mIsUsingFMQ = false;
EventFlag* mFilterEventFlag;
DemuxFilterEvent mFilterEvent;
@@ -160,6 +163,10 @@
static void* __threadLoopFilter(void* user);
void filterThreadLoop();
+ int createAvIonFd(int size);
+ uint8_t* getIonBuffer(int fd, int size);
+ native_handle_t* createNativeHandle(int fd);
+
/**
* Lock to protect writes to the FMQs
*/
@@ -181,6 +188,11 @@
// TODO handle mulptiple Pes filters
int mPesSizeLeft = 0;
vector<uint8_t> mPesOutput;
+
+ // A map from data id to ion handle
+ std::map<uint64_t, int> mDataId2Avfd;
+ uint64_t mLastUsedDataId = 1;
+ int mAvBufferCopyCount = 0;
};
} // namespace implementation
diff --git a/tv/tuner/1.0/default/Frontend.cpp b/tv/tuner/1.0/default/Frontend.cpp
index 7e206a7..bb0d8dc 100644
--- a/tv/tuner/1.0/default/Frontend.cpp
+++ b/tv/tuner/1.0/default/Frontend.cpp
@@ -63,9 +63,6 @@
return Result::INVALID_STATE;
}
- // TODO dynamically allocate file to the source file
- mSourceStreamFile = FRONTEND_STREAM_FILE;
-
mCallback->onEvent(FrontendEventType::LOCKED);
return Result::SUCCESS;
}
@@ -180,7 +177,7 @@
}
string Frontend::getSourceFile() {
- return mSourceStreamFile;
+ return FRONTEND_STREAM_FILE;
}
} // namespace implementation
diff --git a/tv/tuner/1.0/default/Frontend.h b/tv/tuner/1.0/default/Frontend.h
index eab43a3..b954639 100644
--- a/tv/tuner/1.0/default/Frontend.h
+++ b/tv/tuner/1.0/default/Frontend.h
@@ -76,7 +76,6 @@
FrontendId mId = 0;
const string FRONTEND_STREAM_FILE = "/vendor/etc/dumpTs3.ts";
- string mSourceStreamFile;
std::ifstream mFrontendData;
};
diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp
index 4fd3355..8fb5061 100644
--- a/tv/tuner/1.0/default/Tuner.cpp
+++ b/tv/tuner/1.0/default/Tuner.cpp
@@ -106,7 +106,7 @@
return Void();
}
-Return<void> Tuner::getFrontendInfo(FrontendId /* frontendId */, getFrontendInfo_cb _hidl_cb) {
+Return<void> Tuner::getFrontendInfo(FrontendId /*frontendId*/, getFrontendInfo_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
vector<FrontendStatusType> statusCaps = {
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
index f693e7c..8b0413c 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp
@@ -47,7 +47,6 @@
#include "VtsHalTvTunerV1_0TestConfigurations.h"
#define WAIT_TIMEOUT 3000000000
-#define WAIT_TIMEOUT_data_ready 3000000000 * 4
using android::Condition;
using android::IMemory;
@@ -57,6 +56,7 @@
using android::sp;
using android::hardware::EventFlag;
using android::hardware::fromHeap;
+using android::hardware::hidl_handle;
using android::hardware::hidl_string;
using android::hardware::hidl_vec;
using android::hardware::HidlMemory;
@@ -68,6 +68,7 @@
using android::hardware::tv::tuner::V1_0::DataFormat;
using android::hardware::tv::tuner::V1_0::DemuxFilterEvent;
using android::hardware::tv::tuner::V1_0::DemuxFilterMainType;
+using android::hardware::tv::tuner::V1_0::DemuxFilterMediaEvent;
using android::hardware::tv::tuner::V1_0::DemuxFilterPesDataSettings;
using android::hardware::tv::tuner::V1_0::DemuxFilterPesEvent;
using android::hardware::tv::tuner::V1_0::DemuxFilterRecordSettings;
@@ -156,7 +157,6 @@
// const uint16_t FMQ_SIZE_4K = 0x1000;
const uint32_t FMQ_SIZE_1M = 0x100000;
const uint32_t FMQ_SIZE_16M = 0x1000000;
-const uint8_t FRONTEND_EVENT_CALLBACK_WAIT_COUNT = 4;
enum FilterEventType : uint8_t {
UNDEFINED,
@@ -179,52 +179,65 @@
public:
virtual Return<void> onEvent(FrontendEventType frontendEventType) override {
android::Mutex::Autolock autoLock(mMsgLock);
+ ALOGD("[vts] frontend event received. Type: %d", frontendEventType);
mEventReceived = true;
- mEventType = frontendEventType;
mMsgCondition.signal();
- return Void();
+ switch (frontendEventType) {
+ case FrontendEventType::LOCKED:
+ mLockMsgReceived = true;
+ mLockMsgCondition.signal();
+ return Void();
+ default:
+ // do nothing
+ return Void();
+ }
}
virtual Return<void> onScanMessage(FrontendScanMessageType type,
const FrontendScanMessage& message) override {
android::Mutex::Autolock autoLock(mMsgLock);
- ALOGD("[vts] scan message. Type: %d", mScanMessageType);
+ while (!mScanMsgProcessed) {
+ mMsgCondition.wait(mMsgLock);
+ }
+ ALOGD("[vts] frontend scan message. Type: %d", type);
mScanMessageReceived = true;
+ mScanMsgProcessed = false;
mScanMessageType = type;
- mScanLockMessageReceived =
- mScanLockMessageReceived | (type == FrontendScanMessageType::LOCKED);
mScanMessage = message;
mMsgCondition.signal();
return Void();
- };
+ }
void tuneTestOnEventReceive(sp<IFrontend>& frontend, FrontendSettings settings);
void tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings settings);
- void scanTestOnMessageLock(sp<IFrontend>& frontend, FrontendSettings settings,
- FrontendScanType type);
+ void scanTest(sp<IFrontend>& frontend, FrontendConfig config, FrontendScanType type);
+
+ // Helper methods
+ uint32_t getTargetFrequency(FrontendSettings settings, FrontendType type);
+ void resetBlindScanStartingFrequency(FrontendConfig config, uint32_t resetingFreq);
private:
bool mEventReceived = false;
bool mScanMessageReceived = false;
- bool mScanLockMessageReceived = false;
- FrontendEventType mEventType;
+ bool mLockMsgReceived = false;
+ bool mScanMsgProcessed = true;
FrontendScanMessageType mScanMessageType;
FrontendScanMessage mScanMessage;
hidl_vec<uint8_t> mEventMessage;
android::Mutex mMsgLock;
android::Condition mMsgCondition;
- uint8_t mOnEvenRetry = 0;
+ android::Condition mLockMsgCondition;
};
void FrontendCallback::tuneTestOnEventReceive(sp<IFrontend>& frontend, FrontendSettings settings) {
Result result = frontend->tune(settings);
-
EXPECT_TRUE(result == Result::SUCCESS);
android::Mutex::Autolock autoLock(mMsgLock);
while (!mEventReceived) {
if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
- EXPECT_TRUE(false) << "event not received within timeout";
+ EXPECT_TRUE(false) << "Event not received within timeout";
+ mLockMsgReceived = false;
return;
}
}
@@ -233,61 +246,134 @@
void FrontendCallback::tuneTestOnLock(sp<IFrontend>& frontend, FrontendSettings settings) {
Result result = frontend->tune(settings);
-
EXPECT_TRUE(result == Result::SUCCESS);
android::Mutex::Autolock autoLock(mMsgLock);
-wait:
- while (!mEventReceived) {
- if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
- EXPECT_TRUE(false) << "event not received within timeout";
+ while (!mLockMsgReceived) {
+ if (-ETIMEDOUT == mLockMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
+ EXPECT_TRUE(false) << "Event LOCKED not received within timeout";
+ mLockMsgReceived = false;
return;
}
}
- if (mEventType != FrontendEventType::LOCKED) {
- ALOGD("[vts] frontend callback event received. Type: %d", mEventType);
- mEventReceived = false;
- if (mOnEvenRetry++ < FRONTEND_EVENT_CALLBACK_WAIT_COUNT) {
- goto wait;
- }
- }
- EXPECT_TRUE(mEventType == FrontendEventType::LOCKED) << "LOCK event not received";
- mEventReceived = false;
- mOnEvenRetry = 0;
+ mLockMsgReceived = false;
}
-void FrontendCallback::scanTestOnMessageLock(sp<IFrontend>& frontend, FrontendSettings settings,
- FrontendScanType type) {
- Result result = frontend->scan(settings, type);
- EXPECT_TRUE(result == Result::SUCCESS);
- android::Mutex::Autolock autoLock(mMsgLock);
- int messagesCount = 0;
+void FrontendCallback::scanTest(sp<IFrontend>& frontend, FrontendConfig config,
+ FrontendScanType type) {
+ uint32_t targetFrequency = getTargetFrequency(config.settings, config.type);
+ if (type == FrontendScanType::SCAN_BLIND) {
+ // reset the frequency in the scan configuration to test blind scan. The settings param of
+ // passed in means the real input config on the transponder connected to the DUT.
+ // We want the blind the test to start from lower frequency than this to check the blind
+ // scan implementation.
+ resetBlindScanStartingFrequency(config, targetFrequency - 100);
+ }
+ Result result = frontend->scan(config.settings, type);
+ EXPECT_TRUE(result == Result::SUCCESS);
+
+ bool scanMsgLockedReceived = false;
+ bool targetFrequencyReceived = false;
+
+ android::Mutex::Autolock autoLock(mMsgLock);
wait:
- int count = 0;
while (!mScanMessageReceived) {
if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) {
- ALOGD("[vts] waiting for scan message callback...");
- if (count++ > 10) {
- EXPECT_TRUE(false) << "WAITING TOO LONG!!";
- return;
- }
+ EXPECT_TRUE(false) << "Scan message not received within timeout";
+ mScanMessageReceived = false;
+ mScanMsgProcessed = true;
+ return;
}
}
if (mScanMessageType != FrontendScanMessageType::END) {
- ALOGD("[vts] frontend scan message received. Type: %d", mScanMessageType);
- mScanMessageReceived = false;
- if (messagesCount++ > 3) {
- EXPECT_TRUE(false) << "WAITING ON TOO MANY MSGS!!";
- return;
+ if (mScanMessageType == FrontendScanMessageType::LOCKED) {
+ scanMsgLockedReceived = true;
+ Result result = frontend->scan(config.settings, type);
+ EXPECT_TRUE(result == Result::SUCCESS);
}
+
+ if (mScanMessageType == FrontendScanMessageType::FREQUENCY) {
+ targetFrequencyReceived = mScanMessage.frequencies().size() > 0 &&
+ mScanMessage.frequencies()[0] == targetFrequency;
+ }
+
+ if (mScanMessageType == FrontendScanMessageType::PROGRESS_PERCENT) {
+ ALOGD("[vts] Scan in progress...[%d%%]", mScanMessage.progressPercent());
+ }
+
+ mScanMessageReceived = false;
+ mScanMsgProcessed = true;
+ mMsgCondition.signal();
goto wait;
}
- EXPECT_TRUE(mScanLockMessageReceived) << "scan lock message not received before scan ended";
+ EXPECT_TRUE(scanMsgLockedReceived) << "Scan message LOCKED not received before END";
+ EXPECT_TRUE(targetFrequencyReceived) << "frequency not received before LOCKED on blindScan";
mScanMessageReceived = false;
- mScanLockMessageReceived = false;
+ mScanMsgProcessed = true;
+}
+
+uint32_t FrontendCallback::getTargetFrequency(FrontendSettings settings, FrontendType type) {
+ switch (type) {
+ case FrontendType::ANALOG:
+ return settings.analog().frequency;
+ case FrontendType::ATSC:
+ return settings.atsc().frequency;
+ case FrontendType::ATSC3:
+ return settings.atsc3().frequency;
+ case FrontendType::DVBC:
+ return settings.dvbc().frequency;
+ case FrontendType::DVBS:
+ return settings.dvbs().frequency;
+ case FrontendType::DVBT:
+ return settings.dvbt().frequency;
+ case FrontendType::ISDBS:
+ return settings.isdbs().frequency;
+ case FrontendType::ISDBS3:
+ return settings.isdbs3().frequency;
+ case FrontendType::ISDBT:
+ return settings.isdbt().frequency;
+ default:
+ return 0;
+ }
+}
+
+void FrontendCallback::resetBlindScanStartingFrequency(FrontendConfig config,
+ uint32_t resetingFreq) {
+ switch (config.type) {
+ case FrontendType::ANALOG:
+ config.settings.analog().frequency = resetingFreq;
+ break;
+ case FrontendType::ATSC:
+ config.settings.atsc().frequency = resetingFreq;
+ break;
+ case FrontendType::ATSC3:
+ config.settings.atsc3().frequency = resetingFreq;
+ break;
+ case FrontendType::DVBC:
+ config.settings.dvbc().frequency = resetingFreq;
+ break;
+ case FrontendType::DVBS:
+ config.settings.dvbs().frequency = resetingFreq;
+ break;
+ case FrontendType::DVBT:
+ config.settings.dvbt().frequency = resetingFreq;
+ break;
+ case FrontendType::ISDBS:
+ config.settings.isdbs().frequency = resetingFreq;
+ break;
+ case FrontendType::ISDBS3:
+ config.settings.isdbs3().frequency = resetingFreq;
+ break;
+ case FrontendType::ISDBT:
+ config.settings.isdbt().frequency = resetingFreq;
+ break;
+ default:
+ // do nothing
+ return;
+ }
}
/******************************** End FrontendCallback **********************************/
@@ -313,6 +399,7 @@
}
void setFilterId(uint32_t filterId) { mFilterId = filterId; }
+ void setFilterInterface(sp<IFilter> filter) { mFilter = filter; }
void setFilterEventType(FilterEventType type) { mFilterEventType = type; }
void testFilterDataOutput();
@@ -324,6 +411,7 @@
void updateFilterMQ(MQDesc& filterMQDescriptor);
void updateGoldenOutputMap(string goldenOutputFile);
bool readFilterEventData();
+ bool dumpAvData(DemuxFilterMediaEvent event);
private:
struct FilterThreadArgs {
@@ -336,6 +424,7 @@
string mFilterIdToGoldenOutput;
uint32_t mFilterId;
+ sp<IFilter> mFilter;
FilterEventType mFilterEventType;
std::unique_ptr<FilterMQ> mFilterMQ;
EventFlag* mFilterMQEventFlag;
@@ -407,7 +496,7 @@
bool FilterCallback::readFilterEventData() {
bool result = false;
DemuxFilterEvent filterEvent = mFilterEvent;
- ALOGW("[vts] reading from filter FMQ %d", mFilterId);
+ ALOGW("[vts] reading from filter FMQ or buffer %d", mFilterId);
// todo separate filter handlers
for (int i = 0; i < filterEvent.events.size(); i++) {
switch (mFilterEventType) {
@@ -418,8 +507,7 @@
mDataLength = filterEvent.events[i].pes().dataLength;
break;
case FilterEventType::MEDIA:
- mDataLength = filterEvent.events[i].media().dataLength;
- break;
+ return dumpAvData(filterEvent.events[i].media());
case FilterEventType::RECORD:
break;
case FilterEventType::MMTPRECORD:
@@ -443,6 +531,26 @@
mFilterMQEventFlag->wake(static_cast<uint32_t>(DemuxQueueNotifyBits::DATA_CONSUMED));
return result;
}
+
+bool FilterCallback::dumpAvData(DemuxFilterMediaEvent event) {
+ uint32_t length = event.dataLength;
+ uint64_t dataId = event.avDataId;
+ // read data from buffer pointed by a handle
+ hidl_handle handle = event.avMemory;
+
+ int av_fd = handle.getNativeHandle()->data[0];
+ uint8_t* buffer = static_cast<uint8_t*>(
+ mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, av_fd, 0 /*offset*/));
+ if (buffer == MAP_FAILED) {
+ ALOGE("[vts] fail to allocate av buffer, errno=%d", errno);
+ return false;
+ }
+ uint8_t output[length + 1];
+ memcpy(output, buffer, length);
+ // print buffer and check with golden output.
+ EXPECT_TRUE(mFilter->releaseAvHandle(handle, dataId) == Result::SUCCESS);
+ return true;
+}
/******************************** End FilterCallback **********************************/
/******************************** Start DvrCallback **********************************/
@@ -731,6 +839,7 @@
sp<IFilter> mFilter;
std::map<uint32_t, sp<IFilter>> mFilters;
std::map<uint32_t, sp<FilterCallback>> mFilterCallbacks;
+
sp<FilterCallback> mFilterCallback;
sp<DvrCallback> mDvrCallback;
MQDesc mFilterMQDescriptor;
@@ -826,7 +935,7 @@
EXPECT_TRUE(mFrontendInfo.type == config.type)
<< "FrontendConfig does not match the frontend info of the given id.";
- mFrontendCallback->scanTestOnMessageLock(mFrontend, config.settings, type);
+ mFrontendCallback->scanTest(mFrontend, config, type);
return AssertionResult(true);
}
@@ -926,13 +1035,14 @@
if (status == Result::SUCCESS) {
mFilterCallback->setFilterId(mFilterId);
+ mFilterCallback->setFilterInterface(mFilter);
mUsedFilterIds.insert(mUsedFilterIds.end(), mFilterId);
mFilters[mFilterId] = mFilter;
mFilterCallbacks[mFilterId] = mFilterCallback;
filterId = mFilterId;
}
- return AssertionResult(status == Result::SUCCESS || status == Result::UNAVAILABLE);
+ return AssertionResult(status == Result::SUCCESS);
}
AssertionResult TunerHidlTest::configFilter(DemuxFilterSettings setting, uint32_t filterId) {
@@ -1300,7 +1410,6 @@
}
ASSERT_TRUE(openFrontend(mFeIds[i]));
ASSERT_TRUE(setFrontendCallback());
- ASSERT_TRUE(stopTuneFrontend());
ASSERT_TRUE(tuneFrontend(frontendArray[0]));
ASSERT_TRUE(stopTuneFrontend());
ASSERT_TRUE(closeFrontend());
@@ -1320,13 +1429,31 @@
}
ASSERT_TRUE(openFrontend(mFeIds[i]));
ASSERT_TRUE(setFrontendCallback());
- ASSERT_TRUE(stopScanFrontend());
ASSERT_TRUE(scanFrontend(frontendScanArray[0], FrontendScanType::SCAN_AUTO));
ASSERT_TRUE(stopScanFrontend());
ASSERT_TRUE(closeFrontend());
break;
}
}
+
+TEST_P(TunerHidlTest, BlindScanFrontend) {
+ description("Run an blind frontend scan with specific setting and check lock scanMessage");
+ ASSERT_TRUE(getFrontendIds());
+ ASSERT_TRUE(mFeIds.size() > 0);
+
+ for (size_t i = 0; i < mFeIds.size(); i++) {
+ ASSERT_TRUE(getFrontendInfo(mFeIds[i]));
+ if (mFrontendInfo.type != frontendArray[0].type) {
+ continue;
+ }
+ ASSERT_TRUE(openFrontend(mFeIds[i]));
+ ASSERT_TRUE(setFrontendCallback());
+ ASSERT_TRUE(scanFrontend(frontendScanArray[0], FrontendScanType::SCAN_BLIND));
+ ASSERT_TRUE(stopScanFrontend());
+ ASSERT_TRUE(closeFrontend());
+ break;
+ }
+}
/*=============================== End Frontend Tests ===============================*/
/*============================ Start Demux/Filter Tests ============================*/
@@ -1535,6 +1662,39 @@
ASSERT_TRUE(recordDataFlowTest(filterConf, recordSetting, goldenOutputFiles));
}*/
+
+TEST_P(TunerHidlTest, AvBufferTest) {
+ description("Test the av filter data bufferring.");
+
+ ASSERT_TRUE(getFrontendIds());
+ ASSERT_TRUE(mFeIds.size() > 0);
+
+ for (size_t i = 0; i < mFeIds.size(); i++) {
+ ASSERT_TRUE(getFrontendInfo(mFeIds[i]));
+ if (mFrontendInfo.type != frontendArray[1].type) {
+ continue;
+ }
+ ASSERT_TRUE(openFrontend(mFeIds[i]));
+ ASSERT_TRUE(setFrontendCallback());
+ ASSERT_TRUE(openDemux());
+ ASSERT_TRUE(openFilterInDemux(filterArray[0].type));
+ uint32_t filterId;
+ ASSERT_TRUE(getNewlyOpenedFilterId(filterId));
+ ASSERT_TRUE(configFilter(filterArray[0].setting, filterId));
+ ASSERT_TRUE(startFilter(filterId));
+ ASSERT_TRUE(setDemuxFrontendDataSource(mFeIds[i]));
+ // tune test
+ ASSERT_TRUE(tuneFrontend(frontendArray[1]));
+ // broadcast data flow test
+ ASSERT_TRUE(broadcastDataFlowTest(goldenOutputFiles));
+ ASSERT_TRUE(stopTuneFrontend());
+ ASSERT_TRUE(stopFilter(filterId));
+ ASSERT_TRUE(closeFilter(filterId));
+ ASSERT_TRUE(closeDemux());
+ ASSERT_TRUE(closeFrontend());
+ break;
+ }
+}
/*============================== End Data Flow Tests ==============================*/
/******************************** End Test Entry **********************************/
} // namespace
diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
index 55ca857..31e3b51 100644
--- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
+++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h
@@ -64,7 +64,7 @@
namespace {
-#define frontend_transponders_count 1
+#define frontend_transponders_count 2
#define channels_count 1
#define frontend_scan_count 1
#define filter_count 2
@@ -108,13 +108,24 @@
.standard = FrontendDvbtStandard::T,
};
frontendArray[0].type = FrontendType::DVBT, frontendArray[0].settings.dvbt(dvbtSettings);
+ frontendArray[1].type = FrontendType::DVBS;
};
/** Configuration array for the frontend scan test */
inline void initFrontendScanConfig() {
- frontendScanArray[0].type = FrontendType::DVBT, frontendScanArray[0].settings.dvbt({
- .frequency = 577000,
- });
+ frontendScanArray[0].type = FrontendType::DVBT;
+ frontendScanArray[0].settings.dvbt({
+ .frequency = 578000,
+ .transmissionMode = FrontendDvbtTransmissionMode::MODE_8K,
+ .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ,
+ .constellation = FrontendDvbtConstellation::AUTO,
+ .hierarchy = FrontendDvbtHierarchy::AUTO,
+ .hpCoderate = FrontendDvbtCoderate::AUTO,
+ .lpCoderate = FrontendDvbtCoderate::AUTO,
+ .guardInterval = FrontendDvbtGuardInterval::AUTO,
+ .isHighPriority = true,
+ .standard = FrontendDvbtStandard::T,
+ });
};
/** Configuration array for the filter test */
@@ -122,7 +133,7 @@
// TS Video filter setting
filterArray[0].type.mainType = DemuxFilterMainType::TS;
filterArray[0].type.subType.tsFilterType(DemuxTsFilterType::VIDEO);
- filterArray[0].setting.ts().tpid = 49;
+ filterArray[0].setting.ts().tpid = 119;
filterArray[0].setting.ts().filterSettings.av({.isPassthrough = false});
// TS PES filter setting
filterArray[1].type.mainType = DemuxFilterMainType::TS;
@@ -134,4 +145,4 @@
});
};
-} // namespace
\ No newline at end of file
+} // namespace