Loading api/current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -22538,13 +22538,7 @@ package android.mtp { 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 { api/system-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -24084,13 +24084,7 @@ package android.mtp { 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 { api/test-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -22546,13 +22546,7 @@ package android.mtp { 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 { media/java/android/mtp/MtpEvent.java +1 −101 Original line number Diff line number Diff line Loading @@ -18,115 +18,15 @@ package android.mtp; /** * 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 + "."); } } } media/jni/android_mtp_MtpDevice.cpp +1 −16 Original line number Diff line number Diff line Loading @@ -98,8 +98,6 @@ static jfieldID field_objectInfo_keywords; // MtpEvent fields static jfieldID field_event_eventCode; static jfieldID field_event_parameter1; static jfieldID field_event_parameter2; class JavaArrayWriter { public: Loading Loading @@ -575,16 +573,13 @@ static jobject android_mtp_MtpDevice_reap_event_request(JNIEnv *env, jobject thi 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; } Loading Loading @@ -837,16 +832,6 @@ int register_android_mtp_MtpDevice(JNIEnv *env) 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"); Loading Loading
api/current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -22538,13 +22538,7 @@ package android.mtp { 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 {
api/system-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -24084,13 +24084,7 @@ package android.mtp { 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 {
api/test-current.txt +0 −6 Original line number Diff line number Diff line Loading @@ -22546,13 +22546,7 @@ package android.mtp { 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 {
media/java/android/mtp/MtpEvent.java +1 −101 Original line number Diff line number Diff line Loading @@ -18,115 +18,15 @@ package android.mtp; /** * 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 + "."); } } }
media/jni/android_mtp_MtpDevice.cpp +1 −16 Original line number Diff line number Diff line Loading @@ -98,8 +98,6 @@ static jfieldID field_objectInfo_keywords; // MtpEvent fields static jfieldID field_event_eventCode; static jfieldID field_event_parameter1; static jfieldID field_event_parameter2; class JavaArrayWriter { public: Loading Loading @@ -575,16 +573,13 @@ static jobject android_mtp_MtpDevice_reap_event_request(JNIEnv *env, jobject thi 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; } Loading Loading @@ -837,16 +832,6 @@ int register_android_mtp_MtpDevice(JNIEnv *env) 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"); Loading