Move USB framework support from android.hardware to android.hardware.usb package

Change-Id: I00fd4f0caaa4aebe48f71c576bb211b5f38bf88d
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2011-03-01 08:04:54 -08:00
parent 43cdf9b419
commit c4308f01c9
34 changed files with 154 additions and 276 deletions

View File

@@ -115,7 +115,7 @@ LOCAL_SRC_FILES += \
core/java/android/content/pm/IPackageMoveObserver.aidl \
core/java/android/content/pm/IPackageStatsObserver.aidl \
core/java/android/database/IContentObserver.aidl \
core/java/android/hardware/IUsbManager.aidl \
core/java/android/hardware/usb/IUsbManager.aidl \
core/java/android/net/IConnectivityManager.aidl \
core/java/android/net/INetworkManagementEventObserver.aidl \
core/java/android/net/IThrottleManager.aidl \

View File

@@ -94,6 +94,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ImageProcessing_
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ModelViewer_intermediates/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PerfTest_intermediates/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/RSTest_intermediates/)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware/IUsbManager.java)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST

View File

@@ -94374,11 +94374,14 @@
>
</field>
</class>
</package>
<package name="android.hardware.usb"
>
<class name="UsbAccessory"
extends="java.lang.Object"
abstract="false"
static="false"
final="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
@@ -94474,7 +94477,7 @@
visibility="public"
>
<constructor name="UsbConstants"
type="android.hardware.UsbConstants"
type="android.hardware.usb.UsbConstants"
static="false"
final="false"
deprecated="not deprecated"
@@ -94865,7 +94868,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="endpoint" type="android.hardware.UsbEndpoint">
<parameter name="endpoint" type="android.hardware.usb.UsbEndpoint">
</parameter>
<parameter name="buffer" type="byte[]">
</parameter>
@@ -94884,7 +94887,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="intf" type="android.hardware.UsbInterface">
<parameter name="intf" type="android.hardware.usb.UsbInterface">
</parameter>
<parameter name="force" type="boolean">
</parameter>
@@ -95029,7 +95032,7 @@
>
</method>
<method name="getInterface"
return="android.hardware.UsbInterface"
return="android.hardware.usb.UsbInterface"
abstract="false"
native="false"
synchronized="false"
@@ -95095,11 +95098,11 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="intf" type="android.hardware.UsbInterface">
<parameter name="intf" type="android.hardware.usb.UsbInterface">
</parameter>
</method>
<method name="requestWait"
return="android.hardware.UsbRequest"
return="android.hardware.usb.UsbRequest"
abstract="false"
native="false"
synchronized="false"
@@ -95179,7 +95182,7 @@
>
</method>
<method name="getDevice"
return="android.hardware.UsbDevice"
return="android.hardware.usb.UsbDevice"
abstract="false"
native="false"
synchronized="false"
@@ -95212,7 +95215,7 @@
>
</method>
<method name="getInterface"
return="android.hardware.UsbInterface"
return="android.hardware.usb.UsbInterface"
abstract="false"
native="false"
synchronized="false"
@@ -95285,7 +95288,7 @@
extends="java.lang.Object"
abstract="false"
static="false"
final="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
@@ -95303,7 +95306,7 @@
>
</method>
<method name="getDevice"
return="android.hardware.UsbDevice"
return="android.hardware.usb.UsbDevice"
abstract="false"
native="false"
synchronized="false"
@@ -95314,7 +95317,7 @@
>
</method>
<method name="getEndpoint"
return="android.hardware.UsbEndpoint"
return="android.hardware.usb.UsbEndpoint"
abstract="false"
native="false"
synchronized="false"
@@ -95416,7 +95419,7 @@
visibility="public"
>
<method name="getAccessoryList"
return="android.hardware.UsbAccessory[]"
return="android.hardware.usb.UsbAccessory[]"
abstract="false"
native="false"
synchronized="false"
@@ -95427,7 +95430,7 @@
>
</method>
<method name="getDeviceList"
return="java.util.HashMap&lt;java.lang.String, android.hardware.UsbDevice&gt;"
return="java.util.HashMap&lt;java.lang.String, android.hardware.usb.UsbDevice&gt;"
abstract="false"
native="false"
synchronized="false"
@@ -95473,7 +95476,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="accessory" type="android.hardware.UsbAccessory">
<parameter name="accessory" type="android.hardware.usb.UsbAccessory">
</parameter>
</method>
<method name="openDevice"
@@ -95486,14 +95489,14 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="device" type="android.hardware.UsbDevice">
<parameter name="device" type="android.hardware.usb.UsbDevice">
</parameter>
</method>
<field name="ACTION_USB_ACCESSORY_ATTACHED"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.hardware.action.USB_ACCESSORY_ATTACHED&quot;"
value="&quot;android.hardware.usb.action.USB_ACCESSORY_ATTACHED&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -95504,7 +95507,7 @@
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.hardware.action.USB_ACCESSORY_DETACHED&quot;"
value="&quot;android.hardware.usb.action.USB_ACCESSORY_DETACHED&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -95515,7 +95518,7 @@
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.hardware.action.USB_DEVICE_ATTACHED&quot;"
value="&quot;android.hardware.usb.action.USB_DEVICE_ATTACHED&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -95526,7 +95529,7 @@
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.hardware.action.USB_DEVICE_DETACHED&quot;"
value="&quot;android.hardware.usb.action.USB_DEVICE_DETACHED&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -95537,7 +95540,7 @@
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.hardware.action.USB_STATE&quot;"
value="&quot;android.hardware.usb.action.USB_STATE&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -95675,7 +95678,7 @@
visibility="public"
>
<constructor name="UsbRequest"
type="android.hardware.UsbRequest"
type="android.hardware.usb.UsbRequest"
static="false"
final="false"
deprecated="not deprecated"
@@ -95716,7 +95719,7 @@
>
</method>
<method name="getEndpoint"
return="android.hardware.UsbEndpoint"
return="android.hardware.usb.UsbEndpoint"
abstract="false"
native="false"
synchronized="false"
@@ -95736,7 +95739,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="endpoint" type="android.hardware.UsbEndpoint">
<parameter name="endpoint" type="android.hardware.usb.UsbEndpoint">
</parameter>
</method>
<method name="queue"
@@ -112707,7 +112710,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="device" type="android.hardware.UsbDevice">
<parameter name="device" type="android.hardware.usb.UsbDevice">
</parameter>
</method>
<method name="removeListener"
@@ -113474,7 +113477,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="device" type="android.hardware.UsbDevice">
<parameter name="device" type="android.hardware.usb.UsbDevice">
</parameter>
</constructor>
<method name="close"
@@ -113667,7 +113670,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="manager" type="android.hardware.UsbManager">
<parameter name="manager" type="android.hardware.usb.UsbManager">
</parameter>
</method>
</class>
@@ -266666,7 +266669,7 @@
deprecated="not deprecated"
visibility="public"
>
<parameter name="arg0" type="T">
<parameter name="t" type="T">
</parameter>
</method>
</interface>

