summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-06-14 11:39:26 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-06-14 11:39:26 -0700
commite377032899fd7a9f88ad1313847e77c098b9f248 (patch)
treee986fa3bbeb7581a5d64a24a3282bf230d8bfa72
parent26b327c80b8a2728e9d4d16671e03d7085c38747 (diff)
parent864c68ea452baa0f4f298faf2155af45a9b6d60c (diff)
downloadframeworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.zip
frameworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.tar.gz
frameworks_base-e377032899fd7a9f88ad1313847e77c098b9f248.tar.bz2
am 864c68ea: merge from froyo-plus-aosp
Merge commit '864c68ea452baa0f4f298faf2155af45a9b6d60c' * commit '864c68ea452baa0f4f298faf2155af45a9b6d60c': Added an addAll to the ArrayAdapter WLAN: Reset power save mode to startup value after DHCP response. Add PageUp and PageDown hot keys Should accept "application/vnd.wap.multipart.alternative" message. replaced deprecated getIntent with parseURI
-rw-r--r--api/current.xml26
-rw-r--r--core/java/android/provider/Settings.java4
-rw-r--r--core/java/android/webkit/WebView.java10
-rw-r--r--core/java/android/widget/ArrayAdapter.java43
-rw-r--r--core/java/com/google/android/mms/pdu/PduParser.java7
-rw-r--r--core/jni/android_net_wifi_Wifi.cpp15
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java2
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java29
8 files changed, 129 insertions, 7 deletions
diff --git a/api/current.xml b/api/current.xml
index 76f05ec..bfe916a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -206362,6 +206362,32 @@
<parameter name="object" type="T">
</parameter>
</method>
+<method name="addAll"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="collection" type="java.util.Collection&lt;? extends T&gt;">
+</parameter>
+</method>
+<method name="addAll"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="items" type="T...">
+</parameter>
+</method>
<method name="clear"
return="void"
abstract="false"
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 9bc28e4..37f18de 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -3534,7 +3534,7 @@ public final class Settings {
while (intent == null && c.moveToNext()) {
try {
String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
- intent = Intent.getIntent(intentURI);
+ intent = Intent.parseUri(intentURI, 0);
} catch (java.net.URISyntaxException e) {
// The stored URL is bad... ignore it.
} catch (IllegalArgumentException e) {
@@ -3632,7 +3632,7 @@ public final class Settings {
Intent intent;
try {
- intent = Intent.getIntent(intentUri);
+ intent = Intent.parseUri(intentUri, 0);
} catch (URISyntaxException e) {
return "";
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index b25e75f..4584de4 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3675,6 +3675,16 @@ public class WebView extends AbsoluteLayout
}
}
+ if (keyCode == KeyEvent.KEYCODE_PAGE_UP) {
+ pageUp(false);
+ return true;
+ }
+
+ if (keyCode == KeyEvent.KEYCODE_PAGE_DOWN) {
+ pageDown(false);
+ return true;
+ }
+
if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
&& keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
switchOutDrawHistory();
diff --git a/core/java/android/widget/ArrayAdapter.java b/core/java/android/widget/ArrayAdapter.java
index 32e5504..03ada94 100644
--- a/core/java/android/widget/ArrayAdapter.java
+++ b/core/java/android/widget/ArrayAdapter.java
@@ -24,6 +24,7 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Comparator;
import java.util.Collections;
@@ -83,7 +84,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
*/
private boolean mNotifyOnChange = true;
- private Context mContext;
+ private Context mContext;
private ArrayList<T> mOriginalValues;
private ArrayFilter mFilter;
@@ -181,6 +182,44 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
}
/**
+ * Adds the specified Collection at the end of the array.
+ *
+ * @param collection The Collection to add at the end of the array.
+ */
+ public void addAll(Collection<? extends T> collection) {
+ if (mOriginalValues != null) {
+ synchronized (mLock) {
+ mOriginalValues.addAll(collection);
+ if (mNotifyOnChange) notifyDataSetChanged();
+ }
+ } else {
+ mObjects.addAll(collection);
+ if (mNotifyOnChange) notifyDataSetChanged();
+ }
+ }
+
+ /**
+ * Adds the specified items at the end of the array.
+ *
+ * @param items The items to add at the end of the array.
+ */
+ public void addAll(T ... items) {
+ if (mOriginalValues != null) {
+ synchronized (mLock) {
+ for (T item : items) {
+ mOriginalValues.add(item);
+ }
+ if (mNotifyOnChange) notifyDataSetChanged();
+ }
+ } else {
+ for (T item : items) {
+ mObjects.add(item);
+ }
+ if (mNotifyOnChange) notifyDataSetChanged();
+ }
+ }
+
+ /**
* Inserts the specified object at the specified index in the array.
*
* @param object The object to insert into the array.
@@ -236,7 +275,7 @@ public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
*/
public void sort(Comparator<? super T> comparator) {
Collections.sort(mObjects, comparator);
- if (mNotifyOnChange) notifyDataSetChanged();
+ if (mNotifyOnChange) notifyDataSetChanged();
}
/**
diff --git a/core/java/com/google/android/mms/pdu/PduParser.java b/core/java/com/google/android/mms/pdu/PduParser.java
index 1cd118b..92d5cc4 100644
--- a/core/java/com/google/android/mms/pdu/PduParser.java
+++ b/core/java/com/google/android/mms/pdu/PduParser.java
@@ -161,6 +161,13 @@ public class PduParser {
// The MMS content type must be "application/vnd.wap.multipart.mixed"
// or "application/vnd.wap.multipart.related"
return retrieveConf;
+ } else if (ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) {
+ // "application/vnd.wap.multipart.alternative"
+ // should take only the first part.
+ PduPart firstPart = mBody.getPart(0);
+ mBody.removeAll();
+ mBody.addPart(0, firstPart);
+ return retrieveConf;
}
return null;
case PduHeaders.MESSAGE_TYPE_DELIVERY_IND:
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp
index 46000c9..7392442 100644
--- a/core/jni/android_net_wifi_Wifi.cpp
+++ b/core/jni/android_net_wifi_Wifi.cpp
@@ -392,6 +392,20 @@ static jboolean android_net_wifi_setPowerModeCommand(JNIEnv* env, jobject clazz,
return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK");
}
+static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz)
+{
+ char reply[256];
+ int power;
+
+ if (doCommand("DRIVER GETPOWER", reply, sizeof(reply)) != 0) {
+ return (jint)-1;
+ }
+ // reply comes back in the form "powermode = XX" where XX is the
+ // number we're interested in.
+ sscanf(reply, "%*s = %u", &power);
+ return (jint)power;
+}
+
static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels)
{
char cmdstr[256];
@@ -540,6 +554,7 @@ static JNINativeMethod gWifiMethods[] = {
{ "startPacketFiltering", "()Z", (void*) android_net_wifi_startPacketFiltering },
{ "stopPacketFiltering", "()Z", (void*) android_net_wifi_stopPacketFiltering },
{ "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand },
+ { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand },
{ "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand },
{ "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand },
{ "setBluetoothCoexistenceModeCommand", "(I)Z",
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index f98cd28..7a3282c 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -109,6 +109,8 @@ public class WifiNative {
public native static boolean setPowerModeCommand(int mode);
+ public native static int getPowerModeCommand();
+
public native static boolean setNumAllowedChannelsCommand(int numChannels);
public native static int getNumAllowedChannelsCommand();
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 2cec996..73cba93 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -2010,6 +2010,17 @@ public class WifiStateTracker extends Handler implements NetworkStateTracker {
}
/**
+ * Get power mode
+ * @return power mode
+ */
+ public synchronized int getPowerMode() {
+ if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ return -1;
+ }
+ return WifiNative.getPowerModeCommand();
+ }
+
+ /**
* Set power mode
* @param mode
* DRIVER_POWER_MODE_AUTO
@@ -2342,6 +2353,8 @@ public class WifiStateTracker extends Handler implements NetworkStateTracker {
case EVENT_DHCP_START:
boolean modifiedBluetoothCoexistenceMode = false;
+ int powerMode = DRIVER_POWER_MODE_AUTO;
+
if (shouldDisableCoexistenceMode()) {
/*
* There are problems setting the Wi-Fi driver's power
@@ -2365,8 +2378,16 @@ public class WifiStateTracker extends Handler implements NetworkStateTracker {
setBluetoothCoexistenceMode(
WifiNative.BLUETOOTH_COEXISTENCE_MODE_DISABLED);
}
-
- setPowerMode(DRIVER_POWER_MODE_ACTIVE);
+
+ powerMode = getPowerMode();
+ if (powerMode < 0) {
+ // Handle the case where supplicant driver does not support
+ // getPowerModeCommand.
+ powerMode = DRIVER_POWER_MODE_AUTO;
+ }
+ if (powerMode != DRIVER_POWER_MODE_ACTIVE) {
+ setPowerMode(DRIVER_POWER_MODE_ACTIVE);
+ }
synchronized (this) {
// A new request is being made, so assume we will callback
@@ -2382,7 +2403,9 @@ public class WifiStateTracker extends Handler implements NetworkStateTracker {
NetworkUtils.getDhcpError());
}
- setPowerMode(DRIVER_POWER_MODE_AUTO);
+ if (powerMode != DRIVER_POWER_MODE_ACTIVE) {
+ setPowerMode(powerMode);
+ }
if (modifiedBluetoothCoexistenceMode) {
// Set the coexistence mode back to its default value