diff options
5 files changed, 36 insertions, 35 deletions
diff --git a/core/java/android/text/method/Touch.java b/core/java/android/text/method/Touch.java index 3f9b94563a0b..106a80190b36 100644 --- a/core/java/android/text/method/Touch.java +++ b/core/java/android/text/method/Touch.java @@ -35,44 +35,39 @@ public class Touch { * Y position. */ public static void scrollTo(TextView widget, Layout layout, int x, int y) { - int padding = widget.getTotalPaddingTop() + - widget.getTotalPaddingBottom(); - int top = layout.getLineForVertical(y); - int bottom = layout.getLineForVertical(y + widget.getHeight() - - padding); + final int verticalPadding = widget.getTotalPaddingTop() + widget.getTotalPaddingBottom(); + final int top = layout.getLineForVertical(y); + final int bottom = layout.getLineForVertical(y + widget.getHeight() - verticalPadding); int left = Integer.MAX_VALUE; int right = 0; - Alignment a = null; - boolean ltr = true; + Alignment a = layout.getParagraphAlignment(top); + boolean ltr = layout.getParagraphDirection(top) > 0; for (int i = top; i <= bottom; i++) { left = (int) Math.min(left, layout.getLineLeft(i)); right = (int) Math.max(right, layout.getLineRight(i)); - - if (a == null) { - a = layout.getParagraphAlignment(i); - ltr = layout.getParagraphDirection(i) > 0; - } } - padding = widget.getTotalPaddingLeft() + widget.getTotalPaddingRight(); - int width = widget.getWidth(); - int diff = 0; + final int hoizontalPadding = widget.getTotalPaddingLeft() + widget.getTotalPaddingRight(); + final int availableWidth = widget.getWidth() - hoizontalPadding; + final int actualWidth = right - left; - // align_opposite does NOT mean align_right, we need the paragraph - // direction to resolve it to left or right - if (right - left < width - padding) { + if (actualWidth < availableWidth) { if (a == Alignment.ALIGN_CENTER) { - diff = (width - padding - (right - left)) / 2; - } else if (ltr == (a == Alignment.ALIGN_OPPOSITE)) { - diff = width - padding - (right - left); + x = left - ((availableWidth - actualWidth) / 2); + } else if ((ltr && (a == Alignment.ALIGN_OPPOSITE)) || (a == Alignment.ALIGN_RIGHT)) { + // align_opposite does NOT mean align_right, we need the paragraph + // direction to resolve it to left or right + x = left - (availableWidth - actualWidth); + } else { + x = left; } + } else { + x = Math.min(x, right - availableWidth); + x = Math.max(x, left); } - x = Math.min(x, right - (width - padding) - diff); - x = Math.max(x, left - diff); - widget.scrollTo(x, y); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index ca06b9cf118a..f993160f1829 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -12969,15 +12969,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Request that the visibility of the status bar be changed. * @param visibility Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}. - * - * This value will be re-applied immediately, even if the flags have not changed, so a view may - * easily reassert a particular SystemUiVisibility condition even if the system UI itself has - * since countermanded the original request. */ public void setSystemUiVisibility(int visibility) { - mSystemUiVisibility = visibility; - if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) { - mParent.recomputeViewAttributes(this); + if (visibility != mSystemUiVisibility) { + mSystemUiVisibility = visibility; + if (mParent != null && mAttachInfo != null && !mAttachInfo.mRecomputeGlobalAttributes) { + mParent.recomputeViewAttributes(this); + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 8fc844882334..da6bcd21a329 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -2031,8 +2031,13 @@ public class PhoneStatusBar extends StatusBar { // The user is not allowed to get stuck without navigation UI. Upon the slightest user // interaction we bring the navigation back. public void userActivity() { - if (mNavigationBarView != null) { - mNavigationBarView.setHidden(false); + if (0 != (mSystemUiVisibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)) { + try { + mBarService.setSystemUiVisibility( + mSystemUiVisibility & ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); + } catch (RemoteException ex) { + // weep softly + } } } diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 2b1638b83b02..86ac296c2c95 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -2618,7 +2618,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } if (VDBG) log("changing default proxy to " + proxy); - if ((proxy == null && mGlobalProxy == null) || proxy.equals(mGlobalProxy)) return; + + // global trumps default, if set, ignore this. if (mGlobalProxy != null) return; sendProxyBroadcast(proxy); } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index ebf5e65a3d9d..c62ccc68ce26 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -1768,8 +1768,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { ApnSetting apn = apnContext.getApnSetting(); if (apn.proxy != null && apn.proxy.length() != 0) { try { + String port = apn.port; + if (TextUtils.isEmpty(port)) port = "8080"; ProxyProperties proxy = new ProxyProperties(apn.proxy, - Integer.parseInt(apn.port), null); + Integer.parseInt(port), null); dcac.setLinkPropertiesHttpProxySync(proxy); } catch (NumberFormatException e) { loge("onDataSetupComplete: NumberFormatException making ProxyProperties (" + |