Merge "Fix fill color alpha in layoutlib"
diff --git a/api/current.xml b/api/current.xml
index 6daeca9..9923020 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -14535,6 +14535,17 @@
visibility="public"
>
</field>
+<field name="Theme_Holo_DialogWhenLarge"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16973954"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="Theme_Holo_Dialog_Alert"
type="int"
transient="false"
@@ -27381,6 +27392,17 @@
visibility="public"
>
</method>
+<method name="getResources"
+ return="android.content.res.Resources"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getRetainInstance"
return="boolean"
abstract="false"
@@ -27392,6 +27414,34 @@
visibility="public"
>
</method>
+<method name="getString"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+</method>
+<method name="getString"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+<parameter name="formatArgs" type="java.lang.Object...">
+</parameter>
+</method>
<method name="getTag"
return="java.lang.String"
abstract="false"
@@ -27425,6 +27475,19 @@
visibility="public"
>
</method>
+<method name="getText"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+</method>
<method name="getView"
return="android.view.View"
abstract="false"
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index e90ddbf..ce9501a 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -892,7 +892,7 @@
+ Integer.toHexString(resid) + " in package "
+ packageName, e);
} catch (NameNotFoundException e) {
- Log.w("PackageManager", "Failure retrieving resources for"
+ Log.w("PackageManager", "Failure retrieving resources for "
+ appInfo.packageName);
}
return null;
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index eaf1aee..b103385 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -619,6 +620,46 @@
}
/**
+ * Return <code>getActivity().getResources()</code>.
+ */
+ final public Resources getResources() {
+ return mActivity.getResources();
+ }
+
+ /**
+ * Return a localized, styled CharSequence from the application's package's
+ * default string table.
+ *
+ * @param resId Resource id for the CharSequence text
+ */
+ public final CharSequence getText(int resId) {
+ return getResources().getText(resId);
+ }
+
+ /**
+ * Return a localized string from the application's package's
+ * default string table.
+ *
+ * @param resId Resource id for the string
+ */
+ public final String getString(int resId) {
+ return getResources().getString(resId);
+ }
+
+ /**
+ * Return a localized formatted string from the application's package's
+ * default string table, substituting the format arguments as defined in
+ * {@link java.util.Formatter} and {@link java.lang.String#format}.
+ *
+ * @param resId Resource id for the format string
+ * @param formatArgs The format arguments that will be used for substitution.
+ */
+
+ public final String getString(int resId, Object... formatArgs) {
+ return getResources().getString(resId, formatArgs);
+ }
+
+ /**
* Return the FragmentManager for interacting with fragments associated
* with this fragment's activity. Note that this will be non-null slightly
* before {@link #getActivity()}, during the time from when the fragment is
diff --git a/core/java/android/content/pm/RegisteredServicesCache.java b/core/java/android/content/pm/RegisteredServicesCache.java
index dce3963..06095d1 100644
--- a/core/java/android/content/pm/RegisteredServicesCache.java
+++ b/core/java/android/content/pm/RegisteredServicesCache.java
@@ -271,17 +271,11 @@
}
synchronized (mServicesLock) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "generateServicesMap: " + mInterfaceName);
- }
if (mPersistentServices == null) {
readPersistentServicesLocked();
}
mServices = Maps.newHashMap();
- boolean changed = false;
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "found " + serviceInfos.size() + " services");
- }
+ StringBuilder changes = new StringBuilder();
for (ServiceInfo<V> info : serviceInfos) {
// four cases:
// - doesn't exist yet
@@ -294,10 +288,7 @@
// - add, notify user that it was added
Integer previousUid = mPersistentServices.get(info.type);
if (previousUid == null) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered new type: " + info);
- }
- changed = true;
+ changes.append(" New service added: ").append(info).append("\n");
mServices.put(info.type, info);
mPersistentServices.put(info.type, info.uid);
if (!mPersistentServicesFileDidNotExist) {
@@ -305,29 +296,25 @@
}
} else if (previousUid == info.uid) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered existing type with the same uid: " + info);
+ changes.append(" Existing service (nop): ").append(info).append("\n");
}
mServices.put(info.type, info);
} else if (inSystemImage(info.uid)
|| !containsTypeAndUid(serviceInfos, info.type, previousUid)) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- if (inSystemImage(info.uid)) {
- Log.d(TAG, "encountered existing type with a new uid but from"
- + " the system: " + info);
- } else {
- Log.d(TAG, "encountered existing type with a new uid but existing was"
- + " removed: " + info);
- }
+ if (inSystemImage(info.uid)) {
+ changes.append(" System service replacing existing: ").append(info)
+ .append("\n");
+ } else {
+ changes.append(" Existing service replacing a removed service: ")
+ .append(info).append("\n");
}
- changed = true;
mServices.put(info.type, info);
mPersistentServices.put(info.type, info.uid);
notifyListener(info.type, false /* removed */);
} else {
// ignore
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "encountered existing type with a new uid, ignoring: " + info);
- }
+ changes.append(" Existing service with new uid ignored: ").append(info)
+ .append("\n");
}
}
@@ -339,18 +326,16 @@
}
for (V v1 : toBeRemoved) {
mPersistentServices.remove(v1);
- changed = true;
+ changes.append(" Service removed: ").append(v1).append("\n");
notifyListener(v1, true /* removed */);
}
- if (changed) {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "writing updated list of persistent services");
- }
+ if (changes.length() > 0) {
+ Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
+ serviceInfos.size() + " services:\n" + changes);
writePersistentServicesLocked();
} else {
- if (Log.isLoggable(TAG, Log.VERBOSE)) {
- Log.d(TAG, "persistent services did not change, so not writing anything");
- }
+ Log.d(TAG, "generateServicesMap(" + mInterfaceName + "): " +
+ serviceInfos.size() + " services unchanged");
}
mPersistentServicesFileDidNotExist = false;
}
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index 4f56281..56ab6bf 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -287,8 +287,6 @@
mBluetoothService.setIsDiscovering(true);
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
} else {
- // Stop the discovery.
- mBluetoothService.cancelDiscovery();
mBluetoothService.setIsDiscovering(false);
intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
}
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 1538bd0..a58d648 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -36,6 +36,7 @@
import android.text.method.MovementMethod;
import android.text.method.Touch;
import android.util.Log;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
@@ -54,6 +55,8 @@
import java.util.ArrayList;
+import junit.framework.Assert;
+
/**
* WebTextView is a specialized version of EditText used by WebView
* to overlay html textfields (and textareas) to use our standard
@@ -144,6 +147,19 @@
mWebView = webView;
mMaxLength = -1;
setAutoFillable(autoFillQueryId);
+ // Turn on subpixel text, and turn off kerning, so it better matches
+ // the text in webkit.
+ TextPaint paint = getPaint();
+ int flags = paint.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG
+ | Paint.SUBPIXEL_TEXT_FLAG | Paint.DITHER_FLAG;
+ paint.setFlags(flags);
+
+ // Set the text color to black, regardless of the theme. This ensures
+ // that other applications that use embedded WebViews will properly
+ // display the text in password textfields.
+ setTextColor(Color.BLACK);
+ // This helps to align the text better with the text in the web page.
+ setIncludeFontPadding(false);
}
public void setAutoFillable(int queryId) {
@@ -845,16 +861,6 @@
mBackground = new OutlineDrawable();
setGravity(Gravity.CENTER_VERTICAL);
- // Turn on subpixel text, and turn off kerning, so it better matches
- // the text in webkit.
- TextPaint paint = getPaint();
- int flags = paint.getFlags() | Paint.SUBPIXEL_TEXT_FLAG |
- Paint.ANTI_ALIAS_FLAG & ~Paint.DEV_KERN_TEXT_FLAG;
- paint.setFlags(flags);
- // Set the text color to black, regardless of the theme. This ensures
- // that other applications that use embedded WebViews will properly
- // display the text in password textfields.
- setTextColor(Color.BLACK);
}
@Override
@@ -928,6 +934,20 @@
}
/**
+ * Update the text size according to the size of the focus candidate's text
+ * size in mWebView. Should only be called from mWebView.
+ */
+ /* package */ void updateTextSize() {
+ Assert.assertNotNull("updateTextSize should only be called from "
+ + "mWebView, so mWebView should never be null!", mWebView);
+ // Note that this is approximately WebView.contentToViewDimension,
+ // without being rounded.
+ float size = mWebView.nativeFocusCandidateTextSize()
+ * mWebView.getScale();
+ setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
+ }
+
+ /**
* Set the text to the new string, but use the old selection, making sure
* to keep it within the new string.
* @param text The new text to place in the textfield.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index f3f9a6d..4e0c386 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -54,7 +54,6 @@
import android.util.AttributeSet;
import android.util.EventLog;
import android.util.Log;
-import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -3585,7 +3584,17 @@
*/
private SelectActionModeCallback mSelectCallback;
- private boolean didUpdateTextViewBounds(boolean allowIntersect) {
+ /**
+ * Check to see if the focused textfield/textarea is still on screen. If it
+ * is, update the the dimensions and location of WebTextView. Otherwise,
+ * remove the WebTextView. Should be called when the zoom level changes.
+ * @param allowIntersect Whether to consider the textfield/textarea on
+ * screen if it only intersects the screen (as opposed to being
+ * completely on screen).
+ * @return boolean True if the textfield/textarea is still on screen and the
+ * dimensions/location of WebTextView have been updated.
+ */
+ private boolean didUpdateWebTextViewDimensions(boolean allowIntersect) {
Rect contentBounds = nativeFocusCandidateNodeBounds();
Rect vBox = contentToViewRect(contentBounds);
Rect visibleRect = new Rect();
@@ -3597,9 +3606,8 @@
: visibleRect.contains(vBox)) {
mWebTextView.setRect(vBox.left, vBox.top, vBox.width(),
vBox.height());
- mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- contentToViewDimension(
- nativeFocusCandidateTextSize()));
+ mWebTextView.updateTextSize();
+ updateWebTextViewPadding();
return true;
} else {
// The textfield is now off screen. The user probably
@@ -3632,7 +3640,8 @@
private void onZoomAnimationEnd() {
// adjust the edit text view if needed
- if (inEditingMode() && didUpdateTextViewBounds(false) && nativeFocusCandidateIsPassword()) {
+ if (inEditingMode() && didUpdateWebTextViewDimensions(false)
+ && nativeFocusCandidateIsPassword()) {
// If it is a password field, start drawing the WebTextView once
// again.
mWebTextView.setInPassword(true);
@@ -3765,7 +3774,7 @@
// finishes. We also do not need to do this unless the WebTextView
// is showing.
if (!animateZoom && inEditingMode()) {
- didUpdateTextViewBounds(true);
+ didUpdateWebTextViewDimensions(true);
}
}
}
@@ -3870,7 +3879,7 @@
if (inEditingMode()) {
imm.showSoftInput(mWebTextView, 0);
if (zoom) {
- didUpdateTextViewBounds(true);
+ didUpdateWebTextViewDimensions(true);
}
return;
}
@@ -3918,8 +3927,7 @@
// Initialize our generation number.
mTextGeneration = 0;
}
- mWebTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- contentToViewDimension(nativeFocusCandidateTextSize()));
+ mWebTextView.updateTextSize();
Rect visibleRect = new Rect();
calcOurContentVisibleRect(visibleRect);
// Note that sendOurVisibleRect calls viewToContent, so the coordinates
@@ -3951,16 +3959,7 @@
// requestFormData, and it needs to have the correct nodePointer.
mWebTextView.setNodePointer(nodePointer);
mWebTextView.setType(nativeFocusCandidateType());
- Rect paddingRect = nativeFocusCandidatePaddingRect();
- if (paddingRect != null) {
- // Use contentToViewDimension since these are the dimensions of
- // the padding.
- mWebTextView.setPadding(
- contentToViewDimension(paddingRect.left),
- contentToViewDimension(paddingRect.top),
- contentToViewDimension(paddingRect.right),
- contentToViewDimension(paddingRect.bottom));
- }
+ updateWebTextViewPadding();
if (null == text) {
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "rebuildWebTextView null == text");
@@ -3979,6 +3978,22 @@
}
/**
+ * Update the padding of mWebTextView based on the native textfield/textarea
+ */
+ void updateWebTextViewPadding() {
+ Rect paddingRect = nativeFocusCandidatePaddingRect();
+ if (paddingRect != null) {
+ // Use contentToViewDimension since these are the dimensions of
+ // the padding.
+ mWebTextView.setPadding(
+ contentToViewDimension(paddingRect.left),
+ contentToViewDimension(paddingRect.top),
+ contentToViewDimension(paddingRect.right),
+ contentToViewDimension(paddingRect.bottom));
+ }
+ }
+
+ /**
* Tell webkit to put the cursor on screen.
*/
/* package */ void revealSelection() {
@@ -7466,7 +7481,7 @@
private native Rect nativeFocusCandidatePaddingRect();
/* package */ native int nativeFocusCandidatePointer();
private native String nativeFocusCandidateText();
- private native int nativeFocusCandidateTextSize();
+ /* package */ native int nativeFocusCandidateTextSize();
/**
* Returns an integer corresponding to WebView.cpp::type.
* See WebTextView.setType()
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 7cf369f..cd1cae6 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -616,7 +616,7 @@
public int getSelectedNavigationIndex() {
switch (mActionView.getNavigationMode()) {
case NAVIGATION_MODE_TABS:
- return mSelectedTab.getPosition();
+ return mSelectedTab != null ? mSelectedTab.getPosition() : -1;
case NAVIGATION_MODE_LIST:
return mActionView.getDropdownSelectedPosition();
default:
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index c9478240..1d103ed 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -24,6 +24,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.View.MeasureSpec;
+import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.ListPopupWindow;
import android.widget.PopupWindow;
@@ -33,7 +34,8 @@
/**
* @hide
*/
-public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener {
+public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.OnKeyListener,
+ ViewTreeObserver.OnGlobalLayoutListener {
private static final String TAG = "MenuPopupHelper";
private Context mContext;
@@ -42,6 +44,7 @@
private int mPopupMaxWidth;
private WeakReference<View> mAnchorView;
private boolean mOverflowOnly;
+ private ViewTreeObserver mTreeObserver;
private PopupWindow.OnDismissListener mDismissListener = new PopupWindow.OnDismissListener() {
public void onDismiss() {
@@ -82,12 +85,18 @@
mPopup.setAdapter(adapter);
mPopup.setModal(true);
- if (mAnchorView != null) {
- mPopup.setAnchorView(mAnchorView.get());
- } else if (mMenu instanceof SubMenuBuilder) {
+ View anchor = mAnchorView != null ? mAnchorView.get() : null;
+ if (anchor == null && mMenu instanceof SubMenuBuilder) {
SubMenuBuilder subMenu = (SubMenuBuilder) mMenu;
final MenuItemImpl itemImpl = (MenuItemImpl) subMenu.getItem();
- mPopup.setAnchorView(itemImpl.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, null));
+ anchor = itemImpl.getItemView(MenuBuilder.TYPE_ACTION_BUTTON, null);
+ mAnchorView = new WeakReference<View>(anchor);
+ }
+
+ if (anchor != null) {
+ mTreeObserver = anchor.getViewTreeObserver();
+ mTreeObserver.addOnGlobalLayoutListener(this);
+ mPopup.setAnchorView(anchor);
} else {
throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
}
@@ -101,6 +110,8 @@
if (isShowing()) {
mPopup.dismiss();
}
+ mTreeObserver.removeGlobalOnLayoutListener(this);
+ mTreeObserver = null;
}
public boolean isShowing() {
@@ -115,7 +126,7 @@
item = mMenu.getItem(position);
}
mMenu.performItemAction(item, 0);
- mPopup.dismiss();
+ dismiss();
}
public boolean onKey(View v, int keyCode, KeyEvent event) {
@@ -142,4 +153,17 @@
}
return width;
}
+
+ @Override
+ public void onGlobalLayout() {
+ if (!isShowing()) {
+ mTreeObserver.removeGlobalOnLayoutListener(this);
+ mTreeObserver = null;
+ } else {
+ final View anchor = mAnchorView != null ? mAnchorView.get() : null;
+ if (anchor != null && !anchor.isShown()) {
+ dismiss();
+ }
+ }
+ }
}
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index be6a57a..7a64da0 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -330,6 +330,7 @@
mSubtitle = subtitle;
if (mSubtitleView != null) {
mSubtitleView.setText(subtitle);
+ mSubtitleView.setVisibility(subtitle != null ? VISIBLE : GONE);
}
}
diff --git a/core/res/res/values-large/themes.xml b/core/res/res/values-large/themes.xml
new file mode 100644
index 0000000..cdf58fe
--- /dev/null
+++ b/core/res/res/values-large/themes.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2010, 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.
+*/
+-->
+<resources>
+ <style name="Theme.Holo.DialogWhenLarge" parent="@android:style/Theme.Holo.Dialog">
+ </style>
+</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index a1b9dc9..bf0ac47 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1366,6 +1366,12 @@
<public type="attr" name="autoAdvanceViewId" />
<public type="attr" name="useIntrinsicSizeAsMinimum" />
+ <public type="attr" name="actionModeCutDrawable" />
+ <public type="attr" name="actionModeCopyDrawable" />
+ <public type="attr" name="actionModePasteDrawable" />
+ <public type="attr" name="textEditPasteWindowLayout" />
+ <public type="attr" name="textEditNoPasteWindowLayout" />
+
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
@@ -1431,11 +1437,7 @@
<public type="style" name="TextAppearance.Widget.PopupMenu.Small" />
<public type="style" name="Widget.FragmentBreadCrumbs" />
+ <public type="style" name="Theme.Holo.DialogWhenLarge" />
+
<public type="string" name="selectTextMode" />
-
- <public type="attr" name="actionModeCutDrawable" />
- <public type="attr" name="actionModeCopyDrawable" />
- <public type="attr" name="actionModePasteDrawable" />
- <public type="attr" name="textEditPasteWindowLayout" />
- <public type="attr" name="textEditNoPasteWindowLayout" />
</resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index b4e3c6f..c8cce81 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -1187,6 +1187,12 @@
<item name="windowContentOverlay">@null</item>
</style>
+ <!-- Theme for a window that will be displayed either full-screen on
+ smaller screens (small, normal) or as a dialog on larger screens
+ (large, xlarge) -->
+ <style name="Theme.Holo.DialogWhenLarge" parent="@android:style/Theme.Holo">
+ </style>
+
<!-- Light holo dialog themes -->
<!-- Holo light theme for dialog windows and activities, which is used by the
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 2a21f6d..96c90a2 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -478,7 +478,7 @@
* {@code true} otherwise.
*/
public synchronized boolean getDataEnabled() {
- return dataEnabled[APN_DEFAULT_ID];
+ return (mMasterDataEnabled && dataEnabled[APN_DEFAULT_ID]);
}
/**
@@ -487,8 +487,8 @@
* @return {@code false} if data connectivity has been explicitly disabled,
* {@code true} otherwise.
*/
- public boolean getAnyDataEnabled() {
- return (enabledCount != 0);
+ public synchronized boolean getAnyDataEnabled() {
+ return (mMasterDataEnabled && (enabledCount != 0));
}
protected abstract void startNetStatPoll();
@@ -832,7 +832,9 @@
protected void onSetDataEnabled(boolean enable) {
if (mMasterDataEnabled != enable) {
- mMasterDataEnabled = enable;
+ synchronized (this) {
+ mMasterDataEnabled = enable;
+ }
if (enable) {
mRetryMgr.resetRetryCount();
onTrySetupData(Phone.REASON_DATA_ENABLED);