Merge "Revert "Add event parameters to MtpEvent.""
diff --git a/api/current.txt b/api/current.txt
index b42c8fc..b0eb006 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22579,13 +22579,7 @@
 
   public class MtpEvent {
     ctor public MtpEvent();
-    method public int getDevicePropCode();
     method public int getEventCode();
-    method public int getObjectFormatCode();
-    method public int getObjectHandle();
-    method public int getObjectPropCode();
-    method public int getStorageId();
-    method public int getTransactionId();
   }
 
   public final class MtpObjectInfo {
diff --git a/api/system-current.txt b/api/system-current.txt
index 560b0c5..bd7dc97 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -24126,13 +24126,7 @@
 
   public class MtpEvent {
     ctor public MtpEvent();
-    method public int getDevicePropCode();
     method public int getEventCode();
-    method public int getObjectFormatCode();
-    method public int getObjectHandle();
-    method public int getObjectPropCode();
-    method public int getStorageId();
-    method public int getTransactionId();
   }
 
   public final class MtpObjectInfo {
diff --git a/api/test-current.txt b/api/test-current.txt
index 455b3b1..13d98f4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -22587,13 +22587,7 @@
 
   public class MtpEvent {
     ctor public MtpEvent();
-    method public int getDevicePropCode();
     method public int getEventCode();
-    method public int getObjectFormatCode();
-    method public int getObjectHandle();
-    method public int getObjectPropCode();
-    method public int getStorageId();
-    method public int getTransactionId();
   }
 
   public final class MtpObjectInfo {
diff --git a/media/java/android/mtp/MtpEvent.java b/media/java/android/mtp/MtpEvent.java
index bab1467..6ec16db 100644
--- a/media/java/android/mtp/MtpEvent.java
+++ b/media/java/android/mtp/MtpEvent.java
@@ -18,115 +18,15 @@
 
 /**
  * This class encapsulates information about a MTP event.
- * This corresponds to the events described in appendix G of the MTP specification.
+ * Event constants are defined by the USB-IF MTP specification.
  */
 public class MtpEvent {
     private int mEventCode = MtpConstants.EVENT_UNDEFINED;
 
-    // Parameters for event. The interpretation of event parameters depends upon mEventCode.
-    private int mParameter1;
-    private int mParameter2;
-
     /**
      * Returns event code of MTP event.
      * See the USB-IF MTP specification for the details of event constants.
      * @return event code
      */
     public int getEventCode() { return mEventCode; }
-
-    /**
-     * Obtains objectHandle event parameter.
-     */
-    public int getObjectHandle() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_OBJECT_ADDED:
-                return mParameter1;
-            case MtpConstants.EVENT_OBJECT_REMOVED:
-                return mParameter1;
-            case MtpConstants.EVENT_OBJECT_INFO_CHANGED:
-                return mParameter1;
-            case MtpConstants.EVENT_REQUEST_OBJECT_TRANSFER:
-                return mParameter1;
-            case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
-                return mParameter1;
-            case MtpConstants.EVENT_OBJECT_REFERENCES_CHANGED:
-                return mParameter1;
-            default:
-                throw new IllegalParameterAccess("objectHandle", mEventCode);
-        }
-    }
-
-    /**
-     * Obtains storageID event parameter.
-     */
-    public int getStorageId() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_STORE_ADDED:
-                return mParameter1;
-            case MtpConstants.EVENT_STORE_REMOVED:
-                return mParameter1;
-            case MtpConstants.EVENT_STORE_FULL:
-                return mParameter1;
-            case MtpConstants.EVENT_STORAGE_INFO_CHANGED:
-                return mParameter1;
-            default:
-                throw new IllegalParameterAccess("storageID", mEventCode);
-        }
-    }
-
-    /**
-     * Obtains devicePropCode event parameter.
-     */
-    public int getDevicePropCode() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_DEVICE_PROP_CHANGED:
-                return mParameter1;
-            default:
-                throw new IllegalParameterAccess("devicePropCode", mEventCode);
-        }
-    }
-
-    /**
-     * Obtains transactionID event parameter.
-     */
-    public int getTransactionId() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_CAPTURE_COMPLETE:
-                return mParameter1;
-            default:
-                throw new IllegalParameterAccess("transactionID", mEventCode);
-        }
-    }
-
-    /**
-     * Obtains objectPropCode event parameter.
-     */
-    public int getObjectPropCode() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_OBJECT_PROP_CHANGED:
-                return mParameter2;
-            case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
-                return mParameter1;
-            default:
-                throw new IllegalParameterAccess("objectPropCode", mEventCode);
-        }
-    }
-
-    /**
-     * Obtains objectFormatCode event parameter.
-     */
-    public int getObjectFormatCode() {
-        switch (mEventCode) {
-            case MtpConstants.EVENT_OBJECT_PROP_DESC_CHANGED:
-                return mParameter2;
-            default:
-                throw new IllegalParameterAccess("objectFormatCode", mEventCode);
-        }
-    }
-
-    private static class IllegalParameterAccess extends UnsupportedOperationException {
-        public IllegalParameterAccess(String propertyName, int eventCode) {
-            super("Cannot obtain " + propertyName + " for the event: " + eventCode + ".");
-        }
-    }
 }
