summaryrefslogtreecommitdiffstats
path: root/services/jni
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-02-27 09:10:37 -0800
committerMike Lockwood <lockwood@android.com>2011-02-28 17:00:45 -0800
commit02eb8746de2d60563ec2751a34d20923192e4293 (patch)
tree7bf0390f0cdfd07857581ed98911fca857979f13 /services/jni
parent12511f64a05733d15d1a80a884b7b4711e7dd3b1 (diff)
downloadframeworks_base-02eb8746de2d60563ec2751a34d20923192e4293.zip
frameworks_base-02eb8746de2d60563ec2751a34d20923192e4293.tar.gz
frameworks_base-02eb8746de2d60563ec2751a34d20923192e4293.tar.bz2
UsbManager: Enhancements for managing USB devices and accessories
When a USB device or accessory is connected, the UsbService now asks the user which application to associate with the device or accessory. Applications interested in devices or accessories must specify the devices they work with via meta-data attached to their manifest. Permission to communicate with the device is assigned when the user chooses the activity to use for the device. The user has the option of clicking the "always use this application" checkbox to make the assignment automatic in the future. The user may later clear this preference and revoke permission for an application to have permission to communicate with the device by clicking the "Clear defaults" button for the activity in the Manage Applications panel in Settings. Added class UsbResolveActivity (a subclass or ResolveActivity for choosing an activity for a USB device or accessory) Added UsbDeviceManager, which manages the mapping between USB devices/accessories and applications, including default applications for devices and accessories, and manages application permissions. Add interface to allow Settings to clear device and accessory preferences and permissions for an application. Remove obsolete ACCESS_USB permission. Add new signatureOrSystem MANAGE_USB permission to allow administrating preferences and permissions. Moved UsbService.java to a "usb" subdirectory, along with new classes UsbResolveActivity and UsbDeviceManager. Change-Id: I92554381e9779e68ce380daaee4e1401fb875703 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services/jni')
-rw-r--r--services/jni/com_android_server_UsbService.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/services/jni/com_android_server_UsbService.cpp b/services/jni/com_android_server_UsbService.cpp
index 192daaf..3c49e54 100644
--- a/services/jni/com_android_server_UsbService.cpp
+++ b/services/jni/com_android_server_UsbService.cpp
@@ -177,7 +177,6 @@ static void set_accessory_string(JNIEnv *env, int fd, int cmd, jobjectArray strA
buffer[0] = 0;
int length = ioctl(fd, cmd, buffer);
- LOGD("ioctl returned %d", length);
if (buffer[0]) {
jstring obj = env->NewStringUTF(buffer);
env->SetObjectArrayElement(strArray, index, obj);
@@ -236,9 +235,9 @@ static JNINativeMethod method_table[] = {
int register_android_server_UsbService(JNIEnv *env)
{
- jclass clazz = env->FindClass("com/android/server/UsbService");
+ jclass clazz = env->FindClass("com/android/server/usb/UsbService");
if (clazz == NULL) {
- LOGE("Can't find com/android/server/UsbService");
+ LOGE("Can't find com/android/server/usb/UsbService");
return -1;
}
method_usbDeviceAdded = env->GetMethodID(clazz, "usbDeviceAdded", "(Ljava/lang/String;IIIII[I[I)V");
@@ -267,7 +266,7 @@ int register_android_server_UsbService(JNIEnv *env)
LOG_FATAL_IF(gParcelFileDescriptorOffsets.mConstructor == NULL,
"Unable to find constructor for android.os.ParcelFileDescriptor");
- return jniRegisterNativeMethods(env, "com/android/server/UsbService",
+ return jniRegisterNativeMethods(env, "com/android/server/usb/UsbService",
method_table, NELEM(method_table));
}