Merge change 23271 into eclair

* changes:
  Cleanup egregious style issues.
This commit is contained in:
Android (Google) Code Review
2009-08-31 19:45:05 -07:00
3 changed files with 166 additions and 219 deletions

View File

@@ -28,20 +28,9 @@ import android.telephony.SignalStrength;
* {@hide} * {@hide}
*/ */
public abstract class ServiceStateTracker extends Handler { public abstract class ServiceStateTracker extends Handler {
/** /**
* The access technology currently in use: * Access technology currently in use.
* 0 = unknown
* 1 = GPRS only
* 2 = EDGE
* 3 = UMTS
* 4 = IS95A
* 5 = IS95B
* 6 = 1xRTT
* 7 = EvDo_0
* 8 = EvDo_A
* 9 = HSDPA
* 10 = HSUPA
* 11 = HSPA
*/ */
protected static final int DATA_ACCESS_UNKNOWN = 0; protected static final int DATA_ACCESS_UNKNOWN = 0;
protected static final int DATA_ACCESS_GPRS = 1; protected static final int DATA_ACCESS_GPRS = 1;
@@ -55,7 +44,6 @@ public abstract class ServiceStateTracker extends Handler {
protected static final int DATA_ACCESS_HSDPA = 9; protected static final int DATA_ACCESS_HSDPA = 9;
protected static final int DATA_ACCESS_HSUPA = 10; protected static final int DATA_ACCESS_HSUPA = 10;
protected static final int DATA_ACCESS_HSPA = 11; protected static final int DATA_ACCESS_HSPA = 11;
//***** Instance Variables
protected CommandsInterface cm; protected CommandsInterface cm;
@@ -64,33 +52,36 @@ public abstract class ServiceStateTracker extends Handler {
public SignalStrength mSignalStrength; public SignalStrength mSignalStrength;
// Used as a unique identifier to track requests associated with a poll /**
// and ignore stale responses.The value is a count-down of expected responses * A unique identifier to track requests associated with a poll
// in this pollingContext * and ignore stale responses. The value is a count-down of
* expected responses in this pollingContext.
*/
protected int[] pollingContext; protected int[] pollingContext;
protected boolean mDesiredPowerState; protected boolean mDesiredPowerState;
protected boolean dontPollSignalStrength = false; // Default is to poll strength /**
// If we're getting unsolicited signal strength updates from the radio, * By default, strength polling is enabled. However, if we're
// set value to true and don't bother polling any more * getting unsolicited signal strength updates from the radio, set
* value to true and don't bother polling any more.
*/
protected boolean dontPollSignalStrength = false;
protected RegistrantList networkAttachedRegistrants = new RegistrantList(); protected RegistrantList networkAttachedRegistrants = new RegistrantList();
protected RegistrantList roamingOnRegistrants = new RegistrantList(); protected RegistrantList roamingOnRegistrants = new RegistrantList();
protected RegistrantList roamingOffRegistrants = new RegistrantList(); protected RegistrantList roamingOffRegistrants = new RegistrantList();
//***** Constants
protected static final boolean DBG = true; protected static final boolean DBG = true;
// signal strength poll rate /** Signal strength poll rate. */
protected static final int POLL_PERIOD_MILLIS = 20 * 1000; protected static final int POLL_PERIOD_MILLIS = 20 * 1000;
// waiting period before recheck gprs and voice registration /** Waiting period before recheck gprs and voice registration. */
public static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000; public static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000;
public static final int DATA_STATE_POLL_SLEEP_MS = 100; public static final int DATA_STATE_POLL_SLEEP_MS = 100;
//*****GSM events /** GSM events */
protected static final int EVENT_RADIO_STATE_CHANGED = 1; protected static final int EVENT_RADIO_STATE_CHANGED = 1;
protected static final int EVENT_NETWORK_STATE_CHANGED = 2; protected static final int EVENT_NETWORK_STATE_CHANGED = 2;
protected static final int EVENT_GET_SIGNAL_STRENGTH = 3; protected static final int EVENT_GET_SIGNAL_STRENGTH = 3;
@@ -112,7 +103,7 @@ public abstract class ServiceStateTracker extends Handler {
protected static final int EVENT_CHECK_REPORT_GPRS = 22; protected static final int EVENT_CHECK_REPORT_GPRS = 22;
protected static final int EVENT_RESTRICTED_STATE_CHANGED = 23; protected static final int EVENT_RESTRICTED_STATE_CHANGED = 23;
//*****CDMA events: /** CDMA events */
protected static final int EVENT_POLL_STATE_REGISTRATION_CDMA = 24; protected static final int EVENT_POLL_STATE_REGISTRATION_CDMA = 24;
protected static final int EVENT_POLL_STATE_OPERATOR_CDMA = 25; protected static final int EVENT_POLL_STATE_OPERATOR_CDMA = 25;
protected static final int EVENT_RUIM_READY = 26; protected static final int EVENT_RUIM_READY = 26;
@@ -129,13 +120,14 @@ public abstract class ServiceStateTracker extends Handler {
protected static final int EVENT_OTA_PROVISION_STATUS_CHANGE = 37; protected static final int EVENT_OTA_PROVISION_STATUS_CHANGE = 37;
protected static final int EVENT_SET_RADIO_POWER_OFF = 38; protected static final int EVENT_SET_RADIO_POWER_OFF = 38;
//***** Time Zones
protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone";
// List of ISO codes for countries that can have an offset of GMT+0 /**
// when not in daylight savings time. This ignores some small places * List of ISO codes for countries that can have an offset of
// such as the Canary Islands (Spain) and Danmarkshavn (Denmark). * GMT+0 when not in daylight savings time. This ignores some
// The list must be sorted by code. * small places such as the Canary Islands (Spain) and
* Danmarkshavn (Denmark). The list must be sorted by code.
*/
protected static final String[] GMT_COUNTRY_CODES = { protected static final String[] GMT_COUNTRY_CODES = {
"bf", // Burkina Faso "bf", // Burkina Faso
"ci", // Cote d'Ivoire "ci", // Cote d'Ivoire
@@ -159,11 +151,10 @@ public abstract class ServiceStateTracker extends Handler {
"uk", // U.K "uk", // U.K
}; };
//***** Registration denied reason /** Reason for registration denial. */
protected static final String REGISTRATION_DENIED_GEN = "General"; protected static final String REGISTRATION_DENIED_GEN = "General";
protected static final String REGISTRATION_DENIED_AUTH = "Authentication Failure"; protected static final String REGISTRATION_DENIED_AUTH = "Authentication Failure";
//***** Constructors
public ServiceStateTracker() { public ServiceStateTracker() {
} }
@@ -228,8 +219,6 @@ public abstract class ServiceStateTracker extends Handler {
obtainMessage(EVENT_GET_PREFERRED_NETWORK_TYPE, onComplete)); obtainMessage(EVENT_GET_PREFERRED_NETWORK_TYPE, onComplete));
} }
//***** Called from Phone
public void public void
setRadioPower(boolean power) { setRadioPower(boolean power) {
mDesiredPowerState = power; mDesiredPowerState = power;
@@ -237,7 +226,6 @@ public abstract class ServiceStateTracker extends Handler {
setPowerStateToDesired(); setPowerStateToDesired();
} }
public void enableLocationUpdates() { public void enableLocationUpdates() {
cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED)); cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
} }
@@ -246,17 +234,15 @@ public abstract class ServiceStateTracker extends Handler {
cm.setLocationUpdates(false, null); cm.setLocationUpdates(false, null);
} }
//***** Overridden from Handler
public abstract void handleMessage(Message msg); public abstract void handleMessage(Message msg);
//***** Protected abstract Methods
protected abstract void handlePollStateResult(int what, AsyncResult ar); protected abstract void handlePollStateResult(int what, AsyncResult ar);
protected abstract void updateSpnDisplay(); protected abstract void updateSpnDisplay();
protected abstract void setPowerStateToDesired(); protected abstract void setPowerStateToDesired();
/** Cancel a pending (if any) pollState() operation */ /** Cancel a pending (if any) pollState() operation */
protected void cancelPollState() { protected void cancelPollState() {
// This will effectively cancel the rest of the poll requests // This will effectively cancel the rest of the poll requests.
pollingContext = new int[1]; pollingContext = new int[1];
} }
} }

