summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:00 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:44:00 -0800
commitd24b8183b93e781080b2c16c487e60d51c12da31 (patch)
treefbb89154858984eb8e41556da7e9433040d55cd4 /telephony
parentf1e484acb594a726fb57ad0ae4cfe902c7f35858 (diff)
downloadframeworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.zip
frameworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.tar.gz
frameworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.tar.bz2
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java8
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/CallTracker.java107
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java94
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GSMConnection.java46
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GSMPhone.java18
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/MccTable.java4
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/PdpConnection.java21
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java163
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java55
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/TelephonyEventLog.java33
10 files changed, 374 insertions, 175 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 374a703..c5b1b73 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -252,10 +252,7 @@ public class TelephonyManager {
*/
public List<NeighboringCellInfo> getNeighboringCellInfo() {
try {
- ITelephony tel = getITelephony();
- if (tel != null) {
- return tel.getNeighboringCellInfo();
- }
+ return getITelephony().getNeighboringCellInfo();
} catch (RemoteException ex) {
}
return null;
@@ -683,7 +680,8 @@ public class TelephonyManager {
public void listen(PhoneStateListener listener, int events) {
String pkgForDebug = mContext != null ? mContext.getPackageName() : "<unknown>";
try {
- mRegistry.listen(pkgForDebug, listener.callback, events, true);
+ Boolean notifyNow = (getITelephony() != null);
+ mRegistry.listen(pkgForDebug, listener.callback, events, notifyNow);
} catch (RemoteException ex) {
// system process dead
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/CallTracker.java b/telephony/java/com/android/internal/telephony/gsm/CallTracker.java
index afd11c4..2d716bb 100644
--- a/telephony/java/com/android/internal/telephony/gsm/CallTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/CallTracker.java
@@ -51,10 +51,7 @@ public final class CallTracker extends Handler
private static final boolean REPEAT_POLLING = false;
private static final boolean DBG_POLL = false;
-
- // Event Log Tags
- private static final int EVENT_LOG_CALL_DROP = 50106;
-
+
//***** Constants
static final int POLL_DELAY_MSEC = 250;
@@ -62,17 +59,17 @@ public final class CallTracker extends Handler
static final int MAX_CONNECTIONS_PER_CALL = 5; // only 5 connections allowed per call
//***** Instance Variables
-
+
GSMConnection connections[] = new GSMConnection[MAX_CONNECTIONS];
RegistrantList voiceCallEndedRegistrants = new RegistrantList();
RegistrantList voiceCallStartedRegistrants = new RegistrantList();
// connections dropped durin last poll
- ArrayList<GSMConnection> droppedDuringPoll
- = new ArrayList<GSMConnection>(MAX_CONNECTIONS);
+ ArrayList<GSMConnection> droppedDuringPoll
+ = new ArrayList<GSMConnection>(MAX_CONNECTIONS);
- GSMCall ringingCall = new GSMCall(this);
+ GSMCall ringingCall = new GSMCall(this);
// A call that is ringing or (call) waiting
GSMCall foregroundCall = new GSMCall(this);
GSMCall backgroundCall = new GSMCall(this);
@@ -172,13 +169,13 @@ public final class CallTracker extends Handler
// for the newly dialed connection
switchWaitingOrHoldingAndActive();
- // Fake local state so that
+ // Fake local state so that
// a) foregroundCall is empty for the newly dialed connection
// b) hasNonHangupStateChanged remains false in the
// next poll, so that we don't clear a failed dialing call
fakeHoldForegroundBeforeDial();
- }
-
+ }
+
if (foregroundCall.getState() != Call.State.IDLE) {
//we should have failed in !canDial() above before we get here
throw new CallStateException("cannot dial in current state");
@@ -194,22 +191,22 @@ public final class CallTracker extends Handler
pendingMO.cause = Connection.DisconnectCause.INVALID_NUMBER;
// handlePollCalls() will notice this call not present
- // and will mark it as dropped.
+ // and will mark it as dropped.
pollCallsWhenSafe();
} else {
// Always unmute when initiating a new call
setMute(false);
- cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
+ cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
}
updatePhoneState();
phone.notifyCallStateChanged();
-
+
return pendingMO;
}
-
+
Connection
dial (String dialString) throws CallStateException
{
@@ -222,7 +219,7 @@ public final class CallTracker extends Handler
// FIXME if SWITCH fails, should retry with ANSWER
// in case the active/holding call disappeared and this
// is no longer call waiting
-
+
if (ringingCall.getState() == Call.State.INCOMING) {
Log.i("phone", "acceptCall: incoming...");
// Always unmute when answering a new call
@@ -270,7 +267,7 @@ public final class CallTracker extends Handler
{
cm.explicitCallTransfer(obtainCompleteMessage(EVENT_ECT_RESULT));
}
-
+
void
clearDisconnected()
{
@@ -280,7 +277,7 @@ public final class CallTracker extends Handler
phone.notifyCallStateChanged();
}
- boolean
+ boolean
canConference()
{
return foregroundCall.getState() == Call.State.ACTIVE
@@ -312,13 +309,13 @@ public final class CallTracker extends Handler
}
//***** Private Instance Methods
-
+
private void
internalClearDisconnected()
{
ringingCall.clearDisconnected();
foregroundCall.clearDisconnected();
- backgroundCall.clearDisconnected();
+ backgroundCall.clearDisconnected();
}
/**
@@ -364,7 +361,7 @@ public final class CallTracker extends Handler
/**
* Obtain a complete message that indicates that this operation
* does not require polling of getCurrentCalls(). However, if other
- * operations that do need getCurrentCalls() are pending or are
+ * operations that do need getCurrentCalls() are pending or are
* scheduled while this operation is pending, the invocatoin
* of getCurrentCalls() will be postponed until this
* operation is also complete.
@@ -382,20 +379,20 @@ public final class CallTracker extends Handler
operationComplete()
{
pendingOperations--;
-
+
if (DBG_POLL) log("operationComplete: pendingOperations=" +
pendingOperations + ", needsPoll=" + needsPoll);
if (pendingOperations == 0 && needsPoll) {
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
- cm.getCurrentCalls(lastRelevantPoll);
+ cm.getCurrentCalls(lastRelevantPoll);
} else if (pendingOperations < 0) {
// this should never happen
Log.e(LOG_TAG,"CallTracker.pendingOperations < 0");
pendingOperations = 0;
}
}
-
+
private void
pollCallsWhenSafe()
{
@@ -403,10 +400,10 @@ public final class CallTracker extends Handler
if (checkNoOperationsPending()) {
lastRelevantPoll = obtainMessage(EVENT_POLL_CALLS_RESULT);
- cm.getCurrentCalls(lastRelevantPoll);
+ cm.getCurrentCalls(lastRelevantPoll);
}
}
-
+
private void
pollCallsAfterDelay()
{
@@ -428,7 +425,7 @@ public final class CallTracker extends Handler
updatePhoneState()
{
Phone.State oldState = state;
-
+
if (ringingCall.isRinging()) {
state = Phone.State.RINGING;
} else if (pendingMO != null ||
@@ -436,7 +433,7 @@ public final class CallTracker extends Handler
state = Phone.State.OFFHOOK;
} else {
state = Phone.State.IDLE;
- }
+ }
if (state == Phone.State.IDLE && oldState != state) {
voiceCallEndedRegistrants.notifyRegistrants(
@@ -475,7 +472,7 @@ public final class CallTracker extends Handler
boolean needsPollDelay = false;
boolean unknownConnectionAppeared = false;
- for (int i = 0, curDC = 0, dcSize = polledCalls.size()
+ for (int i = 0, curDC = 0, dcSize = polledCalls.size()
; i < connections.length; i++) {
GSMConnection conn = connections[i];
DriverCall dc = null;
@@ -532,7 +529,7 @@ public final class CallTracker extends Handler
// which is neither a ringing call or one we created.
// Either we've crashed and re-attached to an existing
// call, or something else (eg, SIM) initiated the call.
-
+
Log.i(LOG_TAG,"Phantom call appeared " + dc);
// If it's a connected call, set the connect time so that
@@ -549,8 +546,8 @@ public final class CallTracker extends Handler
hasNonHangupStateChanged = true;
} else if (conn != null && dc == null) {
// Connection missing in CLCC response that we were
- // tracking.
- droppedDuringPoll.add(conn);
+ // tracking.
+ droppedDuringPoll.add(conn);
// Dropped connections are removed from the CallTracker
// list but kept in the GSMCall list
connections[i] = null;
@@ -558,7 +555,7 @@ public final class CallTracker extends Handler
// Connection in CLCC response does not match what
// we were tracking. Assume dropped call and new call
- droppedDuringPoll.add(conn);
+ droppedDuringPoll.add(conn);
connections[i] = new GSMConnection (phone.getContext(), dc, this, i);
if (connections[i].getCall() == ringingCall) {
@@ -594,11 +591,11 @@ public final class CallTracker extends Handler
// This is the first poll after an ATD.
// We expect the pending call to appear in the list
// If it does not, we land here
- if (pendingMO != null) {
- Log.d(LOG_TAG,"Pending MO dropped before poll fg state:"
+ if (pendingMO != null) {
+ Log.d(LOG_TAG,"Pending MO dropped before poll fg state:"
+ foregroundCall.getState());
- droppedDuringPoll.add(pendingMO);
+ droppedDuringPoll.add(pendingMO);
pendingMO = null;
hangupPendingMO = false;
}
@@ -619,7 +616,7 @@ public final class CallTracker extends Handler
if (conn.cause == Connection.DisconnectCause.LOCAL) {
cause = Connection.DisconnectCause.INCOMING_REJECTED;
} else {
- cause = Connection.DisconnectCause.INCOMING_MISSED;
+ cause = Connection.DisconnectCause.INCOMING_MISSED;
}
if (Phone.DEBUG_PHONE) {
@@ -690,7 +687,7 @@ public final class CallTracker extends Handler
dumpState()
{
List l;
-
+
Log.i(LOG_TAG,"Phone State:" + state);
Log.i(LOG_TAG,"Ringing call: " + ringingCall.toString());
@@ -722,7 +719,7 @@ public final class CallTracker extends Handler
hangup (GSMConnection conn) throws CallStateException
{
if (conn.owner != this) {
- throw new CallStateException ("Connection " + conn
+ throw new CallStateException ("Connection " + conn
+ "does not belong to CallTracker " + this);
}
@@ -731,14 +728,14 @@ public final class CallTracker extends Handler
// GSM index assigned yet
if (Phone.DEBUG_PHONE) log("hangup: set hangupPendingMO to true");
- hangupPendingMO = true;
+ hangupPendingMO = true;
} else {
- try {
+ try {
cm.hangupConnection (conn.getGSMIndex(), obtainCompleteMessage());
} catch (CallStateException ex) {
// Ignore "connection not found"
// Call may have hung up already
- Log.w(LOG_TAG,"CallTracker WARN: hangup() on absent connection "
+ Log.w(LOG_TAG,"CallTracker WARN: hangup() on absent connection "
+ conn);
}
}
@@ -750,16 +747,16 @@ public final class CallTracker extends Handler
separate (GSMConnection conn) throws CallStateException
{
if (conn.owner != this) {
- throw new CallStateException ("Connection " + conn
+ throw new CallStateException ("Connection " + conn
+ "does not belong to CallTracker " + this);
}
try {
- cm.separateConnection (conn.getGSMIndex(),
+ cm.separateConnection (conn.getGSMIndex(),
obtainCompleteMessage(EVENT_SEPARATE_RESULT));
} catch (CallStateException ex) {
// Ignore "connection not found"
// Call may have hung up already
- Log.w(LOG_TAG,"CallTracker WARN: separate() on absent connection "
+ Log.w(LOG_TAG,"CallTracker WARN: separate() on absent connection "
+ conn);
}
}
@@ -772,14 +769,14 @@ public final class CallTracker extends Handler
desiredMute = mute;
cm.setMute(desiredMute, null);
}
-
+
/*package*/ boolean
getMute()
{
return desiredMute;
}
-
+
//***** Called from GSMCall
/* package */ void
@@ -886,11 +883,11 @@ public final class CallTracker extends Handler
//****** Overridden from Handler
- public void
+ public void
handleMessage (Message msg)
{
AsyncResult ar;
-
+
switch (msg.what) {
case EVENT_POLL_CALLS_RESULT:
ar = (AsyncResult)msg.obj;
@@ -924,7 +921,7 @@ public final class CallTracker extends Handler
int causeCode;
ar = (AsyncResult)msg.obj;
- operationComplete();
+ operationComplete();
if (ar.exception != null) {
// An exception occurred...just treat the disconnect
@@ -936,7 +933,7 @@ public final class CallTracker extends Handler
causeCode = ((int[])ar.result)[0];
}
// Log the causeCode if its not normal
- if (causeCode == CallFailCause.NO_CIRCUIT_AVAIL ||
+ if (causeCode == CallFailCause.NO_CIRCUIT_AVAIL ||
causeCode == CallFailCause.TEMPORARY_FAILURE ||
causeCode == CallFailCause.SWITCHING_CONGESTION ||
causeCode == CallFailCause.CHANNEL_NOT_AVAIL ||
@@ -946,12 +943,12 @@ public final class CallTracker extends Handler
int cid = -1;
GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
if (loc != null) cid = loc.getCid();
-
- EventLog.List val = new EventLog.List(causeCode, cid,
+
+ EventLog.List val = new EventLog.List(causeCode, cid,
TelephonyManager.getDefault().getNetworkType());
- EventLog.writeEvent(EVENT_LOG_CALL_DROP, val);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CALL_DROP, val);
}
-
+
for (int i = 0, s = droppedDuringPoll.size()
; i < s ; i++
) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java
index b0b8cdc..b115713 100644
--- a/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java
@@ -16,11 +16,6 @@
package com.android.internal.telephony.gsm;
-import static com.android.internal.telephony.TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE;
-import static com.android.internal.telephony.gsm.ServiceStateTracker.DATA_ACCESS_EDGE;
-import static com.android.internal.telephony.gsm.ServiceStateTracker.DATA_ACCESS_GPRS;
-import static com.android.internal.telephony.gsm.ServiceStateTracker.DATA_ACCESS_UMTS;
-import static com.android.internal.telephony.gsm.ServiceStateTracker.DATA_ACCESS_UNKNOWN;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@@ -31,6 +26,8 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.database.Cursor;
+import android.net.NetworkInfo;
+import android.net.wifi.WifiManager;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.INetStatService;
@@ -50,13 +47,10 @@ import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
-import android.util.EventLog.List;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.gsm.PdpConnection.PdpFailCause;
-import android.net.wifi.WifiManager;
-import android.net.NetworkInfo;
-
+
import java.io.IOException;
import java.util.ArrayList;
@@ -128,7 +122,8 @@ final class DataConnectionTracker extends Handler
Handler mDataConnectionTracker = null;
private ContentResolver mResolver;
- int txPkts, rxPkts, sentSinceLastRecv, netStatPollPeriod;
+ long txPkts, rxPkts, sentSinceLastRecv;
+ int netStatPollPeriod;
private int mNoRecvPollCount = 0;
private boolean mPingTestActive = false;
// Count of PDP reset attempts; reset when we see incoming,
@@ -161,7 +156,7 @@ final class DataConnectionTracker extends Handler
/** CID of active PDP */
int cidActive;
-
+
/** Currently requested APN type */
private String mRequestedApnType = Phone.APN_TYPE_DEFAULT;
@@ -232,13 +227,6 @@ final class DataConnectionTracker extends Handler
private static final String INTENT_RECONNECT_ALARM_EXTRA_REASON = "reason";
- //***** Tag IDs for EventLog
- private static final int EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED = 50101;
- private static final int EVENT_LOG_RADIO_RESET = 50102;
- private static final int EVENT_LOG_PDP_RESET = 50103;
- private static final int EVENT_LOG_REREGISTER_NETWORK = 50104;
- private static final int EVENT_LOG_RADIO_PDP_SETUP_FAIL = 50105;
-
//***** Event Codes
static final int EVENT_DATA_SETUP_COMPLETE = 1;
static final int EVENT_RADIO_AVAILABLE = 3;
@@ -500,7 +488,7 @@ final class DataConnectionTracker extends Handler
}
return true;
}
-
+
private boolean isApnTypeActive(String type) {
// TODO: to support simultaneous, mActiveApn can be a List instead.
return mActiveApn != null && mActiveApn.canHandleType(type);
@@ -537,7 +525,7 @@ final class DataConnectionTracker extends Handler
Log.d(LOG_TAG, "dataEnabled[DEFAULT_APN]=" + dataEnabled[APN_DEFAULT_ID] +
" dataEnabled[MMS_APN]=" + dataEnabled[APN_MMS_ID]);
}
-
+
/**
* Prevent mobile data connections from being established,
* or once again allow mobile data connections. If the state
@@ -605,7 +593,7 @@ final class DataConnectionTracker extends Handler
//Retrieve the data roaming setting from the shared preferences.
public boolean getDataOnRoamingEnabled() {
try {
- return Settings.Secure.getInt(phone.getContext().getContentResolver(),
+ return Settings.Secure.getInt(phone.getContext().getContentResolver(),
Settings.Secure.DATA_ROAMING) > 0;
} catch (SettingNotFoundException snfe) {
return false;
@@ -636,7 +624,7 @@ final class DataConnectionTracker extends Handler
stopNetStatPoll();
phone.notifyDataConnection(Phone.REASON_GPRS_DETACHED);
}
-
+
private void onGprsAttached() {
if (state == State.CONNECTED) {
startNetStatPoll();
@@ -746,7 +734,7 @@ final class DataConnectionTracker extends Handler
* IDLE before the code below runs. If we didn't check
* for that, future calls to trySetupData would fail,
* and we would never get out of the DISCONNECTING state.
- */
+ */
if (!tearDown) {
setState(State.IDLE);
phone.notifyDataConnection(reason);
@@ -932,6 +920,16 @@ final class DataConnectionTracker extends Handler
Log.i(LOG_TAG, "PDP connection has dropped. Reconnecting");
+ // Add an event log when the network drops PDP
+ int cid = -1;
+ GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+ if (loc != null) cid = loc.getCid();
+
+ EventLog.List val = new EventLog.List(cid,
+ TelephonyManager.getDefault().getNetworkType());
+
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val);
+
cleanUpConnection(true, null);
return;
@@ -964,6 +962,16 @@ final class DataConnectionTracker extends Handler
Log.i(LOG_TAG, "PDP connection has dropped (active=false case). "
+ " Reconnecting");
+ // Log the network drop on the event log.
+ int cid = -1;
+ GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+ if (loc != null) cid = loc.getCid();
+
+ EventLog.List val = new EventLog.List(cid,
+ TelephonyManager.getDefault().getNetworkType());
+
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val);
+
cleanUpConnection(true, null);
}
}
@@ -1040,14 +1048,14 @@ final class DataConnectionTracker extends Handler
if (state == State.CONNECTED) {
int maxPdpReset = Settings.Gservices.getInt(mResolver,
Settings.Gservices.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT,
- DEFAULT_MAX_PDP_RESET_FAIL);
+ DEFAULT_MAX_PDP_RESET_FAIL);
if (mPdpResetCount < maxPdpReset) {
mPdpResetCount++;
- EventLog.writeEvent(EVENT_LOG_PDP_RESET, sentSinceLastRecv);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_RESET, sentSinceLastRecv);
cleanUpConnection(true, Phone.REASON_PDP_RESET);
} else {
mPdpResetCount = 0;
- EventLog.writeEvent(EVENT_LOG_REREGISTER_NETWORK, sentSinceLastRecv);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_REREGISTER_NETWORK, sentSinceLastRecv);
phone.mSST.reRegisterNetwork(null);
}
// TODO: Add increasingly drastic recovery steps, eg,
@@ -1096,8 +1104,8 @@ final class DataConnectionTracker extends Handler
{
public void run() {
- int sent, received;
- int preTxPkts = -1, preRxPkts = -1;
+ long sent, received;
+ long preTxPkts = -1, preRxPkts = -1;
Activity newActivity;
@@ -1105,8 +1113,8 @@ final class DataConnectionTracker extends Handler
preRxPkts = rxPkts;
try {
- txPkts = netstat.getTxPackets();
- rxPkts = netstat.getRxPackets();
+ txPkts = netstat.getMobileTxPackets();
+ rxPkts = netstat.getMobileRxPackets();
} catch (RemoteException e) {
txPkts = 0;
rxPkts = 0;
@@ -1152,7 +1160,7 @@ final class DataConnectionTracker extends Handler
if (sentSinceLastRecv >= watchdogTrigger) {
// we already have NUMBER_SENT_PACKETS sent without ack
if (mNoRecvPollCount == 0) {
- EventLog.writeEvent(EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED,
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED,
sentSinceLastRecv);
}
@@ -1220,11 +1228,11 @@ final class DataConnectionTracker extends Handler
} catch (Exception e) {
Log.w(LOG_TAG, "exception trying to ping");
}
-
+
if (status == 0) {
// ping succeeded. False alarm. Reset netStatPoll.
// ("-1" for this event indicates a false alarm)
- EventLog.writeEvent(EVENT_LOG_PDP_RESET, -1);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_RESET, -1);
mPdpResetCount = 0;
sendMessage(obtainMessage(EVENT_START_NETSTAT_POLL));
} else {
@@ -1335,7 +1343,7 @@ final class DataConnectionTracker extends Handler
case EVENT_GPRS_ATTACHED:
onGprsAttached();
break;
-
+
case EVENT_ROAMING_ON:
if (getDataOnRoamingEnabled()) {
trySetupData(Phone.REASON_ROAMING_ON);
@@ -1410,7 +1418,7 @@ final class DataConnectionTracker extends Handler
SystemProperties.set("gsm.defaultpdpcontext.active", "false");
}
notifyDefaultData(reason);
-
+
// TODO: For simultaneous PDP support, we need to build another
// trigger another TRY_SETUP_DATA for the next APN type. (Note
// that the existing connection may service that type, in which
@@ -1421,7 +1429,7 @@ final class DataConnectionTracker extends Handler
if(DBG)
log("PDP setup failed " + cause);
// Log this failure to the Event Logs.
- if (cause == PdpConnection.PdpFailCause.BAD_APN ||
+ if (cause == PdpConnection.PdpFailCause.BAD_APN ||
cause == PdpConnection.PdpFailCause.BAD_PAP_SECRET ||
cause == PdpConnection.PdpFailCause.BARRED ||
cause == PdpConnection.PdpFailCause.RADIO_ERROR_RETRY ||
@@ -1431,12 +1439,12 @@ final class DataConnectionTracker extends Handler
int cid = -1;
GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
if (loc != null) cid = loc.getCid();
-
+
EventLog.List val = new EventLog.List(
- cause.ordinal(), cid,
- TelephonyManager.getDefault().getNetworkType());
- EventLog.writeEvent(EVENT_LOG_RADIO_PDP_SETUP_FAIL, val);
- }
+ cause.ordinal(), cid,
+ TelephonyManager.getDefault().getNetworkType());
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_RADIO_PDP_SETUP_FAIL, val);
+ }
// No try for permanent failure
if (cause.isPermanentFail()) {
notifyNoData(cause);
@@ -1575,7 +1583,7 @@ final class DataConnectionTracker extends Handler
if (cursor != null) {
if (cursor.getCount() > 0) {
allApns = createApnList(cursor);
- // TODO: Figure out where this fits in. This basically just
+ // TODO: Figure out where this fits in. This basically just
// writes the pap-secrets file. No longer tied to PdpConnection
// object. Not used on current platform (no ppp).
//PdpConnection pdp = pdpList.get(pdp_name);
@@ -1622,7 +1630,7 @@ final class DataConnectionTracker extends Handler
}
/**
- * Get next apn in waitingApns
+ * Get next apn in waitingApns
* @return the first apn found in waitingApns, null if none
*/
private ApnSetting getNextApn() {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMConnection.java b/telephony/java/com/android/internal/telephony/gsm/GSMConnection.java
index 43930c1..a503766 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GSMConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMConnection.java
@@ -77,15 +77,15 @@ public class GSMConnection extends Connection {
private PowerManager.WakeLock mPartialWakeLock;
//***** Event Constants
-
static final int EVENT_DTMF_DONE = 1;
static final int EVENT_PAUSE_DONE = 2;
static final int EVENT_NEXT_POST_DIAL = 3;
-
+ static final int EVENT_WAKE_LOCK_TIMEOUT = 4;
+
//***** Constants
-
static final int PAUSE_DELAY_FIRST_MILLIS = 100;
static final int PAUSE_DELAY_MILLIS = 3 * 1000;
+ static final int WAKE_LOCK_TIMEOUT_MILLIS = 60*1000;
//***** Inner Classes
@@ -100,8 +100,10 @@ public class GSMConnection extends Connection {
case EVENT_DTMF_DONE:
case EVENT_PAUSE_DONE:
processNextPostDialChar();
- break;
-
+ break;
+ case EVENT_WAKE_LOCK_TIMEOUT:
+ releaseWakeLock();
+ break;
}
}
}
@@ -279,7 +281,7 @@ public class GSMConnection extends Connection {
return;
}
- postDialState = PostDialState.STARTED;
+ setPostDialState(PostDialState.STARTED);
processNextPostDialChar();
}
@@ -291,7 +293,7 @@ public class GSMConnection extends Connection {
return;
}
- postDialState = PostDialState.STARTED;
+ setPostDialState(PostDialState.STARTED);
if (false) {
boolean playedTone = false;
@@ -333,7 +335,7 @@ public class GSMConnection extends Connection {
public void cancelPostDial()
{
- postDialState = PostDialState.CANCELLED;
+ setPostDialState(PostDialState.CANCELLED);
}
/**
@@ -562,9 +564,9 @@ public class GSMConnection extends Connection {
PAUSE_DELAY_MILLIS);
}
} else if (c == PhoneNumberUtils.WAIT) {
- postDialState = PostDialState.WAIT;
+ setPostDialState(PostDialState.WAIT);
} else if (c == PhoneNumberUtils.WILD) {
- postDialState = PostDialState.WILD;
+ setPostDialState(PostDialState.WILD);
} else {
return false;
}
@@ -614,14 +616,14 @@ public class GSMConnection extends Connection {
if (postDialString == null ||
postDialString.length() <= nextPostDialChar) {
- postDialState = PostDialState.COMPLETE;
+ setPostDialState(PostDialState.COMPLETE);
// notifyMessage.arg1 is 0 on complete
c = 0;
} else {
boolean isValid;
- postDialState = PostDialState.STARTED;
+ setPostDialState(PostDialState.STARTED);
c = postDialString.charAt(nextPostDialChar++);
@@ -699,6 +701,26 @@ public class GSMConnection extends Connection {
}
}
+ /**
+ * Set post dial state and acquire wake lock while switching to "started"
+ * state, the wake lock will be released if state switches out of "started"
+ * state or after WAKE_LOCK_TIMEOUT_MILLIS.
+ * @param s new PostDialState
+ */
+ private void setPostDialState(PostDialState s) {
+ if (postDialState != PostDialState.STARTED
+ && s == PostDialState.STARTED) {
+ acquireWakeLock();
+ Message msg = h.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
+ h.sendMessageDelayed(msg, WAKE_LOCK_TIMEOUT_MILLIS);
+ } else if (postDialState == PostDialState.STARTED
+ && s != PostDialState.STARTED) {
+ h.removeMessages(EVENT_WAKE_LOCK_TIMEOUT);
+ releaseWakeLock();
+ }
+ postDialState = s;
+ }
+
private void
createWakeLock(Context context) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index f314944..bd6d41e 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -108,6 +108,8 @@ public class GSMPhone extends PhoneBase {
SimPhoneBookInterfaceManager mSimPhoneBookIntManager;
SimSmsInterfaceManager mSimSmsIntManager;
PhoneSubInfo mSubInfo;
+ boolean mDnsCheckDisabled = false;
+
Registrant mPostDialHandler;
@@ -1151,6 +1153,22 @@ public class GSMPhone extends PhoneBase {
return mDataConnection.getAllPdps();
}
+ /**
+ * Disables the DNS check (i.e., allows "0.0.0.0").
+ * Useful for lab testing environment.
+ * @param b true disables the check, false enables.
+ */
+ public void disableDnsCheck(boolean b) {
+ mDnsCheckDisabled = b;
+ }
+
+ /**
+ * Returns true if the DNS check is currently disabled.
+ */
+ public boolean isDnsCheckDisabled() {
+ return mDnsCheckDisabled;
+ }
+
public void updateServiceLocation(Message response) {
mSST.getLacAndCid(response);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/MccTable.java b/telephony/java/com/android/internal/telephony/gsm/MccTable.java
index 8f6b22e..57a54c4 100644
--- a/telephony/java/com/android/internal/telephony/gsm/MccTable.java
+++ b/telephony/java/com/android/internal/telephony/gsm/MccTable.java
@@ -283,8 +283,8 @@ public final class MccTable
table.add(new MccEntry(436,"tj",2)); //Tajikistan (Republic of)
table.add(new MccEntry(437,"kg",2)); //Kyrgyz Republic
table.add(new MccEntry(438,"tm",2)); //Turkmenistan
- table.add(new MccEntry(440,"jp",2)); //Japan
- table.add(new MccEntry(441,"jp",2)); //Japan
+ table.add(new MccEntry(440,"jp",2,"Asia/Tokyo","ja")); //Japan
+ table.add(new MccEntry(441,"jp",2,"Asia/Tokyo","ja")); //Japan
table.add(new MccEntry(450,"kr",2)); //Korea (Republic of)
table.add(new MccEntry(452,"vn",2)); //Viet Nam (Socialist Republic of)
table.add(new MccEntry(454,"hk",2)); //"Hong Kong, China"
diff --git a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
index 6428f70..66f8b72 100644
--- a/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/PdpConnection.java
@@ -114,9 +114,6 @@ public class PdpConnection extends Handler {
private static final int EVENT_DEACTIVATE_DONE = 4;
private static final int EVENT_FORCE_RETRY = 5;
- //***** Tag IDs for EventLog
- private static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
-
//***** Instance Variables
private GSMPhone phone;
private String pdp_name;
@@ -301,7 +298,7 @@ public class PdpConnection extends Handler {
private void notifyDisconnect(Message msg) {
if (DBG) log("Notify PDP disconnect");
-
+
if (msg != null) {
AsyncResult.forMessage(msg);
msg.sendToTarget();
@@ -378,7 +375,7 @@ public class PdpConnection extends Handler {
if (ar.exception != null) {
Log.e(LOG_TAG, "PDP Context Init failed " + ar.exception);
-
+
if (receivedDisconnectReq) {
// Don't bother reporting the error if there's already a
// pending disconnect request, since DataConnectionTracker
@@ -406,7 +403,7 @@ public class PdpConnection extends Handler {
} else {
String[] response = ((String[]) ar.result);
cid = Integer.parseInt(response[0]);
-
+
if (response.length > 2) {
interfaceName = response[1];
ipAddress = response[2];
@@ -420,7 +417,8 @@ public class PdpConnection extends Handler {
+ " DNS2=" + dnsServers[1]);
}
- if (NULL_IP.equals(dnsServers[0]) && NULL_IP.equals(dnsServers[1])) {
+ if (NULL_IP.equals(dnsServers[0]) && NULL_IP.equals(dnsServers[1])
+ && !phone.isDnsCheckDisabled()) {
// Work around a race condition where QMI does not fill in DNS:
// Deactivate PDP and let DataConnectionTracker retry.
// Do not apply the race condition workaround for MMS APN
@@ -428,20 +426,21 @@ public class PdpConnection extends Handler {
// Otherwise, the default APN will not be restored anymore.
if (!apn.types[0].equals(Phone.APN_TYPE_MMS)
|| !isIpAddress(apn.mmsProxy)) {
- EventLog.writeEvent(EVENT_LOG_BAD_DNS_ADDRESS, dnsServers[0]);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_BAD_DNS_ADDRESS,
+ dnsServers[0]);
phone.mCM.deactivateDefaultPDP(cid,
obtainMessage(EVENT_FORCE_RETRY));
break;
}
}
}
-
+
if (dataLink != null) {
dataLink.connect();
} else {
onLinkStateChanged(DataLink.LinkState.LINK_UP);
}
-
+
if (DBG) log("PDP setup on cid = " + cid);
}
}
@@ -463,7 +462,7 @@ public class PdpConnection extends Handler {
} else {
ar = (AsyncResult) msg.obj;
PdpFailCause cause = PdpFailCause.UNKNOWN;
-
+
if (ar.exception == null) {
int rilFailCause = ((int[]) (ar.result))[0];
cause = getFailCauseFromRequest(rilFailCause);
diff --git a/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java
index daf4b9c..0ab4a0e 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java
@@ -135,7 +135,9 @@ final class SMSDispatcher extends Handler {
/** Maximum number of times to retry sending a failed SMS. */
private static final int MAX_SEND_RETRIES = 3;
/** Delay before next send attempt on a failed SMS, in milliseconds. */
- private static final int SEND_RETRY_DELAY = 2000; // ms
+ private static final int SEND_RETRY_DELAY = 2000;
+ /** single part SMS */
+ private static final int SINGLE_PART_SMS = 1;
/**
* Message reference for a CONCATENATED_8_BIT_REFERENCE or
@@ -169,15 +171,23 @@ final class SMSDispatcher extends Handler {
mSmsStamp = new HashMap<String, ArrayList<Long>> ();
}
- boolean check(String appName) {
+ /**
+ * Check to see if an application allow to send new SMS messages
+ *
+ * @param appName is the application sending sms
+ * @param smsWaiting is the number of new sms wants to be sent
+ * @return true if application is allowed to send the requested number
+ * of new sms messages
+ */
+ boolean check(String appName, int smsWaiting) {
if (!mSmsStamp.containsKey(appName)) {
mSmsStamp.put(appName, new ArrayList<Long>());
}
- return isUnderLimit(mSmsStamp.get(appName));
+ return isUnderLimit(mSmsStamp.get(appName), smsWaiting);
}
- private boolean isUnderLimit(ArrayList<Long> sent) {
+ private boolean isUnderLimit(ArrayList<Long> sent, int smsWaiting) {
Long ct = System.currentTimeMillis();
Log.d(TAG, "SMS send size=" + sent.size() + "time=" + ct);
@@ -185,9 +195,11 @@ final class SMSDispatcher extends Handler {
while (sent.size() > 0 && (ct - sent.get(0)) > mCheckPeriod ) {
sent.remove(0);
}
-
- if (sent.size() < mMaxAllowed) {
- sent.add(ct);
+
+ if ( (sent.size() + smsWaiting) <= mMaxAllowed) {
+ for (int i = 0; i < smsWaiting; i++ ) {
+ sent.add(ct);
+ }
return true;
}
return false;
@@ -290,8 +302,11 @@ final class SMSDispatcher extends Handler {
case EVENT_SEND_CONFIRMED_SMS:
if (mSTracker!=null) {
- Log.d(TAG, "Ready to send SMS again.");
- sendSms(mSTracker);
+ if (isMultipartTracker(mSTracker)) {
+ sendMultipartSms(mSTracker);
+ } else {
+ sendSms(mSTracker);
+ }
mSTracker = null;
}
break;
@@ -786,6 +801,81 @@ final class SMSDispatcher extends Handler {
void sendMultipartText(String destinationAddress, String scAddress, ArrayList<String> parts,
ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
+ PendingIntent sentIntent = null;
+
+
+ int ss = mPhone.getServiceState().getState();
+
+ if (ss == ServiceState.STATE_IN_SERVICE) {
+ // Only check SMS sending limit while in service
+ if (sentIntents != null && sentIntents.size() > 0) {
+ sentIntent = sentIntents.get(0);
+ }
+ String appName = getAppNameByIntent(sentIntent);
+ if ( !mCounter.check(appName, parts.size())) {
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ map.put("destination", destinationAddress);
+ map.put("scaddress", scAddress);
+ map.put("parts", parts);
+ map.put("sentIntents", sentIntents);
+ map.put("deliveryIntents", deliveryIntents);
+
+ SmsTracker multipartParameter = new SmsTracker(map, null, null);
+
+ sendMessage(obtainMessage(EVENT_POST_ALERT, multipartParameter));
+ return;
+ }
+ }
+
+ sendMultipartTextWithPermit(destinationAddress,
+ scAddress, parts, sentIntents, deliveryIntents);
+ }
+
+ /**
+ * Send a multi-part text based SMS which already passed SMS control check.
+ *
+ * It is the working function for sendMultipartText().
+ *
+ * @param destinationAddress the address to send the message to
+ * @param scAddress is the service center address or null to use
+ * the current default SMSC
+ * @param parts an <code>ArrayList</code> of strings that, in order,
+ * comprise the original message
+ * @param sentIntents if not null, an <code>ArrayList</code> of
+ * <code>PendingIntent</code>s (one for each message part) that is
+ * broadcast when the corresponding message part has been sent.
+ * The result code will be <code>Activity.RESULT_OK<code> for success,
+ * or one of these errors:
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code>
+ * <code>RESULT_ERROR_RADIO_OFF</code>
+ * <code>RESULT_ERROR_NULL_PDU</code>.
+ * @param deliveryIntents if not null, an <code>ArrayList</code> of
+ * <code>PendingIntent</code>s (one for each message part) that is
+ * broadcast when the corresponding message part has been delivered
+ * to the recipient. The raw pdu of the status report is in the
+ * extended data ("pdu").
+ */
+ private void sendMultipartTextWithPermit(String destinationAddress,
+ String scAddress, ArrayList<String> parts,
+ ArrayList<PendingIntent> sentIntents,
+ ArrayList<PendingIntent> deliveryIntents) {
+
+ PendingIntent sentIntent = null;
+ PendingIntent deliveryIntent = null;
+
+ // check if in service
+ int ss = mPhone.getServiceState().getState();
+ if (ss != ServiceState.STATE_IN_SERVICE) {
+ for (int i = 0, count = parts.size(); i < count; i++) {
+ if (sentIntents != null && sentIntents.size() > i) {
+ sentIntent = sentIntents.get(i);
+ }
+ SmsTracker tracker = new SmsTracker(null, sentIntent, null);
+ handleNotInService(ss, tracker);
+ }
+ return;
+ }
+
int ref = ++sConcatenatedRef & 0xff;
for (int i = 0, count = parts.size(); i < count; i++) {
@@ -796,9 +886,7 @@ final class SMSDispatcher extends Handler {
data[2] = (byte) (i + 1); // 1-based sequence
SmsHeader header = new SmsHeader();
header.add(new SmsHeader.Element(SmsHeader.CONCATENATED_8_BIT_REFERENCE, data));
- PendingIntent sentIntent = null;
- PendingIntent deliveryIntent = null;
-
+
if (sentIntents != null && sentIntents.size() > i) {
sentIntent = sentIntents.get(i);
}
@@ -809,10 +897,16 @@ final class SMSDispatcher extends Handler {
SmsMessage.SubmitPdu pdus = SmsMessage.getSubmitPdu(scAddress, destinationAddress,
parts.get(i), deliveryIntent != null, header.toByteArray());
- sendRawPdu(pdus.encodedScAddress, pdus.encodedMessage, sentIntent, deliveryIntent);
- }
- }
+ HashMap<String, Object> map = new HashMap<String, Object>();
+ map.put("smsc", pdus.encodedScAddress);
+ map.put("pdu", pdus.encodedMessage);
+ SmsTracker tracker = new SmsTracker(map, sentIntent,
+ deliveryIntent);
+ sendSms(tracker);
+ }
+ }
+
/**
* Send a SMS
*
@@ -856,7 +950,7 @@ final class SMSDispatcher extends Handler {
handleNotInService(ss, tracker);
} else {
String appName = getAppNameByIntent(sentIntent);
- if (mCounter.check(appName)) {
+ if (mCounter.check(appName, SINGLE_PART_SMS)) {
sendSms(tracker);
} else {
sendMessage(obtainMessage(EVENT_POST_ALERT, tracker));
@@ -913,6 +1007,41 @@ final class SMSDispatcher extends Handler {
}
/**
+ * Send the multi-part SMS based on multipart Sms tracker
+ *
+ * @param tracker holds the multipart Sms tracker ready to be sent
+ */
+ private void sendMultipartSms (SmsTracker tracker) {
+ ArrayList<String> parts;
+ ArrayList<PendingIntent> sentIntents;
+ ArrayList<PendingIntent> deliveryIntents;
+
+ HashMap map = tracker.mData;
+
+ String destinationAddress = (String) map.get("destination");
+ String scAddress = (String) map.get("scaddress");
+
+ parts = (ArrayList<String>) map.get("parts");
+ sentIntents = (ArrayList<PendingIntent>) map.get("sentIntents");
+ deliveryIntents = (ArrayList<PendingIntent>) map.get("deliveryIntents");
+
+ sendMultipartTextWithPermit(destinationAddress,
+ scAddress, parts, sentIntents, deliveryIntents);
+
+ }
+
+ /**
+ * Check if a SmsTracker holds multi-part Sms
+ *
+ * @param tracker a SmsTracker could hold a multi-part Sms
+ * @return true for tracker holds Multi-parts Sms
+ */
+ private boolean isMultipartTracker (SmsTracker tracker) {
+ HashMap map = tracker.mData;
+ return ( map.get("parts") != null);
+ }
+
+ /**
* Keeps track of an SMS that has been sent to the RIL, until it it has
* successfully been sent, or we're done trying.
*
@@ -939,7 +1068,7 @@ final class SMSDispatcher extends Handler {
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON1) {
+ if (which == DialogInterface.BUTTON_POSITIVE) {
Log.d(TAG, "click YES to send out sms");
sendMessage(obtainMessage(EVENT_SEND_CONFIRMED_SMS));
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java
index d3a19c5..10baa1b 100644
--- a/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java
@@ -122,7 +122,7 @@ final class ServiceStateTracker extends Handler
private boolean mZoneDst;
private long mZoneTime;
private boolean mGotCountryCode = false;
-
+
String mSavedTimeZone;
long mSavedTime;
long mSavedAtTime;
@@ -154,7 +154,6 @@ final class ServiceStateTracker extends Handler
static final int DEFAULT_GPRS_CHECK_PERIOD_MILLIS = 60 * 1000;
//***** Events
-
static final int EVENT_RADIO_STATE_CHANGED = 1;
static final int EVENT_NETWORK_STATE_CHANGED = 2;
static final int EVENT_GET_SIGNAL_STRENGTH = 3;
@@ -175,10 +174,6 @@ final class ServiceStateTracker extends Handler
static final int EVENT_RESET_PREFERRED_NETWORK_TYPE = 21;
static final int EVENT_CHECK_REPORT_GPRS = 22;
- // Event Log Tags
- private static final int EVENT_LOG_CGREG_FAIL = 50107;
- private static final int EVENT_DATA_STATE_RADIO_OFF = 50108;
-
//***** Time Zones
private static final String TIMEZONE_PROPERTY = "persist.sys.timezone";
@@ -209,7 +204,7 @@ final class ServiceStateTracker extends Handler
"tg", // Togo
"uk", // U.K
};
-
+
private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
@Override
public void onChange(boolean selfChange) {
@@ -230,7 +225,7 @@ final class ServiceStateTracker extends Handler
cellLoc = new GsmCellLocation();
newCellLoc = new GsmCellLocation();
- cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
+ cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null);
cm.registerForNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED, null);
@@ -238,16 +233,16 @@ final class ServiceStateTracker extends Handler
cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
cm.registerForSIMReady(this, EVENT_SIM_READY, null);
-
+
// system setting property AIRPLANE_MODE_ON is set in Settings.
int airplaneMode = Settings.System.getInt(
phone.getContext().getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0);
- mDesiredPowerState = ! (airplaneMode > 0);
+ mDesiredPowerState = ! (airplaneMode > 0);
ContentResolver cr = phone.getContext().getContentResolver();
cr.registerContentObserver(
- Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
+ Settings.System.getUriFor(Settings.System.AUTO_TIME), true,
mAutoTimeObserver);
setRssiDefaultValues();
mNeedToRegForSimLoaded = true;
@@ -272,7 +267,7 @@ final class ServiceStateTracker extends Handler
void registerForNetworkAttach(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj);
networkAttachedRegistrants.add(r);
-
+
if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
r.notifyRegistrant();
}
@@ -360,7 +355,7 @@ final class ServiceStateTracker extends Handler
/*package*/ void enableLocationUpdates() {
cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
}
-
+
/*package*/ void disableLocationUpdates() {
cm.setLocationUpdates(false, null);
}
@@ -407,7 +402,7 @@ final class ServiceStateTracker extends Handler
pollState();
break;
- case EVENT_GET_SIGNAL_STRENGTH:
+ case EVENT_GET_SIGNAL_STRENGTH:
// This callback is called when signal strength is polled
// all by itself
@@ -418,7 +413,7 @@ final class ServiceStateTracker extends Handler
ar = (AsyncResult) msg.obj;
onSignalStrengthResult(ar);
queueNextSignalStrengthPoll();
-
+
break;
case EVENT_GET_LOC_DONE:
@@ -503,7 +498,7 @@ final class ServiceStateTracker extends Handler
getLacAndCid(null);
}
break;
-
+
case EVENT_SET_PREFERRED_NETWORK_TYPE:
ar = (AsyncResult) msg.obj;
// Don't care the result, only use for dereg network (COPS=2)
@@ -548,7 +543,7 @@ final class ServiceStateTracker extends Handler
if (loc != null) cid = loc.getCid();
EventLog.List val = new EventLog.List(ss.getOperatorNumeric(), cid);
- EventLog.writeEvent(EVENT_LOG_CGREG_FAIL, val);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_CGREG_FAIL, val);
mReportedGprsNoReg = true;
}
mStartedGprsRegCheck = false;
@@ -598,7 +593,7 @@ final class ServiceStateTracker extends Handler
EventLog.List val = new EventLog.List(
dcTracker.getStateInString(),
(dcTracker.getAnyDataEnabled() ? 1 : 0) );
- EventLog.writeEvent(EVENT_DATA_STATE_RADIO_OFF, val);
+ EventLog.writeEvent(TelephonyEventLog.EVENT_DATA_STATE_RADIO_OFF, val);
}
// If it's on and available and we want it off..
cm.setRadioPower(false, null);
@@ -689,7 +684,7 @@ final class ServiceStateTracker extends Handler
if (states.length > 0) {
try {
regState = Integer.parseInt(states[0]);
-
+
// states[3] (if present) is the current radio technology
if (states.length >= 4 && states[3] != null) {
type = Integer.parseInt(states[3]);
@@ -1038,7 +1033,7 @@ final class ServiceStateTracker extends Handler
break;
}
}
-
+
return guess;
}
@@ -1147,7 +1142,7 @@ final class ServiceStateTracker extends Handler
String simNumeric = SystemProperties.get(PROPERTY_SIM_OPERATOR_NUMERIC, "");
String operatorNumeric = s.getOperatorNumeric();
-
+
boolean equalsMcc = true;
try {
equalsMcc = simNumeric.substring(0, 3).
@@ -1329,7 +1324,7 @@ final class ServiceStateTracker extends Handler
}
saveNitzTimeZone(zone.getID());
}
-
+
String ignore = SystemProperties.get("gsm.ignore-nitz");
if (ignore != null && ignore.equals("yes")) {
Log.i(LOG_TAG, "NITZ: Not setting clock because gsm.ignore-nitz is set");
@@ -1339,7 +1334,7 @@ final class ServiceStateTracker extends Handler
if (getAutoTime()) {
long millisSinceNitzReceived
= SystemClock.elapsedRealtime() - nitzReceiveTime;
-
+
if (millisSinceNitzReceived < 0) {
// Sanity check: something is wrong
Log.i(LOG_TAG, "NITZ: not setting time, clock has rolled "
@@ -1347,7 +1342,7 @@ final class ServiceStateTracker extends Handler
+ nitz);
return;
}
-
+
if (millisSinceNitzReceived > Integer.MAX_VALUE) {
// If the time is this far off, something is wrong > 24 days!
Log.i(LOG_TAG, "NITZ: not setting time, processing has taken "
@@ -1355,10 +1350,10 @@ final class ServiceStateTracker extends Handler
+ " days");
return;
}
-
+
// Note: with range checks above, cast to int is safe
c.add(Calendar.MILLISECOND, (int)millisSinceNitzReceived);
-
+
Log.i(LOG_TAG, "NITZ: Setting time of day to " + c.getTime()
+ " NITZ receive delay(ms): " + millisSinceNitzReceived
+ " gained(ms): "
@@ -1399,11 +1394,11 @@ final class ServiceStateTracker extends Handler
/**
* Set the timezone and send out a sticky broadcast so the system can
* determine if the timezone was set by the carrier.
- *
+ *
* @param zoneId timezone set by carrier
*/
private void setAndBroadcastNetworkSetTimeZone(String zoneId) {
- AlarmManager alarm =
+ AlarmManager alarm =
(AlarmManager) phone.getContext().getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(zoneId);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE);
@@ -1414,9 +1409,9 @@ final class ServiceStateTracker extends Handler
/**
* Set the time and Send out a sticky broadcast so the system can determine
* if the time was set by the carrier.
- *
+ *
* @param time time set by network
- */
+ */
private void setAndBroadcastNetworkSetTime(long time) {
SystemClock.setCurrentTimeMillis(time);
Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME);
diff --git a/telephony/java/com/android/internal/telephony/gsm/TelephonyEventLog.java b/telephony/java/com/android/internal/telephony/gsm/TelephonyEventLog.java
new file mode 100644
index 0000000..1e583f0
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/gsm/TelephonyEventLog.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony.gsm;
+
+/* This class contains the details related to Telephony Event Logging */
+public final class TelephonyEventLog {
+
+ /* Event log tags */
+ public static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100;
+ public static final int EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED = 50101;
+ public static final int EVENT_LOG_RADIO_RESET = 50102;
+ public static final int EVENT_LOG_PDP_RESET = 50103;
+ public static final int EVENT_LOG_REREGISTER_NETWORK = 50104;
+ public static final int EVENT_LOG_RADIO_PDP_SETUP_FAIL = 50105;
+ public static final int EVENT_LOG_CALL_DROP = 50106;
+ public static final int EVENT_LOG_CGREG_FAIL = 50107;
+ public static final int EVENT_DATA_STATE_RADIO_OFF = 50108;
+ public static final int EVENT_LOG_PDP_NETWORK_DROP = 50109;
+}