summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Notification.java24
-rw-r--r--core/java/android/content/pm/PackageManager.java8
-rw-r--r--core/java/android/content/pm/PackageParser.java2
-rw-r--r--core/java/android/nfc/NfcAdapter.java6
-rw-r--r--core/java/android/text/style/StyleSpan.java1
-rw-r--r--core/java/android/text/style/TextAppearanceSpan.java1
-rw-r--r--core/java/android/text/style/TypefaceSpan.java1
-rw-r--r--core/java/android/view/AccessibilityInteractionController.java114
-rw-r--r--core/java/android/view/View.java39
-rw-r--r--core/java/android/view/ViewRootImpl.java40
-rw-r--r--core/java/android/view/ViewTreeObserver.java206
-rw-r--r--core/java/android/view/accessibility/AccessibilityNodeInfo.java9
-rw-r--r--core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl30
-rw-r--r--core/java/android/webkit/WebViewClassic.java74
-rw-r--r--core/java/android/widget/AbsListView.java16
-rw-r--r--core/java/android/widget/Switch.java4
-rw-r--r--core/java/android/widget/TextView.java6
-rw-r--r--core/java/com/android/internal/view/menu/ListMenuPresenter.java3
18 files changed, 340 insertions, 244 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 457238a..caade70 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1614,6 +1614,7 @@ public class Notification implements Parcelable
{
private CharSequence mBigContentTitle;
private CharSequence mSummaryText = null;
+ private boolean mSummaryTextSet = false;
protected Builder mBuilder;
@@ -1630,6 +1631,7 @@ public class Notification implements Parcelable
*/
protected void internalSetSummaryText(CharSequence cs) {
mSummaryText = cs;
+ mSummaryTextSet = true;
}
public void setBuilder(Builder builder) {
@@ -1660,9 +1662,13 @@ public class Notification implements Parcelable
contentView.setViewVisibility(R.id.line1, View.VISIBLE);
}
- // The last line defaults to the content text or subtext, but can be replaced by mSummaryText
- if (mSummaryText != null && !mSummaryText.equals("")) {
- contentView.setTextViewText(R.id.text, mSummaryText);
+ // The last line defaults to the subtext, but can be replaced by mSummaryText
+ final CharSequence overflowText =
+ mSummaryTextSet ? mSummaryText
+ : mBuilder.mSubText;
+ if (overflowText != null) {
+ contentView.setTextViewText(R.id.text, overflowText);
+ contentView.setViewVisibility(R.id.overflow_divider, View.VISIBLE);
contentView.setViewVisibility(R.id.line3, View.VISIBLE);
}
@@ -1803,9 +1809,16 @@ public class Notification implements Parcelable
}
private RemoteViews makeBigContentView() {
- // Remove the content text so line3 disappears entirely
+ // Remove the content text so line3 only shows if you have a summary
+ final boolean hadThreeLines = (mBuilder.mContentText != null && mBuilder.mSubText != null);
mBuilder.mContentText = null;
RemoteViews contentView = getStandardView(R.layout.notification_template_big_text);
+
+ if (hadThreeLines) {
+ // vertical centering
+ contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
+ }
+
contentView.setTextViewText(R.id.big_text, mBigText);
contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
contentView.setViewVisibility(R.id.text2, View.GONE);
@@ -1875,7 +1888,10 @@ public class Notification implements Parcelable
}
private RemoteViews makeBigContentView() {
+ // Remove the content text so line3 disappears unless you have a summary
+ mBuilder.mContentText = null;
RemoteViews contentView = getStandardView(R.layout.notification_template_inbox);
+
contentView.setViewVisibility(R.id.text2, View.GONE);
int[] rowIds = {R.id.inbox_text0, R.id.inbox_text1, R.id.inbox_text2, R.id.inbox_text3,
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index bcdd012..6de69b0 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -520,6 +520,14 @@ public abstract class PackageManager {
public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
/**
+ * Installation return code: this is passed to the {@link IPackageInstallObserver} by
+ * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
+ * the new package is assigned a different UID than it previously held.
+ * @hide
+ */
+ public static final int INSTALL_FAILED_UID_CHANGED = -24;
+
+ /**
* Installation parse return code: this is passed to the {@link IPackageInstallObserver} by
* {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
* if the parser was given a path that is not a file, or does not end with the expected
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 679a8ac..b9811c8 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -129,7 +129,7 @@ public class PackageParser {
new PackageParser.SplitPermissionInfo[] {
new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE },
- android.os.Build.VERSION_CODES.CUR_DEVELOPMENT+1),
+ android.os.Build.VERSION_CODES.JELLY_BEAN),
new PackageParser.SplitPermissionInfo(android.Manifest.permission.READ_CONTACTS,
new String[] { android.Manifest.permission.READ_CALL_LOG },
android.os.Build.VERSION_CODES.JELLY_BEAN),
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index 4464d58..8407380 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -637,6 +637,9 @@ public final class NfcAdapter {
* {@link Activity#onDestroy}. This is guaranteed if you call this API
* during {@link Activity#onCreate}.
*
+ * <p class="note">If this device does not support alternate transports
+ * such as Bluetooth or WiFI, calling this method does nothing.
+ *
* <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
*
* @param uris an array of Uri(s) to push over Android Beam
@@ -711,6 +714,9 @@ public final class NfcAdapter {
* {@link Activity#onDestroy}. This is guaranteed if you call this API
* during {@link Activity#onCreate}.
*
+ * <p class="note">If this device does not support alternate transports
+ * such as Bluetooth or WiFI, calling this method does nothing.
+ *
* <p class="note">Requires the {@link android.Manifest.permission#NFC} permission.
*
* @param callback callback, or null to disable
diff --git a/core/java/android/text/style/StyleSpan.java b/core/java/android/text/style/StyleSpan.java
index 8e6147c..deed737 100644
--- a/core/java/android/text/style/StyleSpan.java
+++ b/core/java/android/text/style/StyleSpan.java
@@ -98,6 +98,7 @@ public class StyleSpan extends MetricAffectingSpan implements ParcelableSpan {
}
int fake = want & ~tf.getStyle();
+ fake |= tf.getStyle() & Typeface.BOLD;
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
diff --git a/core/java/android/text/style/TextAppearanceSpan.java b/core/java/android/text/style/TextAppearanceSpan.java
index ecbf4bc..abd02cf 100644
--- a/core/java/android/text/style/TextAppearanceSpan.java
+++ b/core/java/android/text/style/TextAppearanceSpan.java
@@ -235,6 +235,7 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
}
int fake = style & ~tf.getStyle();
+ fake |= tf.getStyle() & Typeface.BOLD;
if ((fake & Typeface.BOLD) != 0) {
ds.setFakeBoldText(true);
diff --git a/core/java/android/text/style/TypefaceSpan.java b/core/java/android/text/style/TypefaceSpan.java
index f194060..3d74ed0 100644
--- a/core/java/android/text/style/TypefaceSpan.java
+++ b/core/java/android/text/style/TypefaceSpan.java
@@ -82,6 +82,7 @@ public class TypefaceSpan extends MetricAffectingSpan implements ParcelableSpan
Typeface tf = Typeface.create(family, oldStyle);
int fake = oldStyle & ~tf.getStyle();
+ fake |= tf.getStyle() & Typeface.BOLD;
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index bd86a8d..29926ca 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -138,18 +138,26 @@ final class AccessibilityInteractionController {
}
public void findAccessibilityNodeInfoByAccessibilityIdClientThread(
- long accessibilityNodeId, int interactionId,
+ long accessibilityNodeId, int windowLeft, int windowTop, int interactionId,
IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID;
message.arg1 = flags;
+
SomeArgs args = mPool.acquire();
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi3 = interactionId;
args.arg1 = callback;
+
+ SomeArgs moreArgs = mPool.acquire();
+ moreArgs.argi1 = windowLeft;
+ moreArgs.argi2 = windowTop;
+ args.arg2 = moreArgs;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -164,13 +172,21 @@ final class AccessibilityInteractionController {
private void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) {
final int flags = message.arg1;
+
SomeArgs args = (SomeArgs) message.obj;
final int accessibilityViewId = args.argi1;
final int virtualDescendantId = args.argi2;
final int interactionId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
+
+ SomeArgs moreArgs = (SomeArgs) args.arg2;
+ mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
+ mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;
+
+ mPool.release(moreArgs);
mPool.release(args);
+
List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
infos.clear();
try {
@@ -200,17 +216,26 @@ final class AccessibilityInteractionController {
}
public void findAccessibilityNodeInfoByViewIdClientThread(long accessibilityNodeId,
- int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int flags, int interrogatingPid, long interrogatingTid) {
+ int viewId, int windowLeft, int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
+ long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_VIEW_ID;
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
+
SomeArgs args = mPool.acquire();
args.argi1 = viewId;
args.argi2 = interactionId;
args.arg1 = callback;
+
+ SomeArgs moreArgs = mPool.acquire();
+ moreArgs.argi1 = windowLeft;
+ moreArgs.argi2 = windowTop;
+ args.arg2 = moreArgs;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -226,12 +251,20 @@ final class AccessibilityInteractionController {
private void findAccessibilityNodeInfoByViewIdUiThread(Message message) {
final int flags = message.arg1;
final int accessibilityViewId = message.arg2;
+
SomeArgs args = (SomeArgs) message.obj;
final int viewId = args.argi1;
final int interactionId = args.argi2;
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
+
+ SomeArgs moreArgs = (SomeArgs) args.arg2;
+ mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
+ mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;
+
+ mPool.release(moreArgs);
mPool.release(args);
+
AccessibilityNodeInfo info = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
@@ -262,18 +295,27 @@ final class AccessibilityInteractionController {
}
public void findAccessibilityNodeInfosByTextClientThread(long accessibilityNodeId,
- String text, int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int flags, int interrogatingPid, long interrogatingTid) {
+ String text, int windowLeft, int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT;
message.arg1 = flags;
+
SomeArgs args = mPool.acquire();
args.arg1 = text;
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi3 = interactionId;
- args.arg2 = callback;
+
+ SomeArgs moreArgs = mPool.acquire();
+ moreArgs.arg1 = callback;
+ moreArgs.argi1 = windowLeft;
+ moreArgs.argi2 = windowTop;
+ args.arg2 = moreArgs;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -288,14 +330,22 @@ final class AccessibilityInteractionController {
private void findAccessibilityNodeInfosByTextUiThread(Message message) {
final int flags = message.arg1;
+
SomeArgs args = (SomeArgs) message.obj;
final String text = (String) args.arg1;
final int accessibilityViewId = args.argi1;
final int virtualDescendantId = args.argi2;
final int interactionId = args.argi3;
+
+ SomeArgs moreArgs = (SomeArgs) args.arg2;
final IAccessibilityInteractionConnectionCallback callback =
- (IAccessibilityInteractionConnectionCallback) args.arg2;
+ (IAccessibilityInteractionConnectionCallback) moreArgs.arg1;
+ mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
+ mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;
+
+ mPool.release(moreArgs);
mPool.release(args);
+
List<AccessibilityNodeInfo> infos = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
@@ -353,19 +403,27 @@ final class AccessibilityInteractionController {
}
}
- public void findFocusClientThread(long accessibilityNodeId, int interactionId, int focusType,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid,
- long interrogatingTid) {
+ public void findFocusClientThread(long accessibilityNodeId, int focusType, int windowLeft,
+ int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
+ int flags, int interogatingPid, long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FIND_FOCUS;
message.arg1 = flags;
message.arg2 = focusType;
+
SomeArgs args = mPool.acquire();
args.argi1 = interactionId;
args.argi2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi3 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.arg1 = callback;
+
+ SomeArgs moreArgs = mPool.acquire();
+ moreArgs.argi1 = windowLeft;
+ moreArgs.argi2 = windowTop;
+ args.arg2 = moreArgs;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -381,13 +439,21 @@ final class AccessibilityInteractionController {
private void findFocusUiThread(Message message) {
final int flags = message.arg1;
final int focusType = message.arg2;
+
SomeArgs args = (SomeArgs) message.obj;
final int interactionId = args.argi1;
final int accessibilityViewId = args.argi2;
final int virtualDescendantId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
+
+ SomeArgs moreArgs = (SomeArgs) args.arg2;
+ mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
+ mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;
+
+ mPool.release(moreArgs);
mPool.release(args);
+
AccessibilityNodeInfo focused = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
@@ -440,19 +506,27 @@ final class AccessibilityInteractionController {
}
}
- public void focusSearchClientThread(long accessibilityNodeId, int interactionId, int direction,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interogatingPid,
- long interrogatingTid) {
+ public void focusSearchClientThread(long accessibilityNodeId, int direction, int windowLeft,
+ int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
+ int flags, int interogatingPid, long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = PrivateHandler.MSG_FOCUS_SEARCH;
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
+
SomeArgs args = mPool.acquire();
args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi2 = direction;
args.argi3 = interactionId;
args.arg1 = callback;
+
+ SomeArgs moreArgs = mPool.acquire();
+ moreArgs.argi1 = windowLeft;
+ moreArgs.argi2 = windowTop;
+ args.arg2 = moreArgs;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -468,13 +542,21 @@ final class AccessibilityInteractionController {
private void focusSearchUiThread(Message message) {
final int flags = message.arg1;
final int accessibilityViewId = message.arg2;
+
SomeArgs args = (SomeArgs) message.obj;
final int virtualDescendantId = args.argi1;
final int direction = args.argi2;
final int interactionId = args.argi3;
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
+
+ SomeArgs moreArgs = (SomeArgs) args.arg2;
+ mViewRootImpl.mAttachInfo.mActualWindowLeft = moreArgs.argi1;
+ mViewRootImpl.mAttachInfo.mActualWindowTop = moreArgs.argi2;
+
+ mPool.release(moreArgs);
mPool.release(args);
+
AccessibilityNodeInfo next = null;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
@@ -541,13 +623,16 @@ final class AccessibilityInteractionController {
message.what = PrivateHandler.MSG_PERFORM_ACCESSIBILITY_ACTION;
message.arg1 = flags;
message.arg2 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
+
SomeArgs args = mPool.acquire();
args.argi1 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
args.argi2 = action;
args.argi3 = interactionId;
args.arg1 = callback;
args.arg2 = arguments;
+
message.obj = args;
+
// If the interrogation is performed by the same thread as the main UI
// thread in this process, set the message as a static reference so
// after this call completes the same thread but in the interrogating
@@ -563,6 +648,7 @@ final class AccessibilityInteractionController {
private void perfromAccessibilityActionUiThread(Message message) {
final int flags = message.arg1;
final int accessibilityViewId = message.arg2;
+
SomeArgs args = (SomeArgs) message.obj;
final int virtualDescendantId = args.argi1;
final int action = args.argi2;
@@ -570,7 +656,9 @@ final class AccessibilityInteractionController {
final IAccessibilityInteractionConnectionCallback callback =
(IAccessibilityInteractionConnectionCallback) args.arg1;
Bundle arguments = (Bundle) args.arg2;
+
mPool.release(args);
+
boolean succeeded = false;
try {
if (mViewRootImpl.mView == null || mViewRootImpl.mAttachInfo == null) {
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 0a2b76c..f005eeb 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -3609,6 +3609,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
case R.styleable.View_importantForAccessibility:
setImportantForAccessibility(a.getInt(attr,
IMPORTANT_FOR_ACCESSIBILITY_DEFAULT));
+ break;
}
}
@@ -4902,6 +4903,30 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
}
/**
+ * Returns the delta between the actual and last reported window left.
+ *
+ * @hide
+ */
+ public int getActualAndReportedWindowLeftDelta() {
+ if (mAttachInfo != null) {
+ return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft;
+ }
+ return 0;
+ }
+
+ /**
+ * Returns the delta between the actual and last reported window top.
+ *
+ * @hide
+ */
+ public int getActualAndReportedWindowTopDelta() {
+ if (mAttachInfo != null) {
+ return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop;
+ }
+ return 0;
+ }
+
+ /**
* Computes whether this view is visible to the user. Such a view is
* attached, visible, all its predecessors are visible, it is not clipped
* entirely by its predecessors, and has an alpha greater than zero.
@@ -17307,6 +17332,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
int mWindowTop;
/**
+ * Left actual position of this view's window.
+ *
+ * TODO: This is a workaround for 6623031. Remove when fixed.
+ */
+ int mActualWindowLeft;
+
+ /**
+ * Actual top position of this view's window.
+ *
+ * TODO: This is a workaround for 6623031. Remove when fixed.
+ */
+ int mActualWindowTop;
+
+ /**
* Indicates whether views need to use 32-bit drawing caches
*/
boolean mUse32BitDrawingCache;
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 3138692..b5fff8a 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -5172,13 +5172,15 @@ public final class ViewRootImpl implements ViewParent,
@Override
public void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId,
- int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int flags, int interrogatingPid, long interrogatingTid) {
+ int windowLeft, int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
.findAccessibilityNodeInfoByAccessibilityIdClientThread(accessibilityNodeId,
- interactionId, callback, flags, interrogatingPid, interrogatingTid);
+ windowLeft, windowTop, interactionId, callback, flags, interrogatingPid,
+ interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
@@ -5211,13 +5213,15 @@ public final class ViewRootImpl implements ViewParent,
@Override
public void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId,
- int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int flags, int interrogatingPid, long interrogatingTid) {
+ int windowLeft, int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
.findAccessibilityNodeInfoByViewIdClientThread(accessibilityNodeId, viewId,
- interactionId, callback, flags, interrogatingPid, interrogatingTid);
+ windowLeft, windowTop, interactionId, callback, flags, interrogatingPid,
+ interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
@@ -5230,13 +5234,15 @@ public final class ViewRootImpl implements ViewParent,
@Override
public void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text,
- int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int flags, int interrogatingPid, long interrogatingTid) {
+ int windowLeft, int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
.findAccessibilityNodeInfosByTextClientThread(accessibilityNodeId, text,
- interactionId, callback, flags, interrogatingPid, interrogatingTid);
+ windowLeft, windowTop, interactionId, callback, flags, interrogatingPid,
+ interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
@@ -5248,14 +5254,15 @@ public final class ViewRootImpl implements ViewParent,
}
@Override
- public void findFocus(long accessibilityNodeId, int interactionId, int focusType,
- IAccessibilityInteractionConnectionCallback callback, int flags,
+ public void findFocus(long accessibilityNodeId, int focusType, int windowLeft,
+ int windowTop, int interactionId,
+ IAccessibilityInteractionConnectionCallback callback, int flags,
int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
- .findFocusClientThread(accessibilityNodeId, interactionId, focusType,
- callback, flags, interrogatingPid, interrogatingTid);
+ .findFocusClientThread(accessibilityNodeId, focusType, windowLeft, windowTop,
+ interactionId, callback, flags, interrogatingPid, interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
@@ -5267,14 +5274,15 @@ public final class ViewRootImpl implements ViewParent,
}
@Override
- public void focusSearch(long accessibilityNodeId, int interactionId, int direction,
+ public void focusSearch(long accessibilityNodeId, int direction, int windowLeft,
+ int windowTop, int interactionId,
IAccessibilityInteractionConnectionCallback callback, int flags,
int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
- .focusSearchClientThread(accessibilityNodeId, interactionId, direction,
- callback, flags, interrogatingPid, interrogatingTid);
+ .focusSearchClientThread(accessibilityNodeId, direction, windowLeft, windowTop,
+ interactionId, callback, flags, interrogatingPid, interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java
index 6a8a60a..1c5d436 100644
--- a/core/java/android/view/ViewTreeObserver.java
+++ b/core/java/android/view/ViewTreeObserver.java
@@ -20,6 +20,7 @@ import android.graphics.Rect;
import android.graphics.Region;
import java.util.ArrayList;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* A view tree observer is used to register listeners that can be notified of global
@@ -31,12 +32,12 @@ import java.util.ArrayList;
* for more information.
*/
public final class ViewTreeObserver {
- private CopyOnWriteArray<OnGlobalFocusChangeListener> mOnGlobalFocusListeners;
- private CopyOnWriteArray<OnGlobalLayoutListener> mOnGlobalLayoutListeners;
- private CopyOnWriteArray<OnTouchModeChangeListener> mOnTouchModeChangeListeners;
- private CopyOnWriteArray<OnComputeInternalInsetsListener> mOnComputeInternalInsetsListeners;
- private CopyOnWriteArray<OnScrollChangedListener> mOnScrollChangedListeners;
- private CopyOnWriteArray<OnPreDrawListener> mOnPreDrawListeners;
+ private CopyOnWriteArrayList<OnGlobalFocusChangeListener> mOnGlobalFocusListeners;
+ private CopyOnWriteArrayList<OnGlobalLayoutListener> mOnGlobalLayoutListeners;
+ private CopyOnWriteArrayList<OnTouchModeChangeListener> mOnTouchModeChangeListeners;
+ private CopyOnWriteArrayList<OnComputeInternalInsetsListener> mOnComputeInternalInsetsListeners;
+ private CopyOnWriteArrayList<OnScrollChangedListener> mOnScrollChangedListeners;
+ private ArrayList<OnPreDrawListener> mOnPreDrawListeners;
private ArrayList<OnDrawListener> mOnDrawListeners;
private boolean mAlive = true;
@@ -146,7 +147,7 @@ public final class ViewTreeObserver {
* windows behind it should be placed.
*/
public final Rect contentInsets = new Rect();
-
+
/**
* Offsets from the frame of the window at which windows behind it
* are visible.
@@ -165,13 +166,13 @@ public final class ViewTreeObserver {
* can be touched.
*/
public static final int TOUCHABLE_INSETS_FRAME = 0;
-
+
/**
* Option for {@link #setTouchableInsets(int)}: the area inside of
* the content insets can be touched.
*/
public static final int TOUCHABLE_INSETS_CONTENT = 1;
-
+
/**
* Option for {@link #setTouchableInsets(int)}: the area inside of
* the visible insets can be touched.
@@ -194,7 +195,7 @@ public final class ViewTreeObserver {
}
int mTouchableInsets;
-
+
void reset() {
contentInsets.setEmpty();
visibleInsets.setEmpty();
@@ -230,7 +231,7 @@ public final class ViewTreeObserver {
mTouchableInsets = other.mTouchableInsets;
}
}
-
+
/**
* Interface definition for a callback to be invoked when layout has
* completed and the client can compute its interior insets.
@@ -327,7 +328,7 @@ public final class ViewTreeObserver {
checkIsAlive();
if (mOnGlobalFocusListeners == null) {
- mOnGlobalFocusListeners = new CopyOnWriteArray<OnGlobalFocusChangeListener>();
+ mOnGlobalFocusListeners = new CopyOnWriteArrayList<OnGlobalFocusChangeListener>();
}
mOnGlobalFocusListeners.add(listener);
@@ -362,7 +363,7 @@ public final class ViewTreeObserver {
checkIsAlive();
if (mOnGlobalLayoutListeners == null) {
- mOnGlobalLayoutListeners = new CopyOnWriteArray<OnGlobalLayoutListener>();
+ mOnGlobalLayoutListeners = new CopyOnWriteArrayList<OnGlobalLayoutListener>();
}
mOnGlobalLayoutListeners.add(listener);
@@ -412,7 +413,7 @@ public final class ViewTreeObserver {
checkIsAlive();
if (mOnPreDrawListeners == null) {
- mOnPreDrawListeners = new CopyOnWriteArray<OnPreDrawListener>();
+ mOnPreDrawListeners = new ArrayList<OnPreDrawListener>();
}
mOnPreDrawListeners.add(listener);
@@ -484,7 +485,7 @@ public final class ViewTreeObserver {
checkIsAlive();
if (mOnScrollChangedListeners == null) {
- mOnScrollChangedListeners = new CopyOnWriteArray<OnScrollChangedListener>();
+ mOnScrollChangedListeners = new CopyOnWriteArrayList<OnScrollChangedListener>();
}
mOnScrollChangedListeners.add(listener);
@@ -518,7 +519,7 @@ public final class ViewTreeObserver {
checkIsAlive();
if (mOnTouchModeChangeListeners == null) {
- mOnTouchModeChangeListeners = new CopyOnWriteArray<OnTouchModeChangeListener>();
+ mOnTouchModeChangeListeners = new CopyOnWriteArrayList<OnTouchModeChangeListener>();
}
mOnTouchModeChangeListeners.add(listener);
@@ -557,7 +558,7 @@ public final class ViewTreeObserver {
if (mOnComputeInternalInsetsListeners == null) {
mOnComputeInternalInsetsListeners =
- new CopyOnWriteArray<OnComputeInternalInsetsListener>();
+ new CopyOnWriteArrayList<OnComputeInternalInsetsListener>();
}
mOnComputeInternalInsetsListeners.add(listener);
@@ -621,16 +622,10 @@ public final class ViewTreeObserver {
// perform the dispatching. The iterator is a safe guard against listeners that
// could mutate the list by calling the various add/remove methods. This prevents
// the array from being modified while we iterate it.
- final CopyOnWriteArray<OnGlobalFocusChangeListener> listeners = mOnGlobalFocusListeners;
+ final CopyOnWriteArrayList<OnGlobalFocusChangeListener> listeners = mOnGlobalFocusListeners;
if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnGlobalFocusChangeListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- access.get(i).onGlobalFocusChanged(oldFocus, newFocus);
- }
- } finally {
- listeners.end();
+ for (OnGlobalFocusChangeListener listener : listeners) {
+ listener.onGlobalFocusChanged(oldFocus, newFocus);
}
}
}
@@ -645,16 +640,10 @@ public final class ViewTreeObserver {
// perform the dispatching. The iterator is a safe guard against listeners that
// could mutate the list by calling the various add/remove methods. This prevents
// the array from being modified while we iterate it.
- final CopyOnWriteArray<OnGlobalLayoutListener> listeners = mOnGlobalLayoutListeners;
+ final CopyOnWriteArrayList<OnGlobalLayoutListener> listeners = mOnGlobalLayoutListeners;
if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnGlobalLayoutListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- access.get(i).onGlobalLayout();
- }
- } finally {
- listeners.end();
+ for (OnGlobalLayoutListener listener : listeners) {
+ listener.onGlobalLayout();
}
}
}
@@ -669,17 +658,17 @@ public final class ViewTreeObserver {
*/
@SuppressWarnings("unchecked")
public final boolean dispatchOnPreDraw() {
+ // NOTE: we *must* clone the listener list to perform the dispatching.
+ // The clone is a safe guard against listeners that
+ // could mutate the list by calling the various add/remove methods. This prevents
+ // the array from being modified while we process it.
boolean cancelDraw = false;
- final CopyOnWriteArray<OnPreDrawListener> listeners = mOnPreDrawListeners;
- if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnPreDrawListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- cancelDraw |= !(access.get(i).onPreDraw());
- }
- } finally {
- listeners.end();
+ if (mOnPreDrawListeners != null && mOnPreDrawListeners.size() > 0) {
+ final ArrayList<OnPreDrawListener> listeners =
+ (ArrayList<OnPreDrawListener>) mOnPreDrawListeners.clone();
+ int numListeners = listeners.size();
+ for (int i = 0; i < numListeners; ++i) {
+ cancelDraw |= !(listeners.get(i).onPreDraw());
}
}
return cancelDraw;
@@ -704,17 +693,11 @@ public final class ViewTreeObserver {
* @param inTouchMode True if the touch mode is now enabled, false otherwise.
*/
final void dispatchOnTouchModeChanged(boolean inTouchMode) {
- final CopyOnWriteArray<OnTouchModeChangeListener> listeners =
+ final CopyOnWriteArrayList<OnTouchModeChangeListener> listeners =
mOnTouchModeChangeListeners;
if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnTouchModeChangeListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- access.get(i).onTouchModeChanged(inTouchMode);
- }
- } finally {
- listeners.end();
+ for (OnTouchModeChangeListener listener : listeners) {
+ listener.onTouchModeChanged(inTouchMode);
}
}
}
@@ -727,16 +710,10 @@ public final class ViewTreeObserver {
// perform the dispatching. The iterator is a safe guard against listeners that
// could mutate the list by calling the various add/remove methods. This prevents
// the array from being modified while we iterate it.
- final CopyOnWriteArray<OnScrollChangedListener> listeners = mOnScrollChangedListeners;
+ final CopyOnWriteArrayList<OnScrollChangedListener> listeners = mOnScrollChangedListeners;
if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnScrollChangedListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- access.get(i).onScrollChanged();
- }
- } finally {
- listeners.end();
+ for (OnScrollChangedListener listener : listeners) {
+ listener.onScrollChanged();
}
}
}
@@ -745,11 +722,11 @@ public final class ViewTreeObserver {
* Returns whether there are listeners for computing internal insets.
*/
final boolean hasComputeInternalInsetsListeners() {
- final CopyOnWriteArray<OnComputeInternalInsetsListener> listeners =
+ final CopyOnWriteArrayList<OnComputeInternalInsetsListener> listeners =
mOnComputeInternalInsetsListeners;
return (listeners != null && listeners.size() > 0);
}
-
+
/**
* Calls all listeners to compute the current insets.
*/
@@ -758,105 +735,12 @@ public final class ViewTreeObserver {
// perform the dispatching. The iterator is a safe guard against listeners that
// could mutate the list by calling the various add/remove methods. This prevents
// the array from being modified while we iterate it.
- final CopyOnWriteArray<OnComputeInternalInsetsListener> listeners =
+ final CopyOnWriteArrayList<OnComputeInternalInsetsListener> listeners =
mOnComputeInternalInsetsListeners;
if (listeners != null && listeners.size() > 0) {
- CopyOnWriteArray.Access<OnComputeInternalInsetsListener> access = listeners.start();
- try {
- int count = access.size();
- for (int i = 0; i < count; i++) {
- access.get(i).onComputeInternalInsets(inoutInfo);
- }
- } finally {
- listeners.end();
- }
- }
- }
-
- /**
- * Copy on write array. This array is not thread safe, and only one loop can
- * iterate over this array at any given time. This class avoids allocations
- * until a concurrent modification happens.
- *
- * Usage:
- *
- * CopyOnWriteArray.Access<MyData> access = array.start();
- * try {
- * for (int i = 0; i < access.size(); i++) {
- * MyData d = access.get(i);
- * }
- * } finally {
- * access.end();
- * }
- */
- static class CopyOnWriteArray<T> {
- private ArrayList<T> mData = new ArrayList<T>();
- private ArrayList<T> mDataCopy;
-
- private final Access<T> mAccess = new Access<T>();
-
- private boolean mStart;
-
- static class Access<T> {
- private ArrayList<T> mData;
- private int mSize;
-
- T get(int index) {
- return mData.get(index);
+ for (OnComputeInternalInsetsListener listener : listeners) {
+ listener.onComputeInternalInsets(inoutInfo);
}
-
- int size() {
- return mSize;
- }
- }
-
- CopyOnWriteArray() {
- }
-
- private ArrayList<T> getArray() {
- if (mStart) {
- if (mDataCopy == null) mDataCopy = new ArrayList<T>(mData);
- return mDataCopy;
- }
- return mData;
- }
-
- Access<T> start() {
- if (mStart) throw new IllegalStateException("Iteration already started");
- mStart = true;
- mDataCopy = null;
- mAccess.mData = mData;
- mAccess.mSize = mData.size();
- return mAccess;
- }
-
- void end() {
- if (!mStart) throw new IllegalStateException("Iteration not started");
- mStart = false;
- if (mDataCopy != null) {
- mData = mDataCopy;
- }
- mDataCopy = null;
- }
-
- int size() {
- return getArray().size();
- }
-
- void add(T item) {
- getArray().add(item);
- }
-
- void addAll(CopyOnWriteArray<T> array) {
- getArray().addAll(array.mData);
- }
-
- void remove(T item) {
- getArray().remove(item);
- }
-
- void clear() {
- getArray().clear();
}
}
}
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index d3c9055..3834fd6 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -382,6 +382,10 @@ public class AccessibilityNodeInfo implements Parcelable {
private int mConnectionId = UNDEFINED;
+ // TODO: These are a workaround for 6623031. Remove when fixed.
+ private int mActualAndReportedWindowLeftDelta;
+ private int mActualAndReportedWindowTopDelta;
+
/**
* Hide constructor from clients.
*/
@@ -428,6 +432,10 @@ public class AccessibilityNodeInfo implements Parcelable {
final int rootAccessibilityViewId =
(root != null) ? root.getAccessibilityViewId() : UNDEFINED;
mSourceNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
+ if (root != null) {
+ mActualAndReportedWindowLeftDelta = root.getActualAndReportedWindowLeftDelta();
+ mActualAndReportedWindowTopDelta = root.getActualAndReportedWindowTopDelta();
+ }
}
/**
@@ -831,6 +839,7 @@ public class AccessibilityNodeInfo implements Parcelable {
public void setBoundsInScreen(Rect bounds) {
enforceNotSealed();
mBoundsInScreen.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
+ mBoundsInScreen.offset(mActualAndReportedWindowLeftDelta, mActualAndReportedWindowTopDelta);
}
/**
diff --git a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
index 9d7a928..292702a 100644
--- a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
+++ b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
@@ -28,25 +28,25 @@ import android.view.accessibility.IAccessibilityInteractionConnectionCallback;
*/
oneway interface IAccessibilityInteractionConnection {
- void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
- long interrogatingTid);
+ void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int windowLeft,
+ int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
+ int flags, int interrogatingPid, long interrogatingTid);
- void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int id, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
- long interrogatingTid);
+ void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int viewId, int windowLeft,
+ int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
+ int flags, int interrogatingPid, long interrogatingTid);
- void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
- long interrogatingTid);
+ void findAccessibilityNodeInfosByText(long accessibilityNodeId, String text, int windowLeft,
+ int windowTop, int interactionId, IAccessibilityInteractionConnectionCallback callback,
+ int flags, int interrogatingPid, long interrogatingTid);
- void findFocus(long accessibilityNodeId, int interactionId, int focusType,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
- long interrogatingTid);
+ void findFocus(long accessibilityNodeId, int focusType, int windowLeft, int windowTop,
+ int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid);
- void focusSearch(long accessibilityNodeId, int interactionId, int direction,
- IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid,
- long interrogatingTid);
+ void focusSearch(long accessibilityNodeId, int direction, int windowLeft, int windowTop,
+ int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags,
+ int interrogatingPid, long interrogatingTid);
void performAccessibilityAction(long accessibilityNodeId, int action, in Bundle arguments,
int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags,
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index d1da53b..611742b 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -2065,31 +2065,31 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
*/
@Override
public void destroy() {
- destroyImpl();
- }
-
- private void destroyImpl() {
- ViewRootImpl viewRoot = mWebView.getViewRootImpl();
- if (viewRoot != null) {
+ if (mWebView.getViewRootImpl() != null) {
Log.e(LOGTAG, "Error: WebView.destroy() called while still attached!");
}
+ ensureFunctorDetached();
+ destroyJava();
+ destroyNative();
+ }
+ private void ensureFunctorDetached() {
if (mWebView.isHardwareAccelerated()) {
int drawGLFunction = nativeGetDrawGLFunction(mNativeClass);
+ ViewRootImpl viewRoot = mWebView.getViewRootImpl();
if (drawGLFunction != 0 && viewRoot != null) {
- // functor should have been detached in onDetachedFromWindow, do
- // additionally here for safety
viewRoot.detachFunctor(drawGLFunction);
}
}
+ }
+ private void destroyJava() {
mCallbackProxy.blockMessages();
clearHelpers();
if (mListBoxDialog != null) {
mListBoxDialog.dismiss();
mListBoxDialog = null;
}
- if (mNativeClass != 0) nativeStopGL();
if (mWebViewCore != null) {
// Tell WebViewCore to destroy itself
synchronized (this) {
@@ -2100,12 +2100,36 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
// Remove any pending messages that might not be serviced yet.
mPrivateHandler.removeCallbacksAndMessages(null);
}
- if (mNativeClass != 0) {
- nativeDestroy();
- mNativeClass = 0;
+ }
+
+ private void destroyNative() {
+ if (mNativeClass == 0) return;
+ int nptr = mNativeClass;
+ mNativeClass = 0;
+ if (Thread.currentThread() == mPrivateHandler.getLooper().getThread()) {
+ // We are on the main thread and can safely delete
+ nativeDestroy(nptr);
+ } else {
+ mPrivateHandler.post(new DestroyNativeRunnable(nptr));
}
}
+ private static class DestroyNativeRunnable implements Runnable {
+
+ private int mNativePtr;
+
+ public DestroyNativeRunnable(int nativePtr) {
+ mNativePtr = nativePtr;
+ }
+
+ @Override
+ public void run() {
+ // nativeDestroy also does a stopGL()
+ nativeDestroy(mNativePtr);
+ }
+
+ }
+
/**
* See {@link WebView#enablePlatformNotifications()}
*/
@@ -4099,14 +4123,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
@Override
protected void finalize() throws Throwable {
try {
- if (mNativeClass != 0) {
- mPrivateHandler.post(new Runnable() {
- @Override
- public void run() {
- destroy();
- }
- });
- }
+ destroy();
} finally {
super.finalize();
}
@@ -5313,13 +5330,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
updateHwAccelerated();
- if (mWebView.isHardwareAccelerated()) {
- int drawGLFunction = nativeGetDrawGLFunction(mNativeClass);
- ViewRootImpl viewRoot = mWebView.getViewRootImpl();
- if (drawGLFunction != 0 && viewRoot != null) {
- viewRoot.detachFunctor(drawGLFunction);
- }
- }
+ ensureFunctorDetached();
}
@Override
@@ -6224,8 +6235,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
final int resultY = Math.max(0,
Math.min(mScrollingLayerRect.top + contentY, maxY));
- if (resultX != mScrollingLayerRect.left ||
- resultY != mScrollingLayerRect.top) {
+ if (resultX != mScrollingLayerRect.left
+ || resultY != mScrollingLayerRect.top
+ || (contentX | contentY) == 0) {
// In case we switched to dragging the page.
mTouchMode = TOUCH_DRAG_LAYER_MODE;
deltaX = contentX;
@@ -8507,7 +8519,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
private native void nativeCreate(int ptr, String drawableDir, boolean isHighEndGfx);
private native void nativeDebugDump();
- private native void nativeDestroy();
+ private static native void nativeDestroy(int ptr);
private native void nativeDraw(Canvas canvas, RectF visibleRect,
int color, int extra);
@@ -8526,7 +8538,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
private native int nativeGetBaseLayer(int nativeInstance);
private native void nativeCopyBaseContentToPicture(Picture pict);
private native boolean nativeHasContent();
- private native void nativeStopGL();
+ private native void nativeStopGL(int ptr);
private native void nativeDiscardAllTextures();
private native void nativeTileProfilingStart();
private native float nativeTileProfilingStop();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 2fa477c..19aef8e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3351,6 +3351,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mPositionScroller.stop();
}
+ if (!mIsAttached) {
+ // Something isn't right.
+ // Since we rely on being attached to get data set change notifications,
+ // don't risk doing anything where we might try to resync and find things
+ // in a bogus state.
+ return false;
+ }
+
if (mFastScroller != null) {
boolean intercepted = mFastScroller.onTouchEvent(ev);
if (intercepted) {
@@ -3846,6 +3854,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mPositionScroller.stop();
}
+ if (!mIsAttached) {
+ // Something isn't right.
+ // Since we rely on being attached to get data set change notifications,
+ // don't risk doing anything where we might try to resync and find things
+ // in a bogus state.
+ return false;
+ }
+
if (mFastScroller != null) {
boolean intercepted = mFastScroller.onInterceptTouchEvent(ev);
if (intercepted) {
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 471f259..39bc7c2 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -259,10 +259,12 @@ public class Switch extends CompoundButton {
// now compute what (if any) algorithmic styling is needed
int typefaceStyle = tf != null ? tf.getStyle() : 0;
int need = style & ~typefaceStyle;
+ need |= typefaceStyle & Typeface.BOLD;
mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0);
mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
} else {
- mTextPaint.setFakeBoldText(false);
+ int typefaceStyle = tf != null ? tf.getStyle() : 0;
+ mTextPaint.setFakeBoldText((typefaceStyle & Typeface.BOLD) != 0);
mTextPaint.setTextSkewX(0);
setSwitchTypeface(tf);
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 131b075..464a527 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -1237,10 +1237,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// now compute what (if any) algorithmic styling is needed
int typefaceStyle = tf != null ? tf.getStyle() : 0;
int need = style & ~typefaceStyle;
+ need |= typefaceStyle & Typeface.BOLD; // keep bold in
mTextPaint.setFakeBoldText((need & Typeface.BOLD) != 0);
mTextPaint.setTextSkewX((need & Typeface.ITALIC) != 0 ? -0.25f : 0);
} else {
- mTextPaint.setFakeBoldText(false);
+ int typefaceStyle = tf != null ? tf.getStyle() : 0;
+ mTextPaint.setFakeBoldText((typefaceStyle & Typeface.BOLD) != 0);
mTextPaint.setTextSkewX(0);
setTypeface(tf);
}
@@ -4656,7 +4658,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// mInputType should already be EditorInfo.TYPE_NULL and mInput should be null
setMovementMethod(selectable ? ArrowKeyMovementMethod.getInstance() : null);
- setText(getText(), selectable ? BufferType.SPANNABLE : BufferType.NORMAL);
+ setText(mText, selectable ? BufferType.SPANNABLE : BufferType.NORMAL);
// Called by setText above, but safer in case of future code changes
mEditor.prepareCursorControllers();
diff --git a/core/java/com/android/internal/view/menu/ListMenuPresenter.java b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
index b3e2d27..4882adc 100644
--- a/core/java/com/android/internal/view/menu/ListMenuPresenter.java
+++ b/core/java/com/android/internal/view/menu/ListMenuPresenter.java
@@ -88,6 +88,9 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
}
}
mMenu = menu;
+ if (mAdapter != null) {
+ mAdapter.notifyDataSetChanged();
+ }
}
@Override