Merge "Not to add invalid spell check spans Bug: 6464197" into jb-dev
diff --git a/core/java/android/content/res/AssetFileDescriptor.java b/core/java/android/content/res/AssetFileDescriptor.java
index 9893133..7d46710 100644
--- a/core/java/android/content/res/AssetFileDescriptor.java
+++ b/core/java/android/content/res/AssetFileDescriptor.java
@@ -52,6 +52,9 @@
*/
public AssetFileDescriptor(ParcelFileDescriptor fd, long startOffset,
long length) {
+ if (fd == null) {
+ throw new IllegalArgumentException("fd must not be null");
+ }
if (length < 0 && startOffset != 0) {
throw new IllegalArgumentException(
"startOffset must be 0 when using UNKNOWN_LENGTH");
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
index ac9ee26..7b6fd64 100644
--- a/core/java/android/os/Trace.java
+++ b/core/java/android/os/Trace.java
@@ -39,6 +39,14 @@
public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7;
public static final long TRACE_TAG_AUDIO = 1L << 8;
+ public static final int TRACE_FLAGS_START_BIT = 1;
+ public static final String[] TRACE_TAGS = {
+ "Graphics", "Input", "View", "WebView", "Window Manager",
+ "Activity Manager", "Sync Manager", "Audio"
+ };
+
+ public static final String PROPERTY_TRACE_TAG_ENABLEFLAGS = "debug.atrace.tags.enableflags";
+
private static final long sEnabledTags = nativeGetEnabledTags();
private static native long nativeGetEnabledTags();
diff --git a/core/java/android/preference/MultiCheckPreference.java b/core/java/android/preference/MultiCheckPreference.java
index 735f66ae..6953075 100644
--- a/core/java/android/preference/MultiCheckPreference.java
+++ b/core/java/android/preference/MultiCheckPreference.java
@@ -136,11 +136,25 @@
*
* @return The array of values.
*/
- public CharSequence[] getEntryValues() {
+ public String[] getEntryValues() {
return mEntryValues;
}
/**
+ * Get the boolean state of a given value.
+ */
+ public boolean getValue(int index) {
+ return mSetValues[index];
+ }
+
+ /**
+ * Set the boolean state of a given value.
+ */
+ public void setValue(int index, boolean state) {
+ mSetValues[index] = state;
+ }
+
+ /**
* Sets the current values.
*/
public void setValues(boolean[] values) {
diff --git a/core/jni/android_os_SystemProperties.cpp b/core/jni/android_os_SystemProperties.cpp
index 66af965..add616e 100644
--- a/core/jni/android_os_SystemProperties.cpp
+++ b/core/jni/android_os_SystemProperties.cpp
@@ -65,6 +65,7 @@
int len;
const char* key;
char buf[PROPERTY_VALUE_MAX];
+ char* end;
jint result = defJ;
if (keyJ == NULL) {
@@ -76,9 +77,10 @@
len = property_get(key, buf, "");
if (len > 0) {
- jint temp;
- if (sscanf(buf, "%d", &temp) == 1)
- result = temp;
+ result = strtol(buf, &end, 0);
+ if (end == buf) {
+ result = defJ;
+ }
}
env->ReleaseStringUTFChars(keyJ, key);
@@ -93,6 +95,7 @@
int len;
const char* key;
char buf[PROPERTY_VALUE_MAX];
+ char* end;
jlong result = defJ;
if (keyJ == NULL) {
@@ -104,9 +107,10 @@
len = property_get(key, buf, "");
if (len > 0) {
- jlong temp;
- if (sscanf(buf, "%lld", &temp) == 1)
- result = temp;
+ result = strtoll(buf, &end, 0);
+ if (end == buf) {
+ result = defJ;
+ }
}
env->ReleaseStringUTFChars(keyJ, key);
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
index 19aa77b..f7b0cd0 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java
@@ -246,9 +246,7 @@
initializeNetworkStates();
- mWifiManager.setWifiEnabled(true);
log("Clear Wifi before we start the test.");
- sleep(SHORT_TIMEOUT);
removeConfiguredNetworksAndDisableWifi();
mWifiRegexs = mCM.getTetherableWifiRegexs();
}
@@ -645,6 +643,11 @@
*/
public boolean disconnectAP() {
// remove saved networks
+ if (!mWifiManager.isWifiEnabled()) {
+ log("Enabled wifi before remove configured networks");
+ mWifiManager.setWifiEnabled(true);
+ sleep(SHORT_TIMEOUT);
+ }
List<WifiConfiguration> wifiConfigList = mWifiManager.getConfiguredNetworks();
log("size of wifiConfigList: " + wifiConfigList.size());
for (WifiConfiguration wifiConfig: wifiConfigList) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 4b91422..cc7050a 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2098,7 +2098,6 @@
if (widthMode == AT_MOST) {
final TypedValue tvw = isPortrait ? mFixedWidthMinor : mFixedWidthMajor;
if (tvw != null && tvw.type != TypedValue.TYPE_NULL) {
- fixedWidth = true;
final int w;
if (tvw.type == TypedValue.TYPE_DIMENSION) {
w = (int) tvw.getDimension(metrics);
@@ -2112,6 +2111,7 @@
final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
widthMeasureSpec = MeasureSpec.makeMeasureSpec(
Math.min(w, widthSize), EXACTLY);
+ fixedWidth = true;
}
}
}