View File

@@ -41,28 +41,19 @@ import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.util.Config; import android.util.Config;
import android.util.TimeUtils; import android.util.TimeUtils;
import java.util.Calendar;
import com.android.internal.telephony.CommandException; import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DataConnectionTracker; import com.android.internal.telephony.DataConnectionTracker;
// pretty sure importing stuff from GSM is bad:
import com.android.internal.telephony.gsm.MccTable; import com.android.internal.telephony.gsm.MccTable;
import com.android.internal.telephony.PhoneProxy; import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.ServiceStateTracker; import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyEventLog;
import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISMANUAL;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISROAMING;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_NUMERIC;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.TimeZone; import java.util.TimeZone;
@@ -70,14 +61,14 @@ import java.util.TimeZone;
* {@hide} * {@hide}
*/ */
final class CdmaServiceStateTracker extends ServiceStateTracker { final class CdmaServiceStateTracker extends ServiceStateTracker {
static final String LOG_TAG = "CDMA";
//***** Instance Variables
CDMAPhone phone; CDMAPhone phone;
CdmaCellLocation cellLoc; CdmaCellLocation cellLoc;
CdmaCellLocation newCellLoc; CdmaCellLocation newCellLoc;
/** /**
* The access technology currently in use: DATA_ACCESS_ * Values correspond to ServiceStateTracker.DATA_ACCESS_ definitions.
*/ */
private int networkType = 0; private int networkType = 0;
private int newNetworkType = 0; private int newNetworkType = 0;
@@ -87,7 +78,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private boolean mIsInPrl; private boolean mIsInPrl;
private int mDefaultRoamingIndicator; private int mDefaultRoamingIndicator;
// Initially we assume no data connection /**
* Initially assume no data connection.
*/
private int cdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE; private int cdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
private int newCdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE; private int newCdmaDataConnectionState = ServiceState.STATE_OUT_OF_SERVICE;
private int mRegistrationState = -1; private int mRegistrationState = -1;
@@ -95,9 +88,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private RegistrantList cdmaDataConnectionDetachedRegistrants = new RegistrantList(); private RegistrantList cdmaDataConnectionDetachedRegistrants = new RegistrantList();
private RegistrantList cdmaForSubscriptionInfoReadyRegistrants = new RegistrantList(); private RegistrantList cdmaForSubscriptionInfoReadyRegistrants = new RegistrantList();
// Sometimes we get the NITZ time before we know what country we are in. /**
// Keep the time zone information from the NITZ string so we can fix * Sometimes we get the NITZ time before we know what country we
// the time zone once know the country. * are in. Keep the time zone information from the NITZ string so
* we can fix the time zone once know the country.
*/
private boolean mNeedFixZone = false; private boolean mNeedFixZone = false;
private int mZoneOffset; private int mZoneOffset;
private boolean mZoneDst; private boolean mZoneDst;
@@ -107,20 +102,23 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
long mSavedTime; long mSavedTime;
long mSavedAtTime; long mSavedAtTime;
// We can't register for SIM_RECORDS_LOADED immediately because the /**
// SIMRecords object may not be instantiated yet. * We can't register for SIM_RECORDS_LOADED immediately because the
* SIMRecords object may not be instantiated yet.
*/
private boolean mNeedToRegForRuimLoaded = false; private boolean mNeedToRegForRuimLoaded = false;
// Wake lock used while setting time of day. /** Wake lock used while setting time of day. */
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
private static final String WAKELOCK_TAG = "ServiceStateTracker"; private static final String WAKELOCK_TAG = "ServiceStateTracker";
// Keep track of SPN display rules, so we only broadcast intent if something changes. /** Track of SPN display rules, so we only broadcast intent if something changes. */
private String curSpn = null; private String curSpn = null;
private String curPlmn = null; // it contains the name of the registered network in CDMA can
// be the ONS or ERI text
private int curSpnRule = 0; private int curSpnRule = 0;
/** Contains the name of the registered network in CDMA (either ONS or ERI text). */
private String curPlmn = null;
private String mMdn; private String mMdn;
private int mHomeSystemId[] = null; private int mHomeSystemId[] = null;
private int mHomeNetworkId[] = null; private int mHomeNetworkId[] = null;
@@ -133,12 +131,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private boolean mPendingRadioPowerOffAfterDataOff = false; private boolean mPendingRadioPowerOffAfterDataOff = false;
// Registration Denied Reason, General/Authentication Failure, used only for debugging purposes /* Used only for debugging purposes. */
private String mRegistrationDeniedReason; private String mRegistrationDeniedReason;
//***** Constants
static final String LOG_TAG = "CDMA";
private ContentResolver cr; private ContentResolver cr;
private String currentCarrier = null; private String currentCarrier = null;
@@ -151,9 +146,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
}; };
//***** Constructors
public CdmaServiceStateTracker(CDMAPhone phone) { public CdmaServiceStateTracker(CDMAPhone phone) {
super(); super();
@@ -182,7 +174,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null); phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null);
cm.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null); cm.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);
// system setting property AIRPLANE_MODE_ON is set in Settings. // System setting property AIRPLANE_MODE_ON is set in Settings.
int airplaneMode = Settings.System.getInt( int airplaneMode = Settings.System.getInt(
phone.getContext().getContentResolver(), phone.getContext().getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0); Settings.System.AIRPLANE_MODE_ON, 0);
@@ -198,7 +190,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
public void dispose() { public void dispose() {
//Unregister for all events // Unregister for all events.
cm.unregisterForAvailable(this); cm.unregisterForAvailable(this);
cm.unregisterForRadioStateChanged(this); cm.unregisterForRadioStateChanged(this);
cm.unregisterForNetworkStateChanged(this); cm.unregisterForNetworkStateChanged(this);
@@ -236,8 +228,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void void registerForCdmaDataConnectionAttached(Handler h, int what, Object obj) {
registerForCdmaDataConnectionAttached(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
cdmaDataConnectionAttachedRegistrants.add(r); cdmaDataConnectionAttachedRegistrants.add(r);
@@ -245,6 +236,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
r.notifyRegistrant(); r.notifyRegistrant();
} }
} }
void unregisterForCdmaDataConnectionAttached(Handler h) { void unregisterForCdmaDataConnectionAttached(Handler h) {
cdmaDataConnectionAttachedRegistrants.remove(h); cdmaDataConnectionAttachedRegistrants.remove(h);
} }
@@ -255,8 +247,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void void registerForCdmaDataConnectionDetached(Handler h, int what, Object obj) {
registerForCdmaDataConnectionDetached(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
cdmaDataConnectionDetachedRegistrants.add(r); cdmaDataConnectionDetachedRegistrants.add(r);
@@ -264,6 +255,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
r.notifyRegistrant(); r.notifyRegistrant();
} }
} }
void unregisterForCdmaDataConnectionDetached(Handler h) { void unregisterForCdmaDataConnectionDetached(Handler h) {
cdmaDataConnectionDetachedRegistrants.remove(h); cdmaDataConnectionDetachedRegistrants.remove(h);
} }
@@ -287,7 +279,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
cdmaForSubscriptionInfoReadyRegistrants.remove(h); cdmaForSubscriptionInfoReadyRegistrants.remove(h);
} }
//***** Called from CDMAPhone
public void public void
getLacAndCid(Message onComplete) { getLacAndCid(Message onComplete) {
cm.getRegistrationState(obtainMessage( cm.getRegistrationState(obtainMessage(
@@ -302,14 +293,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
switch (msg.what) { switch (msg.what) {
case EVENT_RADIO_AVAILABLE: case EVENT_RADIO_AVAILABLE:
//this is unnecessary
//setPowerStateToDesired();
break; break;
case EVENT_RUIM_READY: case EVENT_RUIM_READY:
// The RUIM is now ready i.e if it was locked // The RUIM is now ready i.e if it was locked it has been
// it has been unlocked. At this stage, the radio is already // unlocked. At this stage, the radio is already powered on.
// powered on.
isSubscriptionFromRuim = true; isSubscriptionFromRuim = true;
if (mNeedToRegForRuimLoaded) { if (mNeedToRegForRuimLoaded) {
phone.mRuimRecords.registerForRecordsLoaded(this, phone.mRuimRecords.registerForRecordsLoaded(this,
@@ -320,10 +308,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
cm.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION)); cm.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription."); if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription.");
// restore the previous network selection. // Restore the previous network selection.
pollState(); pollState();
// Signal strength polling stops when radio is off // Signal strength polling stops when radio is off.
queueNextSignalStrengthPoll(); queueNextSignalStrengthPoll();
break; break;
@@ -334,13 +322,12 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
// subscription info. // subscription info.
cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION)); cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
pollState(); pollState();
// Signal strength polling stops when radio is off // Signal strength polling stops when radio is off.
queueNextSignalStrengthPoll(); queueNextSignalStrengthPoll();
break; break;
case EVENT_RADIO_STATE_CHANGED: case EVENT_RADIO_STATE_CHANGED:
// This will do nothing in the radio not // This will do nothing in the 'radio not available' case.
// available case
setPowerStateToDesired(); setPowerStateToDesired();
pollState(); pollState();
break; break;
@@ -351,10 +338,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
case EVENT_GET_SIGNAL_STRENGTH: case EVENT_GET_SIGNAL_STRENGTH:
// This callback is called when signal strength is polled // This callback is called when signal strength is polled
// all by itself // all by itself.
if (!(cm.getRadioState().isOn()) || (cm.getRadioState().isGsm())) { if (!(cm.getRadioState().isOn()) || (cm.getRadioState().isGsm())) {
// Polling will continue when radio turns back on // Polling will continue when radio turns back on.
return; return;
} }
ar = (AsyncResult) msg.obj; ar = (AsyncResult) msg.obj;
@@ -390,7 +377,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
} }
// only update if cell location really changed // Only update if cell location really changed.
if (cellLoc.getBaseStationId() != baseStationData[0] if (cellLoc.getBaseStationId() != baseStationData[0]
|| cellLoc.getBaseStationLatitude() != baseStationData[1] || cellLoc.getBaseStationLatitude() != baseStationData[1]
|| cellLoc.getBaseStationLongitude() != baseStationData[2]) { || cellLoc.getBaseStationLongitude() != baseStationData[2]) {
@@ -479,13 +466,12 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
break; break;
case EVENT_SIGNAL_STRENGTH_UPDATE: case EVENT_SIGNAL_STRENGTH_UPDATE:
// This is a notification from // This is a notification from CommandsInterface.setOnSignalStrengthUpdate.
// CommandsInterface.setOnSignalStrengthUpdate
ar = (AsyncResult) msg.obj; ar = (AsyncResult) msg.obj;
// The radio is telling us about signal strength changes // The radio is telling us about signal strength changes,
// we don't have to ask it // so we don't have to ask it.
dontPollSignalStrength = true; dontPollSignalStrength = true;
onSignalStrengthResult(ar); onSignalStrengthResult(ar);
@@ -504,7 +490,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
break; break;
case EVENT_ERI_FILE_LOADED: case EVENT_ERI_FILE_LOADED:
// Repoll the state once the ERI file has been loaded // Repoll the state once the ERI file has been loaded.
if (DBG) log("[CdmaServiceStateTracker] ERI file has been loaded, repolling."); if (DBG) log("[CdmaServiceStateTracker] ERI file has been loaded, repolling.");
pollState(); pollState();
break; break;
@@ -627,7 +613,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
int ints[]; int ints[];
String states[]; String states[];
// Ignore stale requests from last poll // Ignore stale requests from last poll.
if (ar.userObj != pollingContext) return; if (ar.userObj != pollingContext) return;
if (ar.exception != null) { if (ar.exception != null) {
@@ -638,13 +624,13 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
if (err == CommandException.Error.RADIO_NOT_AVAILABLE) { if (err == CommandException.Error.RADIO_NOT_AVAILABLE) {
// Radio has crashed or turned off // Radio has crashed or turned off.
cancelPollState(); cancelPollState();
return; return;
} }
if (!cm.getRadioState().isOn()) { if (!cm.getRadioState().isOn()) {
// Radio has crashed or turned off // Radio has crashed or turned off.
cancelPollState(); cancelPollState();
return; return;
} }
@@ -698,13 +684,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
mRegistrationState = registrationState; mRegistrationState = registrationState;
// mCdmaRoaming is true when registration state is roaming and TSB58 roaming // When registration state is roaming and TSB58
// indicator is not in the carrier-specified list of ERIs for home system // roaming indicator is not in the carrier-specified
// list of ERIs for home system, mCdmaRoaming is true.
mCdmaRoaming = mCdmaRoaming =
regCodeIsRoaming(registrationState) && !isRoamIndForHomeSystem(states[10]); regCodeIsRoaming(registrationState) && !isRoamIndForHomeSystem(states[10]);
newSS.setState (regCodeToServiceState(registrationState)); newSS.setState (regCodeToServiceState(registrationState));
this.newCdmaDataConnectionState = radioTechnologyToDataServiceState(radioTechnology); this.newCdmaDataConnectionState =
radioTechnologyToDataServiceState(radioTechnology);
newSS.setRadioTechnology(radioTechnology); newSS.setRadioTechnology(radioTechnology);
newNetworkType = radioTechnology; newNetworkType = radioTechnology;
@@ -715,7 +703,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
mDefaultRoamingIndicator = defaultRoamingIndicator; mDefaultRoamingIndicator = defaultRoamingIndicator;
// values are -1 if not available // Values are -1 if not available.
newCellLoc.setCellLocationData(baseStationId, baseStationLatitude, newCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
baseStationLongitude, systemId, networkId); baseStationLongitude, systemId, networkId);
@@ -737,8 +725,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (opNames != null && opNames.length >= 3) { if (opNames != null && opNames.length >= 3) {
if (cm.getRadioState().isNVReady()) { if (cm.getRadioState().isNVReady()) {
// In CDMA in case on NV the ss.mOperatorAlphaLong is set later with the // In CDMA in case on NV, the ss.mOperatorAlphaLong is set later with the
// ERI text, so here it is ignored what is coming from the modem // ERI text, so here it is ignored what is coming from the modem.
newSS.setOperatorName(null, opNames[1], opNames[2]); newSS.setOperatorName(null, opNames[1], opNames[2]);
} else { } else {
newSS.setOperatorName(opNames[0], opNames[1], opNames[2]); newSS.setOperatorName(opNames[0], opNames[1], opNames[2]);
@@ -803,9 +791,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} }
} }
// NOTE: Some operator may require overriding mCdmaRoaming
// NOTE: Some operator may require to override the mCdmaRoaming (set by the modem) // (set by the modem), depending on the mRoamingIndicator.
// depending on the mRoamingIndicator.
if (DBG) { if (DBG) {
log("Set CDMA Roaming Indicator to: " + newSS.getCdmaRoamingIndicator() log("Set CDMA Roaming Indicator to: " + newSS.getCdmaRoamingIndicator()
@@ -865,13 +852,13 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
setSignalStrengthDefaultValues(); setSignalStrengthDefaultValues();
mGotCountryCode = false; mGotCountryCode = false;
//NOTE: pollStateDone() is not needed in this case // NOTE: pollStateDone() is not needed in this case
break; break;
default: default:
// Issue all poll-related commands at once // Issue all poll-related commands at once, then count
// then count down the responses, which // down the responses which are allowed to arrive
// are allowed to arrive out-of-order // out-of-order.
pollingContext[0]++; pollingContext[0]++;
// RIL_REQUEST_OPERATOR is necessary for CDMA // RIL_REQUEST_OPERATOR is necessary for CDMA
@@ -1000,7 +987,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
newSS.setStateOutOfService(); // clean slate for next time newSS.setStateOutOfService(); // clean slate for next time
if (hasNetworkTypeChanged) { if (hasNetworkTypeChanged) {
phone.setSystemProperty(PROPERTY_DATA_NETWORK_TYPE, phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
networkTypeToString(networkType)); networkTypeToString(networkType));
} }
@@ -1027,14 +1014,14 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
String operatorNumeric; String operatorNumeric;
phone.setSystemProperty(PROPERTY_OPERATOR_ALPHA, phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
ss.getOperatorAlphaLong()); ss.getOperatorAlphaLong());
operatorNumeric = ss.getOperatorNumeric(); operatorNumeric = ss.getOperatorNumeric();
phone.setSystemProperty(PROPERTY_OPERATOR_NUMERIC, operatorNumeric); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
if (operatorNumeric == null) { if (operatorNumeric == null) {
phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, ""); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
} else { } else {
String isoCountryCode = ""; String isoCountryCode = "";
try{ try{
@@ -1046,14 +1033,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
Log.w(LOG_TAG, "countryCodeForMcc error" + ex); Log.w(LOG_TAG, "countryCodeForMcc error" + ex);
} }
phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, isoCountryCode); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY,
isoCountryCode);
mGotCountryCode = true; mGotCountryCode = true;
if (mNeedFixZone) { if (mNeedFixZone) {
fixTimeZone(isoCountryCode); fixTimeZone(isoCountryCode);
} }
} }
phone.setSystemProperty(PROPERTY_OPERATOR_ISROAMING, phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
ss.getRoaming() ? "true" : "false"); ss.getRoaming() ? "true" : "false");
updateSpnDisplay(); updateSpnDisplay();
@@ -1282,7 +1270,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
*/ */
private private
boolean isRoamingBetweenOperators(boolean cdmaRoaming, ServiceState s) { boolean isRoamingBetweenOperators(boolean cdmaRoaming, ServiceState s) {
String spn = SystemProperties.get(PROPERTY_ICC_OPERATOR_ALPHA, "empty"); String spn = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, "empty");
// NOTE: in case of RUIM we should completely ignore the ERI data file and // NOTE: in case of RUIM we should completely ignore the ERI data file and
// mOperatorAlphaLong is set from RIL_REQUEST_OPERATOR response 0 (alpha ONS) // mOperatorAlphaLong is set from RIL_REQUEST_OPERATOR response 0 (alpha ONS)
@@ -1366,7 +1354,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
zone = TimeZone.getTimeZone( tzname ); zone = TimeZone.getTimeZone( tzname );
} }
String iso = SystemProperties.get(PROPERTY_OPERATOR_ISO_COUNTRY); String iso = SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY);
if (zone == null) { if (zone == null) {
@@ -1549,7 +1537,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
* that could support voice and data simultaneously. * that could support voice and data simultaneously.
*/ */
boolean isConcurrentVoiceAndData() { boolean isConcurrentVoiceAndData() {
// Note: it needs to be confirmed which CDMA network types // Note: it needs to be confirmed which CDMA network types
// can support voice and data calls concurrently. // can support voice and data calls concurrently.
// For the time-being, the return value will be false. // For the time-being, the return value will be false.
@@ -1576,11 +1563,12 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
/** /**
* Returns IMSI as MCC + MNC + MIN * Returns IMSI as MCC + MNC + MIN
*/ */
/*package*/ String getImsi() { String getImsi() {
// TODO(Moto): When RUIM is enabled, IMSI will come from RUIM // TODO(Moto): When RUIM is enabled, IMSI will come from RUIM
// not build-time props. Moto will provide implementation // not build-time props. Moto will provide implementation
// for RUIM-ready case later. // for RUIM-ready case later.
String operatorNumeric = SystemProperties.get(PROPERTY_ICC_OPERATOR_NUMERIC, ""); String operatorNumeric = SystemProperties.get(
TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
if (!TextUtils.isEmpty(operatorNumeric) && getCdmaMin() != null) { if (!TextUtils.isEmpty(operatorNumeric) && getCdmaMin() != null) {
return (operatorNumeric + getCdmaMin()); return (operatorNumeric + getCdmaMin());

View File

@@ -16,13 +16,6 @@
package com.android.internal.telephony.gsm; package com.android.internal.telephony.gsm;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISROAMING;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_NUMERIC;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
@@ -60,6 +53,7 @@ import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.ServiceStateTracker; import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.TelephonyEventLog; import com.android.internal.telephony.TelephonyEventLog;
import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
@@ -70,8 +64,9 @@ import java.util.TimeZone;
* {@hide} * {@hide}
*/ */
final class GsmServiceStateTracker extends ServiceStateTracker { final class GsmServiceStateTracker extends ServiceStateTracker {
static final String LOG_TAG = "GSM";
static final boolean DBG = true;
//***** Instance Variables
GSMPhone phone; GSMPhone phone;
GsmCellLocation cellLoc; GsmCellLocation cellLoc;
GsmCellLocation newCellLoc; GsmCellLocation newCellLoc;
@@ -82,13 +77,15 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE; private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;
/** /**
* The access technology currently in use: DATA_ACCESS_ * Values correspond to ServiceStateTracker.DATA_ACCESS_ definitions.
*/ */
private int networkType = 0; private int networkType = 0;
private int newNetworkType = 0; private int newNetworkType = 0;
/* gsm roaming status solely based on TS 27.007 7.2 CREG */
/** GSM roaming status solely based on TS 27.007 7.2 CREG. */
private boolean mGsmRoaming = false; private boolean mGsmRoaming = false;
/* data roaming status solely based on TS 27.007 10.1.19 CGREG */
/** Data roaming status solely based on TS 27.007 10.1.19 CGREG. */
private boolean mDataRoaming = false; private boolean mDataRoaming = false;
private boolean newDataRoaming = false; private boolean newDataRoaming = false;
@@ -97,9 +94,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
private RegistrantList psRestrictEnabledRegistrants = new RegistrantList(); private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();
private RegistrantList psRestrictDisabledRegistrants = new RegistrantList(); private RegistrantList psRestrictDisabledRegistrants = new RegistrantList();
// Sometimes we get the NITZ time before we know what country we are in. /**
// Keep the time zone information from the NITZ string so we can fix * Sometimes we get the NITZ time before we know what country we
// the time zone once know the country. * are in. Keep the time zone information from the NITZ string so
* we can fix the time zone once know the country.
*/
private boolean mNeedFixZone = false; private boolean mNeedFixZone = false;
private int mZoneOffset; private int mZoneOffset;
private boolean mZoneDst; private boolean mZoneDst;
@@ -111,13 +110,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
long mSavedTime; long mSavedTime;
long mSavedAtTime; long mSavedAtTime;
// We can't register for SIM_RECORDS_LOADED immediately because the /**
// SIMRecords object may not be instantiated yet. * We can't register for SIM_RECORDS_LOADED immediately because the
* SIMRecords object may not be instantiated yet.
*/
private boolean mNeedToRegForSimLoaded; private boolean mNeedToRegForSimLoaded;
// Started the recheck process after finding gprs should registerd but not /** Started the recheck process after finding gprs should registerd but not. */
private boolean mStartedGprsRegCheck = false; private boolean mStartedGprsRegCheck = false;
// Already sent the event-log for no gprs register
/** Already sent the event-log for no gprs register. */
private boolean mReportedGprsNoReg = false; private boolean mReportedGprsNoReg = false;
/** /**
@@ -125,34 +127,29 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
*/ */
private Notification mNotification; private Notification mNotification;
// Wake lock used while setting time of day. /** Wake lock used while setting time of day. */
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
private static final String WAKELOCK_TAG = "ServiceStateTracker"; private static final String WAKELOCK_TAG = "ServiceStateTracker";
// Keep track of SPN display rules, so we only broadcast intent if something changes. /** Keep track of SPN display rules, so we only broadcast intent if something changes. */
private String curSpn = null; private String curSpn = null;
private String curPlmn = null; private String curPlmn = null;
private int curSpnRule = 0; private int curSpnRule = 0;
//***** Constants /** waiting period before recheck gprs and voice registration. */
static final boolean DBG = true;
static final String LOG_TAG = "GSM";
// waiting period before recheck gprs and voice registration
static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000; static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000;
// notification type /** Notification type. */
static final int PS_ENABLED = 1001; // Access Control blocks data service static final int PS_ENABLED = 1001; // Access Control blocks data service
static final int PS_DISABLED = 1002; // Access Control enables data service static final int PS_DISABLED = 1002; // Access Control enables data service
static final int CS_ENABLED = 1003; // Access Control blocks all voice/sms service static final int CS_ENABLED = 1003; // Access Control blocks all voice/sms service
static final int CS_DISABLED = 1004; // Access Control enables all voice/sms service static final int CS_DISABLED = 1004; // Access Control enables all voice/sms service
static final int CS_NORMAL_ENABLED = 1005; // Access Control blocks normal voice/sms service static final int CS_NORMAL_ENABLED = 1005; // Access Control blocks normal voice/sms service
static final int CS_EMERGENCY_ENABLED = 1006; // Access Control blocks emergency call service static final int CS_EMERGENCY_ENABLED = 1006; // Access Control blocks emergency call service
// notification id /** Notification id. */
static final int PS_NOTIFICATION = 888; //id to update and cancel PS restricted static final int PS_NOTIFICATION = 888; // Id to update and cancel PS restricted
static final int CS_NOTIFICATION = 999; //id to update and cancel CS restricted static final int CS_NOTIFICATION = 999; // Id to update and cancel CS restricted
static final int MAX_NUM_DATA_STATE_READS = 15; static final int MAX_NUM_DATA_STATE_READS = 15;
@@ -164,9 +161,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
}; };
//***** Constructors
public GsmServiceStateTracker(GSMPhone phone) { public GsmServiceStateTracker(GSMPhone phone) {
super(); super();
@@ -207,7 +201,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
public void dispose() { public void dispose() {
//Unregister for all events // Unregister for all events.
cm.unregisterForAvailable(this); cm.unregisterForAvailable(this);
cm.unregisterForRadioStateChanged(this); cm.unregisterForRadioStateChanged(this);
cm.unregisterForNetworkStateChanged(this); cm.unregisterForNetworkStateChanged(this);
@@ -230,7 +224,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void registerForGprsAttached(Handler h, int what, Object obj) { void registerForGprsAttached(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
gprsAttachedRegistrants.add(r); gprsAttachedRegistrants.add(r);
@@ -239,11 +233,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
/*protected*/ void unregisterForGprsAttached(Handler h) { void unregisterForGprsAttached(Handler h) {
gprsAttachedRegistrants.remove(h); gprsAttachedRegistrants.remove(h);
} }
/*protected*/ void registerForNetworkAttach(Handler h, int what, Object obj) { void registerForNetworkAttach(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
networkAttachedRegistrants.add(r); networkAttachedRegistrants.add(r);
@@ -252,16 +246,17 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
/*protected*/ void unregisterForNetworkAttach(Handler h) { void unregisterForNetworkAttach(Handler h) {
networkAttachedRegistrants.remove(h); networkAttachedRegistrants.remove(h);
} }
/** /**
* Registration point for transition into GPRS detached. * Registration point for transition into GPRS detached.
* @param h handler to notify * @param h handler to notify
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void registerForGprsDetached(Handler h, int what, Object obj) { void registerForGprsDetached(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
gprsDetachedRegistrants.add(r); gprsDetachedRegistrants.add(r);
@@ -270,7 +265,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
/*protected*/ void unregisterForGprsDetached(Handler h) { void unregisterForGprsDetached(Handler h) {
gprsDetachedRegistrants.remove(h); gprsDetachedRegistrants.remove(h);
} }
@@ -280,7 +275,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void registerForPsRestrictedEnabled(Handler h, int what, Object obj) { void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedEnabled "); Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedEnabled ");
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
psRestrictEnabledRegistrants.add(r); psRestrictEnabledRegistrants.add(r);
@@ -290,7 +285,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
/*protected*/ void unregisterForPsRestrictedEnabled(Handler h) { void unregisterForPsRestrictedEnabled(Handler h) {
psRestrictEnabledRegistrants.remove(h); psRestrictEnabledRegistrants.remove(h);
} }
@@ -300,7 +295,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param what what code of message when delivered * @param what what code of message when delivered
* @param obj placed in Message.obj * @param obj placed in Message.obj
*/ */
/*protected*/ void registerForPsRestrictedDisabled(Handler h, int what, Object obj) { void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedDisabled "); Log.d(LOG_TAG, "[DSAC DEB] " + "registerForPsRestrictedDisabled ");
Registrant r = new Registrant(h, what, obj); Registrant r = new Registrant(h, what, obj);
psRestrictDisabledRegistrants.add(r); psRestrictDisabledRegistrants.add(r);
@@ -310,25 +305,20 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
/*protected*/ void unregisterForPsRestrictedDisabled(Handler h) { void unregisterForPsRestrictedDisabled(Handler h) {
psRestrictDisabledRegistrants.remove(h); psRestrictDisabledRegistrants.remove(h);
} }
/*protected*/ boolean getDataRoaming() { boolean getDataRoaming() {
return mDataRoaming; return mDataRoaming;
} }
//***** Called from GSMPhone public void getLacAndCid(Message onComplete) {
public void
getLacAndCid(Message onComplete) {
cm.getRegistrationState(obtainMessage( cm.getRegistrationState(obtainMessage(
EVENT_GET_LOC_DONE, onComplete)); EVENT_GET_LOC_DONE, onComplete));
} }
public void handleMessage (Message msg) {
//***** Overridden from ServiceStateTracker
public void
handleMessage (Message msg) {
AsyncResult ar; AsyncResult ar;
int[] ints; int[] ints;
String[] strings; String[] strings;
@@ -529,10 +519,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
//***** Private Instance Methods protected void setPowerStateToDesired() {
protected void setPowerStateToDesired()
{
// If we want it on and it's off, turn it on // If we want it on and it's off, turn it on
if (mDesiredPowerState if (mDesiredPowerState
&& cm.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) { && cm.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
@@ -593,9 +580,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
/** /**
* Handle the result of one of the pollState()-related requests * Handle the result of one of the pollState()-related requests
*/ */
protected void handlePollStateResult (int what, AsyncResult ar) {
protected void
handlePollStateResult (int what, AsyncResult ar) {
int ints[]; int ints[];
String states[]; String states[];
@@ -726,9 +711,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* and start over again if the radio notifies us that some * and start over again if the radio notifies us that some
* event has changed * event has changed
*/ */
private void pollState() {
private void
pollState() {
pollingContext = new int[1]; pollingContext = new int[1];
pollingContext[0] = 0; pollingContext[0] = 0;
@@ -828,8 +811,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
return ret; return ret;
} }
private void private void pollStateDone() {
pollStateDone() {
if (DBG) { if (DBG) {
Log.d(LOG_TAG, "Poll ServiceState done: " + Log.d(LOG_TAG, "Poll ServiceState done: " +
" oldSS=[" + ss + "] newSS=[" + newSS + " oldSS=[" + ss + "] newSS=[" + newSS +
@@ -882,7 +864,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
newSS.setStateOutOfService(); // clean slate for next time newSS.setStateOutOfService(); // clean slate for next time
if (hasNetworkTypeChanged) { if (hasNetworkTypeChanged) {
phone.setSystemProperty(PROPERTY_DATA_NETWORK_TYPE, phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
networkTypeToString(networkType)); networkTypeToString(networkType));
} }
@@ -895,14 +877,14 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
if (hasChanged) { if (hasChanged) {
String operatorNumeric; String operatorNumeric;
phone.setSystemProperty(PROPERTY_OPERATOR_ALPHA, phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ALPHA,
ss.getOperatorAlphaLong()); ss.getOperatorAlphaLong());
operatorNumeric = ss.getOperatorNumeric(); operatorNumeric = ss.getOperatorNumeric();
phone.setSystemProperty(PROPERTY_OPERATOR_NUMERIC, operatorNumeric); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric);
if (operatorNumeric == null) { if (operatorNumeric == null) {
phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, ""); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, "");
} else { } else {
String iso = ""; String iso = "";
try{ try{
@@ -914,7 +896,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
Log.w(LOG_TAG, "countryCodeForMcc error" + ex); Log.w(LOG_TAG, "countryCodeForMcc error" + ex);
} }
phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, iso); phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, iso);
mGotCountryCode = true; mGotCountryCode = true;
if (mNeedFixZone) { if (mNeedFixZone) {
@@ -957,7 +939,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
} }
phone.setSystemProperty(PROPERTY_OPERATOR_ISROAMING, phone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISROAMING,
ss.getRoaming() ? "true" : "false"); ss.getRoaming() ? "true" : "false");
updateSpnDisplay(); updateSpnDisplay();
@@ -1052,8 +1034,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
return guess; return guess;
} }
private void private void queueNextSignalStrengthPoll() {
queueNextSignalStrengthPoll() {
if (dontPollSignalStrength || (cm.getRadioState().isCdma())) { if (dontPollSignalStrength || (cm.getRadioState().isCdma())) {
// The radio is telling us about signal strength changes // The radio is telling us about signal strength changes
// we don't have to ask it // we don't have to ask it
@@ -1075,8 +1056,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* send signal-strength-changed notification if changed * send signal-strength-changed notification if changed
* Called both for solicited and unsolicited signal stength updates * Called both for solicited and unsolicited signal stength updates
*/ */
private void private void onSignalStrengthResult(AsyncResult ar) {
onSignalStrengthResult(AsyncResult ar) {
SignalStrength oldSignalStrength = mSignalStrength; SignalStrength oldSignalStrength = mSignalStrength;
int rssi = 99; int rssi = 99;
@@ -1117,8 +1097,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* *
* @param ar an int value of RIL_RESTRICTED_STATE_* * @param ar an int value of RIL_RESTRICTED_STATE_*
*/ */
private void onRestrictedStateChanged(AsyncResult ar) private void onRestrictedStateChanged(AsyncResult ar) {
{
Log.d(LOG_TAG, "[DSAC DEB] " + "onRestrictedStateChanged"); Log.d(LOG_TAG, "[DSAC DEB] " + "onRestrictedStateChanged");
RestrictedState newRs = new RestrictedState(); RestrictedState newRs = new RestrictedState();
@@ -1207,8 +1186,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
/** code is registration state 0-5 from TS 27.007 7.2 */ /** code is registration state 0-5 from TS 27.007 7.2 */
private int private int regCodeToServiceState(int code) {
regCodeToServiceState(int code) {
switch (code) { switch (code) {
case 0: case 0:
case 2: // 2 is "searching" case 2: // 2 is "searching"
@@ -1234,8 +1212,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* code is registration state 0-5 from TS 27.007 7.2 * code is registration state 0-5 from TS 27.007 7.2
* returns true if registered roam, false otherwise * returns true if registered roam, false otherwise
*/ */
private boolean private boolean regCodeIsRoaming (int code) {
regCodeIsRoaming (int code) {
// 5 is "in service -- roam" // 5 is "in service -- roam"
return 5 == code; return 5 == code;
} }
@@ -1247,9 +1224,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @param s ServiceState hold current ons * @param s ServiceState hold current ons
* @return true for roaming state set * @return true for roaming state set
*/ */
private private boolean isRoamingBetweenOperators(boolean gsmRoaming, ServiceState s) {
boolean isRoamingBetweenOperators(boolean gsmRoaming, ServiceState s) { String spn = SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, "empty");
String spn = SystemProperties.get(PROPERTY_ICC_OPERATOR_ALPHA, "empty");
String onsl = s.getOperatorAlphaLong(); String onsl = s.getOperatorAlphaLong();
String onss = s.getOperatorAlphaShort(); String onss = s.getOperatorAlphaShort();
@@ -1257,7 +1233,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
boolean equalsOnsl = onsl != null && spn.equals(onsl); boolean equalsOnsl = onsl != null && spn.equals(onsl);
boolean equalsOnss = onss != null && spn.equals(onss); boolean equalsOnss = onss != null && spn.equals(onss);
String simNumeric = SystemProperties.get(PROPERTY_ICC_OPERATOR_NUMERIC, ""); String simNumeric = SystemProperties.get(
TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "");
String operatorNumeric = s.getOperatorNumeric(); String operatorNumeric = s.getOperatorNumeric();
boolean equalsMcc = true; boolean equalsMcc = true;
@@ -1270,8 +1247,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
return gsmRoaming && !(equalsMcc && (equalsOnsl || equalsOnss)); return gsmRoaming && !(equalsMcc && (equalsOnsl || equalsOnss));
} }
private static private static int twoDigitsAt(String s, int offset) {
int twoDigitsAt(String s, int offset) {
int a, b; int a, b;
a = Character.digit(s.charAt(offset), 10); a = Character.digit(s.charAt(offset), 10);
@@ -1289,7 +1265,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
* @return The current GPRS state. IN_SERVICE is the same as "attached" * @return The current GPRS state. IN_SERVICE is the same as "attached"
* and OUT_OF_SERVICE is the same as detached. * and OUT_OF_SERVICE is the same as detached.
*/ */
/*package*/ int getCurrentGprsState() { int getCurrentGprsState() {
return gprsState; return gprsState;
} }
@@ -1337,10 +1313,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
/** /**
* nitzReceiveTime is time_t that the NITZ time was posted * nitzReceiveTime is time_t that the NITZ time was posted
*/ */
private void setTimeFromNITZString (String nitz, long nitzReceiveTime) {
private
void setTimeFromNITZString (String nitz, long nitzReceiveTime)
{
// "yy/mm/dd,hh:mm:ss(+/-)tz" // "yy/mm/dd,hh:mm:ss(+/-)tz"
// tz is in number of quarter-hours // tz is in number of quarter-hours
@@ -1404,7 +1377,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
zone = TimeZone.getTimeZone( tzname ); zone = TimeZone.getTimeZone( tzname );
} }
String iso = SystemProperties.get(PROPERTY_OPERATOR_ISO_COUNTRY); String iso = SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY);
if (zone == null) { if (zone == null) {