summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/res/Configuration.java22
-rw-r--r--core/java/android/hardware/usb/UsbAccessory.java18
-rw-r--r--core/java/android/hardware/usb/UsbConstants.java139
-rw-r--r--core/java/android/hardware/usb/UsbDevice.java20
-rw-r--r--core/java/android/hardware/usb/UsbDeviceConnection.java15
-rw-r--r--core/java/android/hardware/usb/UsbEndpoint.java27
-rw-r--r--core/java/android/hardware/usb/UsbInterface.java10
-rw-r--r--core/java/android/hardware/usb/UsbManager.java3
-rw-r--r--core/java/android/hardware/usb/UsbRequest.java9
-rw-r--r--core/java/android/os/Process.java2
-rw-r--r--core/java/android/text/GraphicsOperations.java7
-rw-r--r--core/java/android/text/SpannableStringBuilder.java29
-rw-r--r--core/java/android/webkit/CacheManager.java8
-rw-r--r--core/java/android/webkit/HTML5VideoFullScreen.java11
-rw-r--r--core/java/android/webkit/HTML5VideoView.java18
-rw-r--r--core/java/android/webkit/HTML5VideoViewProxy.java14
-rw-r--r--core/java/android/widget/RemoteViews.java106
-rw-r--r--core/java/android/widget/TextView.java10
18 files changed, 403 insertions, 65 deletions
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 31119d7..72fa07c 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -57,11 +57,30 @@ public final class Configuration implements Parcelable, Comparable<Configuration
*/
public boolean userSetLocale;
+ /** Constant for {@link #screenLayout}: bits that encode the size. */
public static final int SCREENLAYOUT_SIZE_MASK = 0x0f;
+ /** Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_SIZE_MASK}
+ * value indicating that no size has been set. */
public static final int SCREENLAYOUT_SIZE_UNDEFINED = 0x00;
+ /** Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_SIZE_MASK}
+ * value indicating the screen is at least approximately 320x426 dp units.
+ * See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+ * Multiple Screens</a> for more information. */
public static final int SCREENLAYOUT_SIZE_SMALL = 0x01;
+ /** Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_SIZE_MASK}
+ * value indicating the screen is at least approximately 320x470 dp units.
+ * See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+ * Multiple Screens</a> for more information. */
public static final int SCREENLAYOUT_SIZE_NORMAL = 0x02;
+ /** Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_SIZE_MASK}
+ * value indicating the screen is at least approximately 480x640 dp units.
+ * See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+ * Multiple Screens</a> for more information. */
public static final int SCREENLAYOUT_SIZE_LARGE = 0x03;
+ /** Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_SIZE_MASK}
+ * value indicating the screen is at least approximately 720x960 dp units.
+ * See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+ * Multiple Screens</a> for more information.*/
public static final int SCREENLAYOUT_SIZE_XLARGE = 0x04;
public static final int SCREENLAYOUT_LONG_MASK = 0x30;
@@ -88,6 +107,9 @@ public final class Configuration implements Parcelable, Comparable<Configuration
* <p>The {@link #SCREENLAYOUT_LONG_MASK} defines whether the screen
* is wider/taller than normal. They may be one of
* {@link #SCREENLAYOUT_LONG_NO} or {@link #SCREENLAYOUT_LONG_YES}.
+ *
+ * <p>See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
+ * Multiple Screens</a> for more information.
*/
public int screenLayout;
diff --git a/core/java/android/hardware/usb/UsbAccessory.java b/core/java/android/hardware/usb/UsbAccessory.java
index 5e9ead0..c8ea825 100644
--- a/core/java/android/hardware/usb/UsbAccessory.java
+++ b/core/java/android/hardware/usb/UsbAccessory.java
@@ -22,7 +22,21 @@ import android.os.Parcelable;
import android.util.Log;
/**
- * A class representing a USB accessory.
+ * A class representing a USB accessory, which is an external hardware component
+ * that communicates with an android application over USB.
+ * The accessory is the USB host and android the device side of the USB connection.
+ *
+ * <p>When the accessory connects, it reports its manufacturer and model names,
+ * the version of the accessory, and a user visible description of the accessory to the device.
+ * The manufacturer, model and version strings are used by the USB Manager to choose
+ * an appropriate application for the accessory.
+ * The accessory may optionally provide a unique serial number
+ * and a URL to for the accessory's website to the device as well.
+ *
+ * <p>An instance of this class is sent to the application via the
+ * {@link UsbManager#ACTION_USB_ACCESSORY_ATTACHED} Intent.
+ * The application can then call {@link UsbManager#openAccessory} to open a file descriptor
+ * for reading and writing data to and from the accessory.
*/
public class UsbAccessory implements Parcelable {
@@ -63,7 +77,7 @@ public class UsbAccessory implements Parcelable {
}
/**
- * Returns the manufacturer of the accessory.
+ * Returns the manufacturer name of the accessory.
*
* @return the accessory manufacturer
*/
diff --git a/core/java/android/hardware/usb/UsbConstants.java b/core/java/android/hardware/usb/UsbConstants.java
index 6626c9f..0e8d47c 100644
--- a/core/java/android/hardware/usb/UsbConstants.java
+++ b/core/java/android/hardware/usb/UsbConstants.java
@@ -22,45 +22,162 @@ package android.hardware.usb;
*/
public final class UsbConstants {
+ /**
+ * Bitmask used for extracting the {@link UsbEndpoint} direction from its address field.
+ * @see UsbEndpoint#getAddress
+ * @see UsbEndpoint#getDirection
+ * @see #USB_DIR_OUT
+ * @see #USB_DIR_IN
+ *
+ */
public static final int USB_ENDPOINT_DIR_MASK = 0x80;
+ /**
+ * Used to signify direction of data for a {@link UsbEndpoint} is OUT (host to device)
+ * @see UsbEndpoint#getDirection
+ */
public static final int USB_DIR_OUT = 0;
+ /**
+ * Used to signify direction of data for a {@link UsbEndpoint} is IN (device to host)
+ * @see UsbEndpoint#getDirection
+ */
public static final int USB_DIR_IN = 0x80;
- public static final int USB_TYPE_MASK = (0x03 << 5);
- public static final int USB_TYPE_STANDARD = (0x00 << 5);
- public static final int USB_TYPE_CLASS = (0x01 << 5);
- public static final int USB_TYPE_VENDOR = (0x02 << 5);
- public static final int USB_TYPE_RESERVED = (0x03 << 5);
-
+ /**
+ * Bitmask used for extracting the {@link UsbEndpoint} number its address field.
+ * @see UsbEndpoint#getAddress
+ * @see UsbEndpoint#getEndpointNumber
+ */
public static final int USB_ENDPOINT_NUMBER_MASK = 0x0f;
- // flags for endpoint attributes
+ /**
+ * Bitmask used for extracting the {@link UsbEndpoint} type from its address field.
+ * @see UsbEndpoint#getAddress
+ * @see UsbEndpoint#getType
+ * @see #USB_ENDPOINT_XFER_CONTROL
+ * @see #USB_ENDPOINT_XFER_ISOC
+ * @see #USB_ENDPOINT_XFER_BULK
+ * @see #USB_ENDPOINT_XFER_INT
+ */
public static final int USB_ENDPOINT_XFERTYPE_MASK = 0x03;
+ /**
+ * Control endpoint type (endpoint zero)
+ * @see UsbEndpoint#getType
+ */
public static final int USB_ENDPOINT_XFER_CONTROL = 0;
+ /**
+ * Isochronous endpoint type (currently not supported)
+ * @see UsbEndpoint#getType
+ */
public static final int USB_ENDPOINT_XFER_ISOC = 1;
+ /**
+ * Bulk endpoint type
+ * @see UsbEndpoint#getType
+ */
public static final int USB_ENDPOINT_XFER_BULK = 2;
+ /**
+ * Interrupt endpoint type
+ * @see UsbEndpoint#getType
+ */
public static final int USB_ENDPOINT_XFER_INT = 3;
- // USB classes
+
+ /**
+ * Bitmask used for encoding the request type for a control request on endpoint zero.
+ */
+ public static final int USB_TYPE_MASK = (0x03 << 5);
+ /**
+ * Used to specify that an endpoint zero control request is a standard request.
+ */
+ public static final int USB_TYPE_STANDARD = (0x00 << 5);
+ /**
+ * Used to specify that an endpoint zero control request is a class specific request.
+ */
+ public static final int USB_TYPE_CLASS = (0x01 << 5);
+ /**
+ * Used to specify that an endpoint zero control request is a vendor specific request.
+ */
+ public static final int USB_TYPE_VENDOR = (0x02 << 5);
+ /**
+ * Reserved endpoint zero control request type (currently unused).
+ */
+ public static final int USB_TYPE_RESERVED = (0x03 << 5);
+
+
+ /**
+ * USB class indicating that the class is determined on a per-interface basis.
+ */
public static final int USB_CLASS_PER_INTERFACE = 0;
+ /**
+ * USB class for audio devices.
+ */
public static final int USB_CLASS_AUDIO = 1;
+ /**
+ * USB class for communication devices.
+ */
public static final int USB_CLASS_COMM = 2;
+ /**
+ * USB class for human interface devices (for example, mice and keyboards).
+ */
public static final int USB_CLASS_HID = 3;
+ /**
+ * USB class for physical devices.
+ */
public static final int USB_CLASS_PHYSICA = 5;
+ /**
+ * USB class for still image devices (digital cameras).
+ */
public static final int USB_CLASS_STILL_IMAGE = 6;
+ /**
+ * USB class for printers.
+ */
public static final int USB_CLASS_PRINTER = 7;
+ /**
+ * USB class for mass storage devices.
+ */
public static final int USB_CLASS_MASS_STORAGE = 8;
+ /**
+ * USB class for USB hubs.
+ */
public static final int USB_CLASS_HUB = 9;
+ /**
+ * USB class for CDC devices (communications device class).
+ */
public static final int USB_CLASS_CDC_DATA = 0x0a;
+ /**
+ * USB class for content smart card devices.
+ */
public static final int USB_CLASS_CSCID = 0x0b;
+ /**
+ * USB class for content security devices.
+ */
public static final int USB_CLASS_CONTENT_SEC = 0x0d;
+ /**
+ * USB class for video devices.
+ */
public static final int USB_CLASS_VIDEO = 0x0e;
+ /**
+ * USB class for wireless controller devices.
+ */
public static final int USB_CLASS_WIRELESS_CONTROLLER = 0xe0;
+ /**
+ * USB class for wireless miscellaneous devices.
+ */
public static final int USB_CLASS_MISC = 0xef;
+ /**
+ * Application specific USB class.
+ */
public static final int USB_CLASS_APP_SPEC = 0xfe;
+ /**
+ * Vendor specific USB class.
+ */
public static final int USB_CLASS_VENDOR_SPEC = 0xff;
- // USB subclasses
- public static final int USB_INTERFACE_SUBCLASS_BOOT = 1; // for HID class
+ /**
+ * Boot subclass for HID devices.
+ */
+ public static final int USB_INTERFACE_SUBCLASS_BOOT = 1;
+ /**
+ * Vendor specific USB subclass.
+ */
public static final int USB_SUBCLASS_VENDOR_SPEC = 0xff;
-} \ No newline at end of file
+}
diff --git a/core/java/android/hardware/usb/UsbDevice.java b/core/java/android/hardware/usb/UsbDevice.java
index 9e536a7..af3f7f0 100644
--- a/core/java/android/hardware/usb/UsbDevice.java
+++ b/core/java/android/hardware/usb/UsbDevice.java
@@ -24,7 +24,16 @@ import android.util.Log;
import java.io.FileDescriptor;
/**
- * A class representing a USB device.
+ * This class represents a USB device attached to the android device with the android device
+ * acting as the USB host.
+ * Each device contains one or more {@link UsbInterface}s, each of which contains a number of
+ * {@link UsbEndpoint}s (the channels via which data is transmitted over USB).
+ *
+ * <p> This class contains information (along with {@link UsbInterface} and {@link UsbEndpoint})
+ * that describes the capabilities of the USB device.
+ * To communicate with the device, you open a {@link UsbDeviceConnection} for the device
+ * and use {@link UsbRequest} to send and receive data on an endpoint.
+ * {@link UsbDeviceConnection#controlTransfer} is used for control requests on endpoint zero.
*/
public class UsbDevice implements Parcelable {
@@ -96,8 +105,7 @@ public class UsbDevice implements Parcelable {
/**
* Returns the devices's class field.
- * Some useful constants for USB device classes can be found in
- * {@link android.hardware.usb.UsbConstants}
+ * Some useful constants for USB device classes can be found in {@link UsbConstants}.
*
* @return the devices's class
*/
@@ -115,7 +123,7 @@ public class UsbDevice implements Parcelable {
}
/**
- * Returns the device's subclass field.
+ * Returns the device's protocol field.
*
* @return the device's protocol
*/
@@ -124,7 +132,7 @@ public class UsbDevice implements Parcelable {
}
/**
- * Returns the number of {@link android.hardware.usb.UsbInterface}s this device contains.
+ * Returns the number of {@link UsbInterface}s this device contains.
*
* @return the number of interfaces
*/
@@ -133,7 +141,7 @@ public class UsbDevice implements Parcelable {
}
/**
- * Returns the {@link android.hardware.usb.UsbInterface} at the given index.
+ * Returns the {@link UsbInterface} at the given index.
*
* @return the interface
*/
diff --git a/core/java/android/hardware/usb/UsbDeviceConnection.java b/core/java/android/hardware/usb/UsbDeviceConnection.java
index 876287c..a153c0b 100644
--- a/core/java/android/hardware/usb/UsbDeviceConnection.java
+++ b/core/java/android/hardware/usb/UsbDeviceConnection.java
@@ -23,7 +23,8 @@ import java.io.FileDescriptor;
/**
- * A class representing a USB device.
+ * This class is used for sending and receiving data and control messages to a USB device.
+ * Instances of this class are created by {@link UsbManager#openDevice}.
*/
public class UsbDeviceConnection {
@@ -48,15 +49,20 @@ public class UsbDeviceConnection {
/**
* Releases all system resources related to the device.
+ * Once the object is closed it cannot be used again.
+ * The client must call {@link UsbManager#openDevice} again
+ * to retrieve a new instance to reestablish communication with the device.
*/
public void close() {
native_close();
}
/**
- * Returns an integer file descriptor for the device, or
+ * Returns the native file descriptor for the device, or
* -1 if the device is not opened.
- * This is intended for passing to native code to access the device
+ * This is intended for passing to native code to access the device.
+ *
+ * @return the native file descriptor
*/
public int getFileDescriptor() {
return native_get_fd();
@@ -65,7 +71,8 @@ public class UsbDeviceConnection {
/**
* 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
+ * {@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
diff --git a/core/java/android/hardware/usb/UsbEndpoint.java b/core/java/android/hardware/usb/UsbEndpoint.java
index bc2c2c1..753a447 100644
--- a/core/java/android/hardware/usb/UsbEndpoint.java
+++ b/core/java/android/hardware/usb/UsbEndpoint.java
@@ -21,7 +21,14 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * A class representing an endpoint on a {@link android.hardware.usb.UsbInterface}.
+ * A class representing an endpoint on a {@link UsbInterface}.
+ * Endpoints are the channels for sending and receiving data over USB.
+ * Typically bulk endpoints are used for sending non-trivial amounts of data.
+ * Interrupt endpoints are used for sending small amounts of data, typically events,
+ * separately from the main data streams.
+ * The endpoint zero is a special endpoint for control messages sent from the host
+ * to device.
+ * Isochronous endpoints are currently unsupported.
*/
public class UsbEndpoint implements Parcelable {
@@ -43,6 +50,10 @@ public class UsbEndpoint implements Parcelable {
/**
* Returns the endpoint's address field.
+ * The address is a bitfield containing both the endpoint number
+ * as well as the data direction of the endpoint.
+ * the endpoint number and direction can also be accessed via
+ * {@link #getEndpointNumber} and {@link #getDirection}.
*
* @return the endpoint's address
*/
@@ -61,10 +72,12 @@ public class UsbEndpoint implements Parcelable {
/**
* Returns the endpoint's direction.
- * Returns {@link android.hardware.usb.UsbConstants#USB_DIR_OUT}
+ * Returns {@link UsbConstants#USB_DIR_OUT}
* if the direction is host to device, and
- * {@link android.hardware.usb.UsbConstants#USB_DIR_IN} if the
+ * {@link UsbConstants#USB_DIR_IN} if the
* direction is device to host.
+ * @see {@link UsbConstants#USB_DIR_IN}
+ * @see {@link UsbConstants#USB_DIR_OUT}
*
* @return the endpoint's direction
*/
@@ -85,10 +98,10 @@ public class UsbEndpoint implements Parcelable {
* Returns the endpoint's type.
* Possible results are:
* <ul>
- * <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)
+ * <li>{@link UsbConstants#USB_ENDPOINT_XFER_CONTROL} (endpoint zero)
+ * <li>{@link UsbConstants#USB_ENDPOINT_XFER_ISOC} (isochronous endpoint)
+ * <li>{@link UsbConstants#USB_ENDPOINT_XFER_BULK} (bulk endpoint)
+ * <li>{@link UsbConstants#USB_ENDPOINT_XFER_INT} (interrupt endpoint)
* </ul>
*
* @return the endpoint's type
diff --git a/core/java/android/hardware/usb/UsbInterface.java b/core/java/android/hardware/usb/UsbInterface.java
index 2b4c7c0..3b51063 100644
--- a/core/java/android/hardware/usb/UsbInterface.java
+++ b/core/java/android/hardware/usb/UsbInterface.java
@@ -21,7 +21,11 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * A class representing an interface on a {@link android.hardware.usb.UsbDevice}.
+ * A class representing an interface on a {@link UsbDevice}.
+ * USB devices can have one or more interfaces, each one providing a different
+ * piece of functionality, separate from the other interfaces.
+ * An interface will have one or more {@link UsbEndpoint}s, which are the
+ * channels by which the host transfers data with the device.
*/
public class UsbInterface implements Parcelable {
@@ -46,6 +50,7 @@ public class UsbInterface implements Parcelable {
/**
* Returns the interface's ID field.
+ * This is an integer that uniquely identifies the interface on the device.
*
* @return the interface's ID
*/
@@ -55,8 +60,7 @@ public class UsbInterface implements Parcelable {
/**
* Returns the interface's class field.
- * Some useful constants for USB classes can be found in
- * {@link android.hardware.usb.UsbConstants}
+ * Some useful constants for USB classes can be found in {@link UsbConstants}
*
* @return the interface's class
*/
diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java
index 7bf278a..60b37a1 100644
--- a/core/java/android/hardware/usb/UsbManager.java
+++ b/core/java/android/hardware/usb/UsbManager.java
@@ -31,7 +31,8 @@ import java.io.IOException;
import java.util.HashMap;
/**
- * This class allows you to access the state of USB, both in host and device mode.
+ * This class allows you to access the state of USB and communicate with USB devices.
+ * Currently only host mode is supported in the public API.
*
* <p>You can obtain an instance of this class by calling
* {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
diff --git a/core/java/android/hardware/usb/UsbRequest.java b/core/java/android/hardware/usb/UsbRequest.java
index 5fe6c8c..2252248 100644
--- a/core/java/android/hardware/usb/UsbRequest.java
+++ b/core/java/android/hardware/usb/UsbRequest.java
@@ -24,8 +24,13 @@ 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.usb.UsbDeviceConnection}.
- * UsbRequests are sent asynchronously via {@link #queue} and the results
- * are read by {@link android.hardware.usb.UsbDeviceConnection#requestWait}.
+ * UsbRequests can be used to transfer data on bulk and interrupt endpoints.
+ * Requests on bulk endpoints can be sent synchronously via {@link UsbDeviceConnection#bulkTransfer}
+ * or asynchronously via {@link #queue} and {@link UsbDeviceConnection#requestWait}.
+ * Requests on interrupt endpoints are only send and received asynchronously.
+ *
+ * <p>Requests on endpoint zero are not supported by this class;
+ * use {@link UsbDeviceConnection#controlTransfer} for endpoint zero requests instead.
*/
public class UsbRequest {
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 0c6ab9e..c8cb1de 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -95,7 +95,7 @@ public class Process {
* Defines the UID/GID for the NFC service process.
* @hide
*/
- public static final int NFC_UID = 1022;
+ public static final int NFC_UID = 1023;
/**
* Defines the GID for the group that allows write access to the internal media storage.
diff --git a/core/java/android/text/GraphicsOperations.java b/core/java/android/text/GraphicsOperations.java
index d426d12..6e2168b 100644
--- a/core/java/android/text/GraphicsOperations.java
+++ b/core/java/android/text/GraphicsOperations.java
@@ -58,6 +58,13 @@ extends CharSequence
int flags, float[] advances, int advancesIndex, Paint paint);
/**
+ * Just like {@link Paint#getTextRunAdvances}.
+ * @hide
+ */
+ float getTextRunAdvancesICU(int start, int end, int contextStart, int contextEnd,
+ int flags, float[] advances, int advancesIndex, Paint paint);
+
+ /**
* Just like {@link Paint#getTextRunCursor}.
* @hide
*/
diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java
index ea5cdfe..ff6a4cd 100644
--- a/core/java/android/text/SpannableStringBuilder.java
+++ b/core/java/android/text/SpannableStringBuilder.java
@@ -1170,6 +1170,35 @@ implements CharSequence, GetChars, Spannable, Editable, Appendable,
}
/**
+ * Don't call this yourself -- exists for Paint to use internally.
+ * {@hide}
+ */
+ public float getTextRunAdvancesICU(int start, int end, int contextStart, int contextEnd, int flags,
+ float[] advances, int advancesPos, Paint p) {
+
+ float ret;
+
+ int contextLen = contextEnd - contextStart;
+ int len = end - start;
+
+ if (end <= mGapStart) {
+ ret = p.getTextRunAdvancesICU(mText, start, len, contextStart, contextLen,
+ flags, advances, advancesPos);
+ } else if (start >= mGapStart) {
+ ret = p.getTextRunAdvancesICU(mText, start + mGapLength, len,
+ contextStart + mGapLength, contextLen, flags, advances, advancesPos);
+ } else {
+ char[] buf = TextUtils.obtain(contextLen);
+ getChars(contextStart, contextEnd, buf, 0);
+ ret = p.getTextRunAdvancesICU(buf, start - contextStart, len,
+ 0, contextLen, flags, advances, advancesPos);
+ TextUtils.recycle(buf);
+ }
+
+ return ret;
+ }
+
+ /**
* Returns the next cursor position in the run. This avoids placing the cursor between
* surrogates, between characters that form conjuncts, between base characters and combining
* marks, or within a reordering cluster.
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 3ce0730..e21a02e 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -857,6 +857,7 @@ public final class CacheManager {
String cacheControl = headers.getCacheControl();
if (cacheControl != null) {
String[] controls = cacheControl.toLowerCase().split("[ ,;]");
+ boolean noCache = false;
for (int i = 0; i < controls.length; i++) {
if (NO_STORE.equals(controls[i])) {
return null;
@@ -867,7 +868,12 @@ public final class CacheManager {
// can only be used in CACHE_MODE_CACHE_ONLY case
if (NO_CACHE.equals(controls[i])) {
ret.expires = 0;
- } else if (controls[i].startsWith(MAX_AGE)) {
+ noCache = true;
+ // if cache control = no-cache has been received, ignore max-age
+ // header, according to http spec:
+ // If a request includes the no-cache directive, it SHOULD NOT
+ // include min-fresh, max-stale, or max-age.
+ } else if (controls[i].startsWith(MAX_AGE) && !noCache) {
int separator = controls[i].indexOf('=');
if (separator < 0) {
separator = controls[i].indexOf(':');
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
index 9636513..3d15968 100644
--- a/core/java/android/webkit/HTML5VideoFullScreen.java
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -198,8 +198,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView
if (mProgressView != null) {
mProgressView.setVisibility(View.GONE);
- mLayout.removeView(mProgressView);
- mProgressView = null;
}
mVideoWidth = mp.getVideoWidth();
@@ -321,4 +319,13 @@ public class HTML5VideoFullScreen extends HTML5VideoView
return false;
}
+ @Override
+ protected void switchProgressView(boolean playerBuffering) {
+ if (playerBuffering) {
+ mProgressView.setVisibility(View.VISIBLE);
+ } else {
+ mProgressView.setVisibility(View.GONE);
+ }
+ return;
+ }
}
diff --git a/core/java/android/webkit/HTML5VideoView.java b/core/java/android/webkit/HTML5VideoView.java
index ad6e5d3..fd3f358 100644
--- a/core/java/android/webkit/HTML5VideoView.java
+++ b/core/java/android/webkit/HTML5VideoView.java
@@ -78,6 +78,7 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener {
TIMEUPDATE_PERIOD);
}
mPlayer.start();
+ setPlayerBuffering(false);
}
}
@@ -296,4 +297,21 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener {
return 0;
}
+ // This is true only when the player is buffering and paused
+ public boolean mPlayerBuffering = false;
+
+ public boolean getPlayerBuffering() {
+ return mPlayerBuffering;
+ }
+
+ public void setPlayerBuffering(boolean playerBuffering) {
+ mPlayerBuffering = playerBuffering;
+ switchProgressView(playerBuffering);
+ }
+
+
+ protected void switchProgressView(boolean playerBuffering) {
+ // Only used in HTML5VideoFullScreen
+ }
+
}
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index 0ee1566..14157c2 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -95,8 +95,10 @@ class HTML5VideoViewProxy extends Handler
// identify the exact layer on the UI thread to use the SurfaceTexture.
private static int mBaseLayer = 0;
- // This is true only when the player is buffering and paused
- private static boolean mPlayerBuffering = false;
+ private static void setPlayerBuffering(boolean playerBuffering) {
+ mHTML5VideoView.setPlayerBuffering(playerBuffering);
+ }
+
// Every time webView setBaseLayer, this will be called.
// When we found the Video layer, then we set the Surface Texture to it.
// Otherwise, we may want to delete the Surface Texture to save memory.
@@ -111,7 +113,7 @@ class HTML5VideoViewProxy extends Handler
int currentVideoLayerId = mHTML5VideoView.getVideoLayerId();
if (layer != 0 && surfTexture != null && currentVideoLayerId != -1) {
int playerState = mHTML5VideoView.getCurrentState();
- if (mPlayerBuffering)
+ if (mHTML5VideoView.getPlayerBuffering())
playerState = HTML5VideoView.STATE_NOTPREPARED;
boolean foundInTree = nativeSendSurfaceTexture(surfTexture,
layer, currentVideoLayerId, textureName,
@@ -166,7 +168,6 @@ class HTML5VideoViewProxy extends Handler
WebChromeClient client, int videoLayerId) {
int currentVideoLayerId = -1;
boolean backFromFullScreenMode = false;
- mPlayerBuffering = false;
if (mHTML5VideoView != null) {
currentVideoLayerId = mHTML5VideoView.getVideoLayerId();
if (mHTML5VideoView instanceof HTML5VideoFullScreen) {
@@ -231,7 +232,6 @@ class HTML5VideoViewProxy extends Handler
}
public static void onPrepared() {
- mPlayerBuffering = false;
// The VideoView will decide whether to really kick off to play.
mHTML5VideoView.start();
if (mBaseLayer != 0) {
@@ -350,11 +350,11 @@ class HTML5VideoViewProxy extends Handler
break;
}
case BUFFERING_START: {
- VideoPlayer.mPlayerBuffering = true;
+ VideoPlayer.setPlayerBuffering(true);
break;
}
case BUFFERING_END: {
- VideoPlayer.mPlayerBuffering = false;
+ VideoPlayer.setPlayerBuffering(false);
break;
}
}
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index c854fac..9cf2718 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -125,7 +125,7 @@ public class RemoteViews implements Parcelable, Filter {
* SUBCLASSES MUST BE IMMUTABLE SO CLONE WORKS!!!!!
*/
private abstract static class Action implements Parcelable {
- public abstract void apply(View root) throws ActionException;
+ public abstract void apply(View root, ViewGroup rootParent) throws ActionException;
public int describeContents() {
return 0;
@@ -183,7 +183,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View view = root.findViewById(viewId);
if (!(view instanceof AdapterView<?>)) return;
@@ -214,7 +214,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View target = root.findViewById(viewId);
if (target == null) return;
@@ -295,7 +295,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View target = root.findViewById(viewId);
if (target == null) return;
@@ -360,6 +360,60 @@ public class RemoteViews implements Parcelable, Filter {
public final static int TAG = 8;
}
+ private class SetRemoteViewsAdapterIntent extends Action {
+ public SetRemoteViewsAdapterIntent(int id, Intent intent) {
+ this.viewId = id;
+ this.intent = intent;
+ }
+
+ public SetRemoteViewsAdapterIntent(Parcel parcel) {
+ viewId = parcel.readInt();
+ intent = Intent.CREATOR.createFromParcel(parcel);
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(TAG);
+ dest.writeInt(viewId);
+ intent.writeToParcel(dest, flags);
+ }
+
+ @Override
+ public void apply(View root, ViewGroup rootParent) {
+ final View target = root.findViewById(viewId);
+ if (target == null) return;
+
+ // Ensure that we are applying to an AppWidget root
+ if (!(rootParent instanceof AppWidgetHostView)) {
+ Log.e("RemoteViews", "SetRemoteViewsAdapterIntent action can only be used for " +
+ "AppWidgets (root id: " + viewId + ")");
+ return;
+ }
+ // Ensure that we are calling setRemoteAdapter on an AdapterView that supports it
+ if (!(target instanceof AbsListView) && !(target instanceof AdapterViewAnimator)) {
+ Log.e("RemoteViews", "Cannot setRemoteViewsAdapter on a view which is not " +
+ "an AbsListView or AdapterViewAnimator (id: " + viewId + ")");
+ return;
+ }
+
+ // Embed the AppWidget Id for use in RemoteViewsAdapter when connecting to the intent
+ // RemoteViewsService
+ AppWidgetHostView host = (AppWidgetHostView) rootParent;
+ intent.putExtra(EXTRA_REMOTEADAPTER_APPWIDGET_ID, host.getAppWidgetId());
+ if (target instanceof AbsListView) {
+ AbsListView v = (AbsListView) target;
+ v.setRemoteViewsAdapter(intent);
+ } else if (target instanceof AdapterViewAnimator) {
+ AdapterViewAnimator v = (AdapterViewAnimator) target;
+ v.setRemoteViewsAdapter(intent);
+ }
+ }
+
+ int viewId;
+ Intent intent;
+
+ public final static int TAG = 10;
+ }
+
/**
* Equivalent to calling
* {@link android.view.View#setOnClickListener(android.view.View.OnClickListener)}
@@ -383,7 +437,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View target = root.findViewById(viewId);
if (target == null) return;
@@ -479,7 +533,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View target = root.findViewById(viewId);
if (target == null) return;
@@ -539,7 +593,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View view = root.findViewById(viewId);
if (view == null) return;
@@ -755,7 +809,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final View view = root.findViewById(viewId);
if (view == null) return;
@@ -850,7 +904,7 @@ public class RemoteViews implements Parcelable, Filter {
}
@Override
- public void apply(View root) {
+ public void apply(View root, ViewGroup rootParent) {
final Context context = root.getContext();
final ViewGroup target = (ViewGroup) root.findViewById(viewId);
if (target == null) return;
@@ -952,6 +1006,9 @@ public class RemoteViews implements Parcelable, Filter {
case SetOnClickFillInIntent.TAG:
mActions.add(new SetOnClickFillInIntent(parcel));
break;
+ case SetRemoteViewsAdapterIntent.TAG:
+ mActions.add(new SetRemoteViewsAdapterIntent(parcel));
+ break;
default:
throw new ActionException("Tag " + tag + " not found");
}
@@ -1287,16 +1344,29 @@ public class RemoteViews implements Parcelable, Filter {
/**
* Equivalent to calling {@link android.widget.AbsListView#setRemoteViewsAdapter(Intent)}.
*
- * @param appWidgetId The id of the app widget which contains the specified view
+ * @param appWidgetId The id of the app widget which contains the specified view. (This
+ * parameter is ignored in this deprecated method)
* @param viewId The id of the view whose text should change
* @param intent The intent of the service which will be
* providing data to the RemoteViewsAdapter
+ * @deprecated This method has been deprecated. See
+ * {@link android.widget.RemoteViews#setRemoteAdapter(int, Intent)}
*/
+ @Deprecated
public void setRemoteAdapter(int appWidgetId, int viewId, Intent intent) {
- // Embed the AppWidget Id for use in RemoteViewsAdapter when connecting to the intent
- // RemoteViewsService
- intent.putExtra(EXTRA_REMOTEADAPTER_APPWIDGET_ID, appWidgetId);
- setIntent(viewId, "setRemoteViewsAdapter", intent);
+ setRemoteAdapter(viewId, intent);
+ }
+
+ /**
+ * Equivalent to calling {@link android.widget.AbsListView#setRemoteViewsAdapter(Intent)}.
+ * Can only be used for App Widgets.
+ *
+ * @param viewId The id of the view whose text should change
+ * @param intent The intent of the service which will be
+ * providing data to the RemoteViewsAdapter
+ */
+ public void setRemoteAdapter(int viewId, Intent intent) {
+ addAction(new SetRemoteViewsAdapterIntent(viewId, intent));
}
/**
@@ -1499,7 +1569,7 @@ public class RemoteViews implements Parcelable, Filter {
result = inflater.inflate(mLayoutId, parent, false);
- performApply(result);
+ performApply(result, parent);
return result;
}
@@ -1514,15 +1584,15 @@ public class RemoteViews implements Parcelable, Filter {
*/
public void reapply(Context context, View v) {
prepareContext(context);
- performApply(v);
+ performApply(v, (ViewGroup) v.getParent());
}
- private void performApply(View v) {
+ private void performApply(View v, ViewGroup parent) {
if (mActions != null) {
final int count = mActions.size();
for (int i = 0; i < count; i++) {
Action a = mActions.get(i);
- a.apply(v);
+ a.apply(v, parent);
}
}
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index baf20a1..9e482b4 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2951,6 +2951,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
advancesIndex);
}
+ public float getTextRunAdvancesICU(int start, int end, int contextStart,
+ int contextEnd, int flags, float[] advances, int advancesIndex,
+ Paint p) {
+ int count = end - start;
+ int contextCount = contextEnd - contextStart;
+ return p.getTextRunAdvancesICU(mChars, start + mStart, count,
+ contextStart + mStart, contextCount, flags, advances,
+ advancesIndex);
+ }
+
public int getTextRunCursor(int contextStart, int contextEnd, int flags,
int offset, int cursorOpt, Paint p) {
int contextCount = contextEnd - contextStart;