diff --git a/media/jni/android_mtp_MtpDevice.cpp b/media/jni/android_mtp_MtpDevice.cpp
index 76c5277..4aa12c2 100644
--- a/media/jni/android_mtp_MtpDevice.cpp
+++ b/media/jni/android_mtp_MtpDevice.cpp
@@ -98,8 +98,6 @@
 
 // MtpEvent fields
 static jfieldID field_event_eventCode;
-static jfieldID field_event_parameter1;
-static jfieldID field_event_parameter2;
 
 class JavaArrayWriter {
 public:
@@ -575,16 +573,13 @@
         env->ThrowNew(clazz_io_exception, "");
         return NULL;
     }
-    uint32_t parameters[3];
-    const int eventCode = device->reapEventRequest(seq, parameters);
+    const int eventCode = device->reapEventRequest(seq);
     if (eventCode <= 0) {
         env->ThrowNew(clazz_operation_canceled_exception, "");
         return NULL;
     }
     jobject result = env->NewObject(clazz_event, constructor_event);
     env->SetIntField(result, field_event_eventCode, eventCode);
-    env->SetIntField(result, field_event_parameter1, static_cast<jint>(parameters[0]));
-    env->SetIntField(result, field_event_parameter2, static_cast<jint>(parameters[1]));
     return result;
 }
 
@@ -837,16 +832,6 @@
         ALOGE("Can't find MtpObjectInfo.mEventCode");
         return -1;
     }
-    field_event_parameter1 = env->GetFieldID(clazz, "mParameter1", "I");
-    if (field_event_parameter1 == NULL) {
-        ALOGE("Can't find MtpObjectInfo.mParameter1");
-        return -1;
-    }
-    field_event_parameter2 = env->GetFieldID(clazz, "mParameter2", "I");
-    if (field_event_parameter2 == NULL) {
-        ALOGE("Can't find MtpObjectInfo.mParameter2");
-        return -1;
-    }
     clazz_event = (jclass)env->NewGlobalRef(clazz);
 
     clazz = env->FindClass("android/mtp/MtpDevice");
diff --git a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
index dfde27c..49b48c5 100644
--- a/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
+++ b/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpManagerTest.java
@@ -19,8 +19,6 @@
 import android.content.Context;
 import android.hardware.usb.UsbDevice;
 import android.hardware.usb.UsbManager;
-import android.mtp.MtpConstants;
-import android.mtp.MtpEvent;
 import android.os.CancellationSignal;
 import android.os.OperationCanceledException;
 import android.os.SystemClock;
@@ -87,19 +85,6 @@
         getInstrumentation().show(Arrays.toString(records[0].operationsSupported));
     }
 
-    public void testEventObjectAdded() throws Exception {
-        while (true) {
-            getInstrumentation().show("Please take a photo by using connected MTP device.");
-            final CancellationSignal signal = new CancellationSignal();
-            MtpEvent event = mManager.readEvent(mUsbDevice.getDeviceId(), signal);
-            if (event.getEventCode() != MtpConstants.EVENT_OBJECT_ADDED) {
-                continue;
-            }
-            assertTrue(event.getObjectHandle() != 0);
-            break;
-        }
-    }
-
     private Context getContext() {
         return getInstrumentation().getContext();
     }