diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-19 10:57:31 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-19 10:57:31 -0800 |
commit | 3001a035439d8134a7d70d796376d1dfbff3cdcd (patch) | |
tree | 343ccdba15a594ff6e50c874a145232753315a30 /telephony | |
parent | da996f390e17e16f2dfa60e972e7ebc4f868f37e (diff) | |
download | frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.zip frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.tar.gz frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.tar.bz2 |
auto import from //branches/cupcake/...@132276
Diffstat (limited to 'telephony')
7 files changed, 97 insertions, 17 deletions
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 4957366..2b4195b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -38,7 +38,7 @@ interface ITelephony { void dial(String number); /** - * Place a call to the numer. + * Place a call to the specified number. * @param number the number to be called. */ void call(String number); @@ -73,6 +73,36 @@ interface ITelephony { boolean endCall(); /** + * Answer the currently-ringing call. + * + * If there's already a current active call, that call will be + * automatically put on hold. If both lines are currently in use, the + * current active call will be ended. + * + * TODO: provide a flag to let the caller specify what policy to use + * if both lines are in use. (The current behavior is hardwired to + * "answer incoming, end ongoing", which is how the CALL button + * is specced to behave.) + * + * TODO: this should be a oneway call (especially since it's called + * directly from the key queue thread). + */ + void answerRingingCall(); + + /** + * Silence the ringer if an incoming call is currently ringing. + * (If vibrating, stop the vibrator also.) + * + * It's safe to call this if the ringer has already been silenced, or + * even if there's no incoming call. (If so, this method will do nothing.) + * + * TODO: this should be a oneway call too (see above). + * (Actually *all* the methods here that return void can + * probably be oneway.) + */ + void silenceRinger(); + + /** * Check if we are in either an active or holding call * @return true if the phone state is OFFHOOK. */ diff --git a/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java index b115713..1c64641 100644 --- a/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/DataConnectionTracker.java @@ -559,6 +559,14 @@ final class DataConnectionTracker extends Handler } /** + * Simply tear down data connections due to radio off + * and don't setup again. + */ + public void cleanConnectionBeforeRadioOff() { + cleanUpConnection(true, Phone.REASON_RADIO_TURNED_OFF); + } + + /** * Report the current state of data connectivity (enabled or disabled) for * the default APN. * @return {@code false} if data connectivity has been explicitly disabled, @@ -1257,6 +1265,23 @@ final class DataConnectionTracker extends Handler return (shouldPost && cause != PdpConnection.PdpFailCause.UNKNOWN); } + /** + * Return true if data connection need to be setup after disconnected due to + * reason. + * + * @param reason the reason why data is disconnected + * @return true if try setup data connection is need for this reason + */ + private boolean retryAfterDisconnected(String reason) { + boolean retry = true; + + if ( Phone.REASON_RADIO_TURNED_OFF.equals(reason) || + Phone.REASON_DATA_DISABLED.equals(reason) ) { + retry = false; + } + return retry; + } + private void reconnectAfterFail(PdpFailCause lastFailCauseCode, String reason) { if (state == State.FAILED) { Log.d(LOG_TAG, "PDP activate failed. Scheduling next attempt for " @@ -1475,7 +1500,9 @@ final class DataConnectionTracker extends Handler setState(State.IDLE); phone.notifyDataConnection(reason); mActiveApn = null; - trySetupData(reason); + if ( retryAfterDisconnected(reason) ) { + trySetupData(reason); + } break; case EVENT_PDP_STATE_CHANGED: diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index bd6d41e..4ad65fc 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -91,6 +91,8 @@ public class GSMPhone extends PhoneBase { public static final String VM_NUMBER = "vm_number_key"; // Key used to read/write the SIM IMSI used for storing the voice mail public static final String VM_SIM_IMSI = "vm_sim_imsi_key"; + // Key used to read/write "disable DNS server check" pref (used for testing) + public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key"; //***** Instance Variables @@ -197,6 +199,9 @@ public class GSMPhone extends PhoneBase { mCM.setOnCallRing(h, EVENT_CALL_RING, null); mSST.registerForNetworkAttach(h, EVENT_REGISTERED_TO_NETWORK, null); + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); + mDnsCheckDisabled = sp.getBoolean(DNS_SERVER_CHECK_DISABLED_KEY, false); + if (false) { try { //debugSocket = new LocalServerSocket("com.android.internal.telephony.debug"); @@ -1160,6 +1165,10 @@ public class GSMPhone extends PhoneBase { */ public void disableDnsCheck(boolean b) { mDnsCheckDisabled = b; + SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); + SharedPreferences.Editor editor = sp.edit(); + editor.putBoolean(DNS_SERVER_CHECK_DISABLED_KEY, b); + editor.commit(); } /** diff --git a/telephony/java/com/android/internal/telephony/gsm/MccTable.java b/telephony/java/com/android/internal/telephony/gsm/MccTable.java index 57a54c4..bb17cc4 100644 --- a/telephony/java/com/android/internal/telephony/gsm/MccTable.java +++ b/telephony/java/com/android/internal/telephony/gsm/MccTable.java @@ -171,16 +171,16 @@ public final class MccTable table.add(new MccEntry(202,"gr",2)); //Greece table.add(new MccEntry(204,"nl",2,"Europe/Amsterdam")); //Netherlands (Kingdom of the) table.add(new MccEntry(206,"be",2)); //Belgium - table.add(new MccEntry(208,"fr",2)); //France + table.add(new MccEntry(208,"fr",2,"Europe/Paris","fr")); //France table.add(new MccEntry(212,"mc",2)); //Monaco (Principality of) table.add(new MccEntry(213,"ad",2)); //Andorra (Principality of) - table.add(new MccEntry(214,"es",2)); //Spain + table.add(new MccEntry(214,"es",2,"Europe/Madrid","es")); //Spain table.add(new MccEntry(216,"hu",2)); //Hungary (Republic of) table.add(new MccEntry(218,"ba",2)); //Bosnia and Herzegovina table.add(new MccEntry(219,"hr",2)); //Croatia (Republic of) table.add(new MccEntry(220,"rs",2)); //Serbia and Montenegro - table.add(new MccEntry(222,"it",2)); //Italy - table.add(new MccEntry(225,"va",2)); //Vatican City State + table.add(new MccEntry(222,"it",2,"Europe/Rome","it")); //Italy + table.add(new MccEntry(225,"va",2,"Europe/Rome","it")); //Vatican City State table.add(new MccEntry(226,"ro",2)); //Romania table.add(new MccEntry(228,"ch",2)); //Switzerland (Confederation of) table.add(new MccEntry(230,"cz",2,"Europe/Prague")); //Czech Republic @@ -217,7 +217,7 @@ public final class MccTable table.add(new MccEntry(290,"gl",2)); //Greenland (Denmark) table.add(new MccEntry(292,"sm",2)); //San Marino (Republic of) table.add(new MccEntry(293,"sl",2)); //Slovenia (Republic of) - table.add(new MccEntry(294,"mk",2)); //The Former Yugoslav Republic of Macedonia + table.add(new MccEntry(294,"mk",2)); //The Former Yugoslav Republic of Macedonia table.add(new MccEntry(295,"li",2)); //Liechtenstein (Principality of) table.add(new MccEntry(302,"ca",2)); //Canada table.add(new MccEntry(308,"pm",2)); //Saint Pierre and Miquelon (Collectivit territoriale de la Rpublique franaise) diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index 75f56a3..22bd6e2 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -1191,11 +1191,6 @@ public final class SIMRecords extends Handler implements SimConstants SmsMessage message = SmsMessage.newFromCMT( new String[] { "", pdu }); - Log.i("ENF", "message from " + - message.getOriginatingAddress()); - Log.i("ENF", "message text " + - message.getMessageBody()); - phone.mSMS.dispatchMessage(message); } } @@ -1226,11 +1221,6 @@ public final class SIMRecords extends Handler implements SimConstants SmsMessage message = SmsMessage.newFromCMT( new String[] { "", pdu }); - Log.i("ENF", "message from " + - message.getOriginatingAddress()); - Log.i("ENF", "message text " + - message.getMessageBody()); - phone.mSMS.dispatchMessage(message); // 3GPP TS 51.011 v5.0.0 (20011-12) 10.5.3 diff --git a/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java index 0ab4a0e..4176004 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java +++ b/telephony/java/com/android/internal/telephony/gsm/SMSDispatcher.java @@ -449,6 +449,13 @@ final class SMSDispatcher extends Handler { * @param sms the incoming message from the phone */ /* package */ void dispatchMessage(SmsMessage sms) { + + // If sms is null, means there was a parsing error. + // TODO: Should NAK this. + if (sms == null) { + return; + } + boolean handled = false; // Special case the message waiting indicator messages diff --git a/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java index 10baa1b..f37d1eb 100644 --- a/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/ServiceStateTracker.java @@ -25,6 +25,8 @@ import static com.android.internal.telephony.TelephonyProperties.PROPERTY_SIM_OP import static com.android.internal.telephony.TelephonyProperties.PROPERTY_SIM_OPERATOR_NUMERIC; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.Phone; +import com.android.internal.telephony.gsm.DataConnectionTracker.State; + import android.app.AlarmManager; import android.content.ContentResolver; import android.content.Context; @@ -70,6 +72,9 @@ final class ServiceStateTracker extends Handler static final int DATA_ACCESS_GPRS = 1; static final int DATA_ACCESS_EDGE = 2; static final int DATA_ACCESS_UMTS = 3; + + static final int MAX_NUM_DATA_STATE_READS = 15; + static final int DATA_STATE_POLL_SLEEP_MS = 100; //***** Instance Variables @@ -595,6 +600,18 @@ final class ServiceStateTracker extends Handler (dcTracker.getAnyDataEnabled() ? 1 : 0) ); EventLog.writeEvent(TelephonyEventLog.EVENT_DATA_STATE_RADIO_OFF, val); } + dcTracker.cleanConnectionBeforeRadioOff(); + + // poll data state up to 15 times, with a 100ms delay + // totaling 1.5 sec. Normal data disable action will finish in 100ms. + for (int i = 0; i < MAX_NUM_DATA_STATE_READS; i++) { + if (dcTracker.state != State.CONNECTED + && dcTracker.state != State.DISCONNECTING) { + Log.d(LOG_TAG, "Data shutdown complete."); + break; + } + SystemClock.sleep(DATA_STATE_POLL_SLEEP_MS); + } // If it's on and available and we want it off.. cm.setRadioPower(false, null); } // Otherwise, we're in the desired state |