Loading core/jni/android_hardware_UsbDeviceConnection.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ using namespace android; static const int USB_CONTROL_READ_TIMEOUT_MS = 200; static jfieldID field_context; struct usb_device* get_device_from_object(JNIEnv* env, jobject connection) Loading Loading @@ -238,7 +240,8 @@ android_hardware_UsbDeviceConnection_get_serial(JNIEnv *env, jobject thiz) ALOGE("device is closed in native_get_serial"); return NULL; } char* serial = usb_device_get_serial(device); char* serial = usb_device_get_serial(device, USB_CONTROL_READ_TIMEOUT_MS); if (!serial) return NULL; jstring result = env->NewStringUTF(serial); Loading services/core/jni/com_android_server_UsbHostManager.cpp +12 −5 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ namespace android { static const int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200; static struct parcel_file_descriptor_offsets_t { jclass mClass; Loading Loading @@ -69,10 +71,13 @@ static int usb_device_added(const char *devname, void* client_data) { jobject thiz = (jobject)client_data; const usb_device_descriptor* deviceDesc = usb_device_get_device_descriptor(device); char *manufacturer = usb_device_get_manufacturer_name(device); char *product = usb_device_get_product_name(device); char *manufacturer = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char *product = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); int version = usb_device_get_version(device); char *serial = usb_device_get_serial(device); char *serial = usb_device_get_serial(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring deviceName = env->NewStringUTF(devname); jstring manufacturerName = AndroidRuntime::NewStringLatin1(env, manufacturer); Loading @@ -99,7 +104,8 @@ static int usb_device_added(const char *devname, void* client_data) { while ((desc = usb_descriptor_iter_next(&iter)) != NULL) { if (desc->bDescriptorType == USB_DT_CONFIG) { struct usb_config_descriptor *config = (struct usb_config_descriptor *)desc; char *name = usb_device_get_string(device, config->iConfiguration); char *name = usb_device_get_string(device, config->iConfiguration, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring configName = AndroidRuntime::NewStringLatin1(env, name); env->CallVoidMethod(thiz, method_addUsbConfiguration, Loading @@ -110,7 +116,8 @@ static int usb_device_added(const char *devname, void* client_data) { free(name); } else if (desc->bDescriptorType == USB_DT_INTERFACE) { struct usb_interface_descriptor *interface = (struct usb_interface_descriptor *)desc; char *name = usb_device_get_string(device, interface->iInterface); char *name = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring interfaceName = AndroidRuntime::NewStringLatin1(env, name); env->CallVoidMethod(thiz, method_addUsbInterface, Loading Loading
core/jni/android_hardware_UsbDeviceConnection.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ using namespace android; static const int USB_CONTROL_READ_TIMEOUT_MS = 200; static jfieldID field_context; struct usb_device* get_device_from_object(JNIEnv* env, jobject connection) Loading Loading @@ -238,7 +240,8 @@ android_hardware_UsbDeviceConnection_get_serial(JNIEnv *env, jobject thiz) ALOGE("device is closed in native_get_serial"); return NULL; } char* serial = usb_device_get_serial(device); char* serial = usb_device_get_serial(device, USB_CONTROL_READ_TIMEOUT_MS); if (!serial) return NULL; jstring result = env->NewStringUTF(serial); Loading
services/core/jni/com_android_server_UsbHostManager.cpp +12 −5 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ namespace android { static const int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200; static struct parcel_file_descriptor_offsets_t { jclass mClass; Loading Loading @@ -69,10 +71,13 @@ static int usb_device_added(const char *devname, void* client_data) { jobject thiz = (jobject)client_data; const usb_device_descriptor* deviceDesc = usb_device_get_device_descriptor(device); char *manufacturer = usb_device_get_manufacturer_name(device); char *product = usb_device_get_product_name(device); char *manufacturer = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); char *product = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); int version = usb_device_get_version(device); char *serial = usb_device_get_serial(device); char *serial = usb_device_get_serial(device, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring deviceName = env->NewStringUTF(devname); jstring manufacturerName = AndroidRuntime::NewStringLatin1(env, manufacturer); Loading @@ -99,7 +104,8 @@ static int usb_device_added(const char *devname, void* client_data) { while ((desc = usb_descriptor_iter_next(&iter)) != NULL) { if (desc->bDescriptorType == USB_DT_CONFIG) { struct usb_config_descriptor *config = (struct usb_config_descriptor *)desc; char *name = usb_device_get_string(device, config->iConfiguration); char *name = usb_device_get_string(device, config->iConfiguration, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring configName = AndroidRuntime::NewStringLatin1(env, name); env->CallVoidMethod(thiz, method_addUsbConfiguration, Loading @@ -110,7 +116,8 @@ static int usb_device_added(const char *devname, void* client_data) { free(name); } else if (desc->bDescriptorType == USB_DT_INTERFACE) { struct usb_interface_descriptor *interface = (struct usb_interface_descriptor *)desc; char *name = usb_device_get_string(device, interface->iInterface); char *name = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS); jstring interfaceName = AndroidRuntime::NewStringLatin1(env, name); env->CallVoidMethod(thiz, method_addUsbInterface, Loading