Merge branch 'eclair-plus-aosp' of ssh://android-git.corp.google.com:29418/platform/frameworks/base into eclair-mr2-plus-aosp
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.webkit;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -105,7 +106,13 @@ class BrowserFrame extends Handler {
|
||||
if (sJavaBridge == null) {
|
||||
sJavaBridge = new JWebCoreJavaBridge(context);
|
||||
// set WebCore native cache size
|
||||
sJavaBridge.setCacheSize(4 * 1024 * 1024);
|
||||
ActivityManager am = (ActivityManager) context
|
||||
.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (am.getMemoryClass() > 16) {
|
||||
sJavaBridge.setCacheSize(8 * 1024 * 1024);
|
||||
} else {
|
||||
sJavaBridge.setCacheSize(4 * 1024 * 1024);
|
||||
}
|
||||
// initialize CacheManager
|
||||
CacheManager.init(context);
|
||||
// create CookieSyncManager with current Context
|
||||
|
||||
@@ -94,6 +94,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
|
||||
private Bundle mCellLocation = new Bundle();
|
||||
|
||||
private int mDataConnectionNetworkType;
|
||||
|
||||
static final int PHONE_STATE_PERMISSION_MASK =
|
||||
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR |
|
||||
PhoneStateListener.LISTEN_CALL_STATE |
|
||||
@@ -187,7 +189,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
|
||||
try {
|
||||
r.callback.onDataConnectionStateChanged(mDataConnectionState);
|
||||
r.callback.onDataConnectionStateChanged(mDataConnectionState,
|
||||
mDataConnectionNetworkType);
|
||||
} catch (RemoteException ex) {
|
||||
remove(r.binder);
|
||||
}
|
||||
@@ -345,7 +348,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
public void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||
String reason, String apn, String[] apnTypes, String interfaceName) {
|
||||
String reason, String apn, String[] apnTypes, String interfaceName, int networkType) {
|
||||
if (!checkNotifyPermission("notifyDataConnection()" )) {
|
||||
return;
|
||||
}
|
||||
@@ -356,11 +359,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
mDataConnectionApn = apn;
|
||||
mDataConnectionApnTypes = apnTypes;
|
||||
mDataConnectionInterfaceName = interfaceName;
|
||||
mDataConnectionNetworkType = networkType;
|
||||
for (int i = mRecords.size() - 1; i >= 0; i--) {
|
||||
Record r = mRecords.get(i);
|
||||
if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
|
||||
try {
|
||||
r.callback.onDataConnectionStateChanged(state);
|
||||
r.callback.onDataConnectionStateChanged(state, networkType);
|
||||
} catch (RemoteException ex) {
|
||||
remove(r.binder);
|
||||
}
|
||||
|
||||
@@ -782,7 +782,7 @@ public class StatusBarPolicy {
|
||||
public void onServiceStateChanged(ServiceState state) {
|
||||
mServiceState = state;
|
||||
updateSignalStrength();
|
||||
updateCdmaRoamingIcon();
|
||||
updateCdmaRoamingIcon(state);
|
||||
updateDataIcon();
|
||||
}
|
||||
|
||||
@@ -796,9 +796,9 @@ public class StatusBarPolicy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataConnectionStateChanged(int state) {
|
||||
public void onDataConnectionStateChanged(int state, int networkType) {
|
||||
mDataState = state;
|
||||
updateDataNetType();
|
||||
updateDataNetType(networkType);
|
||||
updateDataIcon();
|
||||
}
|
||||
|
||||
@@ -835,7 +835,7 @@ public class StatusBarPolicy {
|
||||
}
|
||||
|
||||
private boolean isCdma() {
|
||||
return ((mPhone != null) && (mPhone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA));
|
||||
return (mSignalStrength != null) && !mSignalStrength.isGsm();
|
||||
}
|
||||
|
||||
private boolean isEvdo() {
|
||||
@@ -889,6 +889,7 @@ public class StatusBarPolicy {
|
||||
else if (asu >= 4) iconLevel = 2;
|
||||
else iconLevel = 1;
|
||||
|
||||
// Though mPhone is a Manager, this call is not an IPC
|
||||
if (mPhone.isNetworkRoaming()) {
|
||||
iconList = sSignalImages_r;
|
||||
} else {
|
||||
@@ -956,8 +957,7 @@ public class StatusBarPolicy {
|
||||
return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
|
||||
}
|
||||
|
||||
private final void updateDataNetType() {
|
||||
int net = mPhone.getNetworkType();
|
||||
private final void updateDataNetType(int net) {
|
||||
|
||||
switch (net) {
|
||||
case TelephonyManager.NETWORK_TYPE_EDGE:
|
||||
@@ -1211,7 +1211,7 @@ public class StatusBarPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
private final void updateCdmaRoamingIcon() {
|
||||
private final void updateCdmaRoamingIcon(ServiceState state) {
|
||||
if (!hasService()) {
|
||||
mService.setIconVisibility(mCdmaRoamingIndicatorIcon, false);
|
||||
return;
|
||||
@@ -1223,8 +1223,8 @@ public class StatusBarPolicy {
|
||||
}
|
||||
|
||||
int[] iconList = sRoamingIndicatorImages_cdma;
|
||||
int iconIndex = mPhone.getCdmaEriIconIndex();
|
||||
int iconMode = mPhone.getCdmaEriIconMode();
|
||||
int iconIndex = state.getCdmaEriIconIndex();
|
||||
int iconMode = state.getCdmaEriIconMode();
|
||||
|
||||
if (iconIndex == -1) {
|
||||
Log.e(TAG, "getCdmaEriIconIndex returned null, skipping ERI icon update");
|
||||
|
||||
@@ -205,6 +205,13 @@ public class PhoneStateListener {
|
||||
// default implementation empty
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* same as above, but with the network type. Both called.
|
||||
*/
|
||||
public void onDataConnectionStateChanged(int state, int networkType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when data activity state changes.
|
||||
*
|
||||
@@ -264,8 +271,9 @@ public class PhoneStateListener {
|
||||
Message.obtain(mHandler, LISTEN_CALL_STATE, state, 0, incomingNumber).sendToTarget();
|
||||
}
|
||||
|
||||
public void onDataConnectionStateChanged(int state) {
|
||||
Message.obtain(mHandler, LISTEN_DATA_CONNECTION_STATE, state, 0, null).sendToTarget();
|
||||
public void onDataConnectionStateChanged(int state, int networkType) {
|
||||
Message.obtain(mHandler, LISTEN_DATA_CONNECTION_STATE, state, networkType, null).
|
||||
sendToTarget();
|
||||
}
|
||||
|
||||
public void onDataActivity(int direction) {
|
||||
@@ -299,6 +307,7 @@ public class PhoneStateListener {
|
||||
PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj);
|
||||
break;
|
||||
case LISTEN_DATA_CONNECTION_STATE:
|
||||
PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2);
|
||||
PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1);
|
||||
break;
|
||||
case LISTEN_DATA_ACTIVITY:
|
||||
|
||||
@@ -120,6 +120,8 @@ public class ServiceState implements Parcelable {
|
||||
private int mSystemId;
|
||||
private int mCdmaRoamingIndicator;
|
||||
private int mCdmaDefaultRoamingIndicator;
|
||||
private int mCdmaEriIconIndex;
|
||||
private int mCdmaEriIconMode;
|
||||
|
||||
/**
|
||||
* Create a new ServiceState from a intent notifier Bundle
|
||||
@@ -166,6 +168,8 @@ public class ServiceState implements Parcelable {
|
||||
mSystemId = s.mSystemId;
|
||||
mCdmaRoamingIndicator = s.mCdmaRoamingIndicator;
|
||||
mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator;
|
||||
mCdmaEriIconIndex = s.mCdmaEriIconIndex;
|
||||
mCdmaEriIconMode = s.mCdmaEriIconMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,6 +188,8 @@ public class ServiceState implements Parcelable {
|
||||
mSystemId = in.readInt();
|
||||
mCdmaRoamingIndicator = in.readInt();
|
||||
mCdmaDefaultRoamingIndicator = in.readInt();
|
||||
mCdmaEriIconIndex = in.readInt();
|
||||
mCdmaEriIconMode = in.readInt();
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
@@ -199,6 +205,8 @@ public class ServiceState implements Parcelable {
|
||||
out.writeInt(mSystemId);
|
||||
out.writeInt(mCdmaRoamingIndicator);
|
||||
out.writeInt(mCdmaDefaultRoamingIndicator);
|
||||
out.writeInt(mCdmaEriIconIndex);
|
||||
out.writeInt(mCdmaEriIconMode);
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
@@ -253,6 +261,20 @@ public class ServiceState implements Parcelable {
|
||||
return this.mCdmaDefaultRoamingIndicator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int getCdmaEriIconIndex() {
|
||||
return this.mCdmaEriIconIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int getCdmaEriIconMode() {
|
||||
return this.mCdmaEriIconMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current registered operator name in long alphanumeric format
|
||||
*
|
||||
@@ -412,8 +434,11 @@ public class ServiceState implements Parcelable {
|
||||
mSystemId = -1;
|
||||
mCdmaRoamingIndicator = -1;
|
||||
mCdmaDefaultRoamingIndicator = -1;
|
||||
mCdmaEriIconIndex = -1;
|
||||
mCdmaEriIconMode = -1;
|
||||
}
|
||||
|
||||
// TODO - can't this be combined with the above func..
|
||||
public void setStateOff() {
|
||||
mState = STATE_POWER_OFF;
|
||||
mRoaming = false;
|
||||
@@ -427,6 +452,8 @@ public class ServiceState implements Parcelable {
|
||||
mSystemId = -1;
|
||||
mCdmaRoamingIndicator = -1;
|
||||
mCdmaDefaultRoamingIndicator = -1;
|
||||
mCdmaEriIconIndex = -1;
|
||||
mCdmaEriIconMode = -1;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
@@ -451,6 +478,20 @@ public class ServiceState implements Parcelable {
|
||||
this.mCdmaDefaultRoamingIndicator = roaming;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setCdmaEriIconIndex(int index) {
|
||||
this.mCdmaEriIconIndex = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setCdmaEriIconMode(int mode) {
|
||||
this.mCdmaEriIconMode = mode;
|
||||
}
|
||||
|
||||
public void setOperatorName(String longName, String shortName, String numeric) {
|
||||
mOperatorAlphaLong = longName;
|
||||
mOperatorAlphaShort = shortName;
|
||||
|
||||
@@ -93,13 +93,16 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
|
||||
}
|
||||
|
||||
public void notifyDataConnection(Phone sender, String reason) {
|
||||
TelephonyManager telephony = TelephonyManager.getDefault();
|
||||
try {
|
||||
mRegistry.notifyDataConnection(
|
||||
convertDataState(sender.getDataConnectionState()),
|
||||
sender.isDataConnectivityPossible(), reason,
|
||||
sender.getActiveApn(),
|
||||
sender.getActiveApnTypes(),
|
||||
sender.getInterfaceName(null));
|
||||
sender.getInterfaceName(null),
|
||||
((telephony!=null) ? telephony.getNetworkType() :
|
||||
TelephonyManager.NETWORK_TYPE_UNKNOWN));
|
||||
} catch (RemoteException ex) {
|
||||
// system process is dead
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ oneway interface IPhoneStateListener {
|
||||
// we use bundle here instead of CellLocation so it can get the right subclass
|
||||
void onCellLocationChanged(in Bundle location);
|
||||
void onCallStateChanged(int state, String incomingNumber);
|
||||
void onDataConnectionStateChanged(int state);
|
||||
void onDataConnectionStateChanged(int state, int networkType);
|
||||
void onDataActivity(int direction);
|
||||
void onSignalStrengthsChanged(in SignalStrength signalStrength);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ interface ITelephonyRegistry {
|
||||
void notifyCallForwardingChanged(boolean cfi);
|
||||
void notifyDataActivity(int state);
|
||||
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
|
||||
String reason, String apn, in String[] apnTypes, String interfaceName);
|
||||
String reason, String apn, in String[] apnTypes, String interfaceName, int networkType);
|
||||
void notifyDataConnectionFailed(String reason);
|
||||
void notifyCellLocation(in Bundle cellLocation);
|
||||
}
|
||||
|
||||
@@ -257,6 +257,12 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
public ServiceState getServiceState() {
|
||||
int roamInd = mSST.ss.getCdmaRoamingIndicator();
|
||||
int defRoamInd = mSST.ss.getCdmaDefaultRoamingIndicator();
|
||||
|
||||
mSST.ss.setCdmaEriIconIndex(mEriManager.getCdmaEriIconIndex(roamInd, defRoamInd));
|
||||
mSST.ss.setCdmaEriIconMode(mEriManager.getCdmaEriIconMode(roamInd, defRoamInd));
|
||||
|
||||
return mSST.ss;
|
||||
}
|
||||
|
||||
@@ -798,6 +804,10 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
void notifyServiceStateChanged(ServiceState ss) {
|
||||
// TODO this seems really inefficient. Can't we calc this when the fundamentals change and store in the
|
||||
// service state?
|
||||
ss.setCdmaEriIconIndex(this.getCdmaEriIconIndex());
|
||||
ss.setCdmaEriIconMode(this.getCdmaEriIconMode());
|
||||
super.notifyServiceStateChangedP(ss);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user