Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -22684,6 +22684,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported(); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -24278,6 +24278,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported(); api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -22692,6 +22692,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported(); media/java/android/mtp/MtpDeviceInfo.java +64 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class MtpDeviceInfo { private String mVersion; private String mSerialNumber; private int[] mOperationsSupported; private int[] mEventsSupported; // only instantiated via JNI private MtpDeviceInfo() { Loading Loading @@ -74,9 +75,71 @@ public class MtpDeviceInfo { /** * Returns operation code supported by the device. * * @return supported operation code * @return supported operation code. Can be null if device does not provide the property. * @see MtpConstants#OPERATION_GET_DEVICE_INFO * @see MtpConstants#OPERATION_OPEN_SESSION * @see MtpConstants#OPERATION_CLOSE_SESSION * @see MtpConstants#OPERATION_GET_STORAGE_I_DS * @see MtpConstants#OPERATION_GET_STORAGE_INFO * @see MtpConstants#OPERATION_GET_NUM_OBJECTS * @see MtpConstants#OPERATION_GET_OBJECT_HANDLES * @see MtpConstants#OPERATION_GET_OBJECT_INFO * @see MtpConstants#OPERATION_GET_OBJECT * @see MtpConstants#OPERATION_GET_THUMB * @see MtpConstants#OPERATION_DELETE_OBJECT * @see MtpConstants#OPERATION_SEND_OBJECT_INFO * @see MtpConstants#OPERATION_SEND_OBJECT * @see MtpConstants#OPERATION_INITIATE_CAPTURE * @see MtpConstants#OPERATION_FORMAT_STORE * @see MtpConstants#OPERATION_RESET_DEVICE * @see MtpConstants#OPERATION_SELF_TEST * @see MtpConstants#OPERATION_SET_OBJECT_PROTECTION * @see MtpConstants#OPERATION_POWER_DOWN * @see MtpConstants#OPERATION_GET_DEVICE_PROP_DESC * @see MtpConstants#OPERATION_GET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_SET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_RESET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_TERMINATE_OPEN_CAPTURE * @see MtpConstants#OPERATION_MOVE_OBJECT * @see MtpConstants#OPERATION_COPY_OBJECT * @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT * @see MtpConstants#OPERATION_INITIATE_OPEN_CAPTURE * @see MtpConstants#OPERATION_GET_OBJECT_PROPS_SUPPORTED * @see MtpConstants#OPERATION_GET_OBJECT_PROP_DESC * @see MtpConstants#OPERATION_GET_OBJECT_PROP_VALUE * @see MtpConstants#OPERATION_SET_OBJECT_PROP_VALUE * @see MtpConstants#OPERATION_GET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SKIP */ public final @Nullable int[] getOperationsSupported() { return mOperationsSupported; } /** * Returns event code supported by the device. * * @return supported event code. Can be null if device does not provide the property. * @see MtpConstants#EVENT_UNDEFINED * @see MtpConstants#EVENT_CANCEL_TRANSACTION * @see MtpConstants#EVENT_OBJECT_ADDED * @see MtpConstants#EVENT_OBJECT_REMOVED * @see MtpConstants#EVENT_STORE_ADDED * @see MtpConstants#EVENT_STORE_REMOVED * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED * @see MtpConstants#EVENT_DEVICE_INFO_CHANGED * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER * @see MtpConstants#EVENT_STORE_FULL * @see MtpConstants#EVENT_DEVICE_RESET * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED * @see MtpConstants#EVENT_CAPTURE_COMPLETE * @see MtpConstants#EVENT_UNREPORTED_STATUS * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED */ public final @Nullable int[] getEventsSupported() { return mEventsSupported; } } media/jni/android_mtp_MtpDevice.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <unistd.h> #include <fcntl.h> #include <memory> #include "jni.h" #include "JNIHelp.h" #include "ScopedPrimitiveArray.h" Loading Loading @@ -66,6 +68,7 @@ static jfieldID field_deviceInfo_model; static jfieldID field_deviceInfo_version; static jfieldID field_deviceInfo_serialNumber; static jfieldID field_deviceInfo_operationsSupported; static jfieldID field_deviceInfo_eventsSupported; // MtpStorageInfo fields static jfieldID field_storageInfo_storageId; Loading Loading @@ -216,7 +219,7 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) ALOGD("android_mtp_MtpDevice_get_device_info device is null"); return NULL; } MtpDeviceInfo* deviceInfo = device->getDeviceInfo(); std::unique_ptr<MtpDeviceInfo> deviceInfo(device->getDeviceInfo()); if (!deviceInfo) { ALOGD("android_mtp_MtpDevice_get_device_info deviceInfo is null"); return NULL; Loading @@ -224,7 +227,6 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) jobject info = env->NewObject(clazz_deviceInfo, constructor_deviceInfo); if (info == NULL) { ALOGE("Could not create a MtpDeviceInfo object"); delete deviceInfo; return NULL; } Loading @@ -242,17 +244,35 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) env->NewStringUTF(deviceInfo->mSerial)); if (deviceInfo->mOperations) { const size_t size = deviceInfo->mOperations->size(); const jintArray operations = env->NewIntArray(size); ScopedLocalRef<jintArray> operations(env, static_cast<jintArray>(env->NewIntArray(size))); { ScopedIntArrayRW elements(env, operations); ScopedIntArrayRW elements(env, operations.get()); if (elements.get() == NULL) { ALOGE("Could not create operationsSupported element."); return NULL; } for (size_t i = 0; i < size; ++i) { elements[i] = deviceInfo->mOperations->itemAt(i); } env->SetObjectField(info, field_deviceInfo_operationsSupported, operations.get()); } } if (deviceInfo->mEvents) { const size_t size = deviceInfo->mEvents->size(); ScopedLocalRef<jintArray> events(env, static_cast<jintArray>(env->NewIntArray(size))); { ScopedIntArrayRW elements(env, events.get()); if (elements.get() == NULL) { ALOGE("Could not create eventsSupported element."); return NULL; } for (size_t i = 0; i < size; ++i) { elements[i] = deviceInfo->mEvents->itemAt(i); } env->SetObjectField(info, field_deviceInfo_eventsSupported, events.get()); } env->SetObjectField(info, field_deviceInfo_operationsSupported, operations); } delete deviceInfo; return info; } Loading Loading @@ -686,6 +706,11 @@ int register_android_mtp_MtpDevice(JNIEnv *env) ALOGE("Can't find MtpDeviceInfo.mOperationsSupported"); return -1; } field_deviceInfo_eventsSupported = env->GetFieldID(clazz, "mEventsSupported", "[I"); if (field_deviceInfo_eventsSupported == NULL) { ALOGE("Can't find MtpDeviceInfo.mEventsSupported"); return -1; } clazz_deviceInfo = (jclass)env->NewGlobalRef(clazz); clazz = env->FindClass("android/mtp/MtpStorageInfo"); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -22684,6 +22684,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported();
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -24278,6 +24278,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported();
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -22692,6 +22692,7 @@ package android.mtp { } public class MtpDeviceInfo { method public final int[] getEventsSupported(); method public final java.lang.String getManufacturer(); method public final java.lang.String getModel(); method public final int[] getOperationsSupported();
media/java/android/mtp/MtpDeviceInfo.java +64 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ public class MtpDeviceInfo { private String mVersion; private String mSerialNumber; private int[] mOperationsSupported; private int[] mEventsSupported; // only instantiated via JNI private MtpDeviceInfo() { Loading Loading @@ -74,9 +75,71 @@ public class MtpDeviceInfo { /** * Returns operation code supported by the device. * * @return supported operation code * @return supported operation code. Can be null if device does not provide the property. * @see MtpConstants#OPERATION_GET_DEVICE_INFO * @see MtpConstants#OPERATION_OPEN_SESSION * @see MtpConstants#OPERATION_CLOSE_SESSION * @see MtpConstants#OPERATION_GET_STORAGE_I_DS * @see MtpConstants#OPERATION_GET_STORAGE_INFO * @see MtpConstants#OPERATION_GET_NUM_OBJECTS * @see MtpConstants#OPERATION_GET_OBJECT_HANDLES * @see MtpConstants#OPERATION_GET_OBJECT_INFO * @see MtpConstants#OPERATION_GET_OBJECT * @see MtpConstants#OPERATION_GET_THUMB * @see MtpConstants#OPERATION_DELETE_OBJECT * @see MtpConstants#OPERATION_SEND_OBJECT_INFO * @see MtpConstants#OPERATION_SEND_OBJECT * @see MtpConstants#OPERATION_INITIATE_CAPTURE * @see MtpConstants#OPERATION_FORMAT_STORE * @see MtpConstants#OPERATION_RESET_DEVICE * @see MtpConstants#OPERATION_SELF_TEST * @see MtpConstants#OPERATION_SET_OBJECT_PROTECTION * @see MtpConstants#OPERATION_POWER_DOWN * @see MtpConstants#OPERATION_GET_DEVICE_PROP_DESC * @see MtpConstants#OPERATION_GET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_SET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_RESET_DEVICE_PROP_VALUE * @see MtpConstants#OPERATION_TERMINATE_OPEN_CAPTURE * @see MtpConstants#OPERATION_MOVE_OBJECT * @see MtpConstants#OPERATION_COPY_OBJECT * @see MtpConstants#OPERATION_GET_PARTIAL_OBJECT * @see MtpConstants#OPERATION_INITIATE_OPEN_CAPTURE * @see MtpConstants#OPERATION_GET_OBJECT_PROPS_SUPPORTED * @see MtpConstants#OPERATION_GET_OBJECT_PROP_DESC * @see MtpConstants#OPERATION_GET_OBJECT_PROP_VALUE * @see MtpConstants#OPERATION_SET_OBJECT_PROP_VALUE * @see MtpConstants#OPERATION_GET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SET_OBJECT_REFERENCES * @see MtpConstants#OPERATION_SKIP */ public final @Nullable int[] getOperationsSupported() { return mOperationsSupported; } /** * Returns event code supported by the device. * * @return supported event code. Can be null if device does not provide the property. * @see MtpConstants#EVENT_UNDEFINED * @see MtpConstants#EVENT_CANCEL_TRANSACTION * @see MtpConstants#EVENT_OBJECT_ADDED * @see MtpConstants#EVENT_OBJECT_REMOVED * @see MtpConstants#EVENT_STORE_ADDED * @see MtpConstants#EVENT_STORE_REMOVED * @see MtpConstants#EVENT_DEVICE_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_INFO_CHANGED * @see MtpConstants#EVENT_DEVICE_INFO_CHANGED * @see MtpConstants#EVENT_REQUEST_OBJECT_TRANSFER * @see MtpConstants#EVENT_STORE_FULL * @see MtpConstants#EVENT_DEVICE_RESET * @see MtpConstants#EVENT_STORAGE_INFO_CHANGED * @see MtpConstants#EVENT_CAPTURE_COMPLETE * @see MtpConstants#EVENT_UNREPORTED_STATUS * @see MtpConstants#EVENT_OBJECT_PROP_CHANGED * @see MtpConstants#EVENT_OBJECT_PROP_DESC_CHANGED * @see MtpConstants#EVENT_OBJECT_REFERENCES_CHANGED */ public final @Nullable int[] getEventsSupported() { return mEventsSupported; } }
media/jni/android_mtp_MtpDevice.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <unistd.h> #include <fcntl.h> #include <memory> #include "jni.h" #include "JNIHelp.h" #include "ScopedPrimitiveArray.h" Loading Loading @@ -66,6 +68,7 @@ static jfieldID field_deviceInfo_model; static jfieldID field_deviceInfo_version; static jfieldID field_deviceInfo_serialNumber; static jfieldID field_deviceInfo_operationsSupported; static jfieldID field_deviceInfo_eventsSupported; // MtpStorageInfo fields static jfieldID field_storageInfo_storageId; Loading Loading @@ -216,7 +219,7 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) ALOGD("android_mtp_MtpDevice_get_device_info device is null"); return NULL; } MtpDeviceInfo* deviceInfo = device->getDeviceInfo(); std::unique_ptr<MtpDeviceInfo> deviceInfo(device->getDeviceInfo()); if (!deviceInfo) { ALOGD("android_mtp_MtpDevice_get_device_info deviceInfo is null"); return NULL; Loading @@ -224,7 +227,6 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) jobject info = env->NewObject(clazz_deviceInfo, constructor_deviceInfo); if (info == NULL) { ALOGE("Could not create a MtpDeviceInfo object"); delete deviceInfo; return NULL; } Loading @@ -242,17 +244,35 @@ android_mtp_MtpDevice_get_device_info(JNIEnv *env, jobject thiz) env->NewStringUTF(deviceInfo->mSerial)); if (deviceInfo->mOperations) { const size_t size = deviceInfo->mOperations->size(); const jintArray operations = env->NewIntArray(size); ScopedLocalRef<jintArray> operations(env, static_cast<jintArray>(env->NewIntArray(size))); { ScopedIntArrayRW elements(env, operations); ScopedIntArrayRW elements(env, operations.get()); if (elements.get() == NULL) { ALOGE("Could not create operationsSupported element."); return NULL; } for (size_t i = 0; i < size; ++i) { elements[i] = deviceInfo->mOperations->itemAt(i); } env->SetObjectField(info, field_deviceInfo_operationsSupported, operations.get()); } } if (deviceInfo->mEvents) { const size_t size = deviceInfo->mEvents->size(); ScopedLocalRef<jintArray> events(env, static_cast<jintArray>(env->NewIntArray(size))); { ScopedIntArrayRW elements(env, events.get()); if (elements.get() == NULL) { ALOGE("Could not create eventsSupported element."); return NULL; } for (size_t i = 0; i < size; ++i) { elements[i] = deviceInfo->mEvents->itemAt(i); } env->SetObjectField(info, field_deviceInfo_eventsSupported, events.get()); } env->SetObjectField(info, field_deviceInfo_operationsSupported, operations); } delete deviceInfo; return info; } Loading Loading @@ -686,6 +706,11 @@ int register_android_mtp_MtpDevice(JNIEnv *env) ALOGE("Can't find MtpDeviceInfo.mOperationsSupported"); return -1; } field_deviceInfo_eventsSupported = env->GetFieldID(clazz, "mEventsSupported", "[I"); if (field_deviceInfo_eventsSupported == NULL) { ALOGE("Can't find MtpDeviceInfo.mEventsSupported"); return -1; } clazz_deviceInfo = (jclass)env->NewGlobalRef(clazz); clazz = env->FindClass("android/mtp/MtpStorageInfo"); Loading