Loading api/current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -22579,7 +22579,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo { api/system-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -24126,7 +24126,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo { api/test-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -22587,7 +22587,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo { media/java/android/mtp/MtpEvent.java +138 −1 Original line number Diff line number Diff line Loading @@ -18,15 +18,152 @@ package android.mtp; /** * This class encapsulates information about a MTP event. * Event constants are defined by the USB-IF MTP specification. * This corresponds to the events described in appendix G of the 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; private int mParameter3; /** * 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 the first event parameter. */ public int getParameter1() { return mParameter1; } /** * Obtains the second event parameter. */ public int getParameter2() { return mParameter2; } /** * Obtains the third event parameter. */ public int getParameter3() { return mParameter3; } /** * Obtains objectHandle event parameter. * * @see MtpConstants#EVENT_OBJECT_ADDED * @see MtpConstants#EVENT_OBJECT_REMOVED * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED */ 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. * * @see MtpConstants#EVENT_STORE_ADDED * @see MtpConstants#EVENT_STORE_REMOVED * @see MtpConstants#EVENT_STORE_FULL * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED */ 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. * * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED */ public int getDevicePropCode() { switch (mEventCode) { case MtpConstants.EVENT_DEVICE_PROP_CHANGED: return mParameter1; default: throw new IllegalParameterAccess("devicePropCode", mEventCode); } } /** * Obtains transactionID event parameter. * * @see MtpConstants#EVENT_CAPTURE_COMPLETE */ public int getTransactionId() { switch (mEventCode) { case MtpConstants.EVENT_CAPTURE_COMPLETE: return mParameter1; default: throw new IllegalParameterAccess("transactionID", mEventCode); } } /** * Obtains objectPropCode event parameter. * * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED */ 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. * * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED */ 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 +23 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ static jfieldID field_objectInfo_keywords; // MtpEvent fields static jfieldID field_event_eventCode; static jfieldID field_event_parameter1; static jfieldID field_event_parameter2; static jfieldID field_event_parameter3; class JavaArrayWriter { public: Loading Loading @@ -573,13 +576,17 @@ static jobject android_mtp_MtpDevice_reap_event_request(JNIEnv *env, jobject thi env->ThrowNew(clazz_io_exception, ""); return NULL; } const int eventCode = device->reapEventRequest(seq); uint32_t parameters[3]; const int eventCode = device->reapEventRequest(seq, ¶meters); 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])); env->SetIntField(result, field_event_parameter3, static_cast<jint>(parameters[2])); return result; } Loading Loading @@ -832,6 +839,21 @@ 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; } field_event_parameter3 = env->GetFieldID(clazz, "mParameter3", "I"); if (field_event_parameter3 == NULL) { ALOGE("Can't find MtpObjectInfo.mParameter3"); return -1; } clazz_event = (jclass)env->NewGlobalRef(clazz); clazz = env->FindClass("android/mtp/MtpDevice"); Loading Loading
api/current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -22579,7 +22579,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo {
api/system-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -24126,7 +24126,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo {
api/test-current.txt +9 −0 Original line number Diff line number Diff line Loading @@ -22587,7 +22587,16 @@ 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 getParameter1(); method public int getParameter2(); method public int getParameter3(); method public int getStorageId(); method public int getTransactionId(); } public final class MtpObjectInfo {
media/java/android/mtp/MtpEvent.java +138 −1 Original line number Diff line number Diff line Loading @@ -18,15 +18,152 @@ package android.mtp; /** * This class encapsulates information about a MTP event. * Event constants are defined by the USB-IF MTP specification. * This corresponds to the events described in appendix G of the 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; private int mParameter3; /** * 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 the first event parameter. */ public int getParameter1() { return mParameter1; } /** * Obtains the second event parameter. */ public int getParameter2() { return mParameter2; } /** * Obtains the third event parameter. */ public int getParameter3() { return mParameter3; } /** * Obtains objectHandle event parameter. * * @see MtpConstants#EVENT_OBJECT_ADDED * @see MtpConstants#EVENT_OBJECT_REMOVED * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED */ 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. * * @see MtpConstants#EVENT_STORE_ADDED * @see MtpConstants#EVENT_STORE_REMOVED * @see MtpConstants#EVENT_STORE_FULL * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED */ 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. * * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED */ public int getDevicePropCode() { switch (mEventCode) { case MtpConstants.EVENT_DEVICE_PROP_CHANGED: return mParameter1; default: throw new IllegalParameterAccess("devicePropCode", mEventCode); } } /** * Obtains transactionID event parameter. * * @see MtpConstants#EVENT_CAPTURE_COMPLETE */ public int getTransactionId() { switch (mEventCode) { case MtpConstants.EVENT_CAPTURE_COMPLETE: return mParameter1; default: throw new IllegalParameterAccess("transactionID", mEventCode); } } /** * Obtains objectPropCode event parameter. * * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED */ 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. * * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED */ 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 +23 −1 Original line number Diff line number Diff line Loading @@ -98,6 +98,9 @@ static jfieldID field_objectInfo_keywords; // MtpEvent fields static jfieldID field_event_eventCode; static jfieldID field_event_parameter1; static jfieldID field_event_parameter2; static jfieldID field_event_parameter3; class JavaArrayWriter { public: Loading Loading @@ -573,13 +576,17 @@ static jobject android_mtp_MtpDevice_reap_event_request(JNIEnv *env, jobject thi env->ThrowNew(clazz_io_exception, ""); return NULL; } const int eventCode = device->reapEventRequest(seq); uint32_t parameters[3]; const int eventCode = device->reapEventRequest(seq, ¶meters); 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])); env->SetIntField(result, field_event_parameter3, static_cast<jint>(parameters[2])); return result; } Loading Loading @@ -832,6 +839,21 @@ 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; } field_event_parameter3 = env->GetFieldID(clazz, "mParameter3", "I"); if (field_event_parameter3 == NULL) { ALOGE("Can't find MtpObjectInfo.mParameter3"); return -1; } clazz_event = (jclass)env->NewGlobalRef(clazz); clazz = env->FindClass("android/mtp/MtpDevice"); Loading