Update hash and VTS for the 2nd FD of dumpstate

Bug: 33820081
Test: Run VTS
Change-Id: I139dfed6edb20fada2676684ab7013daefa69bc8
diff --git a/current.txt b/current.txt
index 8d0785f..b671bac 100644
--- a/current.txt
+++ b/current.txt
@@ -189,4 +189,5 @@
 
 # ABI preserving changes to HALs released in Android O
 
+760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice
 28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types
diff --git a/dumpstate/1.0/IDumpstateDevice.hal b/dumpstate/1.0/IDumpstateDevice.hal
index 206c139..12a0db4 100644
--- a/dumpstate/1.0/IDumpstateDevice.hal
+++ b/dumpstate/1.0/IDumpstateDevice.hal
@@ -18,7 +18,14 @@
 
 interface IDumpstateDevice {
     /**
-     * Dumps device-specific state into the given file descriptor.
+     * Dump device-specific state into the given file descriptors.
+     *
+     * One file descriptor must be passed to this method but two may be passed:
+     * the first descriptor must be used to dump device-specific state in text
+     * format, the second descriptor is optional and may be used to dump
+     * device-specific state in binary format.
+     *
+     * @param h A native handle with one or two valid file descriptors.
      */
     dumpstateBoard(handle h);
 };
diff --git a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
index 7ab4812..046bf56 100644
--- a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
+++ b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
@@ -59,6 +59,7 @@
 // Positive test: make sure dumpstateBoard() writes something to the FD.
 TEST_F(DumpstateHidlTest, TestOk) {
     FILE* file = tmpfile();
+
     ASSERT_NE(nullptr, file) << "Could not create temp file: " << strerror(errno);
 
     native_handle_t* handle = native_handle_create(1, 0);
@@ -80,6 +81,29 @@
     native_handle_delete(handle);
 }
 
+// Positive test: make sure dumpstateBoard() doesn't crash with two FDs.
+TEST_F(DumpstateHidlTest, TestHandleWithTwoFds) {
+    FILE* file1 = tmpfile();
+    FILE* file2 = tmpfile();
+
+    ASSERT_NE(nullptr, file1) << "Could not create temp file #1: " << strerror(errno);
+    ASSERT_NE(nullptr, file2) << "Could not create temp file #2: " << strerror(errno);
+
+    native_handle_t* handle = native_handle_create(2, 0);
+    ASSERT_NE(handle, nullptr) << "Could not create native_handle";
+    handle->data[0] = fileno(file1);
+    handle->data[1] = fileno(file2);
+
+    Return<void> status = dumpstate->dumpstateBoard(handle);
+    ASSERT_TRUE(status.isOk()) << "Status should be ok: " << status.description();
+
+    EXPECT_EQ(0, fclose(file1)) << errno;
+    EXPECT_EQ(0, fclose(file2)) << errno;
+
+    native_handle_close(handle);
+    native_handle_delete(handle);
+}
+
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
     int status = RUN_ALL_TESTS();