View File

@@ -41,9 +41,9 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.hardware.IUsbManager;
import android.hardware.SensorManager;
import android.hardware.UsbManager;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.UsbManager;
import android.location.CountryDetector;
import android.location.ICountryDetector;
import android.location.ILocationManager;

View File

@@ -1664,11 +1664,11 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a {@link
* android.hardware.UsbManager} for access to USB devices (as a USB host)
* android.hardware.usb.UsbManager} for access to USB devices (as a USB host)
* and for controlling this device's behavior as a USB device.
*
* @see #getSystemService
* @see android.harware.UsbManager
* @see android.harware.usb.UsbManager
*/
public static final String USB_SERVICE = "usb";

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.hardware.UsbAccessory;
import android.hardware.UsbDevice;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbDevice;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
parcelable UsbAccessory;

View File

@@ -14,28 +14,24 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.ParcelFileDescriptor;
import android.util.Log;
/**
* A class representing a USB accessory.
*/
public final class UsbAccessory implements Parcelable {
public class UsbAccessory implements Parcelable {
private static final String TAG = "UsbAccessory";
private String mManufacturer;
private String mModel;
private String mType;
private String mVersion;
private UsbAccessory() {
}
private final String mManufacturer;
private final String mModel;
private final String mType;
private final String mVersion;
/**
* UsbAccessory should only be instantiated by UsbService implementation

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
/**
* Contains constants for the USB protocol.

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
parcelable UsbDevice;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.os.Bundle;
import android.os.Parcel;
@@ -106,7 +106,7 @@ public final class UsbDevice implements Parcelable {
/**
* Returns the devices's class field.
* Some useful constants for USB device classes can be found in
* {@link android.hardware.UsbConstants}
* {@link android.hardware.usb.UsbConstants}
*
* @return the devices's class
*/
@@ -133,7 +133,7 @@ public final class UsbDevice implements Parcelable {
}
/**
* Returns the number of {@link android.hardware.UsbInterface}s this device contains.
* Returns the number of {@link android.hardware.usb.UsbInterface}s this device contains.
*
* @return the number of interfaces
*/
@@ -142,7 +142,7 @@ public final class UsbDevice implements Parcelable {
}
/**
* Returns the {@link android.hardware.UsbInterface} at the given index.
* Returns the {@link android.hardware.usb.UsbInterface} at the given index.
*
* @return the interface
*/
@@ -171,9 +171,9 @@ public final class UsbDevice implements Parcelable {
}
/**
* Claims exclusive access to a {@link android.hardware.UsbInterface}.
* Claims exclusive access to a {@link android.hardware.usb.UsbInterface}.
* This must be done before sending or receiving data on any
* {@link android.hardware.UsbEndpoint}s belonging to the interface
* {@link android.hardware.usb.UsbEndpoint}s belonging to the interface
* @param intf the interface to claim
* @param force true to disconnect kernel driver if necessary
* @return true if the interface was successfully claimed
@@ -183,7 +183,7 @@ public final class UsbDevice implements Parcelable {
}
/**
* Releases exclusive access to a {@link android.hardware.UsbInterface}.
* Releases exclusive access to a {@link android.hardware.usb.UsbInterface}.
*
* @return true if the interface was successfully released
*/
@@ -231,11 +231,12 @@ public final class UsbDevice implements Parcelable {
}
/**
* Waits for the result of a {@link android.hardware.UsbRequest#queue} operation
* Note that this may return requests queued on multiple {@link android.hardware.UsbEndpoint}s.
* When multiple endpoints are in use, {@link android.hardware.UsbRequest#getEndpoint} and
* {@link android.hardware.UsbRequest#getClientData} can be useful in determining how to process
* the result of this function.
* Waits for the result of a {@link android.hardware.usb.UsbRequest#queue} operation
* Note that this may return requests queued on multiple
* {@link android.hardware.usb.UsbEndpoint}s.
* When multiple endpoints are in use, {@link android.hardware.usb.UsbRequest#getEndpoint} and
* {@link android.hardware.usb.UsbRequest#getClientData} can be useful in determining
* how to process the result of this function.
*
* @return a completed USB request, or null if an error occurred
*/

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
parcelable UsbEndpoint;

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
/**
* A class representing an endpoint on a {@link android.hardware.UsbInterface}.
* A class representing an endpoint on a {@link android.hardware.usb.UsbInterface}.
*/
public final class UsbEndpoint implements Parcelable {
@@ -65,9 +65,9 @@ public final class UsbEndpoint implements Parcelable {
/**
* Returns the endpoint's direction.
* Returns {@link android.hardware.UsbConstants#USB_DIR_OUT}
* Returns {@link android.hardware.usb.UsbConstants#USB_DIR_OUT}
* if the direction is host to device, and
* {@link android.hardware.UsbConstants#USB_DIR_IN} if the
* {@link android.hardware.usb.UsbConstants#USB_DIR_IN} if the
* direction is device to host.
*
* @return the endpoint's direction
@@ -89,10 +89,10 @@ public final class UsbEndpoint implements Parcelable {
* Returns the endpoint's type.
* Possible results are:
* <ul>
* <li>{@link android.hardware.UsbConstants#USB_ENDPOINT_XFER_CONTROL} (endpoint zero)
* <li>{@link android.hardware.UsbConstants#USB_ENDPOINT_XFER_ISOC} (isochronous endpoint)
* <li>{@link android.hardware.UsbConstants#USB_ENDPOINT_XFER_BULK} (bulk endpoint)
* <li>{@link android.hardware.UsbConstants#USB_ENDPOINT_XFER_INT} (interrupt endpoint)
* <li>{@link android.hardware.usb.UsbConstants#USB_ENDPOINT_XFER_CONTROL} (endpoint zero)
* <li>{@link android.hardware.usb.UsbConstants#USB_ENDPOINT_XFER_ISOC} (isochronous endpoint)
* <li>{@link android.hardware.usb.UsbConstants#USB_ENDPOINT_XFER_BULK} (bulk endpoint)
* <li>{@link android.hardware.usb.UsbConstants#USB_ENDPOINT_XFER_INT} (interrupt endpoint)
* </ul>
*
* @return the endpoint's type
@@ -120,7 +120,7 @@ public final class UsbEndpoint implements Parcelable {
}
/**
* Returns the {@link android.hardware.UsbInterface} this endpoint belongs to.
* Returns the {@link android.hardware.usb.UsbInterface} this endpoint belongs to.
*
* @return the endpoint's interface
*/
@@ -129,7 +129,7 @@ public final class UsbEndpoint implements Parcelable {
}
/**
* Returns the {@link android.hardware.UsbDevice} this endpoint belongs to.
* Returns the {@link android.hardware.usb.UsbDevice} this endpoint belongs to.
*
* @return the endpoint's device
*/

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
parcelable UsbInterface;

View File

@@ -14,16 +14,16 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
/**
* A class representing an interface on a {@link android.hardware.UsbDevice}.
* A class representing an interface on a {@link android.hardware.usb.UsbDevice}.
*/
public final class UsbInterface implements Parcelable {
public class UsbInterface implements Parcelable {
private int mId;
private int mClass;
@@ -60,7 +60,7 @@ public final class UsbInterface implements Parcelable {
/**
* Returns the interface's class field.
* Some useful constants for USB classes can be found in
* {@link android.hardware.UsbConstants}
* {@link android.hardware.usb.UsbConstants}
*
* @return the interface's class
*/
@@ -87,7 +87,7 @@ public final class UsbInterface implements Parcelable {
}
/**
* Returns the number of {@link android.hardware.UsbEndpoint}s this interface contains.
* Returns the number of {@link android.hardware.usb.UsbEndpoint}s this interface contains.
*
* @return the number of endpoints
*/
@@ -96,7 +96,7 @@ public final class UsbInterface implements Parcelable {
}
/**
* Returns the {@link android.hardware.UsbEndpoint} at the given index.
* Returns the {@link android.hardware.usb.UsbEndpoint} at the given index.
*
* @return the endpoint
*/
@@ -105,7 +105,7 @@ public final class UsbInterface implements Parcelable {
}
/**
* Returns the {@link android.hardware.UsbDevice} this interface belongs to.
* Returns the {@link android.hardware.usb.UsbDevice} this interface belongs to.
*
* @return the interface's device
*/

View File

@@ -15,7 +15,7 @@
*/
package android.hardware;
package android.hardware.usb;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
@@ -55,55 +55,55 @@ public class UsbManager {
* </ul>
*/
public static final String ACTION_USB_STATE =
"android.hardware.action.USB_STATE";
"android.hardware.usb.action.USB_STATE";
/**
* Broadcast Action: A broadcast for USB device attached event.
*
* This intent is sent when a USB device is attached to the USB bus when in host mode.
* <ul>
* <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.UsbDevice}
* <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.usb.UsbDevice}
* for the attached device
* </ul>
*/
public static final String ACTION_USB_DEVICE_ATTACHED =
"android.hardware.action.USB_DEVICE_ATTACHED";
"android.hardware.usb.action.USB_DEVICE_ATTACHED";
/**
* Broadcast Action: A broadcast for USB device detached event.
*
* This intent is sent when a USB device is detached from the USB bus when in host mode.
* <ul>
* <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.UsbDevice}
* <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.usb.UsbDevice}
* for the detached device
* </ul>
*/
public static final String ACTION_USB_DEVICE_DETACHED =
"android.hardware.action.USB_DEVICE_DETACHED";
"android.hardware.usb.action.USB_DEVICE_DETACHED";
/**
* Broadcast Action: A broadcast for USB accessory attached event.
*
* This intent is sent when a USB accessory is attached.
* <ul>
* <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.UsbAccessory}
* <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.usb.UsbAccessory}
* for the attached accessory
* </ul>
*/
public static final String ACTION_USB_ACCESSORY_ATTACHED =
"android.hardware.action.USB_ACCESSORY_ATTACHED";
"android.hardware.usb.action.USB_ACCESSORY_ATTACHED";
/**
* Broadcast Action: A broadcast for USB accessory detached event.
*
* This intent is sent when a USB accessory is detached.
* <ul>
* <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.UsbAccessory}
* <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.usb.UsbAccessory}
* for the attached accessory that was detached
* </ul>
*/
public static final String ACTION_USB_ACCESSORY_DETACHED =
"android.hardware.action.USB_ACCESSORY_DETACHED";
"android.hardware.usb.action.USB_ACCESSORY_DETACHED";
/**
* Boolean extra indicating whether USB is connected or disconnected.
@@ -210,7 +210,7 @@ public class UsbManager {
/**
* Opens the device so it can be used to send and receive
* data using {@link android.hardware.UsbRequest}.
* data using {@link android.hardware.usb.UsbRequest}.
*
* @param device the device to open
* @return true if we successfully opened the device

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package android.hardware;
package android.hardware.usb;
import android.util.Log;
@@ -23,9 +23,9 @@ import java.nio.ByteBuffer;
/**
* A class representing USB request packet.
* This can be used for both reading and writing data to or from a
* {@link android.hardware.UsbDevice}.
* {@link android.hardware.usb.UsbDevice}.
* UsbRequests are sent asynchronously via {@link #queue} and the results
* are read by {@link android.hardware.UsbDevice#requestWait}.
* are read by {@link android.hardware.usb.UsbDevice#requestWait}.
*/
public class UsbRequest {
@@ -94,7 +94,7 @@ public class UsbRequest {
* This can be used in conjunction with {@link #setClientData}
* to associate another object with this request, which can be useful for
* maintaining state between calls to {@link #queue} and
* {@link android.hardware.UsbDevice#requestWait}
* {@link android.hardware.usb.UsbDevice#requestWait}
*
* @return the client data for the request
*/
@@ -107,7 +107,7 @@ public class UsbRequest {
* This can be used in conjunction with {@link #getClientData}
* to associate another object with this request, which can be useful for
* maintaining state between calls to {@link #queue} and
* {@link android.hardware.UsbDevice#requestWait}
* {@link android.hardware.usb.UsbDevice#requestWait}
*
* @param data the client data for the request
*/
@@ -121,7 +121,7 @@ public class UsbRequest {
* For IN endpoints, the endpoint will attempt to read the given number of bytes
* into the specified buffer.
* If the queueing operation is successful, we return true and the result will be
* returned via {@link android.hardware.UsbDevice#requestWait}
* returned via {@link android.hardware.usb.UsbDevice#requestWait}
*
* @param buffer the buffer containing the bytes to write, or location to store
* the results of a read

View File

@@ -237,7 +237,7 @@ static JNINativeMethod method_table[] = {
(void *)android_hardware_UsbDevice_control_request},
{"native_bulk_request", "(I[BII)I",
(void *)android_hardware_UsbDevice_bulk_request},
{"native_request_wait", "()Landroid/hardware/UsbRequest;",
{"native_request_wait", "()Landroid/hardware/usb/UsbRequest;",
(void *)android_hardware_UsbDevice_request_wait},
{ "native_get_serial", "()Ljava/lang/String;",
(void*)android_hardware_UsbDevice_get_serial },
@@ -251,9 +251,9 @@ static JNINativeMethod method_table[] = {
int register_android_hardware_UsbDevice(JNIEnv *env)
{
jclass clazz = env->FindClass("android/hardware/UsbDevice");
jclass clazz = env->FindClass("android/hardware/usb/UsbDevice");
if (clazz == NULL) {
LOGE("Can't find android/hardware/UsbDevice");
LOGE("Can't find android/hardware/usb/UsbDevice");
return -1;
}
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
@@ -262,7 +262,7 @@ int register_android_hardware_UsbDevice(JNIEnv *env)
return -1;
}
return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbDevice",
return AndroidRuntime::registerNativeMethods(env, "android/hardware/usb/UsbDevice",
method_table, NELEM(method_table));
}

View File

@@ -1,124 +0,0 @@
/*
* 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.
*/
#define LOG_TAG "UsbEndpoint"
#include "utils/Log.h"
#include "jni.h"
#include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h"
#include <usbhost/usbhost.h>
#include <stdio.h>
using namespace android;
static jfieldID field_context;
static jfieldID field_address;
static jfieldID field_attributes;
static jfieldID field_max_packet_size;
static jfieldID field_interval;
struct usb_endpoint* get_endpoint_from_object(JNIEnv* env, jobject javaEndpoint)
{
return (struct usb_endpoint*)env->GetIntField(javaEndpoint, field_context);
}
// in android_hardware_UsbDevice.cpp
extern struct usb_device* get_device_from_object(JNIEnv* env, jobject javaDevice);
static jboolean
android_hardware_UsbEndpoint_init(JNIEnv *env, jobject thiz, jobject javaDevice)
{
LOGD("open\n");
struct usb_device* device = get_device_from_object(env, javaDevice);
if (!device) {
LOGE("device null in native_init");
return false;
}
// construct an endpoint descriptor from the Java object fields
struct usb_endpoint_descriptor desc;
desc.bLength = USB_DT_ENDPOINT_SIZE;
desc.bDescriptorType = USB_DT_ENDPOINT;
desc.bEndpointAddress = env->GetIntField(thiz, field_address);
desc.bmAttributes = env->GetIntField(thiz, field_attributes);
desc.wMaxPacketSize = env->GetIntField(thiz, field_max_packet_size);
desc.bInterval = env->GetIntField(thiz, field_interval);
struct usb_endpoint* endpoint = usb_endpoint_init(device, &desc);
if (endpoint)
env->SetIntField(thiz, field_context, (int)device);
return (endpoint != NULL);
}
static void
android_hardware_UsbEndpoint_close(JNIEnv *env, jobject thiz)
{
LOGD("close\n");
struct usb_endpoint* endpoint = get_endpoint_from_object(env, thiz);
if (endpoint) {
usb_endpoint_close(endpoint);
env->SetIntField(thiz, field_context, 0);
}
}
static JNINativeMethod method_table[] = {
{"native_init", "(Landroid/hardware/UsbDevice;)Z",
(void *)android_hardware_UsbEndpoint_init},
{"native_close", "()V", (void *)android_hardware_UsbEndpoint_close},
};
int register_android_hardware_UsbEndpoint(JNIEnv *env)
{
jclass clazz = env->FindClass("android/hardware/UsbEndpoint");
if (clazz == NULL) {
LOGE("Can't find android/hardware/UsbEndpoint");
return -1;
}
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
if (field_context == NULL) {
LOGE("Can't find UsbEndpoint.mNativeContext");
return -1;
}
field_address = env->GetFieldID(clazz, "mAddress", "I");
if (field_address == NULL) {
LOGE("Can't find UsbEndpoint.mAddress");
return -1;
}
field_attributes = env->GetFieldID(clazz, "mAttributes", "I");
if (field_attributes == NULL) {
LOGE("Can't find UsbEndpoint.mAttributes");
return -1;
}
field_max_packet_size = env->GetFieldID(clazz, "mMaxPacketSize", "I");
if (field_max_packet_size == NULL) {
LOGE("Can't find UsbEndpoint.mMaxPacketSize");
return -1;
}
field_interval = env->GetFieldID(clazz, "mInterval", "I");
if (field_interval == NULL) {
LOGE("Can't find UsbEndpoint.mInterval");
return -1;
}
return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbEndpoint",
method_table, NELEM(method_table));
}

View File

@@ -187,7 +187,7 @@ android_hardware_UsbRequest_cancel(JNIEnv *env, jobject thiz)
}
static JNINativeMethod method_table[] = {
{"native_init", "(Landroid/hardware/UsbDevice;IIII)Z",
{"native_init", "(Landroid/hardware/usb/UsbDevice;IIII)Z",
(void *)android_hardware_UsbRequest_init},
{"native_close", "()V", (void *)android_hardware_UsbRequest_close},
{"native_queue_array", "([BIZ)Z", (void *)android_hardware_UsbRequest_queue_array},
@@ -200,9 +200,9 @@ static JNINativeMethod method_table[] = {
int register_android_hardware_UsbRequest(JNIEnv *env)
{
jclass clazz = env->FindClass("android/hardware/UsbRequest");
jclass clazz = env->FindClass("android/hardware/usb/UsbRequest");
if (clazz == NULL) {
LOGE("Can't find android/hardware/UsbRequest");
LOGE("Can't find android/hardware/usb/UsbRequest");
return -1;
}
field_context = env->GetFieldID(clazz, "mNativeContext", "I");
@@ -211,7 +211,7 @@ int register_android_hardware_UsbRequest(JNIEnv *env)
return -1;
}
return AndroidRuntime::registerNativeMethods(env, "android/hardware/UsbRequest",
return AndroidRuntime::registerNativeMethods(env, "android/hardware/usb/UsbRequest",
method_table, NELEM(method_table));
}

View File

@@ -84,11 +84,11 @@
<protected-broadcast android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<protected-broadcast android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
<protected-broadcast android:name="android.hardware.action.USB_STATE" />
<protected-broadcast android:name="android.hardware.action.USB_ACCESSORY_ATTACHED" />
<protected-broadcast android:name="android.hardware.action.USB_ACCESSORY_ATTACHED" />
<protected-broadcast android:name="android.hardware.action.USB_DEVICE_ATTACHED" />
<protected-broadcast android:name="android.hardware.action.USB_DEVICE_DETACHED" />
<protected-broadcast android:name="android.hardware.usb.action.USB_STATE" />
<protected-broadcast android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
<protected-broadcast android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
<protected-broadcast android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<protected-broadcast android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
<protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" />
<protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" />

View File

@@ -26,7 +26,7 @@ public final class UsbAccessory {
private final String mType;
private final String mVersion;
/* package */ UsbAccessory(android.hardware.UsbAccessory accessory) {
/* package */ UsbAccessory(android.hardware.usb.UsbAccessory accessory) {
mManufacturer = accessory.getManufacturer();
mModel = accessory.getModel();
mType = accessory.getType();

View File

@@ -19,7 +19,7 @@ package com.google.android.usb;
import android.content.Context;
import android.content.Intent;
import android.hardware.IUsbManager;
import android.hardware.usb.IUsbManager;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -43,7 +43,7 @@ public class UsbManager {
* {@link com.google.android.usb.UsbAccessory} for the attached accessory.
*/
public static final String ACTION_USB_ACCESSORY_ATTACHED =
"android.hardware.action.USB_ACCESSORY_ATTACHED";
"android.hardware.usb.action.USB_ACCESSORY_ATTACHED";
/**
* Broadcast Action: A broadcast for USB accessory detached event.
@@ -53,7 +53,7 @@ public class UsbManager {
* {@link com.google.android.usb.UsbAccessory} for the attached accessory that was detached.
*/
public static final String ACTION_USB_ACCESSORY_DETACHED =
"android.hardware.action.USB_ACCESSORY_DETACHED";
"android.hardware.usb.action.USB_ACCESSORY_DETACHED";
private final IUsbManager mService;
@@ -79,8 +79,8 @@ public class UsbManager {
* @return UsbAccessory for the broadcast.
*/
public static UsbAccessory getAccessory(Intent intent) {
android.hardware.UsbAccessory accessory =
intent.getParcelableExtra(android.hardware.UsbManager.EXTRA_ACCESSORY);
android.hardware.usb.UsbAccessory accessory =
intent.getParcelableExtra(android.hardware.usb.UsbManager.EXTRA_ACCESSORY);
if (accessory == null) {
return null;
} else {
@@ -96,7 +96,7 @@ public class UsbManager {
*/
public UsbAccessory[] getAccessoryList() {
try {
android.hardware.UsbAccessory accessory = mService.getCurrentAccessory();
android.hardware.usb.UsbAccessory accessory = mService.getCurrentAccessory();
if (accessory == null) {
return null;
} else {
@@ -116,7 +116,7 @@ public class UsbManager {
*/
public ParcelFileDescriptor openAccessory(UsbAccessory accessory) {
try {
return mService.openAccessory(new android.hardware.UsbAccessory(
return mService.openAccessory(new android.hardware.usb.UsbAccessory(
accessory.getManufacturer(),accessory.getModel(),
accessory.getType(), accessory.getVersion()));
} catch (RemoteException e) {

View File

@@ -12,10 +12,10 @@
</intent-filter>
<intent-filter>
<action android:name="android.hardware.action.USB_ACCESSORY_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.action.USB_ACCESSORY_ATTACHED"
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
</application>

View File

@@ -20,10 +20,10 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.UsbConstants;
import android.hardware.UsbDevice;
import android.hardware.UsbInterface;
import android.hardware.UsbManager;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -95,7 +95,7 @@ public class MtpClient {
}
/**
* Tests to see if a {@link android.hardware.UsbDevice}
* Tests to see if a {@link android.hardware.usb.UsbDevice}
* supports the PTP protocol (typically used by digital cameras)
*
* @param device the device to test
@@ -140,7 +140,7 @@ public class MtpClient {
}
/**
* Opens the {@link android.hardware.UsbDevice} for an MTP or PTP
* Opens the {@link android.hardware.usb.UsbDevice} for an MTP or PTP
* device and return an {@link android.mtp.MtpDevice} for it.
*
* @param device the device to open

View File

@@ -16,8 +16,8 @@
package android.mtp;
import android.hardware.UsbDevice;
import android.hardware.UsbManager;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -37,7 +37,7 @@ public final class MtpDevice {
/**
* MtpClient constructor
*
* @param device the {@link android.hardware.UsbDevice} for the MTP or PTP device
* @param device the {@link android.hardware.usb.UsbDevice} for the MTP or PTP device
*/
public MtpDevice(UsbDevice device) {
mDevice = device;
@@ -46,7 +46,7 @@ public final class MtpDevice {
/**
* Opens the MTP or PTP device and return an {@link android.mtp.MtpDevice} for it.
*
* @param manager reference to {@link android.hardware.UsbManager}
* @param manager reference to {@link android.hardware.usb.UsbManager}
* @return true if the device was successfully opened.
*/
public boolean open(UsbManager manager) {

View File

@@ -12,9 +12,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.action.USB_DEVICE_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.action.USB_DEVICE_ATTACHED"
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>

View File

@@ -21,8 +21,8 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.UsbDevice;
import android.hardware.UsbManager;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.util.Log;
public class DeviceDisconnectedReceiver extends BroadcastReceiver {

View File

@@ -30,7 +30,7 @@ import android.content.DialogInterface.OnCancelListener;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.hardware.UsbManager;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;

View File

@@ -37,7 +37,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.hardware.UsbManager;
import android.hardware.usb.UsbManager;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Binder;

View File

@@ -26,7 +26,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.hardware.UsbManager;
import android.hardware.usb.UsbManager;
import android.net.ConnectivityManager;
import android.net.InterfaceConfiguration;
import android.net.IConnectivityManager;

View File

@@ -25,10 +25,10 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.XmlResourceParser;
import android.hardware.UsbAccessory;
import android.hardware.UsbDevice;
import android.hardware.UsbInterface;
import android.hardware.UsbManager;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.os.Binder;
import android.os.FileUtils;
import android.os.Process;

View File

@@ -21,10 +21,10 @@ import com.android.internal.app.ResolverActivity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.hardware.IUsbManager;
import android.hardware.UsbAccessory;
import android.hardware.UsbDevice;
import android.hardware.UsbManager;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;

View File

@@ -20,13 +20,13 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.hardware.IUsbManager;
import android.hardware.UsbAccessory;
import android.hardware.UsbConstants;
import android.hardware.UsbDevice;
import android.hardware.UsbEndpoint;
import android.hardware.UsbInterface;
import android.hardware.UsbManager;
import android.hardware.usb.IUsbManager;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;