Reland "Return parameters of event as well as event code."

The CL was previously reviewed at ag/842911.

> The CL makes MtpDevice#reapEvent return event parameters as well as
> event code.
>
> BUG=26480986

Change-Id: Ie750a58248068cd0e804f20b57e7e86eef19d315
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 30843a7..6f72a3e 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -866,15 +866,19 @@
     return currentHandle;
 }
 
-int MtpDevice::reapEventRequest(int handle) {
+int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) {
     Mutex::Autolock autoLock(mEventMutex);
-    if (!mProcessingEvent || mCurrentEventHandle != handle) {
+    if (!mProcessingEvent || mCurrentEventHandle != handle || !parameters) {
         return -1;
     }
     mProcessingEvent = false;
     const int readSize = mEventPacket.readResponse(mRequestIntr->dev);
     const int result = mEventPacket.getEventCode();
-    return readSize == 0 ? 0 : result;
+    // MTP event has three parameters.
+    (*parameters)[0] = mEventPacket.getParameter(1);
+    (*parameters)[1] = mEventPacket.getParameter(2);
+    (*parameters)[2] = mEventPacket.getParameter(3);
+    return readSize != 0 ? result : 0;
 }
 
 void MtpDevice::discardEventRequest(int handle) {
diff --git a/media/mtp/MtpDevice.h b/media/mtp/MtpDevice.h
index 60f08ba..edc608f 100644
--- a/media/mtp/MtpDevice.h
+++ b/media/mtp/MtpDevice.h
@@ -124,8 +124,9 @@
     int                     submitEventRequest();
     // Waits for MTP event from the device and returns MTP event code. It blocks the current thread
     // until it receives an event from the device. |handle| should be a request handle returned
-    // by |submitEventRequest|. Returns 0 for cancellations. Returns -1 for errors.
-    int                     reapEventRequest(int handle);
+    // by |submitEventRequest|. The function writes event parameters to |parameters|. Returns 0 for
+    // cancellations. Returns -1 for errors.
+    int                     reapEventRequest(int handle, uint32_t (*parameters)[3]);
     // Cancels an event request. |handle| should be request handle returned by
     // |submitEventRequest|. If there is a thread blocked by |reapEventRequest| with the same
     // |handle|, the thread will resume.