Fix validation logic in TvInputAidlTest
[Description]
Handle validation incorrectly allows empty integer arrays, causing
potential errors.
Bug:348575546
[Test Report]
Test ok
Change-Id: Ie597fecfaa783b050510b11665a03e31ccb8feaf
(cherry picked from commit 3b85a4e59ad649211ddb5be4ec25addf289195a0)
diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
index 8d3395b..90404f6 100644
--- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
+++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
@@ -135,13 +135,15 @@
}
bool TvInputAidlTest::isValidHandle(NativeHandle& handle) {
- if (handle.fds.empty()) {
+ if (handle.fds.empty() && handle.ints.empty()) {
return false;
}
- for (size_t i = 0; i < handle.fds.size(); i++) {
- int fd = handle.fds[i].get();
- if (fcntl(fd, F_GETFL) < 0) {
- return false;
+ if (!(handle.fds.empty())) {
+ for (size_t i = 0; i < handle.fds.size(); i++) {
+ int fd = handle.fds[i].get();
+ if (fcntl(fd, F_GETFL) < 0) {
+ return false;
+ }
}
}
return true;