diff options
| -rw-r--r-- | api/8.xml | 11 | ||||
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | core/java/android/bluetooth/BluetoothHeadset.java | 16 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageManager.java | 8 | ||||
| -rw-r--r-- | core/java/android/text/method/ArrowKeyMovementMethod.java | 54 | ||||
| -rw-r--r-- | core/java/com/android/internal/os/BatteryStatsImpl.java | 5 | ||||
| -rw-r--r-- | core/res/res/drawable-mdpi/stat_notify_chat.png | bin | 2197 -> 27587 bytes |
7 files changed, 81 insertions, 24 deletions
diff --git a/api/8.xml b/api/8.xml index c5e899dfcffc..0e64393bd7ea 100644 --- a/api/8.xml +++ b/api/8.xml @@ -42126,6 +42126,17 @@ visibility="public" > </field> +<field name="FEATURE_TOUCHSCREEN" + type="java.lang.String" + transient="false" + volatile="false" + value=""android.hardware.touchscreen"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="FEATURE_TOUCHSCREEN_MULTITOUCH" type="java.lang.String" transient="false" diff --git a/api/current.xml b/api/current.xml index 806946234909..692cb161ba59 100644 --- a/api/current.xml +++ b/api/current.xml @@ -45288,6 +45288,17 @@ visibility="public" > </field> +<field name="FEATURE_TOUCHSCREEN" + type="java.lang.String" + transient="false" + volatile="false" + value=""android.hardware.touchscreen"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="FEATURE_TOUCHSCREEN_MULTITOUCH" type="java.lang.String" transient="false" diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index fff75ca9aff2..95e61b6f6ace 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -73,6 +73,17 @@ public final class BluetoothHeadset { public static final String EXTRA_AUDIO_STATE = "android.bluetooth.headset.extra.AUDIO_STATE"; + /** Extra to be used with the Headset State change intent. + * This will be used only when Headset state changes to + * {@link #STATE_DISCONNECTED} from any previous state. + * This extra field is optional and will be used when + * we have deterministic information regarding whether + * the disconnect was initiated by the remote device or + * by the local adapter. + */ + public static final String EXTRA_DISCONNECT_INITIATOR = + "android.bluetooth.headset.extra.DISCONNECT_INITIATOR"; + /** * TODO(API release): Consider incorporating as new state in * HEADSET_STATE_CHANGED @@ -100,6 +111,11 @@ public final class BluetoothHeadset { /** Connection canceled before completetion. */ public static final int RESULT_CANCELED = 2; + /** Values for {@link #EXTRA_DISCONNECT_INITIATOR} */ + public static final int REMOTE_DISCONNECT = 0; + public static final int LOCAL_DISCONNECT = 1; + + /** Default priority for headsets that for which we will accept * inconing connections and auto-connect */ public static final int PRIORITY_AUTO_CONNECT = 1000; diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 2f512aee06b6..68b44e705fce 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -738,6 +738,14 @@ public abstract class PackageManager { /** * Feature for {@link #getSystemAvailableFeatures} and + * {@link #hasSystemFeature}: The device's display has a touch screen. + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen"; + + + /** + * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device's touch screen supports * multitouch sufficient for basic two-finger gesture detection. */ diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java index 7b307f8b986f..9af42cc60822 100644 --- a/core/java/android/text/method/ArrowKeyMovementMethod.java +++ b/core/java/android/text/method/ArrowKeyMovementMethod.java @@ -252,7 +252,6 @@ implements MovementMethod int offset = getOffset(x, y, widget); if (cap) { - buffer.setSpan(LAST_TAP_DOWN, offset, offset, Spannable.SPAN_POINT_POINT); @@ -286,13 +285,13 @@ implements MovementMethod Spannable.SPAN_INCLUSIVE_INCLUSIVE); } } - } else if (event.getAction() == MotionEvent.ACTION_MOVE ) { + } else if (event.getAction() == MotionEvent.ACTION_MOVE) { boolean cap = (MetaKeyKeyListener.getMetaState(buffer, KeyEvent.META_SHIFT_ON) == 1) || (MetaKeyKeyListener.getMetaState(buffer, MetaKeyKeyListener.META_SELECTING) != 0); - if (cap & handled) { + if (cap && handled) { // Before selecting, make sure we've moved out of the "slop". // handled will be true, if we're in select mode AND we're // OUT of the slop @@ -308,28 +307,35 @@ implements MovementMethod int y = (int) event.getY(); int offset = getOffset(x, y, widget); - // Get the last down touch position (the position at which the - // user started the selection) - int lastDownOffset = buffer.getSpanStart(LAST_TAP_DOWN); - - // Compute the selection boundaries - int spanstart; - int spanend; - if (offset >= lastDownOffset) { - // Expand from word start of the original tap to new word - // end, since we are selecting "forwards" - spanstart = findWordStart(buffer, lastDownOffset); - spanend = findWordEnd(buffer, offset); + final OnePointFiveTapState[] tap = buffer.getSpans(0, buffer.length(), + OnePointFiveTapState.class); + + if (tap.length > 0 && tap[0].active) { + // Get the last down touch position (the position at which the + // user started the selection) + int lastDownOffset = buffer.getSpanStart(LAST_TAP_DOWN); + + // Compute the selection boundaries + int spanstart; + int spanend; + if (offset >= lastDownOffset) { + // Expand from word start of the original tap to new word + // end, since we are selecting "forwards" + spanstart = findWordStart(buffer, lastDownOffset); + spanend = findWordEnd(buffer, offset); + } else { + // Expand to from new word start to word end of the original + // tap since we are selecting "backwards". + // The spanend will always need to be associated with the touch + // up position, so that refining the selection with the + // trackball will work as expected. + spanstart = findWordEnd(buffer, lastDownOffset); + spanend = findWordStart(buffer, offset); + } + Selection.setSelection(buffer, spanstart, spanend); } else { - // Expand to from new word start to word end of the original - // tap since we are selecting "backwards". - // The spanend will always need to be associated with the touch - // up position, so that refining the selection with the - // trackball will work as expected. - spanstart = findWordEnd(buffer, lastDownOffset); - spanend = findWordStart(buffer, offset); + Selection.extendSelection(buffer, offset); } - Selection.setSelection(buffer, spanstart, spanend); return true; } } else if (event.getAction() == MotionEvent.ACTION_UP) { @@ -393,6 +399,8 @@ implements MovementMethod // If we selecting something with the onepointfivetap-and // swipe gesture, stop it on finger up. MetaKeyKeyListener.stopSelecting(widget, buffer); + } else { + Selection.extendSelection(buffer, off); } } else if (doubletap) { Selection.setSelection(buffer, diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 833c01bc8ff0..aadb576d2c65 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -891,7 +891,10 @@ public final class BatteryStatsImpl extends BatteryStats { for (endIndex=startIndex; endIndex < len && wlBuffer[endIndex] != '\n' && wlBuffer[endIndex] != '\0'; endIndex++); - endIndex++; // endIndex is an exclusive upper bound. + // Don't go over the end of the buffer + if (endIndex < len) { + endIndex++; // endIndex is an exclusive upper bound. + } String[] nameStringArray = mProcWakelocksName; long[] wlData = mProcWakelocksData; diff --git a/core/res/res/drawable-mdpi/stat_notify_chat.png b/core/res/res/drawable-mdpi/stat_notify_chat.png Binary files differindex a3f2f9619748..b8bb2b5c1f82 100644 --- a/core/res/res/drawable-mdpi/stat_notify_chat.png +++ b/core/res/res/drawable-mdpi/stat_notify_chat.png |