merge from froyo-plus-aosp

Change-Id: I9cede57e10df9d6ba411b2960a77d7b9b60a1489
This commit is contained in:
The Android Open Source Project
2010-06-14 11:35:51 -07:00
8 changed files with 129 additions and 7 deletions

View File

@@ -202787,6 +202787,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"

View File

@@ -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) {
@@ -3644,7 +3644,7 @@ public final class Settings {
Intent intent;
try {
intent = Intent.getIntent(intentUri);
intent = Intent.parseUri(intentUri, 0);
} catch (URISyntaxException e) {
return "";
}

View File

@@ -3831,6 +3831,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();

View File

@@ -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;
@@ -180,6 +181,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.
*
@@ -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();
}
/**

View File

@@ -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:

View File

@@ -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",

View File

@@ -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();

View File

@@ -1927,6 +1927,17 @@ public class WifiStateTracker extends NetworkStateTracker {
return WifiNative.stopPacketFiltering();
}
/**
* 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
@@ -2252,6 +2263,8 @@ public class WifiStateTracker extends 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
@@ -2275,8 +2288,16 @@ public class WifiStateTracker extends 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
@@ -2292,7 +2313,9 @@ public class WifiStateTracker extends 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