Loading core/java/android/hardware/UsbManager.java +0 −29 Original line number Diff line number Diff line Loading @@ -39,24 +39,6 @@ public class UsbManager { public static final String ACTION_USB_STATE = "android.hardware.action.USB_STATE"; /** * Broadcast Action: A broadcast for USB camera attached event. * * This intent is sent when a USB device supporting PTP is attached to the host USB bus. * The intent's data contains a Uri for the device in the MTP provider. */ public static final String ACTION_USB_CAMERA_ATTACHED = "android.hardware.action.USB_CAMERA_ATTACHED"; /** * Broadcast Action: A broadcast for USB camera detached event. * * This intent is sent when a USB device supporting PTP is detached from the host USB bus. * The intent's data contains a Uri for the device in the MTP provider. */ public static final String ACTION_USB_CAMERA_DETACHED = "android.hardware.action.USB_CAMERA_DETACHED"; /** * Boolean extra indicating whether USB is connected or disconnected. * Used in extras for the {@link #ACTION_USB_STATE} broadcast. Loading Loading @@ -105,14 +87,6 @@ public class UsbManager { */ public static final String USB_FUNCTION_DISABLED = "disabled"; public static final int getDeviceId(String name) { return native_get_device_id(name); } public static final String getDeviceName(int id) { return native_get_device_name(id); } private static File getFunctionEnableFile(String function) { return new File("/sys/class/usb_composite/" + function + "/enable"); } Loading @@ -138,7 +112,4 @@ public class UsbManager { return false; } } private static native int native_get_device_id(String name); private static native String native_get_device_name(int id); } core/jni/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -123,7 +123,6 @@ LOCAL_SRC_FILES:= \ android_media_ToneGenerator.cpp \ android_hardware_Camera.cpp \ android_hardware_SensorManager.cpp \ android_hardware_UsbManager.cpp \ android_debug_JNITest.cpp \ android_util_FileObserver.cpp \ android/opengl/poly_clip.cpp.arm \ Loading Loading @@ -202,7 +201,6 @@ LOCAL_SHARED_LIBRARIES := \ libwpa_client \ libjpeg \ libnfc_ndef \ libusbhost ifeq ($(USE_OPENGL_RENDERER),true) LOCAL_SHARED_LIBRARIES += libhwui Loading core/jni/AndroidRuntime.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ extern int register_android_opengl_jni_GLES20(JNIEnv* env); extern int register_android_hardware_Camera(JNIEnv *env); extern int register_android_hardware_SensorManager(JNIEnv *env); extern int register_android_hardware_UsbManager(JNIEnv *env); extern int register_android_media_AudioRecord(JNIEnv *env); extern int register_android_media_AudioSystem(JNIEnv *env); Loading Loading @@ -1266,7 +1265,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_com_android_internal_os_ZygoteInit), REG_JNI(register_android_hardware_Camera), REG_JNI(register_android_hardware_SensorManager), REG_JNI(register_android_hardware_UsbManager), REG_JNI(register_android_media_AudioRecord), REG_JNI(register_android_media_AudioSystem), REG_JNI(register_android_media_AudioTrack), Loading core/jni/android_hardware_UsbManager.cppdeleted 100644 → 0 +0 −61 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "jni.h" #include "JNIHelp.h" #include "android_runtime/AndroidRuntime.h" #include <usbhost/usbhost.h> #include <stdio.h> using namespace android; static jint android_hardware_UsbManager_get_device_id(JNIEnv *env, jobject clazz, jstring name) { const char *nameStr = env->GetStringUTFChars(name, NULL); int id = usb_device_get_unique_id_from_name(nameStr); env->ReleaseStringUTFChars(name, nameStr); return id; } static jstring android_hardware_UsbManager_get_device_name(JNIEnv *env, jobject clazz, jint id) { char* name = usb_device_get_name_from_unique_id(id); jstring result = env->NewStringUTF(name); free(name); return result; } static JNINativeMethod method_table[] = { { "native_get_device_id", "(Ljava/lang/String;)I", (void*)android_hardware_UsbManager_get_device_id }, { "native_get_device_name", "(I)Ljava/lang/String;", (void*)android_hardware_UsbManager_get_device_name }, }; int register_android_hardware_UsbManager(JNIEnv *env) { jclass clazz = env->FindClass("android/hardware/UsbManager"); if (clazz == NULL) { LOGE("Can't find android/hardware/UsbManager"); return -1; } return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbManager", method_table, NELEM(method_table)); } services/java/com/android/server/UsbService.java +1 −27 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.net.Uri; import android.os.Handler; import android.os.Message; import android.os.UEventObserver; import android.provider.Ptp; import android.provider.Settings; import android.util.Log; import android.util.Slog; Loading Loading @@ -182,33 +181,8 @@ class UsbService { } } private native void monitorUsbHostBus(); // called from JNI in monitorUsbHostBus() private void usbCameraAdded(int deviceID) { Intent intent = new Intent(UsbManager.ACTION_USB_CAMERA_ATTACHED, Ptp.Device.getContentUri(deviceID)); Log.d(TAG, "usbCameraAdded, sending " + intent); mContext.sendBroadcast(intent); } // called from JNI in monitorUsbHostBus() private void usbCameraRemoved(int deviceID) { Intent intent = new Intent(UsbManager.ACTION_USB_CAMERA_DETACHED, Ptp.Device.getContentUri(deviceID)); Log.d(TAG, "usbCameraRemoved, sending " + intent); mContext.sendBroadcast(intent); } private void initHostSupport() { // Create a thread to call into native code to wait for USB host events. // This thread will call us back on usbCameraAdded and usbCameraRemoved. Runnable runnable = new Runnable() { public void run() { monitorUsbHostBus(); } }; new Thread(null, runnable, "UsbService host thread").start(); // temporarily disabled } void systemReady() { Loading Loading
core/java/android/hardware/UsbManager.java +0 −29 Original line number Diff line number Diff line Loading @@ -39,24 +39,6 @@ public class UsbManager { public static final String ACTION_USB_STATE = "android.hardware.action.USB_STATE"; /** * Broadcast Action: A broadcast for USB camera attached event. * * This intent is sent when a USB device supporting PTP is attached to the host USB bus. * The intent's data contains a Uri for the device in the MTP provider. */ public static final String ACTION_USB_CAMERA_ATTACHED = "android.hardware.action.USB_CAMERA_ATTACHED"; /** * Broadcast Action: A broadcast for USB camera detached event. * * This intent is sent when a USB device supporting PTP is detached from the host USB bus. * The intent's data contains a Uri for the device in the MTP provider. */ public static final String ACTION_USB_CAMERA_DETACHED = "android.hardware.action.USB_CAMERA_DETACHED"; /** * Boolean extra indicating whether USB is connected or disconnected. * Used in extras for the {@link #ACTION_USB_STATE} broadcast. Loading Loading @@ -105,14 +87,6 @@ public class UsbManager { */ public static final String USB_FUNCTION_DISABLED = "disabled"; public static final int getDeviceId(String name) { return native_get_device_id(name); } public static final String getDeviceName(int id) { return native_get_device_name(id); } private static File getFunctionEnableFile(String function) { return new File("/sys/class/usb_composite/" + function + "/enable"); } Loading @@ -138,7 +112,4 @@ public class UsbManager { return false; } } private static native int native_get_device_id(String name); private static native String native_get_device_name(int id); }
core/jni/Android.mk +0 −2 Original line number Diff line number Diff line Loading @@ -123,7 +123,6 @@ LOCAL_SRC_FILES:= \ android_media_ToneGenerator.cpp \ android_hardware_Camera.cpp \ android_hardware_SensorManager.cpp \ android_hardware_UsbManager.cpp \ android_debug_JNITest.cpp \ android_util_FileObserver.cpp \ android/opengl/poly_clip.cpp.arm \ Loading Loading @@ -202,7 +201,6 @@ LOCAL_SHARED_LIBRARIES := \ libwpa_client \ libjpeg \ libnfc_ndef \ libusbhost ifeq ($(USE_OPENGL_RENDERER),true) LOCAL_SHARED_LIBRARIES += libhwui Loading
core/jni/AndroidRuntime.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ extern int register_android_opengl_jni_GLES20(JNIEnv* env); extern int register_android_hardware_Camera(JNIEnv *env); extern int register_android_hardware_SensorManager(JNIEnv *env); extern int register_android_hardware_UsbManager(JNIEnv *env); extern int register_android_media_AudioRecord(JNIEnv *env); extern int register_android_media_AudioSystem(JNIEnv *env); Loading Loading @@ -1266,7 +1265,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_com_android_internal_os_ZygoteInit), REG_JNI(register_android_hardware_Camera), REG_JNI(register_android_hardware_SensorManager), REG_JNI(register_android_hardware_UsbManager), REG_JNI(register_android_media_AudioRecord), REG_JNI(register_android_media_AudioSystem), REG_JNI(register_android_media_AudioTrack), Loading
core/jni/android_hardware_UsbManager.cppdeleted 100644 → 0 +0 −61 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "jni.h" #include "JNIHelp.h" #include "android_runtime/AndroidRuntime.h" #include <usbhost/usbhost.h> #include <stdio.h> using namespace android; static jint android_hardware_UsbManager_get_device_id(JNIEnv *env, jobject clazz, jstring name) { const char *nameStr = env->GetStringUTFChars(name, NULL); int id = usb_device_get_unique_id_from_name(nameStr); env->ReleaseStringUTFChars(name, nameStr); return id; } static jstring android_hardware_UsbManager_get_device_name(JNIEnv *env, jobject clazz, jint id) { char* name = usb_device_get_name_from_unique_id(id); jstring result = env->NewStringUTF(name); free(name); return result; } static JNINativeMethod method_table[] = { { "native_get_device_id", "(Ljava/lang/String;)I", (void*)android_hardware_UsbManager_get_device_id }, { "native_get_device_name", "(I)Ljava/lang/String;", (void*)android_hardware_UsbManager_get_device_name }, }; int register_android_hardware_UsbManager(JNIEnv *env) { jclass clazz = env->FindClass("android/hardware/UsbManager"); if (clazz == NULL) { LOGE("Can't find android/hardware/UsbManager"); return -1; } return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbManager", method_table, NELEM(method_table)); }
services/java/com/android/server/UsbService.java +1 −27 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.net.Uri; import android.os.Handler; import android.os.Message; import android.os.UEventObserver; import android.provider.Ptp; import android.provider.Settings; import android.util.Log; import android.util.Slog; Loading Loading @@ -182,33 +181,8 @@ class UsbService { } } private native void monitorUsbHostBus(); // called from JNI in monitorUsbHostBus() private void usbCameraAdded(int deviceID) { Intent intent = new Intent(UsbManager.ACTION_USB_CAMERA_ATTACHED, Ptp.Device.getContentUri(deviceID)); Log.d(TAG, "usbCameraAdded, sending " + intent); mContext.sendBroadcast(intent); } // called from JNI in monitorUsbHostBus() private void usbCameraRemoved(int deviceID) { Intent intent = new Intent(UsbManager.ACTION_USB_CAMERA_DETACHED, Ptp.Device.getContentUri(deviceID)); Log.d(TAG, "usbCameraRemoved, sending " + intent); mContext.sendBroadcast(intent); } private void initHostSupport() { // Create a thread to call into native code to wait for USB host events. // This thread will call us back on usbCameraAdded and usbCameraRemoved. Runnable runnable = new Runnable() { public void run() { monitorUsbHostBus(); } }; new Thread(null, runnable, "UsbService host thread").start(); // temporarily disabled } void systemReady() { Loading