am 98e0b146: Make PhoneStateListeners not call TelephonyManager

Merge commit '98e0b146b80670b52805b4b210ef5582dad6bb68' into eclair-plus-aosp

* commit '98e0b146b80670b52805b4b210ef5582dad6bb68':
  Make PhoneStateListeners not call TelephonyManager
This commit is contained in:
Robert Greenwalt
2009-10-09 01:22:57 -07:00
committed by Android Git Automerger
8 changed files with 84 additions and 17 deletions

View File

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

View File

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