diff options
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | core/java/android/hardware/usb/UsbDeviceConnection.java | 12 | ||||
| -rw-r--r-- | core/jni/android_hardware_UsbDeviceConnection.cpp | 22 | ||||
| -rw-r--r-- | docs/html/guide/appendix/install-location.jd | 5 | ||||
| -rw-r--r-- | docs/html/guide/publishing/licensing.jd | 6 | ||||
| -rw-r--r-- | docs/html/guide/topics/manifest/manifest-element.jd | 9 |
6 files changed, 60 insertions, 5 deletions
diff --git a/api/current.xml b/api/current.xml index 3a642f6425a8..393e5427489b 100644 --- a/api/current.xml +++ b/api/current.xml @@ -95468,6 +95468,17 @@ visibility="public" > </method> +<method name="getRawDescriptors" + return="byte[]" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getSerial" return="java.lang.String" abstract="false" diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java index a153c0b24fe1..b53649089d10 100644 --- a/core/java/android/hardware/usb/UsbDeviceConnection.java +++ b/core/java/android/hardware/usb/UsbDeviceConnection.java @@ -69,6 +69,17 @@ public class UsbDeviceConnection { } /** + * Returns the raw USB descriptors for the device. + * This can be used to access descriptors not supported directly + * via the higher level APIs. + * + * @return raw USB descriptors + */ + public byte[] getRawDescriptors() { + return native_get_desc(); + } + + /** * Claims exclusive access to a {@link android.hardware.usb.UsbInterface}. * This must be done before sending or receiving data on any * {@link android.hardware.usb.UsbEndpoint}s belonging to the interface. @@ -160,6 +171,7 @@ public class UsbDeviceConnection { private native boolean native_open(String deviceName, FileDescriptor pfd); private native void native_close(); private native int native_get_fd(); + private native byte[] native_get_desc(); private native boolean native_claim_interface(int interfaceID, boolean force); private native boolean native_release_interface(int interfaceID); private native int native_control_request(int requestType, int request, int value, diff --git a/core/jni/android_hardware_UsbDeviceConnection.cpp b/core/jni/android_hardware_UsbDeviceConnection.cpp index ec36a3837d7e..b5d6b912e5f6 100644 --- a/core/jni/android_hardware_UsbDeviceConnection.cpp +++ b/core/jni/android_hardware_UsbDeviceConnection.cpp @@ -83,6 +83,27 @@ android_hardware_UsbDeviceConnection_get_fd(JNIEnv *env, jobject thiz) return usb_device_get_fd(device); } +static jbyteArray +android_hardware_UsbDeviceConnection_get_desc(JNIEnv *env, jobject thiz) +{ + char buffer[16384]; + int fd = android_hardware_UsbDeviceConnection_get_fd(env, thiz); + if (fd < 0) return NULL; + lseek(fd, 0, SEEK_SET); + int length = read(fd, buffer, sizeof(buffer)); + if (length < 0) return NULL; + + jbyteArray ret = env->NewByteArray(length); + if (ret) { + jbyte* bytes = (jbyte*)env->GetPrimitiveArrayCritical(ret, 0); + if (bytes) { + memcpy(bytes, buffer, length); + env->ReleasePrimitiveArrayCritical(ret, bytes, 0); + } + } + return ret; +} + static jboolean android_hardware_UsbDeviceConnection_claim_interface(JNIEnv *env, jobject thiz, int interfaceID, jboolean force) @@ -211,6 +232,7 @@ static JNINativeMethod method_table[] = { (void *)android_hardware_UsbDeviceConnection_open}, {"native_close", "()V", (void *)android_hardware_UsbDeviceConnection_close}, {"native_get_fd", "()I", (void *)android_hardware_UsbDeviceConnection_get_fd}, + {"native_get_desc", "()[B", (void *)android_hardware_UsbDeviceConnection_get_desc}, {"native_claim_interface", "(IZ)Z",(void *)android_hardware_UsbDeviceConnection_claim_interface}, {"native_release_interface","(I)Z", (void *)android_hardware_UsbDeviceConnection_release_interface}, {"native_control_request", "(IIII[BII)I", diff --git a/docs/html/guide/appendix/install-location.jd b/docs/html/guide/appendix/install-location.jd index 7f96809104ac..617f4fc5aa0e 100644 --- a/docs/html/guide/appendix/install-location.jd +++ b/docs/html/guide/appendix/install-location.jd @@ -171,6 +171,11 @@ persist after external storage is remounted.</dd> <dd>The system delivers the {@link android.content.Intent#ACTION_BOOT_COMPLETED} broadcast before the external storage is mounted to the device. If your application is installed on the external storage, it can never receive this broadcast.</dd> + <dt>Copy Protection</dt> + <dd>Your application cannot be installed to a device's SD card if it uses Android Market's + Copy Protection feature. However, if you use Android Market's + <a href="{@docRoot}guide/publishing/licensing.html">Application Licensing</a> instead, your + application <em>can</em> be installed to internal or external storage, including SD cards.</dd> </dl> <p>If your application uses any of the features listed above, you <strong>should not</strong> allow diff --git a/docs/html/guide/publishing/licensing.jd b/docs/html/guide/publishing/licensing.jd index a9b182eff837..d89a8ca810dc 100644 --- a/docs/html/guide/publishing/licensing.jd +++ b/docs/html/guide/publishing/licensing.jd @@ -263,15 +263,15 @@ licensed for all users. If your application is already published as free, you won't be able to upload a new version that uses licensing.</li> </ul> -<h4>Replacement for copy protection</h4> +<h4>Replacement for Copy Protection</h4> <p>Android Market Licensing is a flexible, secure mechanism for controlling -access to your applications. It effectively replaces the copy-protection +access to your applications. It effectively replaces the Copy Protection mechanism offered on Android Market and gives you wider distribution potential for your applications. </p> <ul> -<li>A limitation of the legacy copy-protection mechanism on Android Market is +<li>A limitation of the legacy Copy Protection mechanism on Android Market is that applications using it can be installed only on compatible devices that provide a secure internal storage environment. For example, a copy-protected application cannot be downloaded from Market to a device that provides root diff --git a/docs/html/guide/topics/manifest/manifest-element.jd b/docs/html/guide/topics/manifest/manifest-element.jd index a8125b3384cb..598e88ffda66 100644 --- a/docs/html/guide/topics/manifest/manifest-element.jd +++ b/docs/html/guide/topics/manifest/manifest-element.jd @@ -141,9 +141,14 @@ either internal or external storage through the system settings.</td> </tr> </table> +<p class="caution"><strong>Caution:</strong> If your application uses the Android Market's Copy + Protection feature, it cannot be installed to a device's SD card. However, if you use Android + Market's <a href="{@docRoot}guide/publishing/licensing.html">Application Licensing</a> instead, + your application <em>can</em> be installed to internal or external storage, including SD cards.</p> + <p class="note"><strong>Note:</strong> By default, your application will be installed on the -internal storage and cannot be installed on the external storage unless you define this attribute -to be either "{@code auto}" or "{@code preferExternal}".</p> + internal storage and cannot be installed on the external storage unless you define this attribute + to be either "{@code auto}" or "{@code preferExternal}".</p> <p>When an application is installed on the external storage:</p> <ul> |