summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/ContentUris.java51
-rw-r--r--core/java/android/net/NetworkUtils.java28
-rw-r--r--core/java/android/os/Build.java2
-rw-r--r--core/java/android/os/storage/package.html8
-rw-r--r--core/java/android/provider/Settings.java28
-rw-r--r--core/java/android/view/Choreographer.java6
-rw-r--r--core/java/android/view/View.java9
-rw-r--r--core/java/android/view/ViewConfiguration.java2
-rw-r--r--core/java/android/view/ViewGroup.java8
-rw-r--r--core/java/android/webkit/WebTextView.java90
-rw-r--r--core/java/android/webkit/WebView.java23
-rw-r--r--core/java/android/widget/RemoteViewsService.java3
-rw-r--r--core/java/android/widget/TextView.java1
13 files changed, 197 insertions, 62 deletions
diff --git a/core/java/android/content/ContentUris.java b/core/java/android/content/ContentUris.java
index aa76034..dbe8a7c 100644
--- a/core/java/android/content/ContentUris.java
+++ b/core/java/android/content/ContentUris.java
@@ -19,9 +19,54 @@ package android.content;
import android.net.Uri;
/**
- * Utility methods useful for working with content {@link android.net.Uri}s,
- * those with a "content" scheme.
- */
+* Utility methods useful for working with {@link android.net.Uri} objects
+* that use the "content" (content://) scheme.
+*
+*<p>
+* Content URIs have the syntax
+*</p>
+*<p>
+* <code>content://<em>authority</em>/<em>path</em>/<em>id</em></code>
+*</p>
+*<dl>
+* <dt>
+* <code>content:</code>
+* </dt>
+* <dd>
+* The scheme portion of the URI. This is always set to {@link
+* android.content.ContentResolver#SCHEME_CONTENT ContentResolver.SCHEME_CONTENT} (value
+* <code>content://</code>).
+* </dd>
+* <dt>
+* <em>authority</em>
+* </dt>
+* <dd>
+* A string that identifies the entire content provider. All the content URIs for the provider
+* start with this string. To guarantee a unique authority, providers should consider
+* using an authority that is the same as the provider class' package identifier.
+* </dd>
+* <dt>
+* <em>path</em>
+* </dt>
+* <dd>
+* Zero or more segments, separated by a forward slash (<code>/</code>), that identify
+* some subset of the provider's data. Most providers use the path part to identify
+* individual tables. Individual segments in the path are often called
+* &quot;directories&quot; although they do not refer to file directories. The right-most
+* segment in a path is often called a &quot;twig&quot;
+* </dd>
+* <dt>
+* <em>id</em>
+* </dt>
+* <dd>
+* A unique numeric identifier for a single row in the subset of data identified by the
+* preceding path part. Most providers recognize content URIs that contain an id part
+* and give them special handling. A table that contains a column named <code>_ID</code>
+* often expects the id part to be a particular value for that column.
+* </dd>
+*</dl>
+*
+*/
public class ContentUris {
/**
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index e289fc1..d39e741 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -250,4 +250,32 @@ public class NetworkUtils {
}
return result;
}
+
+ /**
+ * Trim leading zeros from IPv4 address strings
+ * Our base libraries will interpret that as octel..
+ * Must leave non v4 addresses and host names alone.
+ * For example, 192.168.000.010 -> 192.168.0.10
+ * TODO - fix base libraries and remove this function
+ * @param addr a string representing an ip addr
+ * @return a string propertly trimmed
+ */
+ public static String trimV4AddrZeros(String addr) {
+ if (addr == null) return null;
+ String[] octets = addr.split("\\.");
+ if (octets.length != 4) return addr;
+ StringBuilder builder = new StringBuilder(16);
+ String result = null;
+ for (int i = 0; i < 4; i++) {
+ try {
+ if (octets[i].length() > 3) return addr;
+ builder.append(Integer.parseInt(octets[i]));
+ } catch (NumberFormatException e) {
+ return addr;
+ }
+ if (i < 3) builder.append('.');
+ }
+ result = builder.toString();
+ return result;
+ }
}
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 7d03494..88fea91 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -311,7 +311,7 @@ public class Build {
public static final int ICE_CREAM_SANDWICH = 14;
/**
- * Android 4.1.
+ * Android 4.0.3.
*/
public static final int ICE_CREAM_SANDWICH_MR1 = 15;
}
diff --git a/core/java/android/os/storage/package.html b/core/java/android/os/storage/package.html
new file mode 100644
index 0000000..a5f1e1c
--- /dev/null
+++ b/core/java/android/os/storage/package.html
@@ -0,0 +1,8 @@
+<HTML>
+<BODY>
+<p>
+Contains classes for the system storage service, which manages binary asset filesystems
+known as Opaque Binary Blobs (OBBs).
+</p>
+</BODY>
+</HTML>
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 7b0e0ab..c44f23b 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2779,10 +2779,10 @@ public final class Settings {
public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
/**
- * If injection of accessibility enhancing JavaScript scripts
+ * If injection of accessibility enhancing JavaScript screen-reader
* is enabled.
* <p>
- * Note: Accessibility injecting scripts are served by the
+ * Note: The JavaScript based screen-reader is served by the
* Google infrastructure and enable users with disabilities to
* efficiantly navigate in and explore web content.
* </p>
@@ -2795,6 +2795,22 @@ public final class Settings {
"accessibility_script_injection";
/**
+ * The URL for the injected JavaScript based screen-reader used
+ * for providing accessiblity of content in WebView.
+ * <p>
+ * Note: The JavaScript based screen-reader is served by the
+ * Google infrastructure and enable users with disabilities to
+ * efficiently navigate in and explore web content.
+ * </p>
+ * <p>
+ * This property represents a string value.
+ * </p>
+ * @hide
+ */
+ public static final String ACCESSIBILITY_SCREEN_READER_URL =
+ "accessibility_script_injection_url";
+
+ /**
* Key bindings for navigation in built-in accessibility support for web content.
* <p>
* Note: These key bindings are for the built-in accessibility navigation for
@@ -3132,6 +3148,14 @@ public final class Settings {
"wifi_watchdog_blacklist_followup_interval_ms";
/**
+ * Setting to turn off poor network avoidance on Wi-Fi. Feature is disabled by default and
+ * the setting needs to be set to 1 to enable it.
+ * @hide
+ */
+ public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
+ "wifi_watchdog_poor_network_test_enabled";
+
+ /**
* Setting to turn off walled garden test on Wi-Fi. Feature is enabled by default and
* the setting needs to be set to 0 to disable it.
* @hide
diff --git a/core/java/android/view/Choreographer.java b/core/java/android/view/Choreographer.java
index 0fdd105..63de128 100644
--- a/core/java/android/view/Choreographer.java
+++ b/core/java/android/view/Choreographer.java
@@ -66,9 +66,11 @@ public final class Choreographer extends Handler {
// System property to enable/disable the use of the vsync / animation timer
// for drawing rather than drawing immediately.
- // Enabled by default.
+ // Temporarily disabled by default because postponing performTraversals() violates
+ // assumptions about traversals happening in-order relative to other posted messages.
+ // Bug: 5721047
private static final boolean USE_ANIMATION_TIMER_FOR_DRAW = SystemProperties.getBoolean(
- "debug.choreographer.animdraw", true);
+ "debug.choreographer.animdraw", false);
private static final int MSG_DO_ANIMATION = 0;
private static final int MSG_DO_DRAW = 1;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index af8f8cb..5c93a42 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12220,13 +12220,16 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
* @param location an array of two integers in which to hold the coordinates
*/
public void getLocationInWindow(int[] location) {
- // When the view is not attached to a window, this method does not make sense
- if (mAttachInfo == null) return;
-
if (location == null || location.length < 2) {
throw new IllegalArgumentException("location must be an array of two integers");
}
+ if (mAttachInfo == null) {
+ // When the view is not attached to a window, this method does not make sense
+ location[0] = location[1] = 0;
+ return;
+ }
+
float[] position = mAttachInfo.mTmpTransformLocation;
position[0] = position[1] = 0.0f;
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 05c5daa..b455ad5 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -149,7 +149,7 @@ public class ViewConfiguration {
* It may be appropriate to tweak this on a device-specific basis in an overlay based on
* the characteristics of the touch panel and firmware.
*/
- private static final int TOUCH_SLOP = 4;
+ private static final int TOUCH_SLOP = 8;
/**
* Distance the first touch can wander before we stop considering this event a double tap
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 5035cae..1102a47 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2719,13 +2719,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
return more;
}
- float alpha = child.getAlpha();
- // Bail out early if the view does not need to be drawn
- if (alpha <= ViewConfiguration.ALPHA_THRESHOLD && (child.mPrivateFlags & ALPHA_SET) == 0 &&
- !(child instanceof SurfaceView)) {
- return more;
- }
-
if (hardwareAccelerated) {
// Clear INVALIDATED flag to allow invalidation to occur during rendering, but
// retain the flag's value temporarily in the mRecreateDisplayList flag
@@ -2779,6 +2772,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
}
}
+ float alpha = child.getAlpha();
if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix()) {
if (transformToApply != null || !childHasIdentityMatrix) {
int transX = 0;
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 3574a0d..2b59b80 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -19,10 +19,13 @@ package android.webkit;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Paint.Style;
+import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -51,7 +54,6 @@ import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
-import android.widget.AbsoluteLayout;
import android.widget.AbsoluteLayout.LayoutParams;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -74,7 +76,6 @@ import java.util.ArrayList;
static final String LOGTAG = "webtextview";
- private Paint mRingPaint;
private int mRingInset;
private WebView mWebView;
@@ -207,13 +208,51 @@ import java.util.ArrayList;
}
}
};
- float ringWidth = 4f * context.getResources().getDisplayMetrics().density;
mReceiver = new MyResultReceiver(mHandler);
- mRingPaint = new Paint();
- mRingPaint.setColor(0x6633b5e5);
- mRingPaint.setStrokeWidth(ringWidth);
- mRingPaint.setStyle(Style.FILL);
+ float ringWidth = 2f * context.getResources().getDisplayMetrics().density;
mRingInset = (int) ringWidth;
+ setBackgroundDrawable(new BackgroundDrawable(mRingInset));
+ setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
+ getPaddingBottom());
+ }
+
+ private static class BackgroundDrawable extends Drawable {
+
+ private Paint mPaint = new Paint();
+ private int mBorderWidth;
+ private Rect mInsetRect = new Rect();
+
+ public BackgroundDrawable(int width) {
+ mPaint = new Paint();
+ mPaint.setStrokeWidth(width);
+ mBorderWidth = width;
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ mPaint.setColor(0x6633b5e5);
+ canvas.drawRect(getBounds(), mPaint);
+ mInsetRect.left = getBounds().left + mBorderWidth;
+ mInsetRect.top = getBounds().top + mBorderWidth;
+ mInsetRect.right = getBounds().right - mBorderWidth;
+ mInsetRect.bottom = getBounds().bottom - mBorderWidth;
+ mPaint.setColor(Color.WHITE);
+ canvas.drawRect(mInsetRect, mPaint);
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+
}
public void setAutoFillable(int queryId) {
@@ -223,35 +262,9 @@ import java.util.ArrayList;
}
@Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- if (isFocused()) {
- final int ib = getHeight() - mRingInset;
- canvas.drawRect(0, 0, getWidth(), mRingInset, mRingPaint);
- canvas.drawRect(0, ib, getWidth(), getHeight(), mRingPaint);
- canvas.drawRect(0, mRingInset, mRingInset, ib, mRingPaint);
- canvas.drawRect(getWidth() - mRingInset, mRingInset, getWidth(), ib, mRingPaint);
- }
- }
-
- private void growOrShrink(boolean grow) {
- AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) getLayoutParams();
- if (grow) {
- lp.x -= mRingInset;
- lp.y -= mRingInset;
- lp.width += 2 * mRingInset;
- lp.height += 2 * mRingInset;
- setPadding(getPaddingLeft() + mRingInset, getPaddingTop() + mRingInset,
- getPaddingRight() + mRingInset, getPaddingBottom() + mRingInset);
- } else {
- lp.x += mRingInset;
- lp.y += mRingInset;
- lp.width -= 2 * mRingInset;
- lp.height -= 2 * mRingInset;
- setPadding(getPaddingLeft() - mRingInset, getPaddingTop() - mRingInset,
- getPaddingRight() - mRingInset, getPaddingBottom() - mRingInset);
- }
- setLayoutParams(lp);
+ public void setPadding(int left, int top, int right, int bottom) {
+ super.setPadding(left + mRingInset, top + mRingInset,
+ right + mRingInset, bottom + mRingInset);
}
@Override
@@ -555,7 +568,6 @@ import java.util.ArrayList;
} else if (!mInsideRemove) {
mWebView.setActive(false);
}
- growOrShrink(focused);
mFromFocusChange = false;
}
@@ -966,6 +978,10 @@ import java.util.ArrayList;
*/
/* package */ void setRect(int x, int y, int width, int height) {
LayoutParams lp = (LayoutParams) getLayoutParams();
+ x -= mRingInset;
+ y -= mRingInset;
+ width += 2 * mRingInset;
+ height += 2 * mRingInset;
boolean needsUpdate = false;
if (null == lp) {
lp = new LayoutParams(width, height, x, y);
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index b68dec9..40cb248 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -59,6 +59,7 @@ import android.os.Message;
import android.os.StrictMode;
import android.provider.Settings;
import android.speech.tts.TextToSpeech;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.EventLog;
import android.util.Log;
@@ -849,13 +850,12 @@ public class WebView extends AbsoluteLayout
// the alias via which accessibility JavaScript interface is exposed
private static final String ALIAS_ACCESSIBILITY_JS_INTERFACE = "accessibility";
- // JavaScript to inject the script chooser which will
- // pick the right script for the current URL
- private static final String ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT =
+ // Template for JavaScript that injects a screen-reader.
+ private static final String ACCESSIBILITY_SCREEN_READER_JAVASCRIPT_TEMPLATE =
"javascript:(function() {" +
" var chooser = document.createElement('script');" +
" chooser.type = 'text/javascript';" +
- " chooser.src = 'https://ssl.gstatic.com/accessibility/javascript/android/AndroidScriptChooser.user.js';" +
+ " chooser.src = '%1s';" +
" document.getElementsByTagName('head')[0].appendChild(chooser);" +
" })();";
@@ -3818,7 +3818,7 @@ public class WebView extends AbsoluteLayout
if (onDeviceScriptInjectionEnabled) {
ensureAccessibilityScriptInjectorInstance(false);
// neither script injected nor script injection opted out => we inject
- loadUrl(ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT);
+ loadUrl(getScreenReaderInjectingJs());
// TODO: Set this flag after successfull script injection. Maybe upon injection
// the chooser should update the meta tag and we check it to declare success
mAccessibilityScriptInjected = true;
@@ -3832,7 +3832,7 @@ public class WebView extends AbsoluteLayout
} else if (axsParameterValue == ACCESSIBILITY_SCRIPT_INJECTION_PROVIDED) {
ensureAccessibilityScriptInjectorInstance(false);
// the URL provides accessibility but we still need to add our generic script
- loadUrl(ACCESSIBILITY_SCRIPT_CHOOSER_JAVASCRIPT);
+ loadUrl(getScreenReaderInjectingJs());
} else {
Log.e(LOGTAG, "Unknown URL value for the \"axs\" URL parameter: " + axsParameterValue);
}
@@ -3854,6 +3854,17 @@ public class WebView extends AbsoluteLayout
}
/**
+ * Gets JavaScript that injects a screen-reader.
+ *
+ * @return The JavaScript snippet.
+ */
+ private String getScreenReaderInjectingJs() {
+ String screenReaderUrl = Settings.Secure.getString(mContext.getContentResolver(),
+ Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL);
+ return String.format(ACCESSIBILITY_SCREEN_READER_JAVASCRIPT_TEMPLATE, screenReaderUrl);
+ }
+
+ /**
* Gets the "axs" URL parameter value.
*
* @param url A url to fetch the paramter from.
diff --git a/core/java/android/widget/RemoteViewsService.java b/core/java/android/widget/RemoteViewsService.java
index 7ba4777..07bd918 100644
--- a/core/java/android/widget/RemoteViewsService.java
+++ b/core/java/android/widget/RemoteViewsService.java
@@ -145,6 +145,9 @@ public abstract class RemoteViewsService extends Service {
Thread.getDefaultUncaughtExceptionHandler().uncaughtException(t, ex);
}
}
+ public synchronized void onDataSetChangedAsync() {
+ onDataSetChanged();
+ }
public synchronized int getCount() {
int count = 0;
try {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 82bcd3e..babd8e7 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9931,6 +9931,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (suggestionInfo.suggestionIndex == ADD_TO_DICTIONARY) {
Intent intent = new Intent(Settings.ACTION_USER_DICTIONARY_INSERT);
intent.putExtra("word", originalText);
+ intent.putExtra("locale", getTextServicesLocale().toString());
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
getContext().startActivity(intent);
// There is no way to know if the word was indeed added. Re-check.