Merge "Adding APIs for setting whether to show week number and setting the start day of week. Cleaned up the code a bit."
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index da1aac4..d034229 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -201,6 +201,7 @@
} catch (RemoteException e) {
return null;
} catch (java.lang.Exception e) {
+ Log.w(TAG, "Failed to get type for: " + url + " (" + e.getMessage() + ")");
return null;
} finally {
releaseProvider(provider);
@@ -216,6 +217,9 @@
return type;
} catch (RemoteException e) {
return null;
+ } catch (java.lang.Exception e) {
+ Log.w(TAG, "Failed to get type for: " + url + " (" + e.getMessage() + ")");
+ return null;
}
}
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java
index 0ad80dd..f750122 100644
--- a/core/java/android/net/Proxy.java
+++ b/core/java/android/net/Proxy.java
@@ -65,7 +65,9 @@
* that either the default connection or its proxy has changed.
* The intent will have the following extra value:</p>
* <ul>
- * <li><em>EXTRA_PROXY_INFO</em> - The ProxyProperties for the proxy
+ * <li><em>EXTRA_PROXY_INFO</em> - The ProxyProperties for the proxy. Non-null,
+ * though if the proxy is undefined the host string
+ * will be empty.
* </ul>
*
* <p class="note">This is a protected intent that can only be sent by the system
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 33ea66c..b3e0f18 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5445,7 +5445,7 @@
// Figure out if we need to update the pivot point
if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
- if ((mRight - mLeft) != mPrevWidth && (mBottom - mTop) != mPrevHeight) {
+ if ((mRight - mLeft) != mPrevWidth || (mBottom - mTop) != mPrevHeight) {
mPrevWidth = mRight - mLeft;
mPrevHeight = mBottom - mTop;
mPivotX = (float) mPrevWidth / 2f;
@@ -5827,6 +5827,10 @@
onSizeChanged(width, mBottom - mTop, width, oldHeight);
if (!mMatrixIsIdentity) {
+ if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
+ // A change in dimension means an auto-centered pivot point changes, too
+ mMatrixDirty = true;
+ }
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate();
}
@@ -5880,6 +5884,10 @@
onSizeChanged(width, mBottom - mTop, width, oldHeight);
if (!mMatrixIsIdentity) {
+ if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
+ // A change in dimension means an auto-centered pivot point changes, too
+ mMatrixDirty = true;
+ }
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate();
}
@@ -5936,6 +5944,10 @@
onSizeChanged(mRight - mLeft, height, oldWidth, height);
if (!mMatrixIsIdentity) {
+ if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
+ // A change in dimension means an auto-centered pivot point changes, too
+ mMatrixDirty = true;
+ }
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate();
}
@@ -5989,6 +6001,10 @@
onSizeChanged(mRight - mLeft, height, oldWidth, height);
if (!mMatrixIsIdentity) {
+ if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
+ // A change in dimension means an auto-centered pivot point changes, too
+ mMatrixDirty = true;
+ }
mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
invalidate();
}
@@ -8691,6 +8707,10 @@
int newHeight = bottom - top;
if (newWidth != oldWidth || newHeight != oldHeight) {
+ if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
+ // A change in dimension means an auto-centered pivot point changes, too
+ mMatrixDirty = true;
+ }
onSizeChanged(newWidth, newHeight, oldWidth, oldHeight);
}
@@ -8698,7 +8718,7 @@
// If we are visible, force the DRAWN bit to on so that
// this invalidate will go through (at least to our parent).
// This is because someone may have invalidated this view
- // before this call to setFrame came in, therby clearing
+ // before this call to setFrame came in, thereby clearing
// the DRAWN bit.
mPrivateFlags |= DRAWN;
invalidate();
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index bb18270..cf447db 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -238,7 +238,8 @@
}
}
- if ((mSingle && KeyEvent.KEYCODE_ENTER == keyCode)) {
+ if (mSingle && (KeyEvent.KEYCODE_ENTER == keyCode
+ || KeyEvent.KEYCODE_NUMPAD_ENTER == keyCode)) {
if (isPopupShowing()) {
return super.dispatchKeyEvent(event);
}
@@ -296,7 +297,8 @@
// so do not pass down to javascript, and instead
// return true. If it is an arrow key or a delete key, we can go
// ahead and pass it down.
- if (KeyEvent.KEYCODE_ENTER == keyCode) {
+ if (KeyEvent.KEYCODE_ENTER == keyCode
+ || KeyEvent.KEYCODE_NUMPAD_ENTER == keyCode) {
// For multi-line text boxes, newlines will
// trigger onTextChanged for key down (which will send both
// key up and key down) but not key up.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 9eecdc1..5b24c50 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -4471,10 +4471,17 @@
return false;
}
+ private boolean isEnterActionKey(int keyCode) {
+ return keyCode == KeyEvent.KEYCODE_DPAD_CENTER
+ || keyCode == KeyEvent.KEYCODE_ENTER
+ || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER;
+ }
+
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "keyDown at " + System.currentTimeMillis()
+ + "keyCode=" + keyCode
+ ", " + event + ", unicode=" + event.getUnicodeChar());
}
@@ -4543,7 +4550,7 @@
return false;
}
- if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
+ if (isEnterActionKey(keyCode)) {
switchOutDrawHistory();
if (event.getRepeatCount() == 0) {
if (mSelectingText) {
@@ -4672,7 +4679,7 @@
return false;
}
- if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
+ if (isEnterActionKey(keyCode)) {
// remove the long press message first
mPrivateHandler.removeMessages(LONG_PRESS_CENTER);
mGotCenterDown = false;
@@ -5464,8 +5471,10 @@
} else {
// TODO: allow scrollable overflow div to autoscroll
}
- nativeExtendSelection(contentX, contentY);
- invalidate();
+ if (deltaX != 0 || deltaY != 0) {
+ nativeExtendSelection(contentX, contentY);
+ invalidate();
+ }
break;
}
diff --git a/core/java/com/android/internal/app/LocalePicker.java b/core/java/com/android/internal/app/LocalePicker.java
index 6f6b40b..e32c62d 100644
--- a/core/java/com/android/internal/app/LocalePicker.java
+++ b/core/java/com/android/internal/app/LocalePicker.java
@@ -82,6 +82,11 @@
* {@link LocaleInfo#label}.
*/
public static ArrayAdapter<LocaleInfo> constructAdapter(Context context) {
+ return constructAdapter(context, R.layout.locale_picker_item, R.id.locale);
+ }
+
+ public static ArrayAdapter<LocaleInfo> constructAdapter(Context context,
+ int layoutId, int fieldId) {
final Resources resources = context.getResources();
final String[] locales = context.getAssets().getLocales();
final String[] specialLocaleCodes = resources.getStringArray(R.array.special_locale_codes);
@@ -149,8 +154,6 @@
localeInfos[i] = preprocess[i];
}
Arrays.sort(localeInfos);
- final int layoutId = R.layout.locale_picker_item;
- final int fieldId = R.id.locale;
return new ArrayAdapter<LocaleInfo>(context, layoutId, fieldId, localeInfos);
}
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index f329ac4..d57f2c9 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -619,7 +619,10 @@
status_t Parcel::writeString8(const String8& str)
{
status_t err = writeInt32(str.bytes());
- if (err == NO_ERROR) {
+ // only write string if its length is more than zero characters,
+ // as readString8 will only read if the length field is non-zero.
+ // this is slightly different from how writeString16 works.
+ if (str.bytes() > 0 && err == NO_ERROR) {
err = write(str.string(), str.bytes()+1);
}
return err;
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index feb7b63..a84ba78 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -2154,6 +2154,7 @@
}
private void sendProxyBroadcast(ProxyProperties proxy) {
+ if (proxy == null) proxy = new ProxyProperties("", 0, "");
log("sending Proxy Broadcast for " + proxy);
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java
index 859c85c..997e750 100644
--- a/services/java/com/android/server/WallpaperManagerService.java
+++ b/services/java/com/android/server/WallpaperManagerService.java
@@ -587,6 +587,8 @@
mIWindowManager.removeWindowToken(mWallpaperConnection.mToken);
} catch (RemoteException e) {
}
+ mWallpaperConnection.mService = null;
+ mWallpaperConnection.mEngine = null;
mWallpaperConnection = null;
}
}