diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/res/Configuration.java | 49 | ||||
| -rw-r--r-- | core/java/android/net/DhcpStateMachine.java | 25 | ||||
| -rw-r--r-- | core/java/android/net/NetworkPolicyManager.java | 23 | ||||
| -rw-r--r-- | core/java/android/provider/ContactsContract.java | 9 | ||||
| -rw-r--r-- | core/java/android/provider/VoicemailContract.java | 2 | ||||
| -rw-r--r-- | core/java/android/speech/tts/SynthesisRequest.java | 2 | ||||
| -rw-r--r-- | core/java/android/util/LocaleUtil.java | 115 | ||||
| -rw-r--r-- | core/java/android/view/GLES20Canvas.java | 3 | ||||
| -rw-r--r-- | core/java/android/view/GLES20TextureLayer.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/HardwareRenderer.java | 13 | ||||
| -rw-r--r-- | core/java/android/view/TextureView.java | 10 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 15 | ||||
| -rw-r--r-- | core/java/android/view/ViewAncestor.java | 13 | ||||
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 5 | ||||
| -rw-r--r-- | core/java/android/webkit/WebView.java | 8 | ||||
| -rw-r--r-- | core/java/android/widget/CompoundButton.java | 7 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 10 |
17 files changed, 220 insertions, 93 deletions
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java index 9bd45d3..a00f790 100644 --- a/core/java/android/content/res/Configuration.java +++ b/core/java/android/content/res/Configuration.java @@ -19,6 +19,7 @@ package android.content.res; import android.content.pm.ActivityInfo; import android.os.Parcel; import android.os.Parcelable; +import android.util.LocaleUtil; import java.util.Locale; @@ -277,21 +278,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration public int compatSmallestScreenWidthDp; /** - * @hide Do not use. Implementation not finished. - */ - public static final int TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE = -1; - - /** - * @hide Do not use. Implementation not finished. - */ - public static final int TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE = 0; - - /** - * @hide Do not use. Implementation not finished. - */ - public static final int TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE = 1; - - /** * @hide The text layout direction associated to the current Locale */ public int textLayoutDirection; @@ -359,8 +345,8 @@ public final class Configuration implements Parcelable, Comparable<Configuration sb.append(" (no locale)"); } switch (textLayoutDirection) { - case TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE: sb.append(" ?layoutdir"); break; - case TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE: sb.append(" rtl"); break; + case LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE: sb.append(" ?layoutdir"); break; + case LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE: sb.append(" rtl"); break; default: sb.append(" layoutdir="); sb.append(textLayoutDirection); break; } if (smallestScreenWidthDp != SMALLEST_SCREEN_WIDTH_DP_UNDEFINED) { @@ -483,7 +469,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration screenWidthDp = compatScreenWidthDp = SCREEN_WIDTH_DP_UNDEFINED; screenHeightDp = compatScreenHeightDp = SCREEN_HEIGHT_DP_UNDEFINED; smallestScreenWidthDp = compatSmallestScreenWidthDp = SMALLEST_SCREEN_WIDTH_DP_UNDEFINED; - textLayoutDirection = TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; + textLayoutDirection = LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; seq = 0; } @@ -519,7 +505,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration changed |= ActivityInfo.CONFIG_LOCALE; locale = delta.locale != null ? (Locale) delta.locale.clone() : null; - textLayoutDirection = getLayoutDirectionFromLocale(locale); + textLayoutDirection = LocaleUtil.getLayoutDirectionFromLocale(locale); } if (delta.userSetLocale && (!userSetLocale || ((changed & ActivityInfo.CONFIG_LOCALE) != 0))) { @@ -609,31 +595,6 @@ public final class Configuration implements Parcelable, Comparable<Configuration } /** - * Return the layout direction for a given Locale - * @param locale the Locale for which we want the layout direction. Can be null. - * @return the layout direction. This may be one of: - * {@link #TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE} or - * {@link #TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE} or - * {@link #TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE}. - * - * @hide - */ - public static int getLayoutDirectionFromLocale(Locale locale) { - if (locale == null || locale.equals(Locale.ROOT)) return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE; - // Be careful: this code will need to be changed when vertical scripts will be supported - // OR if ICU4C is updated to have the "likelySubtags" file - switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { - case Character.DIRECTIONALITY_LEFT_TO_RIGHT: - return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; - case Character.DIRECTIONALITY_RIGHT_TO_LEFT: - case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: - return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE; - default: - return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE; - } - } - - /** * Return a bit mask of the differences between this Configuration * object and the given one. Does not change the values of either. Any * undefined fields in <var>delta</var> are ignored. diff --git a/core/java/android/net/DhcpStateMachine.java b/core/java/android/net/DhcpStateMachine.java index eaf087f..c49c019 100644 --- a/core/java/android/net/DhcpStateMachine.java +++ b/core/java/android/net/DhcpStateMachine.java @@ -66,6 +66,9 @@ public class DhcpStateMachine extends StateMachine { private static final int DHCP_RENEW = 0; private static final String ACTION_DHCP_RENEW = "android.net.wifi.DHCP_RENEW"; + //Used for sanity check on setting up renewal + private static final int MIN_RENEWAL_TIME_SECS = 5 * 60; // 5 minutes + private enum DhcpAction { START, RENEW @@ -331,13 +334,21 @@ public class DhcpStateMachine extends StateMachine { if (success) { Log.d(TAG, "DHCP succeeded on " + mInterfaceName); - //Do it a bit earlier than half the lease duration time - //to beat the native DHCP client and avoid extra packets - //48% for one hour lease time = 29 minutes - mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, - SystemClock.elapsedRealtime() + - dhcpInfoInternal.leaseDuration * 480, //in milliseconds - mDhcpRenewalIntent); + long leaseDuration = dhcpInfoInternal.leaseDuration; //int to long conversion + + //Sanity check for renewal + //TODO: would be good to notify the user that his network configuration is + //bad and that the device cannot renew below MIN_RENEWAL_TIME_SECS + if (leaseDuration < MIN_RENEWAL_TIME_SECS) { + leaseDuration = MIN_RENEWAL_TIME_SECS; + } + //Do it a bit earlier than half the lease duration time + //to beat the native DHCP client and avoid extra packets + //48% for one hour lease time = 29 minutes + mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, + SystemClock.elapsedRealtime() + + leaseDuration * 480, //in milliseconds + mDhcpRenewalIntent); mController.obtainMessage(CMD_POST_DHCP_ACTION, DHCP_SUCCESS, 0, dhcpInfoInternal) .sendToTarget(); diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index e9d65e6..538a06e 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -19,6 +19,7 @@ package android.net; import static android.text.format.Time.MONTH_DAY; import android.content.Context; +import android.content.Intent; import android.os.RemoteException; import android.text.format.Time; @@ -41,6 +42,28 @@ public class NetworkPolicyManager { /** Reject traffic on paid networks. */ public static final int RULE_REJECT_PAID = 0x1; + /** + * {@link Intent} action launched when user selects {@link NetworkPolicy} + * warning notification. + */ + public static final String ACTION_DATA_USAGE_WARNING = + "android.intent.action.DATA_USAGE_WARNING"; + + /** + * {@link Intent} action launched when user selects {@link NetworkPolicy} + * limit notification. + */ + public static final String ACTION_DATA_USAGE_LIMIT = + "android.intent.action.DATA_USAGE_LIMIT"; + + /** + * {@link Intent} extra included in {@link #ACTION_DATA_USAGE_WARNING} and + * {@link #ACTION_DATA_USAGE_LIMIT} to indicate which + * {@link NetworkPolicy#networkTemplate} it applies to. + */ + public static final String EXTRA_NETWORK_TEMPLATE = + "android.intent.extra.NETWORK_TEMPLATE"; + private INetworkPolicyManager mService; public NetworkPolicyManager(INetworkPolicyManager service) { diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 00e2998..1816066 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -1298,6 +1298,15 @@ public final class ContactsContract { public static final Uri CONTENT_VCARD_URI = Uri.withAppendedPath(CONTENT_URI, "as_vcard"); + /** + * Boolean parameter that may be used with {@link #CONTENT_VCARD_URI} + * and {@link #CONTENT_MULTI_VCARD_URI} to indicate that the returned + * vcard should not contain a photo. + * + * @hide + */ + public static final String QUERY_PARAMETER_VCARD_NO_PHOTO = "nophoto"; + /** * Base {@link Uri} for referencing multiple {@link Contacts} entry, * created by appending {@link #LOOKUP_KEY} using diff --git a/core/java/android/provider/VoicemailContract.java b/core/java/android/provider/VoicemailContract.java index 376e0bb..ae41876 100644 --- a/core/java/android/provider/VoicemailContract.java +++ b/core/java/android/provider/VoicemailContract.java @@ -127,7 +127,7 @@ public class VoicemailContract { * <P>Type: TEXT</P> * <P> Note that this is NOT the voicemail media content data. */ - public static final String SOURCE_DATA = "provider_data"; + public static final String SOURCE_DATA = "source_data"; /** * Whether the media content for this voicemail is available for * consumption. diff --git a/core/java/android/speech/tts/SynthesisRequest.java b/core/java/android/speech/tts/SynthesisRequest.java index ef1704c..6398d3d 100644 --- a/core/java/android/speech/tts/SynthesisRequest.java +++ b/core/java/android/speech/tts/SynthesisRequest.java @@ -42,7 +42,7 @@ public final class SynthesisRequest { private int mSpeechRate; private int mPitch; - SynthesisRequest(String text, Bundle params) { + public SynthesisRequest(String text, Bundle params) { mText = text; // Makes a copy of params. mParams = new Bundle(params); diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java new file mode 100644 index 0000000..e767a85 --- /dev/null +++ b/core/java/android/util/LocaleUtil.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2011 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. + */ + +package android.util; + +import java.util.Locale; + +import libcore.icu.ICU; + +/** + * Various utilities for Locales + * + * @hide + */ +public class LocaleUtil { + + private LocaleUtil() { /* cannot be instantiated */ } + + /** + * @hide Do not use. Implementation not finished. + */ + public static final int TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE = -1; + + /** + * @hide Do not use. Implementation not finished. + */ + public static final int TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE = 0; + + /** + * @hide Do not use. Implementation not finished. + */ + public static final int TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE = 1; + + private static final char UNDERSCORE_CHAR = '_'; + + private static String ARAB_SCRIPT_SUBTAG = "Arab"; + private static String HEBR_SCRIPT_SUBTAG = "Hebr"; + + /** + * Return the layout direction for a given Locale + * + * @param locale the Locale for which we want the layout direction. Can be null. + * @return the layout direction. This may be one of: + * {@link #TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE} or + * {@link #TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE} or + * {@link #TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE}. + * + * Be careful: this code will need to be changed when vertical scripts will be supported + * + * @hide + */ + public static int getLayoutDirectionFromLocale(Locale locale) { + if (locale == null || locale.equals(Locale.ROOT)) { + return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE; + } + + final String localeWithSubtags = ICU.addLikelySubtags(locale.toString()); + if (localeWithSubtags == null) return getLayoutDirectionFromFirstChar(locale); + + // Need to check if we can extract the script subtag. For example, "Latn" in "en_Latn_US" + if (localeWithSubtags.length() <= 7 + || localeWithSubtags.charAt(2) != UNDERSCORE_CHAR + || localeWithSubtags.charAt(7) != UNDERSCORE_CHAR) { + return getLayoutDirectionFromFirstChar(locale); + } + // Extract the script subtag + final String scriptSubtag = localeWithSubtags.substring(3, 7); + + if (scriptSubtag.equalsIgnoreCase(ARAB_SCRIPT_SUBTAG) || + scriptSubtag.equalsIgnoreCase(HEBR_SCRIPT_SUBTAG)) { + return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE; + } + return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; + } + + /** + * Fallback algorithm to detect the locale direction. Rely on the fist char of the + * localized locale name. This will not work if the localized locale name is in English + * (this is the case for ICU 4.4 and "Urdu" script) + * + * @param locale + * @return the layout direction. This may be one of: + * {@link #TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE} or + * {@link #TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE} or + * {@link #TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE}. + * + * Be careful: this code will need to be changed when vertical scripts will be supported + * + * @hide + */ + private static int getLayoutDirectionFromFirstChar(Locale locale) { + switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { + case Character.DIRECTIONALITY_LEFT_TO_RIGHT: + return TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; + case Character.DIRECTIONALITY_RIGHT_TO_LEFT: + case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: + return TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE; + default: + return TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE; + } + } +} diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java index 383bfb3..5216c49 100644 --- a/core/java/android/view/GLES20Canvas.java +++ b/core/java/android/view/GLES20Canvas.java @@ -29,6 +29,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.graphics.Shader; +import android.graphics.SurfaceTexture; import android.graphics.TemporaryBuffer; import android.text.GraphicsOperations; import android.text.SpannableString; @@ -163,7 +164,7 @@ class GLES20Canvas extends HardwareCanvas { static native int nCreateTextureLayer(int[] layerInfo); static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo); static native void nResizeLayer(int layerId, int width, int height, int[] layerInfo); - static native void nUpdateTextureLayer(int layerId, int width, int height, int surface); + static native void nUpdateTextureLayer(int layerId, int width, int height, SurfaceTexture surface); static native void nDestroyLayer(int layerId); static native void nDestroyLayerDeferred(int layerId); static native boolean nCopyLayer(int layerId, int bitmap); diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java index fcf421b..063eee7 100644 --- a/core/java/android/view/GLES20TextureLayer.java +++ b/core/java/android/view/GLES20TextureLayer.java @@ -70,7 +70,7 @@ class GLES20TextureLayer extends GLES20Layer { return mSurface; } - void update(int width, int height, int surface) { - GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, surface); + void update(int width, int height) { + GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, mSurface); } } diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 5944bd4..5ceb12a 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -194,7 +194,7 @@ public abstract class HardwareRenderer { * * @return A {@link SurfaceTexture} */ - abstract SurfaceTexture createSuraceTexture(HardwareLayer layer); + abstract SurfaceTexture createSurfaceTexture(HardwareLayer layer); /** * Updates the specified layer. @@ -202,10 +202,8 @@ public abstract class HardwareRenderer { * @param layer The hardware layer to update * @param width The layer's width * @param height The layer's height - * @param surface The surface to update */ - abstract void updateTextureLayer(HardwareLayer layer, int width, int height, - SurfaceTexture surface); + abstract void updateTextureLayer(HardwareLayer layer, int width, int height); /** * Copies the content of the specified layer into the specified bitmap. @@ -815,14 +813,13 @@ public abstract class HardwareRenderer { } @Override - SurfaceTexture createSuraceTexture(HardwareLayer layer) { + SurfaceTexture createSurfaceTexture(HardwareLayer layer) { return ((GLES20TextureLayer) layer).getSurfaceTexture(); } @Override - void updateTextureLayer(HardwareLayer layer, int width, int height, - SurfaceTexture surface) { - ((GLES20TextureLayer) layer).update(width, height, surface.mSurfaceTexture); + void updateTextureLayer(HardwareLayer layer, int width, int height) { + ((GLES20TextureLayer) layer).update(width, height); } @Override diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index 4daa892..164c657 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -232,7 +232,7 @@ public class TextureView extends View { protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mSurface != null) { - nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); + nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); if (mListener != null) { mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight()); } @@ -247,8 +247,8 @@ public class TextureView extends View { if (mLayer == null) { mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(); - mSurface = mAttachInfo.mHardwareRenderer.createSuraceTexture(mLayer); - nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight()); + mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer); + nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() { @Override @@ -290,7 +290,7 @@ public class TextureView extends View { return; } - mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mSurface); + mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight()); invalidate(); } @@ -447,5 +447,5 @@ public class TextureView extends View { public void onSurfaceTextureDestroyed(SurfaceTexture surface); } - private static native void nSetDefaultBufferSize(int surfaceTexture, int width, int height); + private static native void nSetDefaultBufferSize(SurfaceTexture surfaceTexture, int width, int height); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1dfb858..b0e651a 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -17,6 +17,7 @@ package android.view; import android.util.FloatProperty; +import android.util.LocaleUtil; import android.util.Property; import com.android.internal.R; import com.android.internal.util.Predicate; @@ -8772,18 +8773,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit * @return true if a Locale is corresponding to a RTL script. */ private static boolean isLayoutDirectionRtl(Locale locale) { - if (locale == null || locale.equals(Locale.ROOT)) return false; - // Be careful: this code will need to be changed when vertical scripts will be supported - // OR if ICU4C is updated to have the "likelySubtags" file - switch(Character.getDirectionality(locale.getDisplayName(locale).charAt(0))) { - case Character.DIRECTIONALITY_LEFT_TO_RIGHT: - return false; - case Character.DIRECTIONALITY_RIGHT_TO_LEFT: - case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC: - return true; - default: - return false; - } + return (LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE == + LocaleUtil.getLayoutDirectionFromLocale(locale)); } /** diff --git a/core/java/android/view/ViewAncestor.java b/core/java/android/view/ViewAncestor.java index 914973e..ba3ae58 100644 --- a/core/java/android/view/ViewAncestor.java +++ b/core/java/android/view/ViewAncestor.java @@ -4407,7 +4407,7 @@ public final class ViewAncestor extends Handler implements ViewParent, predicate.init(accessibilityId); View root = ViewAncestor.this.mView; View target = root.findViewByPredicate(predicate); - if (target != null) { + if (target != null && target.isShown()) { info = target.createAccessibilityNodeInfo(); } } finally { @@ -4439,7 +4439,7 @@ public final class ViewAncestor extends Handler implements ViewParent, try { View root = ViewAncestor.this.mView; View target = root.findViewById(viewId); - if (target != null) { + if (target != null && target.isShown()) { info = target.createAccessibilityNodeInfo(); } } finally { @@ -4486,7 +4486,7 @@ public final class ViewAncestor extends Handler implements ViewParent, root = ViewAncestor.this.mView; } - if (root == null) { + if (root == null || !root.isShown()) { return; } @@ -4501,7 +4501,9 @@ public final class ViewAncestor extends Handler implements ViewParent, final int viewCount = foundViews.size(); for (int i = 0; i < viewCount; i++) { View foundView = foundViews.get(i); - infos.add(foundView.createAccessibilityNodeInfo()); + if (foundView.isShown()) { + infos.add(foundView.createAccessibilityNodeInfo()); + } } } finally { try { @@ -4611,7 +4613,8 @@ public final class ViewAncestor extends Handler implements ViewParent, return null; } mFindByAccessibilityIdPredicate.init(accessibilityId); - return root.findViewByPredicate(mFindByAccessibilityIdPredicate); + View foundView = root.findViewByPredicate(mFindByAccessibilityIdPredicate); + return (foundView != null && foundView.isShown()) ? foundView : null; } private final class FindByAccessibilitytIdPredicate implements Predicate<View> { diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 57ee8a0..a6bce75 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2023,10 +2023,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); - for (int i = 0, count = mChildrenCount; i < count; i++) { View child = mChildren[i]; - info.addChild(child); + if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) { + info.addChild(child); + } } } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index bfab8a9..c56e6db 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3062,6 +3062,13 @@ public class WebView extends AbsoluteLayout } /** + * @hide + */ + public int getPageBackgroundColor() { + return nativeGetBackgroundColor(); + } + + /** * Pause all layout, parsing, and JavaScript timers for all webviews. This * is a global requests, not restricted to just this webview. This can be * useful if the application has been paused. @@ -9216,4 +9223,5 @@ public class WebView extends AbsoluteLayout * @return True if the layer is successfully scrolled. */ private native boolean nativeScrollLayer(int layer, int newX, int newY); + private native int nativeGetBackgroundColor(); } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index a730018..2410eb2 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -28,6 +28,7 @@ import android.util.AttributeSet; import android.view.Gravity; import android.view.ViewDebug; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * <p> @@ -214,6 +215,12 @@ public abstract class CompoundButton extends Button implements Checkable { } @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setChecked(mChecked); + } + + @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 470a23d..02c2b8f 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8574,11 +8574,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final String originalText = mText.subSequence(spanStart, spanEnd).toString(); ((Editable) mText).replace(spanStart, spanEnd, suggestion); - // Swap text content between actual text and Suggestion span - String[] suggestions = suggestionInfo.suggestionSpan.getSuggestions(); - suggestions[suggestionInfo.suggestionIndex] = originalText; - - // Notify source IME of the suggestion pick + // Notify source IME of the suggestion pick. Do this before swaping texts. if (!TextUtils.isEmpty( suggestionInfo.suggestionSpan.getNotificationTargetClassName())) { InputMethodManager imm = InputMethodManager.peekInstance(); @@ -8586,6 +8582,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener suggestionInfo.suggestionIndex); } + // Swap text content between actual text and Suggestion span + String[] suggestions = suggestionInfo.suggestionSpan.getSuggestions(); + suggestions[suggestionInfo.suggestionIndex] = originalText; + // Restore previous SuggestionSpans final int lengthDifference = suggestion.length() - (spanEnd - spanStart); for (int i = 0; i < length; i++) { |
