diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-28 20:29:10 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-28 20:29:10 -0700 |
commit | f6355e24f5382356ea197135fdeff827aabfdb90 (patch) | |
tree | 7c76d11cd1df1e89b9018e93ae7444d44a40ddfe | |
parent | 2af7e639906981b1562f3187a60b6c848b7da17c (diff) | |
parent | dda5391d5079537e275c9f4ed2637a1484d0e4e8 (diff) | |
download | frameworks_base-f6355e24f5382356ea197135fdeff827aabfdb90.zip frameworks_base-f6355e24f5382356ea197135fdeff827aabfdb90.tar.gz frameworks_base-f6355e24f5382356ea197135fdeff827aabfdb90.tar.bz2 |
Merge change 2399 into donut
* changes:
Motorola additions for CDMA support without CdmaSuppConnTracker
28 files changed, 2154 insertions, 768 deletions
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index abd6934..7d03801 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -151,6 +151,9 @@ public class CallLog { int presentation, int callType, long start, int duration) { final ContentResolver resolver = context.getContentResolver(); + // TODO(Moto): Which is correct: original code, this only changes the + // number if the number is empty and never changes the caller info name. + if (false) { if (TextUtils.isEmpty(number)) { if (presentation == Connection.PRESENTATION_RESTRICTED) { number = CallerInfo.PRIVATE_NUMBER; @@ -160,7 +163,22 @@ public class CallLog { number = CallerInfo.UNKNOWN_NUMBER; } } - + } else { + // NEWCODE: From Motorola + + //If this is a private number then set the number to Private, otherwise check + //if the number field is empty and set the number to Unavailable + if (presentation == Connection.PRESENTATION_RESTRICTED) { + number = CallerInfo.PRIVATE_NUMBER; + ci.name = ""; + } else if (presentation == Connection.PRESENTATION_PAYPHONE) { + number = CallerInfo.PAYPHONE_NUMBER; + ci.name = ""; + } else if (TextUtils.isEmpty(number) || presentation == Connection.PRESENTATION_UNKNOWN) { + number = CallerInfo.UNKNOWN_NUMBER; + ci.name = ""; + } + } ContentValues values = new ContentValues(5); values.put(NUMBER, number); diff --git a/core/java/android/text/method/DialerKeyListener.java b/core/java/android/text/method/DialerKeyListener.java index b121e60..584e83f 100644 --- a/core/java/android/text/method/DialerKeyListener.java +++ b/core/java/android/text/method/DialerKeyListener.java @@ -106,7 +106,7 @@ public class DialerKeyListener extends NumberKeyListener */ public static final char[] CHARACTERS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '#', '*', - '+', '-', '(', ')', ',', '/', 'N', '.', ' ' + '+', '-', '(', ')', ',', '/', 'N', '.', ' ', ';' }; private static DialerKeyListener sInstance; diff --git a/media/java/android/media/ToneGenerator.java b/media/java/android/media/ToneGenerator.java index 4b53756..54ca6c4 100644 --- a/media/java/android/media/ToneGenerator.java +++ b/media/java/android/media/ToneGenerator.java @@ -19,11 +19,11 @@ package android.media; /** - * This class provides methods to play DTMF tones (ITU-T Recommendation Q.23), - * call supervisory tones (3GPP TS 22.001, CEPT) and proprietary tones (3GPP TS 31.111). + * This class provides methods to play DTMF tones (ITU-T Recommendation Q.23), + * call supervisory tones (3GPP TS 22.001, CEPT) and proprietary tones (3GPP TS 31.111). * Depending on call state and routing options, tones are mixed to the downlink audio - * or output to the speaker phone or headset. - * This API is not for generating tones over the uplink audio path. + * or output to the speaker phone or headset. + * This API is not for generating tones over the uplink audio path. */ public class ToneGenerator { @@ -33,99 +33,99 @@ public class ToneGenerator * List of all available tones: These constants must be kept consistant with * the enum in ToneGenerator C++ class. */ - /** + /** * DTMF tone for key 0: 1336Hz, 941Hz, continuous</p> - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_0 = 0; /** * DTMF tone for key 1: 1209Hz, 697Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_1 = 1; /** * DTMF tone for key 2: 1336Hz, 697Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_2 = 2; /** * DTMF tone for key 3: 1477Hz, 697Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_3 = 3; /** * DTMF tone for key 4: 1209Hz, 770Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_4 = 4; /** * DTMF tone for key 5: 1336Hz, 770Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_5 = 5; /** * DTMF tone for key 6: 1477Hz, 770Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_6 = 6; /** * DTMF tone for key 7: 1209Hz, 852Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_7 = 7; /** * DTMF tone for key 8: 1336Hz, 852Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_8 = 8; /** * DTMF tone for key 9: 1477Hz, 852Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_9 = 9; /** * DTMF tone for key *: 1209Hz, 941Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_S = 10; /** * DTMF tone for key #: 1477Hz, 941Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_P = 11; /** * DTMF tone for key A: 1633Hz, 697Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_A = 12; /** * DTMF tone for key B: 1633Hz, 770Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_B = 13; /** * DTMF tone for key C: 1633Hz, 852Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_C = 14; /** * DTMF tone for key D: 1633Hz, 941Hz, continuous - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_DTMF_D = 15; @@ -151,7 +151,7 @@ public class ToneGenerator * Call supervisory tone, Congestion: * CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF... * ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_CONGESTION = 18; @@ -159,27 +159,28 @@ public class ToneGenerator * Call supervisory tone, Radio path acknowlegment : * CEPT, ANSI: 425Hz, 200ms ON * JAPAN: 400Hz, 1s ON, 2s OFF... - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_RADIO_ACK = 19; /** * Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_RADIO_NOTAVAIL = 20; /** * Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_ERROR = 21; /** * Call supervisory tone, Call Waiting: * CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... - * ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) - * + * ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, + * (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_CALL_WAITING = 22; @@ -187,42 +188,43 @@ public class ToneGenerator * Call supervisory tone, Ring Tone: * CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... * ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_SUP_RINGTONE = 23; /** * Proprietary tone, general beep: 400Hz+1200Hz, 35ms ON - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_PROP_BEEP = 24; /** * Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_PROP_ACK = 25; /** * Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_PROP_NACK = 26; /** * Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_PROP_PROMPT = 27; /** * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON - * + * * @see #ToneGenerator(int, int) */ public static final int TONE_PROP_BEEP2 = 28; /** - * Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms + * Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, + * each on for 250 ms * * @see #ToneGenerator(int, int) */ @@ -240,7 +242,8 @@ public class ToneGenerator */ public static final int TONE_SUP_CONGESTION_ABBREV = 31; /** - * Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle + * Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone + * repeated 3 times in a 100 ms on, 100 ms off cycle * * @see #ToneGenerator(int, int) */ @@ -253,6 +256,241 @@ public class ToneGenerator public static final int TONE_SUP_PIP = 33; + /** + * CDMA SPECIFIC TONES START + */ + + /** TODO(Moto): Change "Proprietary" below with an appropriate specification reference */ + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_DIAL_TONE_LITE = 34; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_NETWORK_USA_RINGBACK = 35; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_REORDER = 36; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_ABBR_REORDER = 37; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_NETWORK_BUSY = 38; + + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_ANSWER = 39; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_NETWORK_CALLWAITING = 40; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_PIP = 41; + + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL = 42; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP = 43; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_SP_PRI = 44; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 = 45; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_RING_RING = 46; + + /** + * Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT5 = 47; + + /** + * general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT6 = 48; + + /** + * general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON + * + * @see #ToneGenerator(int, int) + * + * @hide + */ + public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT7 = 49; + + // TODO(Moto): Need comments for each one and we need ToneGenerator.cpp/ToneGenerator.h + + /** @hide */ + public static final int TONE_CDMA_HIGH_L = 50; + + /** @hide */ + public static final int TONE_CDMA_LOW_L = 51; + /** @hide */ + public static final int TONE_CDMA_HIGH_SS = 52; + /** @hide */ + public static final int TONE_CDMA_MED_SS = 53; + /** @hide */ + public static final int TONE_CDMA_LOW_SS = 54; + /** @hide */ + public static final int TONE_CDMA_HIGH_SSL = 55; + + + /** @hide */ + public static final int TONE_CDMA_MED_SSL = 56; + /** @hide */ + public static final int TONE_CDMA_LOW_SSL = 57; + /** @hide */ + public static final int TONE_CDMA_HIGH_SS_2 = 58; + /** @hide */ + public static final int TONE_CDMA_MED_SS_2 = 59; + /** @hide */ + public static final int TONE_CDMA_LOW_SS_2 = 60; + /** @hide */ + public static final int TONE_CDMA_HIGH_SLS = 61; + /** @hide */ + public static final int TONE_CDMA_MED_SLS = 62; + /** @hide */ + public static final int TONE_CDMA_LOW_SLS = 63; + /** @hide */ + public static final int TONE_CDMA_HIGH_S_X4 = 64; + /** @hide */ + public static final int TONE_CDMA_MED_S_X4 = 65; + /** @hide */ + public static final int TONE_CDMA_LOW_S_X4 = 66; + /** @hide */ + public static final int TONE_CDMA_HIGH_PBX_L = 67; + /** @hide */ + public static final int TONE_CDMA_MED_PBX_L = 68; + /** @hide */ + public static final int TONE_CDMA_LOW_PBX_L = 69; + /** @hide */ + public static final int TONE_CDMA_HIGH_PBX_SS = 70; + /** @hide */ + public static final int TONE_CDMA_MED_PBX_SS = 71; + /** @hide */ + public static final int TONE_CDMA_LOW_PBX_SS = 72; + /** @hide */ + public static final int TONE_CDMA_HIGH_PBX_SSL = 73; + /** @hide */ + public static final int TONE_CDMA_MED_PBX_SSL = 74; + + /** @hide */ + public static final int TONE_CDMA_LOW_PBX_SSL = 75; + /** @hide */ + public static final int TONE_CDMA_HIGH_PBX_SLS = 76; + /** @hide */ + public static final int TONE_CDMA_MED_PBX_SLS = 77; + /** @hide */ + public static final int TONE_CDMA_LOW_PBX_SLS = 78; + /** @hide */ + public static final int TONE_CDMA_HIGH_PBX_S_X4 = 79; + /** @hide */ + public static final int TONE_CDMA_MED_PBX_S_X4 = 80; + /** @hide */ + public static final int TONE_CDMA_LOW_PBX_S_X4 = 81; + /** @hide */ + public static final int TONE_CDMA_INTERCEPT_ONE_SHOT = TONE_SUP_INTERCEPT_ABBREV; + /** @hide */ + public static final int TONE_CDMA_REORDER_ONE_SHOT = TONE_CDMA_ABBR_REORDER; + /** @hide */ + public static final int TONE_CDMA_NETWORK_BUSY_ONE_SHOT = 82; + /** @hide */ + public static final int TONE_CDMA_ABBR_ALERT = 83; + /** @hide */ + public static final int TONE_CDMA_SIGNAL_OFF = 84; + /** @hide */ + public static final int TONE_CDMA_INVALID = 85; + /** Maximum volume, for use with {@link #ToneGenerator(int,int)} */ public static final int MAX_VOLUME = AudioSystem.MAX_VOLUME; /** Minimum volume setting, for use with {@link #ToneGenerator(int,int)} */ @@ -261,10 +499,10 @@ public class ToneGenerator /** * ToneGenerator class contructor specifying output stream type and volume. - * + * * @param streamType The streame type used for tone playback (e.g. STREAM_MUSIC). * @param volume The volume of the tone, given in percentage of maximum volume (from 0-100). - * + * */ public ToneGenerator(int streamType, int volume) { native_setup(streamType, volume); @@ -272,7 +510,7 @@ public class ToneGenerator /** * This method starts the playback of a tone of the specified type. - * only one tone can play at a time: if a tone is playing while this method is called, + * only one tone can play at a time: if a tone is playing while this method is called, * this tone is stopped and replaced by the one requested. * @param toneType The type of tone generate chosen from the following list: * <ul> @@ -328,9 +566,10 @@ public class ToneGenerator private native final void native_setup(int streamType, int volume); private native final void native_finalize(); + + @Override protected void finalize() { native_finalize(); } + @SuppressWarnings("unused") private int mNativeContext; // accessed by native methods - - } diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index e78422e..dba4972 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -54,10 +54,11 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mIccStatusChangedRegistrants = new RegistrantList(); protected RegistrantList mVoicePrivacyOnRegistrants = new RegistrantList(); protected RegistrantList mVoicePrivacyOffRegistrants = new RegistrantList(); - protected RegistrantList mOtaSessionRegistrants = new RegistrantList(); - protected RegistrantList mCallWaitingRegistrants = new RegistrantList(); - protected RegistrantList mInformationRecordsRegistrants = new RegistrantList(); protected Registrant mUnsolOemHookRawRegistrant; + protected RegistrantList mOtaProvisionRegistrants = new RegistrantList(); + protected RegistrantList mCallWaitingInfoRegistrants = new RegistrantList(); + protected RegistrantList mDisplayInfoRegistrants = new RegistrantList(); + protected RegistrantList mSignalInfoRegistrants = new RegistrantList(); protected Registrant mSMSRegistrant; protected Registrant mNITZTimeRegistrant; protected Registrant mSignalStrengthRegistrant; @@ -464,41 +465,51 @@ public abstract class BaseCommands implements CommandsInterface { mRestrictedStateRegistrant.clear(); } - public void setOnUnsolOemHookRaw(Handler h, int what, Object obj) { - mUnsolOemHookRawRegistrant = new Registrant (h, what, obj); + public void registerForDisplayInfo(Handler h, int what, Object obj) { + Registrant r = new Registrant (h, what, obj); + mDisplayInfoRegistrants.add(r); } - public void unSetOnUnsolOemHookRaw(Handler h) { - mUnsolOemHookRawRegistrant.clear(); + public void unregisterForDisplayInfo(Handler h) { + mDisplayInfoRegistrants.remove(h); } - public void registerForOtaSessionStatus(Handler h, int what, Object obj){ + public void registerForCallWaitingInfo(Handler h, int what, Object obj) { Registrant r = new Registrant (h, what, obj); - mOtaSessionRegistrants.add(r); + mCallWaitingInfoRegistrants.add(r); } - public void unregisterForOtaSessionStatus(Handler h){ - mOtaSessionRegistrants.remove(h); + public void unregisterForCallWaitingInfo(Handler h) { + mCallWaitingInfoRegistrants.remove(h); } - public void registerForCdmaCallWaiting(Handler h, int what, Object obj){ + public void registerForSignalInfo(Handler h, int what, Object obj) { Registrant r = new Registrant (h, what, obj); - mCallWaitingRegistrants.add(r); + mSignalInfoRegistrants.add(r); } - public void unregisterForCdmaCallWaiting(Handler h){ - mCallWaitingRegistrants.remove(h); + public void setOnUnsolOemHookRaw(Handler h, int what, Object obj) { + mUnsolOemHookRawRegistrant = new Registrant (h, what, obj); } - public void registerCdmaInformationRecord(Handler h, int what, Object obj) { + public void unSetOnUnsolOemHookRaw(Handler h) { + mUnsolOemHookRawRegistrant.clear(); + } + + public void unregisterForSignalInfo(Handler h) { + mSignalInfoRegistrants.remove(h); + } + + public void registerForCdmaOtaProvision(Handler h,int what, Object obj){ Registrant r = new Registrant (h, what, obj); - mInformationRecordsRegistrants.add(r); + mOtaProvisionRegistrants.add(r); } - public void unregisterCdmaInformationRecord(Handler h) { - mInformationRecordsRegistrants.remove(h); + public void unregisterForCdmaOtaProvision(Handler h){ + mOtaProvisionRegistrants.remove(h); } + //***** Protected Methods /** * Store new RadioState and send notification based on the changes diff --git a/telephony/java/com/android/internal/telephony/CallTracker.java b/telephony/java/com/android/internal/telephony/CallTracker.java index eb339f8..8263ded 100644 --- a/telephony/java/com/android/internal/telephony/CallTracker.java +++ b/telephony/java/com/android/internal/telephony/CallTracker.java @@ -56,6 +56,7 @@ public abstract class CallTracker extends Handler { protected static final int EVENT_CONFERENCE_RESULT = 11; protected static final int EVENT_SEPARATE_RESULT = 12; protected static final int EVENT_ECT_RESULT = 13; + protected static final int EVENT_EXIT_ECM_RESPONSE_CDMA = 14; protected void pollCallsWhenSafe() { diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index da53e15..32f31ef 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -70,6 +70,12 @@ public class CallerInfo { */ public String name; public String phoneNumber; + + public String cnapName; + public int numberPresentation; + public int namePresentation; + public boolean contactExists; + public String phoneLabel; /* Split up the phoneLabel into number type and label name */ public int numberType; @@ -118,6 +124,7 @@ public class CallerInfo { info.numberLabel = null; info.cachedPhoto = null; info.isCachedPhotoCurrent = false; + info.contactExists = false; if (Config.LOGV) Log.v(TAG, "construct callerInfo from cursor"); @@ -176,6 +183,7 @@ public class CallerInfo { columnIndex = cursor.getColumnIndex(People.SEND_TO_VOICEMAIL); info.shouldSendToVoicemail = (columnIndex != -1) && ((cursor.getInt(columnIndex)) == 1); + info.contactExists = true; } cursor.close(); } @@ -303,4 +311,3 @@ public class CallerInfo { } } } - diff --git a/telephony/java/com/android/internal/telephony/CdmaInformationRecord.java b/telephony/java/com/android/internal/telephony/CdmaInformationRecord.java deleted file mode 100644 index 690df05..0000000 --- a/telephony/java/com/android/internal/telephony/CdmaInformationRecord.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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; - -/** - * TODO(Teleca): This class was poorly implemented and didn't - * follow the Android coding conventions. It is now more or less - * follows the conventions but there is still some work, see the - * TODO's. - */ - - -public class CdmaInformationRecord { - public int messageName; - - public CdmaDisplayInfoRec displayInfoRec; - public CdmaNumberInfoRec numberInfoRec; - public CdmaSignalInfoRec signalInfoRec; - public CdmaRedirectingNumberInfoRec redirectingNumberInfoRec; - public CdmaLineControlInfoRec lineControlInfoRec; - public CdmaT53ClirInfoRec cdmaT53ClirInfoRec; - public CdmaT53AudioControlInfoRec cdmaT53AudioControlInfoRec; - - public static final int RIL_CDMA_DISPLAY_INFO_REC = 0; - public static final int RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC = 1; - public static final int RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC = 2; - public static final int RIL_CDMA_CONNECTED_NUMBER_INFO_REC = 3; - public static final int RIL_CDMA_SIGNAL_INFO_REC = 4; - public static final int RIL_CDMA_REDIRECTING_NUMBER_INFO_REC = 5; - public static final int RIL_CDMA_LINE_CONTROL_INFO_REC = 6; - public static final int RIL_CDMA_EXTENDED_DISPLAY_INFO_REC = 7; - public static final int RIL_CDMA_T53_CLIR_INFO_REC = 8; - public static final int RIL_CDMA_T53_RELEASE_INFO_REC = 9; - public static final int RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC = 10; - - public CdmaInformationRecord(int messageName) { - this.messageName = messageName; - } - - void createDisplayInfo(int length, char buffer[]) { - displayInfoRec = new CdmaDisplayInfoRec(length, buffer); - } - - void createNumberInfo(int length, char buffer[]) { - numberInfoRec = new CdmaNumberInfoRec(length, buffer); - } - - void createSignalInfo(char buffer[]) { - signalInfoRec = new CdmaSignalInfoRec(buffer); - } - - void createRedirectingNumberInfo(int length, char buffer[], int reason) { - redirectingNumberInfoRec = new CdmaRedirectingNumberInfoRec(length, buffer, reason); - } - - void createLineControlInfo(char buffer[]) { - lineControlInfoRec = new CdmaLineControlInfoRec(buffer); - } - - void createT53ClirInfo(char buffer) { - cdmaT53ClirInfoRec = new CdmaT53ClirInfoRec(buffer); - } - - void createT53AudioControlInfo(char ul, char dl) { - cdmaT53AudioControlInfoRec = new CdmaT53AudioControlInfoRec(ul, dl); - } - - /** - * TODO(Teleca): Add comments for each class giving the - * document and section where the information is defined - * as shown CdmaSignalInfoRec. Also add a toString to - * each of these to ease debugging. - */ - - /** - * Signal Information record from 3GPP2 C.S005 3.7.5.5 - */ - public static class CdmaSignalInfoRec { - public boolean isPresent; /* non-zero if signal information record is present */ - public int signalType; - public int alertPitch; - public int signalCode; - - public CdmaSignalInfoRec() {} - - public CdmaSignalInfoRec(char buffer[]) { - isPresent = buffer[0] == 1; - signalType = buffer[1]; - alertPitch = buffer[2]; - signalCode = buffer[3]; - } - - @Override - public String toString() { - return "CdmaSignalInfo: {" + - " isPresent: " + isPresent + - ", signalType: " + signalType + - ", alertPitch: " + alertPitch + - ", signalCode: " + signalCode + - " }"; - } - } - - public static class CdmaDisplayInfoRec { - public char alphaLen; - public char alphaBuf[]; - - public CdmaDisplayInfoRec(int length, char buffer[]) { - alphaLen = (char)length; - alphaBuf = new char[length]; - for(int i = 0; i < length; i++) - alphaBuf[i] = buffer[i]; - } - } - - public static class CdmaNumberInfoRec { - public int len; - public char buf[]; - public char numberType; - public char numberPlan; - public char pi; // TODO(Teleca): poor name, no meaning - public char si; // TODO(Teleca): poor name - - public CdmaNumberInfoRec(int length, char buffer[]) { - int i; - - len = length; - buf = new char[length]; - for (i = 0; i < len; i++) { - buf[i] = buffer[i]; - } - - numberType = buffer[i++]; - numberPlan = buffer[i++]; - pi = buffer[i++]; - si = buffer[i++]; - } - } - - public static class CdmaRedirectingNumberInfoRec { - public static final int REASON_UNKNOWN = 0; - public static final int REASON_CALL_FORWARDING_BUSY = 1; - public static final int REASON_CALL_FORWARDING_NO_REPLY = 2; - public static final int REASON_CALLED_DTE_OUT_OF_ORDER = 9; - public static final int REASON_CALL_FORWARDING_BY_THE_CALLED_DTE = 10; - public static final int REASON_CALL_FORWARDING_UNCONDITIONAL = 15; - - public CdmaNumberInfoRec numberInfoRec; - public int redirectingReason; - - public CdmaRedirectingNumberInfoRec(int length, char buffer[], int reason) { - numberInfoRec = new CdmaNumberInfoRec(length, buffer); - redirectingReason = reason; - } - } - - public static class CdmaLineControlInfoRec { - public char lineCtrlPolarityIncluded; - public char lineCtrlToggle; - public char lineCtrlReverse; - public char lineCtrlPowerDenial; - - CdmaLineControlInfoRec(char buffer[]) { - lineCtrlPolarityIncluded = buffer[0]; - lineCtrlToggle = buffer[1]; - lineCtrlReverse = buffer[2]; - lineCtrlPowerDenial = buffer[3]; - } - } - - // TODO(Teleca): A class for a single character, is this needed? - public static class CdmaT53ClirInfoRec { - public char cause; - - public CdmaT53ClirInfoRec(char buffer) { - cause = buffer; - } - } - - public static class CdmaT53AudioControlInfoRec { - public char uplink; - public char downlink; - - public CdmaT53AudioControlInfoRec(char ul, char dl) { - uplink = ul; - downlink = dl; - } - } -} diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index ddf6b50..94a1c13 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -241,24 +241,6 @@ public interface CommandsInterface { void unregisterForRUIMReady(Handler h); /** - * Registers for the status of an OTASP/OTAPA session - */ - void registerForOtaSessionStatus(Handler h, int what, Object obj); - void unregisterForOtaSessionStatus(Handler h); - - /** - * register for Call waiting for CDMA - */ - void registerForCdmaCallWaiting(Handler h, int what, Object obj); - void unregisterForCdmaCallWaiting(Handler h); - - /** - * Registers for CDMA information records - */ - void registerCdmaInformationRecord(Handler h, int what, Object obj); - void unregisterCdmaInformationRecord(Handler h); - - /** * unlike the register* methods, there's only one new SMS handler * if you need to unregister, you should also tell the radio to stop * sending SMS's to you (via AT+CNMI) @@ -344,16 +326,6 @@ public interface CommandsInterface { void unSetOnIccSmsFull(Handler h); /** - * Sets the handler for Emergency call-back Mode enter mesage. - * Unlike the register* methods, there's only one notification handler - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - void setEmergencyCallbackMode(Handler h, int what, Object obj); - - /** * Sets the handler for SIM Refresh notifications. * Unlike the register* methods, there's only one notification handler * @@ -452,6 +424,49 @@ public interface CommandsInterface { void setSuppServiceNotifications(boolean enable, Message result); //void unSetSuppServiceNotifications(Handler h); + /** + * Sets the handler for Event Notifications for CDMA Display Info. + * Unlike the register* methods, there's only one notification handler + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + */ + void registerForDisplayInfo(Handler h, int what, Object obj); + void unregisterForDisplayInfo(Handler h); + + /** + * Sets the handler for Event Notifications for CallWaiting Info. + * Unlike the register* methods, there's only one notification handler + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + */ + void registerForCallWaitingInfo(Handler h, int what, Object obj); + void unregisterForCallWaitingInfo(Handler h); + + /** + * Sets the handler for Event Notifications for Signal Info. + * Unlike the register* methods, there's only one notification handler + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + */ + void registerForSignalInfo(Handler h, int what, Object obj); + void unregisterForSignalInfo(Handler h); + + /** + * Fires on if Modem enters Emergency Callback mode + */ + void setEmergencyCallbackMode(Handler h, int what, Object obj); + + /** + * Fires on any CDMA OTA provision status change + */ + void registerForCdmaOtaProvision(Handler h,int what, Object obj); + void unregisterForCdmaOtaProvision(Handler h); /** * Returns current ICC status. @@ -1244,7 +1259,9 @@ public interface CommandsInterface { public void getCdmaBroadcastConfig(Message result); /** - * Requests the radio's system selection module to exit emergency callback mode. + * Requests the radio's system selection module to exit emergency callback mode. + * This function should only be called from CDMAPHone.java. + * * @param response callback message */ public void exitEmergencyCallbackMode(Message response); diff --git a/telephony/java/com/android/internal/telephony/Connection.java b/telephony/java/com/android/internal/telephony/Connection.java index c6bbf82..237974d 100644 --- a/telephony/java/com/android/internal/telephony/Connection.java +++ b/telephony/java/com/android/internal/telephony/Connection.java @@ -73,6 +73,31 @@ public abstract class Connection { public abstract String getAddress(); /** + * Gets cdma CNAP name associated with connection + * @return cnap name or null if unavailable + */ + public String getCnapName() { + return null; + } + + /** + * Get orignal dial string + * @return orignal dial string or null if unavailable + */ + public String getOrigDialString(){ + return null; + } + + /** + * Gets cdma CNAP presentation associated with connection + * @return cnap name or null if unavailable + */ + + public int getCnapNamePresentation() { + return 0; + }; + + /** * @return Call that owns this Connection, or null if none */ public abstract Call getCall(); @@ -204,8 +229,14 @@ public abstract class Connection { WILD, /* The post dial string playback is waiting for a call to proceedAfterWildChar() */ COMPLETE, /* The post dial string playback is complete */ - CANCELLED /* The post dial string playback was cancelled + CANCELLED, /* The post dial string playback was cancelled with cancelPostDial() */ + PAUSE /* The post dial string playback is pausing for a + call to processNextPostDialChar*/ + } + + public void clearUserData(){ + userData = null; } public abstract PostDialState getPostDialState(); diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index cc6b452..6e6f64c 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -238,5 +238,10 @@ interface ITelephony { */ String getCdmaEriText(); + /** + * Returns the unread count of voicemails + */ + int getCountVoiceMessages(); + } diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 4d0cf41..260f662 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -102,6 +102,7 @@ public interface Phone { static final String DATA_APN_KEY = "apn"; static final String DATA_IFACE_NAME_KEY = "iface"; static final String NETWORK_UNAVAILABLE_KEY = "networkUnvailable"; + static final String PHONE_IN_ECM_STATE = "phoneinECMState"; /** * APN types for data connections. These are usage categories for an APN @@ -195,6 +196,24 @@ public interface Phone { static final int TTY_MODE_HCO = 2; static final int TTY_MODE_VCO = 3; + /** + * CDMA OTA PROVISION STATUS, the same as RIL_CDMA_OTA_Status in ril.h + */ + + public static final int CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED = 0; + public static final int CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED = 1; + public static final int CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED = 2; + public static final int CDMA_OTA_PROVISION_STATUS_SSD_UPDATED = 3; + public static final int CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED = 4; + public static final int CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED = 5; + public static final int CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED = 6; + public static final int CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED = 7; + public static final int CDMA_OTA_PROVISION_STATUS_COMMITTED = 8; + public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED = 9; + public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED = 10; + public static final int CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED = 11; + + /** * Get the current ServiceState. Use * <code>registerForServiceStateChanged</code> to be informed of @@ -273,7 +292,12 @@ public interface Phone { String getActiveApn(); /** - * Get current signal strength. + * Get current signal strength. No change notification available on this + * interface. Use <code>PhoneStateNotifier</code> or an equivalent. + * An ASU is 0-31 or -1 if unknown (for GSM, dBm = -113 - 2 * asu). + * The following special values are defined:</p> + * <ul><li>0 means "-113 dBm or less".</li> + * <li>31 means "-51 dBm or greater".</li></ul> * * @return Current signal strength as SignalStrength */ @@ -499,53 +523,21 @@ public interface Phone { void unregisterForInCallVoicePrivacyOff(Handler h); /** - * Register for notifications about information record available + * Register for notifications when CDMA OTA Provision status change * * @param h Handler that receives the notification message. * @param what User-defined message code. * @param obj User object. */ - void registerCdmaInformationRecord(Handler h, int what, Object obj); + void registerForCdmaOtaStatusChange(Handler h, int what, Object obj); /** - * Unregister for notifications about information record available - * + * Unegister for notifications when CDMA OTA Provision status change * @param h Handler to be removed from the registrant list. */ - void unregisterCdmaInformationRecord(Handler h); - - /** - * Register for the indication of OTA status change - * - * @param h Handler that receives the notification message. - * @param what User-defined message code. - * @param obj User object. - */ - void registerForOtaStatusChange(Handler h, int what, Object obj); + void unregisterForCdmaOtaStatusChange(Handler h); /** - * Unregister for the indication of OTA status change - * - * @param h Handler to be removed from the registrant list. - */ - void unregisterForOtaStatusChange(Handler h); - - /** - * Register for the indication of Cdma Call Waiting - * - * @param h Handler that receives the notification message. - * @param what User-defined message code. - * @param obj User object. - */ - void registerForCdmaCallWaiting(Handler h, int what, Object obj); - - /** - * Unregister for the indication of Cdma Call Waiting - * - * @param h Handler to be removed from the registrant list. - */ - void unregisterForCdmaCallWaiting(Handler h); - /** * Returns SIM record load state. Use * <code>getSimCard().registerForReady()</code> for change notification. * @@ -760,9 +752,18 @@ public interface Phone { void stopDtmf(); /** - * Play a Burst of DTMF tone on the active call. Ignored if there is no active call. + * send burst DTMF tone, it can send the string as single character or multiple character + * ignore if there is no active call or not valid digits string. + * Valid digit means only includes characters ISO-LATIN characters 0-9, *, # + * The difference between sendDtmf and sendBurstDtmf is sendDtmf only sends one character, + * this api can send single character and multiple character, also, this api has response + * back to caller. + * + * @param dtmfString is string representing the dialing digit(s) in the active call + * @param onCompelte is the callback message when the action is processed by BP + * */ - void sendBurstDtmf(String dtmfString); + void sendBurstDtmf(String dtmfString, Message onComplete); /** * Sets the radio power on/off state (off is sometimes @@ -827,6 +828,12 @@ public interface Phone { String getVoiceMailNumber(); /** + * Returns unread voicemail count. This count is shown when the voicemail + * notification is expanded.<p> + */ + int getCountVoiceMessages(); + + /** * Returns the alpha tag associated with the voice mail number. * If there is no alpha tag associated or the record is not yet available, * returns a default localized string. <p> @@ -859,7 +866,7 @@ public interface Phone { * * @param commandInterfaceCFReason is one of the valid call forwarding * CF_REASONS, as defined in - * <code>com.android.internal.telephony.CommandsInterface./code> + * <code>com.android.internal.telephony.CommandsInterface.</code> * @param onComplete a callback message when the action is completed. * @see com.android.internal.telephony.CallForwardInfo for details. */ @@ -872,10 +879,10 @@ public interface Phone { * * @param commandInterfaceCFReason is one of the valid call forwarding * CF_REASONS, as defined in - * <code>com.android.internal.telephony.CommandsInterface./code> + * <code>com.android.internal.telephony.CommandsInterface.</code> * @param commandInterfaceCFAction is one of the valid call forwarding * CF_ACTIONS, as defined in - * <code>com.android.internal.telephony.CommandsInterface./code> + * <code>com.android.internal.telephony.CommandsInterface.</code> * @param dialingNumber is the target phone number to forward calls to * @param timerSeconds is used by CFNRy to indicate the timeout before * forwarding is attempted. @@ -1335,10 +1342,16 @@ public interface Phone { //***** CDMA support methods + /* + * TODO(Moto) TODO(Teleca): can getCdmaMin, getEsn, getMeid use more generic calls + * already defined getXxxx above? + */ + /** * Retrieves the MIN for CDMA phones. */ - String getMin(); + + String getCdmaMin(); /** * Retrieves the ESN for CDMA phones. @@ -1384,14 +1397,6 @@ public interface Phone { void queryTTYMode(Message onComplete); /** - * exitEmergencyCallbackMode - * exits the emergency callback mode - * - * @param onComplete a callback message when the action is completed. - */ - void exitEmergencyCallbackMode(Message onComplete); - - /** * Activate or deactivate cell broadcast SMS. * * @param activate @@ -1438,4 +1443,93 @@ public interface Phone { */ public String getCdmaEriText(); + /** + * request to exit emergency call back mode + * the caller should use setOnECMModeExitResponse + * to receive the emergency callback mode exit response + */ + void exitEmergencyCallbackMode(); + + /** + * this decides if the dial number is OTA(Over the air provision) number or not + * @param dialStr is string representing the dialing digit(s) + * @return true means the dialStr is OTA number, and false means the dialStr is not OTA number + */ + boolean isOtaSpNumber(String dialStr); + + /** + * Register for notifications when CDMA call waiting comes + * + * @param h Handler that receives the notification message. + * @param what User-defined message code. + * @param obj User object. + */ + // TODO(Moto) TODO: Remove when generic implemented + void registerForCallWaiting(Handler h, int what, Object obj); + + /** + * Unegister for notifications when CDMA Call waiting comes + * @param h Handler to be removed from the registrant list. + */ + // TODO(Moto): Remove when generic implemented + void unregisterForCallWaiting(Handler h); + + + /** + * Register for signal information notifications from the network. + * Message.obj will contain an AsyncResult. + * AsyncResult.result will be a SuppServiceNotification instance. + * + * @param h Handler that receives the notification message. + * @param what User-defined message code. + * @param obj User object. + */ + + void registerForSignalInfo(Handler h, int what, Object obj) ; + /** + * Unregisters for signal information notifications. + * Extraneous calls are tolerated silently + * + * @param h Handler to be removed from the registrant list. + */ + void unregisterForSignalInfo(Handler h); + + /** + * Register for display information notifications from the network. + * Message.obj will contain an AsyncResult. + * AsyncResult.result will be a SuppServiceNotification instance. + * + * @param h Handler that receives the notification message. + * @param what User-defined message code. + * @param obj User object. + */ + void registerForDisplayInfo(Handler h, int what, Object obj); + + /** + * Unregisters for display information notifications. + * Extraneous calls are tolerated silently + * + * @param h Handler to be removed from the registrant list. + */ + void unregisterForDisplayInfo(Handler h) ; + + + /** + * registers for exit emergency call back mode request response + * + * @param h Handler that receives the notification message. + * @param what User-defined message code. + * @param obj User object. + */ + + void setOnEcbModeExitResponse(Handler h, int what, Object obj); + + /** + * Unregisters for exit emergency call back mode request response + * + * @param h Handler to be removed from the registrant list. + */ + void unsetOnEcbModeExitResponse(Handler h); + + } diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 7234aa3..d856279 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -100,8 +100,8 @@ public abstract class PhoneBase implements Phone { protected static final int EVENT_RUIM_RECORDS_LOADED = 21; protected static final int EVENT_NV_READY = 22; protected static final int EVENT_SET_ENHANCED_VP = 23; - protected static final int EVENT_CDMA_CALL_WAITING = 24; - protected static final int EVENT_EMERGENCY_CALLBACK_MODE = 25; + protected static final int EVENT_EMERGENCY_CALLBACK_MODE_ENTER = 24; + protected static final int EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE = 25; // Key used to read/write current CLIR setting public static final String CLIR_KEY = "clir_key"; @@ -294,36 +294,6 @@ public abstract class PhoneBase implements Phone { mCM.unregisterForInCallVoicePrivacyOff(h); } - // Inherited documentation suffices. - public void registerForOtaStatusChange(Handler h, int what, Object obj){ - mCM.registerForOtaSessionStatus(h,what,obj); - } - - // Inherited documentation suffices. - public void unregisterForOtaStatusChange(Handler h){ - mCM.unregisterForOtaSessionStatus(h); - } - - // Inherited documentation suffices. - public void registerCdmaInformationRecord(Handler h, int what, Object obj){ - mCM.registerCdmaInformationRecord(h,what,obj); - } - - // Inherited documentation suffices. - public void unregisterCdmaInformationRecord(Handler h){ - mCM.unregisterCdmaInformationRecord(h); - } - - // Inherited documentation suffices. - public void registerForCdmaCallWaiting(Handler h, int what, Object obj){ - mCM.registerForCdmaCallWaiting(h,what,obj); - } - - // Inherited documentation suffices. - public void unregisterForCdmaCallWaiting(Handler h){ - mCM.unregisterForCdmaCallWaiting(h); - } - /** * Notifiy registrants of a new ringing Connection. * Subclasses of Phone probably want to replace this with a @@ -631,14 +601,6 @@ public abstract class PhoneBase implements Phone { } /** - * Send the exit emergency callback mode message - */ - public void exitEmergencyCallbackMode(Message onComplete) { - // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. - Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); - } - - /** * This should only be called in GSM mode. * Only here for some backward compatibility * issues concerning the GSMPhone class. @@ -684,6 +646,11 @@ public abstract class PhoneBase implements Phone { public abstract String getPhoneName(); + /** @hide */ + public int getCountVoiceMessages(){ + return 0; + } + /** * Returns the CDMA ERI icon index to display */ @@ -710,4 +677,71 @@ public abstract class PhoneBase implements Phone { return "GSM nw, no ERI"; } + public String getCdmaMin() { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + return null; + } + + public void sendBurstDtmf(String dtmfString, Message onComplete) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void exitEmergencyCallbackMode() { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void unregisterForCdmaOtaStatusChange(Handler h) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public boolean isOtaSpNumber(String dialStr) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + return false; + } + + public void registerForCallWaiting(Handler h, int what, Object obj){ + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void unregisterForCallWaiting(Handler h){ + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void registerForSignalInfo(Handler h, int what, Object obj) { + mCM.registerForSignalInfo(h, what, obj); + } + + public void unregisterForSignalInfo(Handler h) { + mCM.unregisterForSignalInfo(h); + } + + public void registerForDisplayInfo(Handler h, int what, Object obj) { + mCM.registerForDisplayInfo(h, what, obj); + } + + public void unregisterForDisplayInfo(Handler h) { + mCM.unregisterForDisplayInfo(h); + } + + public void setOnEcbModeExitResponse(Handler h, int what, Object obj){ + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void unsetOnEcbModeExitResponse(Handler h){ + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } } diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index a329cbb..7d968f9 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -306,28 +306,12 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.unregisterForInCallVoicePrivacyOff(h); } - public void registerCdmaInformationRecord(Handler h, int what, Object obj) { - mActivePhone.registerCdmaInformationRecord(h,what,obj); + public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) { + mActivePhone.registerForCdmaOtaStatusChange(h,what,obj); } - public void unregisterCdmaInformationRecord(Handler h) { - mActivePhone.unregisterCdmaInformationRecord(h); - } - - public void registerForOtaStatusChange(Handler h, int what, Object obj){ - mActivePhone.registerForOtaStatusChange(h,what,obj); - } - - public void unregisterForOtaStatusChange(Handler h){ - mActivePhone.unregisterForOtaStatusChange(h); - } - - public void registerForCdmaCallWaiting(Handler h, int what, Object obj){ - mActivePhone.registerForCdmaCallWaiting(h,what,obj); - } - - public void unregisterForCdmaCallWaiting(Handler h){ - mActivePhone.unregisterForCdmaCallWaiting(h); + public void unregisterForCdmaOtaStatusChange(Handler h) { + mActivePhone.unregisterForCdmaOtaStatusChange(h); } public boolean getIccRecordsLoaded() { @@ -414,10 +398,6 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.stopDtmf(); } - public void sendBurstDtmf(String dtmfString) { - mActivePhone.sendBurstDtmf(dtmfString); - } - public void setRadioPower(boolean power) { mActivePhone.setRadioPower(power); } @@ -434,6 +414,10 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getLine1Number(); } + public String getCdmaMin() { + return mActivePhone.getCdmaMin(); + } + public String getLine1AlphaTag() { return mActivePhone.getLine1AlphaTag(); } @@ -446,6 +430,11 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getVoiceMailNumber(); } + /** @hide */ + public int getCountVoiceMessages(){ + return mActivePhone.getCountVoiceMessages(); + } + public String getVoiceMailAlphaTag() { return mActivePhone.getVoiceMailAlphaTag(); } @@ -656,10 +645,6 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getIccSerialNumber(); } - public String getMin() { - return mActivePhone.getMin(); - } - public String getEsn() { return mActivePhone.getEsn(); } @@ -688,10 +673,6 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.queryTTYMode(onComplete); } - public void exitEmergencyCallbackMode(Message onComplete) { - mActivePhone.exitEmergencyCallbackMode(onComplete); - } - public void activateCellBroadcastSms(int activate, Message response) { mActivePhone.activateCellBroadcastSms(activate, response); } @@ -720,12 +701,55 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getCdmaEriIconIndex(); } + public String getCdmaEriText() { + return mActivePhone.getCdmaEriText(); + } + public int getCdmaEriIconMode() { return mActivePhone.getCdmaEriIconMode(); } - public String getCdmaEriText() { - return mActivePhone.getCdmaEriText(); + public void sendBurstDtmf(String dtmfString, Message onComplete){ + mActivePhone.sendBurstDtmf(dtmfString,onComplete); + } + + public void exitEmergencyCallbackMode(){ + mActivePhone.exitEmergencyCallbackMode(); + } + + public boolean isOtaSpNumber(String dialStr){ + return mActivePhone.isOtaSpNumber(dialStr); + } + + public void registerForCallWaiting(Handler h, int what, Object obj){ + mActivePhone.registerForCallWaiting(h,what,obj); + } + + public void unregisterForCallWaiting(Handler h){ + mActivePhone.unregisterForCallWaiting(h); + } + + public void registerForSignalInfo(Handler h, int what, Object obj) { + mActivePhone.registerForSignalInfo(h,what,obj); } -} + public void unregisterForSignalInfo(Handler h) { + mActivePhone.unregisterForSignalInfo(h); + } + + public void registerForDisplayInfo(Handler h, int what, Object obj) { + mActivePhone.registerForDisplayInfo(h,what,obj); + } + + public void unregisterForDisplayInfo(Handler h) { + mActivePhone.unregisterForDisplayInfo(h); + } + + public void setOnEcbModeExitResponse(Handler h, int what, Object obj){ + mActivePhone.setOnEcbModeExitResponse(h,what,obj); + } + + public void unsetOnEcbModeExitResponse(Handler h){ + mActivePhone.unsetOnEcbModeExitResponse(h); + } +} diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 070d233..792e67f 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -38,11 +38,18 @@ import android.telephony.SmsMessage; import android.util.Config; import android.util.Log; -import com.android.internal.telephony.CdmaInformationRecord; -import com.android.internal.telephony.cdma.CdmaCallWaiting; +import com.android.internal.telephony.CallForwardInfo; +import com.android.internal.telephony.CommandException; import com.android.internal.telephony.DataCallState; import com.android.internal.telephony.gsm.NetworkInfo; import com.android.internal.telephony.gsm.SuppServiceNotification; +import com.android.internal.telephony.IccCardApplication; +import com.android.internal.telephony.IccCardStatus; +import com.android.internal.telephony.IccUtils; +import com.android.internal.telephony.RILConstants; +import com.android.internal.telephony.SmsResponse; +import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; +import com.android.internal.telephony.cdma.CdmaInformationRecords; import java.io.ByteArrayInputStream; import java.io.DataInputStream; @@ -1063,10 +1070,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { sendBurstDtmf(String dtmfString, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BURST_DTMF, result); - if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeString(dtmfString); + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + + " : " + dtmfString); + send(rr); } @@ -1992,7 +2000,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_UDUB: ret = responseVoid(p); break; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; - case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseInts(p); break; + case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; case RIL_REQUEST_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_GPRS_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; @@ -2187,7 +2195,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: ret = responseInts(p); break; case RIL_UNSOL_ON_USSD: ret = responseStrings(p); break; case RIL_UNSOL_NITZ_TIME_RECEIVED: ret = responseString(p); break; - case RIL_UNSOL_SIGNAL_STRENGTH: ret = responseInts(p); break; + case RIL_UNSOL_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; case RIL_UNSOL_DATA_CALL_LIST_CHANGED: ret = responseDataCallList(p);break; case RIL_UNSOL_SUPP_SVC_NOTIFICATION: ret = responseSuppServiceNotification(p); break; case RIL_UNSOL_STK_SESSION_END: ret = responseVoid(p); break; @@ -2205,7 +2213,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; case RIL_UNSOL_CDMA_CALL_WAITING: ret = responseCdmaCallWaiting(p); break; case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: ret = responseInts(p); break; - case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break; + case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInfoRec(p); break; case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break; default: @@ -2391,10 +2399,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { break; case RIL_UNSOL_CALL_RING: - if (RILJ_LOGD) unsljLog(response); + if (RILJ_LOGD) unsljLogRet(response, ret); if (mRingRegistrant != null) { - mRingRegistrant.notifyRegistrant(); + mRingRegistrant.notifyRegistrant( + new AsyncResult (null, ret, null)); } break; @@ -2434,13 +2443,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { } break; - case RIL_UNSOL_OEM_HOOK_RAW: - if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); - if (mUnsolOemHookRawRegistrant != null) { - mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null)); - } - break; - case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: if (RILJ_LOGD) unsljLog(response); @@ -2452,25 +2454,46 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_CDMA_CALL_WAITING: if (RILJ_LOGD) unsljLog(response); - if(mCallWaitingRegistrants != null) { - mCallWaitingRegistrants.notifyRegistrants(new AsyncResult (null, ret, null)); + if (mCallWaitingInfoRegistrants != null) { + mCallWaitingInfoRegistrants.notifyRegistrants( + new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: - if (RILJ_LOGD) unsljLog(response); + if (RILJ_LOGD) unsljLogRet(response, ret); - if (mOtaSessionRegistrants != null) { - mOtaSessionRegistrants.notifyRegistrants(new AsyncResult(null, ret, null)); + if (mOtaProvisionRegistrants != null) { + mOtaProvisionRegistrants.notifyRegistrants( + new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_CDMA_INFO_REC: - if (RILJ_LOGD) - unsljLog(response); - if (mInformationRecordsRegistrants != null) { - mInformationRecordsRegistrants.notifyRegistrants(new AsyncResult(null, ret, - null)); + if (RILJ_LOGD) unsljLog(response); + + CdmaInformationRecords infoRec = (CdmaInformationRecords) ret; + if (infoRec.isDispInfo) { + if (mDisplayInfoRegistrants != null) { + if (RILJ_LOGD) unsljLogRet(response, infoRec.cdmaDisplayInfoRecord); + + mDisplayInfoRegistrants.notifyRegistrants( + new AsyncResult (null, infoRec.cdmaDisplayInfoRecord, null)); + } + } + if (infoRec.isSignInfo) { + if (mSignalInfoRegistrants != null) { + if (RILJ_LOGD) unsljLogRet(response, infoRec.cdmaSignalInfoRecord); + mSignalInfoRegistrants.notifyRegistrants( + new AsyncResult (null, infoRec.cdmaSignalInfoRecord, null)); + } + } + break; + + case RIL_UNSOL_OEM_HOOK_RAW: + if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); + if (mUnsolOemHookRawRegistrant != null) { + mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null)); } break; } @@ -2721,11 +2744,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { dc.als = p.readInt(); voiceSettings = p.readInt(); dc.isVoice = (0 == voiceSettings) ? false : true; - - //dc.isVoicePrivacy = (0 != p.readInt()); int voicePrivacy = p.readInt(); dc.isVoicePrivacy = (0 != voicePrivacy); - dc.number = p.readString(); int np = p.readInt(); dc.numberPresentation = DriverCall.presentationFromCLIP(np); @@ -2834,121 +2854,130 @@ public final class RIL extends BaseCommands implements CommandsInterface { private Object responseCDMA_BR_CNF(Parcel p) { - int numInts; + int numServiceCategories; int response[]; - numInts = p.readInt(); + numServiceCategories = p.readInt(); - response = new int[numInts]; + if (numServiceCategories == 0) { + int numInts; + numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1; + response = new int[numInts]; - response[0] = numInts; - for (int i = 1 ; i < numInts; i++) { - response[i] = p.readInt(); + // Indicate that a zero length table was received + response[0] = 0; // TODO(Moto): This is very strange, please explain why. + + // Loop over CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES set 'english' as + // default language and selection status to false + for (int i = 1; i < numInts; i += CDMA_BSI_NO_OF_INTS_STRUCT ) { + response[i + 0] = i / CDMA_BSI_NO_OF_INTS_STRUCT; + response[i + 1] = 1; + response[i + 2] = 0; + } + } else { + int numInts; + numInts = (numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT) + 1; + response = new int[numInts]; + + response[0] = numServiceCategories; + for (int i = 1 ; i < numInts; i++) { + response[i] = p.readInt(); + } } return response; } private Object - responseCdmaInformationRecord(Parcel p){ - - int num; - ArrayList<CdmaInformationRecord> response; + responseSignalStrength(Parcel p) { + int numInts = 7; + int response[]; - num = p.readInt(); + /* TODO: Add SignalStrength class to match RIL_SignalStrength */ + response = new int[numInts]; + for (int i = 0 ; i < numInts ; i++) { + response[i] = p.readInt(); + } - response = new ArrayList<CdmaInformationRecord>(num); + return response; + } - for (int i = 0; i < num; i++) { - int name = p.readInt(); - CdmaInformationRecord InfoRec = new CdmaInformationRecord(name); - - char buffer[]; - int length; - switch (name) { - case CdmaInformationRecord.RIL_CDMA_DISPLAY_INFO_REC: - case CdmaInformationRecord.RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: - length = p.readInt(); - buffer = new char[length]; - for (int j = 0; j < length; j++) { - buffer[j] = (char)p.readInt(); - } - InfoRec.createDisplayInfo(length, buffer); + private Object + responseCdmaInfoRec(Parcel p) { + int infoRecordName; + CdmaInformationRecords records = new CdmaInformationRecords(); + + int numberOfInfoRecs = p.readInt(); + for (int i = 0; i < numberOfInfoRecs; i++) { + infoRecordName = p.readInt(); + switch(infoRecordName) { + case CdmaInformationRecords.RIL_CDMA_DISPLAY_INFO_REC: + case CdmaInformationRecords.RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: + records.setDispInfo(p.readString()); break; - - case CdmaInformationRecord.RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: - case CdmaInformationRecord.RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: - case CdmaInformationRecord.RIL_CDMA_CONNECTED_NUMBER_INFO_REC: - length = p.readInt(); - buffer = new char[length + 4]; - for (int j = 0; j < (length + 4); j++) { - buffer[j] = (char)p.readInt(); - } - InfoRec.createNumberInfo(length, buffer); + case CdmaInformationRecords.RIL_CDMA_SIGNAL_INFO_REC: + records.setSignInfo(p.readInt(), p.readInt(), p.readInt(), p.readInt()); break; - - case CdmaInformationRecord.RIL_CDMA_SIGNAL_INFO_REC: - buffer = new char[4]; - for (int j = 0; j < 4; j++) { - buffer[j] = (char)p.readInt(); - } - InfoRec.createSignalInfo(buffer); + // InfoReocords with names as below aren't supported in AFW yet + case CdmaInformationRecords.RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: + case CdmaInformationRecords.RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: + case CdmaInformationRecords.RIL_CDMA_CONNECTED_NUMBER_INFO_REC: + // TODO(Moto) implement + p.readString(); // number + p.readInt(); // number_type + p.readInt(); // number_plan + p.readInt(); // pi + p.readInt(); // si break; - - case CdmaInformationRecord.RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: - length = p.readInt(); - buffer = new char[length + 4]; - int reason; - for (int j = 0; j < (length + 4); j++) { - buffer[j] = (char)p.readInt(); - } - reason = p.readInt(); - InfoRec.createRedirectingNumberInfo(length, buffer, reason); + case CdmaInformationRecords.RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: + // TODO(Moto) implement + p.readString(); // redirecting number + p.readInt(); // number_type + p.readInt(); // number_plan + p.readInt(); // pi + p.readInt(); // si + p.readInt(); // reason break; - - case CdmaInformationRecord.RIL_CDMA_LINE_CONTROL_INFO_REC: - buffer = new char[4]; - for (int j = 0; j < 4; j++) { - buffer[j] = (char)p.readInt(); - } - InfoRec.createLineControlInfo(buffer); + case CdmaInformationRecords.RIL_CDMA_LINE_CONTROL_INFO_REC: + // TODO(Moto) implement + p.readInt(); // PolarityIncluded + p.readInt(); // Toggle + p.readInt(); // Reverse + p.readInt(); // PowerDenial break; - - case CdmaInformationRecord.RIL_CDMA_T53_CLIR_INFO_REC: - char ch = (char)p.readInt(); - InfoRec.createT53ClirInfo(ch); - break; - - case CdmaInformationRecord.RIL_CDMA_T53_RELEASE_INFO_REC: + case CdmaInformationRecords.RIL_CDMA_T53_CLIR_INFO_REC: + // TODO(Moto) implement + p.readInt(); // Cause break; - - case CdmaInformationRecord.RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: - char ul = (char)p.readInt(); - char dl = (char)p.readInt(); - InfoRec.createT53AudioControlInfo(ul, dl); + case CdmaInformationRecords.RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: + // TODO(Moto) implement + p.readInt(); // upLink + p.readInt(); // downLink break; - + case CdmaInformationRecords.RIL_CDMA_T53_RELEASE_INFO_REC: + // TODO(Moto) implement unknown fall through default: - break; + throw new RuntimeException("RIL_UNSOL_CDMA_INFO_REC: unsupported record. Got " + + records.recordToString(infoRecordName) + " "); } - response.add(InfoRec); } - - return response; + return records; } private Object - responseCdmaCallWaiting(Parcel p){ - CdmaCallWaiting response = new CdmaCallWaiting(); - response.number = p.readString(); - response.numberPresentation = p.readInt(); - response.name = p.readString(); - response.signalInfoRecord.isPresent = p.readInt() == 0 ? false : true; - response.signalInfoRecord.signalType = p.readInt(); - response.signalInfoRecord.alertPitch = p.readInt(); - response.signalInfoRecord.signalCode = p.readInt(); + responseCdmaCallWaiting(Parcel p) { + CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification(); - return response; + notification.number = p.readString(); + notification.numberPresentation = p.readInt(); + notification.name = p.readString(); + notification.namePresentation = notification.numberPresentation; + notification.isPresent = p.readInt(); + notification.signalType = p.readInt(); + notification.alertPitch = p.readInt(); + notification.signal = p.readInt(); + + return notification; } private Object @@ -3104,16 +3133,16 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_SIM_SMS_STORAGE_FULL: return "UNSOL_SIM_SMS_STORAGE_FULL"; case RIL_UNSOL_SIM_REFRESH: return "UNSOL_SIM_REFRESH"; case RIL_UNSOL_CALL_RING: return "UNSOL_CALL_RING"; - case RIL_UNSOL_RESTRICTED_STATE_CHANGED: return "RIL_UNSOL_RESTRICTED_STATE_CHANGED"; - case RIL_UNSOL_OEM_HOOK_RAW: return "RIL_UNSOL_OEM_HOOK_RAW"; case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: return "UNSOL_RESPONSE_SIM_STATUS_CHANGED"; case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: return "UNSOL_RESPONSE_CDMA_NEW_SMS"; case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: return "UNSOL_RESPONSE_NEW_BROADCAST_SMS"; case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL"; + case RIL_UNSOL_RESTRICTED_STATE_CHANGED: return "UNSOL_RESTRICTED_STATE_CHANGED"; case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE"; case RIL_UNSOL_CDMA_CALL_WAITING: return "UNSOL_CDMA_CALL_WAITING"; case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: return "UNSOL_CDMA_OTA_PROVISION_STATUS"; case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC"; + case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW"; default: return "<unknown reponse>"; } } @@ -3286,8 +3315,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { * {@inheritDoc} */ public void exitEmergencyCallbackMode(Message response) { - RILRequest rr - = RILRequest.obtain(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, response); + RILRequest rr = RILRequest.obtain(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index 91aa34e..c78ceae 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -54,8 +54,10 @@ public class TelephonyIntents { public static final String ACTION_RADIO_TECHNOLOGY_CHANGED = "android.intent.action.RADIO_TECHNOLOGY"; /** - * <p>Broadcast Action: The emergency callback mode is entered. - * + * <p>Broadcast Action: The emergency callback mode is changed. + * <ul> + * <li><em>phoneinECMState</em> - A boolean value,true=phone in ECM, false=ECM off</li> + * </ul> * <p class="note"> * You can <em>not</em> receive this through components declared * in manifests, only by explicitly registering for it with @@ -65,8 +67,8 @@ public class TelephonyIntents { * <p class="note"> * Requires no permission. */ - public static final String ACTION_EMERGENCY_CALLBACK_MODE_ENTERED - = "android.intent.action.EMERGENCY_CALLBACK_MODE"; + public static final String ACTION_EMERGENCY_CALLBACK_MODE_CHANGED + = "android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED"; /** * Broadcast Action: The phone's signal strength has changed. The intent will have the * following extra values:</p> @@ -179,4 +181,28 @@ public class TelephonyIntents { */ public static final String ACTION_NETWORK_SET_TIMEZONE = "android.intent.action.NETWORK_SET_TIMEZONE"; + + /** + * <p>Broadcast Action: It indicates the Emergency callback mode blocks datacall/sms + * <p class="note">. + */ + // TODO(Moto): What is the use case, who is interested in this? + public static final String ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS + = "android.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS"; + + /** + * Broadcast Action: The MDN changed during the CDMA OTA Process + * The intent will have the following extra values:</p> + * <ul> + * <li><em>mdn</em> - An Integer of the updated MDN number.</li> + * </ul> + * + * <p class="note"> + */ + // TODO(Moto): Generally broadcast intents are for use to allow entities which + // may not know about each other to "communicate". This seems quite specific + // and maybe using the registrant style would be better. + public static final String ACTION_CDMA_OTA_MDN_CHANGED + = "android.intent.action.ACTION_MDN_STATE_CHANGED"; + } diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java index 453185f..4e8950f 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -98,4 +98,7 @@ public interface TelephonyProperties */ static String PROPERTY_DATA_NETWORK_TYPE = "gsm.network.type"; + /** Indicate if phone is in emergency callback mode */ + static final String PROPERTY_INECM_MODE = "ril.cdma.inecmmode"; + } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index 03f7f98..c0bfe5e 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -35,6 +35,7 @@ import android.text.TextUtils; import android.util.Log; import static com.android.internal.telephony.TelephonyProperties.PROPERTY_BASEBAND_VERSION; +import static com.android.internal.telephony.TelephonyProperties.PROPERTY_INECM_MODE; import com.android.internal.telephony.CallStateException; import com.android.internal.telephony.CommandsInterface; @@ -54,9 +55,9 @@ import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; -import java.util.ArrayList; import java.util.List; - +import java.util.Timer; +import java.util.TimerTask; /** * {@hide} */ @@ -83,8 +84,21 @@ public class CDMAPhone extends PhoneBase { // mEriFileLoadedRegistrants are informed after the ERI text has been loaded private RegistrantList mEriFileLoadedRegistrants = new RegistrantList(); + + // mECMExitRespRegistrant is informed after the phone has been exited + //the emergency callback mode + //keep track of if phone is in emergency callback mode + private boolean mIsPhoneInECMState; + private Registrant mECMExitRespRegistrant; private String mEsn; private String mMeid; + + // A runnable which is used to automatically exit from ECM after a period of time. + private Runnable mExitEcmRunnable = new Runnable() { + public void run() { + exitEmergencyCallbackMode(); + } + }; Registrant mPostDialHandler; @@ -122,13 +136,16 @@ public class CDMAPhone extends PhoneBase { mCM.setOnCallRing(h, EVENT_CALL_RING, null); mSST.registerForNetworkAttach(h, EVENT_REGISTERED_TO_NETWORK, null); mCM.registerForNVReady(h, EVENT_NV_READY, null); - mCM.registerForCdmaCallWaiting(h,EVENT_CDMA_CALL_WAITING,null); - mCM.setEmergencyCallbackMode(h, EVENT_EMERGENCY_CALLBACK_MODE, null); + mCM.setEmergencyCallbackMode(h, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null); //Change the system setting SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE, new Integer(RILConstants.CDMA_PHONE).toString()); + + // TODO(Moto): Is this needed to handle phone crashes and/or power cycling? + String inEcm=SystemProperties.get(PROPERTY_INECM_MODE, "false"); + mIsPhoneInECMState = inEcm.equals("true"); } public void dispose() { @@ -143,7 +160,7 @@ public class CDMAPhone extends PhoneBase { mSST.unregisterForNetworkAttach(h); //EVENT_REGISTERED_TO_NETWORK mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); - mCM.unregisterForCdmaCallWaiting(h); + //Force all referenced classes to unregister their former registered events mCT.dispose(); @@ -370,8 +387,8 @@ public class CDMAPhone extends PhoneBase { return mRuimRecords.getMdnNumber(); } - public String getMin() { - return mRuimRecords.getMin(); + public String getCdmaMIN() { + return mRuimRecords.getCdmaMin(); } public void getCallWaiting(Message onComplete) { @@ -434,7 +451,7 @@ public class CDMAPhone extends PhoneBase { } public void setOnPostDialCharacter(Handler h, int what, Object obj) { - Log.e(LOG_TAG, "setOnPostDialCharacter: not possible in CDMA"); + mPostDialHandler = new Registrant(h, what, obj); } public boolean handlePinMmi(String dialString) { @@ -478,6 +495,30 @@ public class CDMAPhone extends PhoneBase { mDataConnection.setDataOnRoamingEnabled(enable); } + public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) { + mCM.registerForCdmaOtaProvision(h, what, obj); + } + + public void unregisterForCdmaOtaStatusChange(Handler h) { + mCM.unregisterForCdmaOtaProvision(h); + } + + public void setOnEcbModeExitResponse(Handler h, int what, Object obj) { + mECMExitRespRegistrant = new Registrant (h, what, obj); + } + + public void unsetOnEcbModeExitResponse(Handler h) { + mECMExitRespRegistrant.clear(); + } + + public void registerForCallWaiting(Handler h, int what, Object obj) { + Log.e(LOG_TAG, "method registerForCallWaiting is NOT yet supported in CDMA"); + } + + public void unregisterForCallWaiting(Handler h) { + Log.e(LOG_TAG, "method unregisterForCallWaiting is NOT yet supported in CDMA"); + } + public String getIpAddress(String apnType) { return mDataConnection.getIpAddress(); } @@ -565,7 +606,7 @@ public class CDMAPhone extends PhoneBase { mCM.stopDtmf(null); } - public void sendBurstDtmf(String dtmfString) { + public void sendBurstDtmf(String dtmfString, Message onComplete) { boolean check = true; for (int itr = 0;itr < dtmfString.length(); itr++) { if (!PhoneNumberUtils.is12Key(dtmfString.charAt(itr))) { @@ -576,7 +617,7 @@ public class CDMAPhone extends PhoneBase { } } if ((mCT.state == Phone.State.OFFHOOK)&&(check)) { - mCM.sendBurstDtmf(dtmfString, null); + mCM.sendBurstDtmf(dtmfString, onComplete); } } @@ -593,7 +634,7 @@ public class CDMAPhone extends PhoneBase { } public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) { - Log.e(LOG_TAG, "getAvailableNetworks: not possible in CDMA"); + Log.e(LOG_TAG, "setOutgoingCallerIdDisplay: not possible in CDMA"); } public void enableLocationUpdates() { @@ -630,7 +671,14 @@ public class CDMAPhone extends PhoneBase { //TODO: Where can we get this value has to be clarified with QC //return mSIMRecords.getVoiceMailNumber(); // throw new RuntimeException(); - return "12345"; + return "*86"; + } + + /* Returns Number of Voicemails + * @hide + */ + public int getCountVoiceMessages() { + return mRuimRecords.getCountVoiceMessages(); } public String getVoiceMailAlphaTag() { @@ -648,7 +696,15 @@ public class CDMAPhone extends PhoneBase { } public boolean enableDataConnectivity() { - return mDataConnection.setDataEnabled(true); + + // block data activities when phone is in emergency callback mode + if (mIsPhoneInECMState) { + Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS); + ActivityManagerNative.broadcastStickyIntent(intent, null); + return false; + } else { + return mDataConnection.setDataEnabled(true); + } } public void disableLocationUpdates() { @@ -691,7 +747,7 @@ public class CDMAPhone extends PhoneBase { return null; } - /** + /** * Notify any interested party of a Phone state change. */ /*package*/ void notifyPhoneStateChanged() { @@ -736,6 +792,13 @@ public class CDMAPhone extends PhoneBase { mUnknownConnectionRegistrants.notifyResult(this); } + void sendEmergencyCallbackModeChange(){ + //Send an Intent + Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED); + intent.putExtra(PHONE_IN_ECM_STATE, mIsPhoneInECMState); + ActivityManagerNative.broadcastStickyIntent(intent,null); + } + /*package*/ void updateMessageWaitingIndicator(boolean mwi) { // this also calls notifyMessageWaitingIndicator() @@ -761,6 +824,51 @@ public class CDMAPhone extends PhoneBase { mMmiCompleteRegistrants.notifyRegistrants(new AsyncResult(null, fc, null)); } + + @Override + public void exitEmergencyCallbackMode() { + // Send a message which will invoke handleExitEmergencyCallbackMode + mCM.exitEmergencyCallbackMode(h.obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE)); + } + + private void handleEnterEmergencyCallbackMode(Message msg) { + Log.d(LOG_TAG, "Event EVENT_EMERGENCY_CALLBACK_MODE Received"); + // if phone is not in ECM mode, and it's changed to ECM mode + if (mIsPhoneInECMState == false) { + mIsPhoneInECMState = true; + // notify change + sendEmergencyCallbackModeChange(); + setSystemProperty(PROPERTY_INECM_MODE, "true"); + + // Post this runnable so we will automatically exit + // if no one invokes exitEmergencyCallbackMode() directly. + // TODO(Moto): Get the delay a property so it can be adjusted + long delayInMillis = 300000; // 30,000 millis == 5 minutes + h.postDelayed(mExitEcmRunnable, delayInMillis); + } + } + + private void handleExitEmergencyCallbackMode(Message msg) { + Log.d(LOG_TAG, "Event EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE Received"); + AsyncResult ar = (AsyncResult)msg.obj; + + // Remove pending exit ECM runnable, if any + h.removeCallbacks(mExitEcmRunnable); + + if (mECMExitRespRegistrant != null) { + mECMExitRespRegistrant.notifyRegistrant(ar); + } + // if exiting ecm success + if (ar.exception == null) { + if (mIsPhoneInECMState) { + mIsPhoneInECMState = false; + setSystemProperty(PROPERTY_INECM_MODE, "false"); + } + // send an Intent + sendEmergencyCallbackModeChange(); + } + } + //***** Inner Classes class MyHandler extends Handler { MyHandler() { @@ -770,6 +878,7 @@ public class CDMAPhone extends PhoneBase { super(l); } + @Override public void handleMessage(Message msg) { AsyncResult ar; Message onComplete; @@ -806,12 +915,16 @@ public class CDMAPhone extends PhoneBase { } break; - case EVENT_EMERGENCY_CALLBACK_MODE: { - Log.d(LOG_TAG, "Event EVENT_EMERGENCY_CALLBACK_MODE Received"); - Intent intent = - new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_ENTERED); - ActivityManagerNative.broadcastStickyIntent(intent, null); + case EVENT_EMERGENCY_CALLBACK_MODE_ENTER:{ + handleEnterEmergencyCallbackMode(msg); + } + break; + + case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{ + handleExitEmergencyCallbackMode(msg); } + break; + case EVENT_RUIM_RECORDS_LOADED:{ Log.d(LOG_TAG, "Event EVENT_RUIM_RECORDS_LOADED Received"); } @@ -852,11 +965,7 @@ public class CDMAPhone extends PhoneBase { Log.d(LOG_TAG, "ERI read, notify registrants"); mEriFileLoadedRegistrants.notifyRegistrants(); } - } - break; - - case EVENT_CDMA_CALL_WAITING:{ - Log.d(LOG_TAG, "Event EVENT_CDMA_CALL_WAITING Received"); + setSystemProperty(PROPERTY_INECM_MODE,"false"); } break; @@ -867,26 +976,26 @@ public class CDMAPhone extends PhoneBase { } } - /** - * Retrieves the PhoneSubInfo of the CDMAPhone - */ - public PhoneSubInfo getPhoneSubInfo(){ + /** + * Retrieves the PhoneSubInfo of the CDMAPhone + */ + public PhoneSubInfo getPhoneSubInfo() { return mSubInfo; - } + } - /** - * Retrieves the IccSmsInterfaceManager of the CDMAPhone - */ - public IccSmsInterfaceManager getIccSmsInterfaceManager(){ - return mRuimSmsInterfaceManager; - } + /** + * Retrieves the IccSmsInterfaceManager of the CDMAPhone + */ + public IccSmsInterfaceManager getIccSmsInterfaceManager() { + return mRuimSmsInterfaceManager; + } - /** - * Retrieves the IccPhoneBookInterfaceManager of the CDMAPhone - */ - public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){ - return mRuimPhoneBookInterfaceManager; - } + /** + * Retrieves the IccPhoneBookInterfaceManager of the CDMAPhone + */ + public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager() { + return mRuimPhoneBookInterfaceManager; + } public void registerForNvLoaded(Handler h, int what, Object obj) { Registrant r = new Registrant (h, what, obj); @@ -906,97 +1015,146 @@ public class CDMAPhone extends PhoneBase { mEriFileLoadedRegistrants.remove(h); } - // override for allowing access from other classes of this package - /** - * {@inheritDoc} - */ - public final void setSystemProperty(String property, String value) { - super.setSystemProperty(property, value); - } + // override for allowing access from other classes of this package + /** + * {@inheritDoc} + */ + public final void setSystemProperty(String property, String value) { + super.setSystemProperty(property, value); + } - /** - * {@inheritDoc} - */ - public Handler getHandler(){ - return h; - } + /** + * {@inheritDoc} + */ + public Handler getHandler() { + return h; + } - /** - * {@inheritDoc} - */ - public IccFileHandler getIccFileHandler(){ - return this.mIccFileHandler; - } + /** + * {@inheritDoc} + */ + public IccFileHandler getIccFileHandler() { + return this.mIccFileHandler; + } - /** - * Set the TTY mode of the CDMAPhone - */ - public void setTTYMode(int ttyMode, Message onComplete) { - this.mCM.setTTYMode(ttyMode, onComplete); -} + /** + * Set the TTY mode of the CDMAPhone + */ + public void setTTYMode(int ttyMode, Message onComplete) { + this.mCM.setTTYMode(ttyMode, onComplete); + } - /** - * Queries the TTY mode of the CDMAPhone - */ - public void queryTTYMode(Message onComplete) { - this.mCM.queryTTYMode(onComplete); - } + /** + * Queries the TTY mode of the CDMAPhone + */ + public void queryTTYMode(Message onComplete) { + this.mCM.queryTTYMode(onComplete); + } - /** - * Sends Exit EmergencyCallbackMode Exit request on CDMAPhone - */ - public void exitEmergencyCallbackMode(Message onComplete) { - this.mCM.exitEmergencyCallbackMode(onComplete); - } + /** + * Activate or deactivate cell broadcast SMS. + * + * @param activate 0 = activate, 1 = deactivate + * @param response Callback message is empty on completion + */ + public void activateCellBroadcastSms(int activate, Message response) { + mSMS.activateCellBroadcastSms(activate, response); + } - /** - * Activate or deactivate cell broadcast SMS. - * - * @param activate - * 0 = activate, 1 = deactivate - * @param response - * Callback message is empty on completion - */ - public void activateCellBroadcastSms(int activate, Message response) { - mSMS.activateCellBroadcastSms(activate, response); - } + /** + * Query the current configuration of cdma cell broadcast SMS. + * + * @param response Callback message is empty on completion + */ + public void getCellBroadcastSmsConfig(Message response) { + mSMS.getCellBroadcastSmsConfig(response); + } - /** - * Query the current configuration of cdma cell broadcast SMS. - * - * @param response - * Callback message is empty on completion - */ - public void getCellBroadcastSmsConfig(Message response){ - mSMS.getCellBroadcastSmsConfig(response); - } + /** + * Configure cdma cell broadcast SMS. + * + * @param response Callback message is empty on completion + */ + public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) { + mSMS.setCellBroadcastConfig(configValuesArray, response); + } + + public static final String IS683A_FEATURE_CODE = "*228" ; + public static final int IS683A_FEATURE_CODE_NUM_DIGITS = 4 ; + public static final int IS683A_SYS_SEL_CODE_NUM_DIGITS = 2 ; + public static final int IS683A_SYS_SEL_CODE_OFFSET = 4; + + private static final int IS683_CONST_800MHZ_A_BAND = 0; + private static final int IS683_CONST_800MHZ_B_BAND = 1; + private static final int IS683_CONST_1900MHZ_A_BLOCK = 2; + private static final int IS683_CONST_1900MHZ_B_BLOCK = 3; + private static final int IS683_CONST_1900MHZ_C_BLOCK = 4; + private static final int IS683_CONST_1900MHZ_D_BLOCK = 5; + private static final int IS683_CONST_1900MHZ_E_BLOCK = 6; + private static final int IS683_CONST_1900MHZ_F_BLOCK = 7; + + private boolean isIs683OtaSpDialStr(String dialStr) { + int sysSelCodeInt; + boolean isOtaspDialString = false; + int dialStrLen = dialStr.length(); + + if (dialStrLen == IS683A_FEATURE_CODE_NUM_DIGITS) { + if (dialStr.equals(IS683A_FEATURE_CODE)) { + isOtaspDialString = true; + } + } else if ((dialStr.regionMatches(0, IS683A_FEATURE_CODE, 0, + IS683A_FEATURE_CODE_NUM_DIGITS) == true) + && (dialStrLen >= + (IS683A_FEATURE_CODE_NUM_DIGITS + IS683A_SYS_SEL_CODE_NUM_DIGITS))) { + StringBuilder sb = new StringBuilder(dialStr); + // Separate the System Selection Code into its own string + char[] sysSel = new char[2]; + sb.delete(0, IS683A_SYS_SEL_CODE_OFFSET); + sb.getChars(0, IS683A_SYS_SEL_CODE_NUM_DIGITS, sysSel, 0); + + if ((PhoneNumberUtils.isISODigit(sysSel[0])) + && (PhoneNumberUtils.isISODigit(sysSel[1]))) { + String sysSelCode = new String(sysSel); + sysSelCodeInt = Integer.parseInt((String)sysSelCode); + switch (sysSelCodeInt) { + case IS683_CONST_800MHZ_A_BAND: + case IS683_CONST_800MHZ_B_BAND: + case IS683_CONST_1900MHZ_A_BLOCK: + case IS683_CONST_1900MHZ_B_BLOCK: + case IS683_CONST_1900MHZ_C_BLOCK: + case IS683_CONST_1900MHZ_D_BLOCK: + case IS683_CONST_1900MHZ_E_BLOCK: + case IS683_CONST_1900MHZ_F_BLOCK: + isOtaspDialString = true; + break; + + default: + break; + } + } + } + return isOtaspDialString; + } /** - * Configure cdma cell broadcast SMS. + * isOTASPNumber: checks a given number against the IS-683A OTASP dial string and carrier + * OTASP dial string. * - * @param response - * Callback message is empty on completion + * @param dialStr the number to look up. + * @return true if the number is in IS-683A OTASP dial string or carrier OTASP dial string */ - public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response){ - mSMS.setCellBroadcastConfig(configValuesArray, response); - } - - public void registerForOtaSessionStatus(Handler h, int what, Object obj){ - mCM.registerForOtaSessionStatus(h, what, obj); - } - - public void unregisterForOtaSessionStatus(Handler h){ - mCM.unregisterForOtaSessionStatus(h); + @Override + public boolean isOtaSpNumber(String dialStr){ + boolean isOtaSpNum = false; + if(dialStr != null){ + isOtaSpNum=isIs683OtaSpDialStr(dialStr); + if(isOtaSpNum == false){ + //TO DO:Add carrier specific OTASP number detection here. + } + } + return isOtaSpNum; } -/** - * TODO(Teleca): The code in getCdmaEriIconIndex, getCdmaEriIconMode & getCdmaEriText share a - * lot of logic, refactor. - */ - /** - * Returns the CDMA ERI icon index to display, - * it returns 1, EriInfo.ROAMING_INDICATOR_OFF, in case there is no icon to display - */ @Override public int getCdmaEriIconIndex() { int roamInd = getServiceState().getCdmaRoamingIndicator(); diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java index a1d362f..c02fcd4 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java @@ -24,6 +24,7 @@ import android.os.RegistrantList; import android.telephony.PhoneNumberUtils; import android.telephony.ServiceState; import android.util.Log; +import android.os.SystemProperties; import com.android.internal.telephony.CallStateException; import com.android.internal.telephony.CallTracker; @@ -31,11 +32,12 @@ import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.Connection; import com.android.internal.telephony.DriverCall; import com.android.internal.telephony.Phone; -import com.android.internal.telephony.PhoneProxy; +import com.android.internal.telephony.TelephonyProperties; import java.util.ArrayList; import java.util.List; + /** * {@hide} */ @@ -69,11 +71,12 @@ public final class CdmaCallTracker extends CallTracker { CdmaConnection pendingMO; boolean hangupPendingMO; - + boolean pendingCallInECM=false; CDMAPhone phone; boolean desiredMute = false; // false = mute off + int pendingCallClirMode; Phone.State state = Phone.State.IDLE; @@ -115,6 +118,7 @@ public final class CdmaCallTracker extends CallTracker { } + @Override protected void finalize() { Log.d(LOG_TAG, "CdmaCallTracker finalized"); } @@ -204,7 +208,15 @@ public final class CdmaCallTracker extends CallTracker { // Always unmute when initiating a new call setMute(false); - cm.dial(pendingMO.address, clirMode, obtainCompleteMessage()); + String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false"); + if(inEcm.equals("false")) { + cm.dial(pendingMO.address, clirMode, obtainCompleteMessage()); + } else { + phone.exitEmergencyCallbackMode(); + phone.setOnEcbModeExitResponse(this,EVENT_EXIT_ECM_RESPONSE_CDMA, null); + pendingCallClirMode=clirMode; + pendingCallInECM=true; + } } updatePhoneState(); @@ -536,6 +548,9 @@ public final class CdmaCallTracker extends CallTracker { droppedDuringPoll.add(pendingMO); pendingMO = null; hangupPendingMO = false; + if( pendingCallInECM) { + pendingCallInECM = false; + } } if (newRinging != null) { @@ -847,8 +862,17 @@ public final class CdmaCallTracker extends CallTracker { handleRadioNotAvailable(); break; + case EVENT_EXIT_ECM_RESPONSE_CDMA: + //no matter the result, we still do the same here + if (pendingCallInECM) { + cm.dial(pendingMO.address, pendingCallClirMode, obtainCompleteMessage()); + pendingCallInECM = false; + } + phone.unsetOnEcbModeExitResponse(this); + break; + default:{ - throw new RuntimeException("unexpected event not handled"); + throw new RuntimeException("unexpected event not handled"); } } } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java deleted file mode 100644 index 64841d7..0000000 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.cdma; - -import com.android.internal.telephony.CdmaInformationRecord; - -public class CdmaCallWaiting { - public String number; - public int numberPresentation; - public String name; - - public CdmaInformationRecord.CdmaSignalInfoRec signalInfoRecord = - new CdmaInformationRecord.CdmaSignalInfoRec(); - - @Override - public String toString() { - return "CdmaCallWaiting: {" + " number: " + number + " numberPresentation: " - + numberPresentation + " name: " + name + " signalInfoRecord: " - + signalInfoRecord + " }"; - } -} diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java new file mode 100644 index 0000000..54dec48 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 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.cdma; + +/** + * Represents a Supplementary Service Notification received from the network. + * + * {@hide} + */ +public class CdmaCallWaitingNotification { + public String number =null; + public int numberPresentation = 0; + public String name = null; + public int namePresentation = 0; + public int isPresent = 0; + public int signalType = 0; + public int alertPitch = 0; + public int signal = 0; + + + public String toString() + { + return super.toString() + "Call Waiting Notification " + + " number: " + number + + " numberPresentation: " + numberPresentation + + " name: " + name + + " namePresentation: " + namePresentation + + " isPresent: " + isPresent + + " signalType: " + signalType + + " alertPitch: " + alertPitch + + " signal: " + signal ; + } + +} diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java index 0a237c6..32442f6 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java @@ -48,7 +48,7 @@ public class CdmaConnection extends Connection { String postDialString; // outgoing calls only boolean isIncoming; boolean disconnected; - + String cnapName; int index; // index in CdmaCallTracker.connections[], -1 if unassigned /* @@ -74,6 +74,8 @@ public class CdmaConnection extends Connection { DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED; PostDialState postDialState = PostDialState.NOT_STARTED; int numberPresentation = Connection.PRESENTATION_ALLOWED; + int cnapNamePresentation = Connection.PRESENTATION_ALLOWED; + Handler h; @@ -86,10 +88,19 @@ public class CdmaConnection extends Connection { 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; - + static final int PAUSE_DELAY_MILLIS = 2 * 1000; + + // TODO(Moto): These should be come from a resourse file + // at a minimum as different carriers may want to use + // different characters and our general default is "," & ";". + // Furthermore Android supports contacts that have phone + // numbers entered as strings so '1-800-164flowers' would not + // be handled as expected. Both issues need to be resolved. + static final char CUSTOMERIZED_WAIT_CHAR_UPPER ='W'; + static final char CUSTOMERIZED_WAIT_CHAR_LOWER ='w'; + static final char CUSTOMERIZED_PAUSE_CHAR_UPPER ='P'; + static final char CUSTOMERIZED_PAUSE_CHAR_LOWER ='p'; //***** Inner Classes class MyHandler extends Handler { @@ -126,6 +137,8 @@ public class CdmaConnection extends Connection { isIncoming = dc.isMT; createTime = System.currentTimeMillis(); + cnapName = dc.name; + cnapNamePresentation = dc.namePresentation; numberPresentation = dc.numberPresentation; this.index = index; @@ -134,6 +147,16 @@ public class CdmaConnection extends Connection { parent.attach(this, dc); } + CdmaConnection () { + owner = null; + h = null; + address = null; + index = -1; + parent = null; + isIncoming = true; + createTime = System.currentTimeMillis(); + } + /** This is an MO call, created when dialing */ /*package*/ CdmaConnection (Context context, String dialString, CdmaCallTracker ct, CdmaCall parent) { @@ -144,6 +167,9 @@ public class CdmaConnection extends Connection { h = new MyHandler(owner.getLooper()); this.dialString = dialString; + Log.d(LOG_TAG, "[CDMAConn] CdmaConnection: dialString=" + dialString); + dialString = formatDialString(dialString); + Log.d(LOG_TAG, "[CDMAConn] CdmaConnection:formated dialString=" + dialString); this.address = PhoneNumberUtils.extractNetworkPortion(dialString); this.postDialString = PhoneNumberUtils.extractPostDialPortion(dialString); @@ -151,10 +177,15 @@ public class CdmaConnection extends Connection { index = -1; isIncoming = false; + cnapName = null; + cnapNamePresentation = 0; + numberPresentation = 0; createTime = System.currentTimeMillis(); - this.parent = parent; - parent.attachFake(this, CdmaCall.State.DIALING); + if (parent != null) { + this.parent = parent; + parent.attachFake(this, CdmaCall.State.DIALING); + } } public void dispose() { @@ -186,10 +217,22 @@ public class CdmaConnection extends Connection { return (isIncoming ? "incoming" : "outgoing"); } + public String getOrigDialString(){ + return dialString; + } + public String getAddress() { return address; } + public String getCnapName() { + return cnapName; + } + + public int getCnapNamePresentation() { + return cnapNamePresentation; + } + public CdmaCall getCall() { return parent; } @@ -320,6 +363,16 @@ public class CdmaConnection extends Connection { } } + /** + * Used for 3way call only + */ + void update (CdmaConnection c) { + address = c.address; + cnapName = c.cnapName; + cnapNamePresentation = c.cnapNamePresentation; + numberPresentation = c.numberPresentation; + } + public void cancelPostDial() { setPostDialState(PostDialState.CANCELLED); } @@ -355,7 +408,7 @@ public class CdmaConnection extends Connection { case CallFailCause.CDMA_LOCKED_UNTIL_POWER_CYCLE: return DisconnectCause.CDMA_LOCKED_UNTIL_POWER_CYCLE; case CallFailCause.CDMA_DROP: - return DisconnectCause.CDMA_DROP; + return DisconnectCause.LOST_SIGNAL; // TODO(Moto): wink/dave changed from CDMA_DROP; case CallFailCause.CDMA_INTERCEPT: return DisconnectCause.CDMA_INTERCEPT; case CallFailCause.CDMA_REORDER: @@ -434,6 +487,20 @@ public class CdmaConnection extends Connection { changed = true; } + // A null cnapName should be the same as "" + if (null != dc.name) { + if (cnapName != dc.name) { + cnapName = dc.name; + changed = true; + } + } else { + cnapName = ""; + // TODO(Moto): Should changed = true if cnapName wasn't previously "" + } + log("--dssds----"+cnapName); + cnapNamePresentation = dc.namePresentation; + numberPresentation = dc.numberPresentation; + if (newParent != parent) { if (parent != null) { parent.detach(this); @@ -533,25 +600,13 @@ public class CdmaConnection extends Connection { if (PhoneNumberUtils.is12Key(c)) { owner.cm.sendDtmf(c, h.obtainMessage(EVENT_DTMF_DONE)); } else if (c == PhoneNumberUtils.PAUSE) { - // From TS 22.101: - - // "The first occurrence of the "DTMF Control Digits Separator" - // shall be used by the ME to distinguish between the addressing - // digits (i.e. the phone number) and the DTMF digits...." - - if (nextPostDialChar == 1) { - // The first occurrence. - // We don't need to pause here, but wait for just a bit anyway - h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE), - PAUSE_DELAY_FIRST_MILLIS); - } else { - // It continues... - // "Upon subsequent occurrences of the separator, the UE shall - // pause again for 3 seconds (\u00B1 20 %) before sending any - // further DTMF digits." - h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE), + setPostDialState(PostDialState.PAUSE); + + // Upon occurrences of the separator, the UE shall + // pause again for 2 seconds before sending any + // further DTMF digits. + h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE), PAUSE_DELAY_MILLIS); - } } else if (c == PhoneNumberUtils.WAIT) { setPostDialState(PostDialState.WAIT); } else if (c == PhoneNumberUtils.WILD) { @@ -563,17 +618,40 @@ public class CdmaConnection extends Connection { return true; } - public String - getRemainingPostDialString() { + public String getRemainingPostDialString() { if (postDialState == PostDialState.CANCELLED - || postDialState == PostDialState.COMPLETE - || postDialString == null - || postDialString.length() <= nextPostDialChar - ) { + || postDialState == PostDialState.COMPLETE + || postDialString == null + || postDialString.length() <= nextPostDialChar) { return ""; } - return postDialString.substring(nextPostDialChar); + String subStr = postDialString.substring(nextPostDialChar); + if (subStr != null) { + int wIndex = subStr.indexOf(PhoneNumberUtils.WAIT); + int pIndex = subStr.indexOf(PhoneNumberUtils.PAUSE); + + // TODO(Moto): Courtesy of jsh; is this simpler expression equivalent? + // + // if (wIndex > 0 && (wIndex < pIndex || pIndex <= 0)) { + // subStr = subStr.substring(0, wIndex); + // } else if (pIndex > 0) { + // subStr = subStr.substring(0, pIndex); + // } + + if (wIndex > 0 && pIndex > 0) { + if (wIndex > pIndex) { + subStr = subStr.substring(0, pIndex); + } else { + subStr = subStr.substring(0, wIndex); + } + } else if (wIndex > 0) { + subStr = subStr.substring(0, wIndex); + } else if (pIndex > 0) { + subStr = subStr.substring(0, pIndex); + } + } + return subStr; } @Override @@ -591,8 +669,7 @@ public class CdmaConnection extends Connection { releaseWakeLock(); } - private void - processNextPostDialChar() { + void processNextPostDialChar() { char c = 0; Registrant postDialHandler; @@ -698,21 +775,18 @@ public class CdmaConnection extends Connection { postDialState = s; } - private void - createWakeLock(Context context) { - PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + private void createWakeLock(Context context) { + PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); } - private void - acquireWakeLock() { + private void acquireWakeLock() { log("acquireWakeLock"); mPartialWakeLock.acquire(); } - private void - releaseWakeLock() { - synchronized(mPartialWakeLock) { + private void releaseWakeLock() { + synchronized (mPartialWakeLock) { if (mPartialWakeLock.isHeld()) { log("releaseWakeLock"); mPartialWakeLock.release(); @@ -720,6 +794,119 @@ public class CdmaConnection extends Connection { } } + private static boolean isPause(char c) { + if (c == CUSTOMERIZED_PAUSE_CHAR_UPPER || c == CUSTOMERIZED_PAUSE_CHAR_LOWER + || c == PhoneNumberUtils.PAUSE) { + return true; + } else { + return false; + } + } + + private static boolean isWait(char c) { + if (c == CUSTOMERIZED_WAIT_CHAR_LOWER || c == CUSTOMERIZED_WAIT_CHAR_UPPER + || c == PhoneNumberUtils.WAIT) { + return true; + } else { + return false; + } + } + + /** + * format string + * convert "+" to "011" + * handle corner cases for PAUSE/WAIT + * If PAUSE/WAIT sequence at the end,ignore them + * If PAUSE/WAIT sequence in the middle, then if there is any WAIT + * in PAUSE/WAIT sequence, treat them like WAIT + * If PAUSE followed by WAIT or WAIT followed by PAUSE in the middle, + * treat them like just PAUSE or WAIT + */ + private static String formatDialString(String phoneNumber) { + if (phoneNumber == null) { + return null; + } + int length = phoneNumber.length(); + StringBuilder ret = new StringBuilder(); + + // TODO(Moto): Modifying the for loop index is confusing, a + // while loop is probably better and overall this code is + // hard to follow. If this was routine was refactored and + // used several private methods with good names to make it + // easier to follow. + for (int i = 0; i < length; i++) { + char c = phoneNumber.charAt(i); + + if (PhoneNumberUtils.isDialable(c)) { + if (c == '+') { + // TODO(Moto): Is this valid for "all" countries???? + // should probably be pulled from a resource based + // on current contry code (MCC). + ret.append("011"); + } else { + ret.append(c); + } + } else if (isPause(c) || isWait(c)) { + if (i < length - 1) { // if PAUSE/WAIT not at the end + int index = 0; + boolean wMatched = false; + for (index = i + 1; index < length; index++) { + char cNext = phoneNumber.charAt(index); + // if there is any W inside P/W sequence,mark it + if (isWait(cNext)) { + wMatched = true; + } + // if any characters other than P/W chars after P/W sequence + // we break out the loop and append the correct + if (!isWait(cNext) && !isPause(cNext)) { + break; + } + } + if (index == length) { + // it means there is no dialable character after PAUSE/WAIT + i = length - 1; + break; + } else {// means index <length + if (isPause(c)) { + c = PhoneNumberUtils.PAUSE; + } else if (isWait(c)) { + c = PhoneNumberUtils.WAIT; + } + + if (index == i + 1) { + ret.append(c); + } else if (isWait(c)) { + // for case like 123WP456 =123P456 + if ((index == i + 2) && isPause(phoneNumber.charAt(index - 1))) { + // skip W,append P + ret.append(PhoneNumberUtils.PAUSE); + } else { + // append W + ret.append(c); + } + i = index - 1; + } else if (isPause(c)) { + + // for case like 123PW456 =123W456, skip p, append W + // or there is 1 W in between, treat the whole PW + // sequence as W + if (wMatched == true) { + // skip P,append W + ret.append(PhoneNumberUtils.WAIT); + i = index - 1; + } else { + ret.append(c); + } + } // end of pause case + } // end of index <length, it means dialable characters after P/W + } + } else { // if it's characters other than P/W + ret.append(c); + } + } + return ret.toString(); + } + private void log(String msg) { Log.d(LOG_TAG, "[CDMAConn] " + msg); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java b/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java new file mode 100644 index 0000000..93a6aa4 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaInformationRecords.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009 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.cdma; +import static com.android.internal.telephony.RILConstants.*; + +public final class CdmaInformationRecords { + public static final int RIL_CDMA_DISPLAY_INFO_REC = 0; + public static final int RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC = 1; + public static final int RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC = 2; + public static final int RIL_CDMA_CONNECTED_NUMBER_INFO_REC = 3; + public static final int RIL_CDMA_SIGNAL_INFO_REC = 4; + public static final int RIL_CDMA_REDIRECTING_NUMBER_INFO_REC = 5; + public static final int RIL_CDMA_LINE_CONTROL_INFO_REC = 6; + public static final int RIL_CDMA_EXTENDED_DISPLAY_INFO_REC = 7; + public static final int RIL_CDMA_T53_CLIR_INFO_REC = 8; + public static final int RIL_CDMA_T53_RELEASE_INFO_REC = 9; + public static final int RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC = 10; + + public boolean isDispInfo; + public boolean isSignInfo; + public String cdmaDisplayInfoRecord; + public int[] cdmaSignalInfoRecord; + + private static final int ALPHA_LEN_FOR_DISPLAY_INFO = 64; + + public CdmaInformationRecords() { + isDispInfo = false; + isSignInfo = false; + } + + public void setDispInfo(String resString) { + isDispInfo = true; + cdmaDisplayInfoRecord = resString; + } + + public void setSignInfo(int isPresent, int signalType, int alertPitch, int signal) { + isSignInfo = true; + cdmaSignalInfoRecord = new int[4]; + cdmaSignalInfoRecord[0] = isPresent; + cdmaSignalInfoRecord[1] = signalType; + cdmaSignalInfoRecord[2] = alertPitch; + cdmaSignalInfoRecord[3] = signal; + } + + public String recordToString (int record) { + switch(record) { + case RIL_CDMA_DISPLAY_INFO_REC: return "RIL_CDMA_DISPLAY_INFO_REC"; + case RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: return "RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC"; + case RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: return "RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC"; + case RIL_CDMA_CONNECTED_NUMBER_INFO_REC: return "RIL_CDMA_CONNECTED_NUMBER_INFO_REC"; + case RIL_CDMA_SIGNAL_INFO_REC: return "RIL_CDMA_SIGNAL_INFO_REC"; + case RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: return "RIL_CDMA_REDIRECTING_NUMBER_INFO_REC"; + case RIL_CDMA_LINE_CONTROL_INFO_REC: return "RIL_CDMA_LINE_CONTROL_INFO_REC"; + case RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: return "RIL_CDMA_EXTENDED_DISPLAY_INFO_REC"; + case RIL_CDMA_T53_CLIR_INFO_REC: return "RIL_CDMA_T53_CLIR_INFO_REC"; + case RIL_CDMA_T53_RELEASE_INFO_REC: return "RIL_CDMA_T53_RELEASE_INFO_REC"; + case RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: return "RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC"; + default: return "<unknown record>"; + } + } +} diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index dbb0f93..8ecdecd 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -24,6 +24,7 @@ import android.database.ContentObserver; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; +import android.os.PowerManager; import android.os.Registrant; import android.os.RegistrantList; import android.os.SystemClock; @@ -38,7 +39,9 @@ import android.telephony.cdma.CdmaCellLocation; import android.text.TextUtils; import android.util.EventLog; import android.util.Log; +import android.util.Config; import android.util.TimeUtils; +import java.util.Calendar; import com.android.internal.telephony.CommandException; import com.android.internal.telephony.CommandsInterface; @@ -100,12 +103,26 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { private RegistrantList cdmaDataConnectionAttachedRegistrants = new RegistrantList(); private RegistrantList cdmaDataConnectionDetachedRegistrants = 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 + // the time zone once know the country. + private boolean mNeedFixZone = false; + private int mZoneOffset; + private boolean mZoneDst; + private long mZoneTime; private boolean mGotCountryCode = false; + String mSavedTimeZone; + long mSavedTime; + long mSavedAtTime; // We can't register for SIM_RECORDS_LOADED immediately because the // SIMRecords object may not be instantiated yet. private boolean mNeedToRegForRuimLoaded; + // Wake lock used while setting time of day. + private PowerManager.WakeLock mWakeLock; + private static final String WAKELOCK_TAG = "ServiceStateTracker"; + // Keep track of SPN display rules, so we only broadcast intent if something changes. private String curSpn = null; private String curEriText = null; @@ -134,7 +151,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { @Override public void onChange(boolean selfChange) { Log.i("CdmaServiceStateTracker", "Auto time state called ..."); - //NOTE in CDMA NITZ is not used + revertToNitz(); + } }; @@ -152,10 +170,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { newCellLoc = new CdmaCellLocation(); mSignalStrength = new SignalStrength(); + PowerManager powerManager = + (PowerManager)phone.getContext().getSystemService(Context.POWER_SERVICE); + mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_TAG); + cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null); cm.registerForNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null); + cm.setOnNITZTime(this, EVENT_NITZ_TIME, null); cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); cm.registerForRUIMReady(this, EVENT_RUIM_READY, null); @@ -188,6 +211,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { phone.unregisterForEriFileLoaded(this); phone.mRuimRecords.unregisterForRecordsLoaded(this); cm.unSetOnSignalStrengthUpdate(this); + cm.unSetOnNITZTime(this); cr.unregisterContentObserver(this.mAutoTimeObserver); } @@ -378,6 +402,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { cm.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH)); break; + case EVENT_NITZ_TIME: + ar = (AsyncResult) msg.obj; + + String nitzString = (String)((Object[])ar.result)[0]; + long nitzReceiveTime = ((Long)((Object[])ar.result)[1]).longValue(); + + setTimeFromNITZString(nitzString, nitzReceiveTime); + break; + case EVENT_SIGNAL_STRENGTH_UPDATE: // This is a notification from // CommandsInterface.setOnSignalStrengthUpdate @@ -800,8 +833,44 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { return ret; } - private void - pollStateDone() { + private void fixTimeZone(String isoCountryCode) { + TimeZone zone = null; + // If the offset is (0, false) and the time zone property + // is set, use the time zone property rather than GMT. + String zoneName = SystemProperties.get(TIMEZONE_PROPERTY); + if ((mZoneOffset == 0) && (mZoneDst == false) && (zoneName != null) + && (zoneName.length() > 0) + && (Arrays.binarySearch(GMT_COUNTRY_CODES, isoCountryCode) < 0)) { + // For NITZ string without time zone, + // need adjust time to reflect default time zone setting + zone = TimeZone.getDefault(); + long tzOffset; + tzOffset = zone.getOffset(System.currentTimeMillis()); + if (getAutoTime()) { + setAndBroadcastNetworkSetTime(System.currentTimeMillis() - tzOffset); + } else { + // Adjust the saved NITZ time to account for tzOffset. + mSavedTime = mSavedTime - tzOffset; + } + } else if (isoCountryCode.equals("")) { + // Country code not found. This is likely a test network. + // Get a TimeZone based only on the NITZ parameters (best guess). + zone = getNitzTimeZone(mZoneOffset, mZoneDst, mZoneTime); + } else { + zone = TimeUtils.getTimeZone(mZoneOffset, mZoneDst, mZoneTime, isoCountryCode); + } + + mNeedFixZone = false; + + if (zone != null) { + if (getAutoTime()) { + setAndBroadcastNetworkSetTimeZone(zone.getID()); + } + saveNitzTimeZone(zone.getID()); + } + } + + private void pollStateDone() { if (DBG) log("Poll ServiceState done: oldSS=[" + ss + "] newSS=[" + newSS + "]"); boolean hasRegistered = @@ -896,9 +965,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { if (operatorNumeric == null) { phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, ""); } else { - String iso = ""; + String isoCountryCode = ""; try{ - iso = MccTable.countryCodeForMcc(Integer.parseInt( + isoCountryCode = MccTable.countryCodeForMcc(Integer.parseInt( operatorNumeric.substring(0,3))); } catch ( NumberFormatException ex){ Log.w(LOG_TAG, "countryCodeForMcc error" + ex); @@ -906,8 +975,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { Log.w(LOG_TAG, "countryCodeForMcc error" + ex); } - phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, iso); + phone.setSystemProperty(PROPERTY_OPERATOR_ISO_COUNTRY, isoCountryCode); mGotCountryCode = true; + if (mNeedFixZone) { + fixTimeZone(isoCountryCode); + } } phone.setSystemProperty(PROPERTY_OPERATOR_ISROAMING, @@ -1123,6 +1195,169 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { return cdmaRoaming && !(equalsOnsl || equalsOnss); } + + /** + * nitzReceiveTime is time_t that the NITZ time was posted + */ + + private + void setTimeFromNITZString (String nitz, long nitzReceiveTime) + { + // "yy/mm/dd,hh:mm:ss(+/-)tz" + // tz is in number of quarter-hours + + long start = SystemClock.elapsedRealtime(); + Log.i(LOG_TAG, "NITZ: " + nitz + "," + nitzReceiveTime + + " start=" + start + " delay=" + (start - nitzReceiveTime)); + + try { + /* NITZ time (hour:min:sec) will be in UTC but it supplies the timezone + * offset as well (which we won't worry about until later) */ + Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + + c.clear(); + c.set(Calendar.DST_OFFSET, 0); + + String[] nitzSubs = nitz.split("[/:,+-]"); + + int year = 2000 + Integer.parseInt(nitzSubs[0]); + c.set(Calendar.YEAR, year); + + // month is 0 based! + int month = Integer.parseInt(nitzSubs[1]) - 1; + c.set(Calendar.MONTH, month); + + int date = Integer.parseInt(nitzSubs[2]); + c.set(Calendar.DATE, date); + + int hour = Integer.parseInt(nitzSubs[3]); + c.set(Calendar.HOUR, hour); + + int minute = Integer.parseInt(nitzSubs[4]); + c.set(Calendar.MINUTE, minute); + + int second = Integer.parseInt(nitzSubs[5]); + c.set(Calendar.SECOND, second); + + boolean sign = (nitz.indexOf('-') == -1); + + int tzOffset = Integer.parseInt(nitzSubs[6]); + + int dst = (nitzSubs.length >= 8 ) ? Integer.parseInt(nitzSubs[7]) + : 0; + + // The zone offset received from NITZ is for current local time, + // so DST correction is already applied. Don't add it again. + // + // tzOffset += dst * 4; + // + // We could unapply it if we wanted the raw offset. + + tzOffset = (sign ? 1 : -1) * tzOffset * 15 * 60 * 1000; + + TimeZone zone = null; + + // As a special extension, the Android emulator appends the name of + // the host computer's timezone to the nitz string. this is zoneinfo + // timezone name of the form Area!Location or Area!Location!SubLocation + // so we need to convert the ! into / + if (nitzSubs.length >= 9) { + String tzname = nitzSubs[8].replace('!','/'); + zone = TimeZone.getTimeZone( tzname ); + } + + String iso = SystemProperties.get(PROPERTY_OPERATOR_ISO_COUNTRY); + + if (zone == null) { + + if (mGotCountryCode) { + if (iso != null && iso.length() > 0) { + zone = TimeUtils.getTimeZone(tzOffset, dst != 0, + c.getTimeInMillis(), + iso); + } else { + // We don't have a valid iso country code. This is + // most likely because we're on a test network that's + // using a bogus MCC (eg, "001"), so get a TimeZone + // based only on the NITZ parameters. + zone = getNitzTimeZone(tzOffset, (dst != 0), c.getTimeInMillis()); + } + } + } + + if (zone == null) { + // We got the time before the country, so we don't know + // how to identify the DST rules yet. Save the information + // and hope to fix it up later. + + mNeedFixZone = true; + mZoneOffset = tzOffset; + mZoneDst = dst != 0; + mZoneTime = c.getTimeInMillis(); + } + + if (zone != null) { + if (getAutoTime()) { + setAndBroadcastNetworkSetTimeZone(zone.getID()); + } + 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"); + return; + } + + try { + mWakeLock.acquire(); + + 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 " + + "backwards since NITZ time was received, " + + 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 " + + (millisSinceNitzReceived / (1000 * 60 * 60 * 24)) + + " 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): " + + (c.getTimeInMillis() - System.currentTimeMillis()) + + " from " + nitz); + + setAndBroadcastNetworkSetTime(c.getTimeInMillis()); + Log.i(LOG_TAG, "NITZ: after Setting time of day"); + } + SystemProperties.set("gsm.nitz.time", String.valueOf(c.getTimeInMillis())); + saveNitzTime(c.getTimeInMillis()); + if (Config.LOGV) { + long end = SystemClock.elapsedRealtime(); + Log.v(LOG_TAG, "NITZ: end=" + end + " dur=" + (end - start)); + } + } finally { + mWakeLock.release(); + } + } catch (RuntimeException ex) { + Log.e(LOG_TAG, "NITZ: Parsing NITZ time " + nitz, ex); + } + } + private boolean getAutoTime() { try { return Settings.System.getInt(phone.getContext().getContentResolver(), @@ -1132,6 +1367,58 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { } } + private void saveNitzTimeZone(String zoneId) { + mSavedTimeZone = zoneId; + } + + private void saveNitzTime(long time) { + mSavedTime = time; + mSavedAtTime = SystemClock.elapsedRealtime(); + } + + /** + * 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) phone.getContext().getSystemService(Context.ALARM_SERVICE); + alarm.setTimeZone(zoneId); + Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIMEZONE); + intent.putExtra("time-zone", zoneId); + phone.getContext().sendStickyBroadcast(intent); + } + + /** + * 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); + intent.putExtra("time", time); + phone.getContext().sendStickyBroadcast(intent); + } + + private void revertToNitz() { + if (Settings.System.getInt(phone.getContext().getContentResolver(), + Settings.System.AUTO_TIME, 0) == 0) { + return; + } + Log.d(LOG_TAG, "Reverting to NITZ: tz='" + mSavedTimeZone + + "' mSavedTime=" + mSavedTime + + " mSavedAtTime=" + mSavedAtTime); + if (mSavedTimeZone != null && mSavedTime != 0 && mSavedAtTime != 0) { + setAndBroadcastNetworkSetTimeZone(mSavedTimeZone); + setAndBroadcastNetworkSetTime(mSavedTime + + (SystemClock.elapsedRealtime() - mSavedAtTime)); + } + } + /** * @return true if phone is camping on a technology * that could support voice and data simultaneously. diff --git a/telephony/java/com/android/internal/telephony/cdma/FeatureCode.java b/telephony/java/com/android/internal/telephony/cdma/FeatureCode.java index c226b62..85fe6dc 100644 --- a/telephony/java/com/android/internal/telephony/cdma/FeatureCode.java +++ b/telephony/java/com/android/internal/telephony/cdma/FeatureCode.java @@ -84,7 +84,7 @@ public final class FeatureCode extends Handler implements MmiCode { CDMAPhone phone; Context context; - + CdmaConnection suppConn; String action; // '*' in CDMA String sc; // Service Code String poundString; // Entire Flash string @@ -239,8 +239,15 @@ public final class FeatureCode extends Handler implements MmiCode { /** Process a Flash Code...anything that isn't a dialing number */ void processCode () { Log.d(LOG_TAG, "send feature code..."); - phone.mCM.sendCDMAFeatureCode(this.poundString, - obtainMessage(EVENT_CDMA_FLASH_COMPLETED)); + if (this.poundString != null) { + // TODO(Moto): Is suppConn going away? + suppConn = new CdmaConnection(phone.getContext(), this.poundString, phone.mCT, null); + phone.mCM.sendCDMAFeatureCode(suppConn.address, + obtainMessage(EVENT_CDMA_FLASH_COMPLETED)); + } else { + phone.mCM.sendCDMAFeatureCode(this.poundString, + obtainMessage(EVENT_CDMA_FLASH_COMPLETED)); + } } /** Called from CDMAPhone.handleMessage; not a Handler subclass */ @@ -261,6 +268,7 @@ public final class FeatureCode extends Handler implements MmiCode { } else { state = State.COMPLETE; message = context.getText(com.android.internal.R.string.fcComplete); + suppConn.processNextPostDialChar(); } phone.onFeatureCodeDone(this); break; diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java index 321824f..d5b8379 100644 --- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java @@ -39,6 +39,10 @@ import com.android.internal.telephony.IccRecords; import com.android.internal.telephony.IccUtils; import com.android.internal.telephony.PhoneProxy; +import com.android.internal.telephony.TelephonyIntents; +import android.app.ActivityManagerNative; +import android.content.Intent; + /** * {@hide} @@ -47,6 +51,7 @@ public final class RuimRecords extends IccRecords { static final String LOG_TAG = "CDMA"; private static final boolean DBG = true; + private boolean m_ota_commited=false; //***** Instance Variables @@ -73,6 +78,7 @@ public final class RuimRecords extends IccRecords { private static final int EVENT_GET_SMS_DONE = 22; private static final int EVENT_RUIM_REFRESH = 31; + private static final int EVENT_OTA_PROVISION_STATUS_CHANGE = 32; RuimRecords(CDMAPhone p) { super(p); @@ -93,6 +99,7 @@ public final class RuimRecords extends IccRecords { // Start off by setting empty state onRadioOffOrNotAvailable(); + p.mCM.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null); } @@ -101,6 +108,8 @@ public final class RuimRecords extends IccRecords { phone.mCM.unregisterForRUIMReady(this); phone.mCM.unregisterForOffOrNotAvailable( this); phone.mCM.unSetOnIccRefresh(this); + phone.mCM.unregisterForNVReady(this); + phone.mCM.unregisterForCdmaOtaProvision(this); } @Override @@ -134,7 +143,7 @@ public final class RuimRecords extends IccRecords { return mMyMobileNumber; } - public String getMin() { + public String getCdmaMin() { return mMin2Min1; } @@ -219,11 +228,21 @@ public final class RuimRecords extends IccRecords { if (ar.exception != null) { break; } - + if(m_ota_commited) { + if(mMyMobileNumber != localTemp[0]) { + Intent intent = new Intent(TelephonyIntents.ACTION_CDMA_OTA_MDN_CHANGED); + intent.putExtra("mdn", localTemp[0]); + Log.d(LOG_TAG,"Broadcasting intent MDN Change in OTA "); + ActivityManagerNative.broadcastStickyIntent(intent, null); + } + m_ota_commited=false; + } mMyMobileNumber = localTemp[0]; mSid = localTemp[1]; mNid = localTemp[2]; - mMin2Min1 = localTemp[3]; + if (localTemp.length >= 3) { // TODO(Moto): remove when new ril always returns min2_min1 + mMin2Min1 = localTemp[3]; + } Log.d(LOG_TAG, "MDN: " + mMyMobileNumber + " MIN: " + mMin2Min1); @@ -272,6 +291,19 @@ public final class RuimRecords extends IccRecords { } break; + case EVENT_OTA_PROVISION_STATUS_CHANGE: + m_ota_commited=false; + ar = (AsyncResult)msg.obj; + if (ar.exception == null) { + int[] ints = (int[]) ar.result; + int otaStatus = ints[0]; + if (otaStatus== phone.CDMA_OTA_PROVISION_STATUS_COMMITTED) { + m_ota_commited=true; + phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE)); + } + } + break; + }}catch (RuntimeException exc) { // I don't want these exceptions to be fatal Log.w(LOG_TAG, "Exception parsing RUIM record", exc); @@ -374,17 +406,17 @@ public final class RuimRecords extends IccRecords { switch ((result[0])) { case CommandsInterface.SIM_REFRESH_FILE_UPDATED: - if (DBG) log("handleRuimRefresh with SIM_REFRESH_FILE_UPDATED"); + if (DBG) log("handleRuimRefresh with SIM_REFRESH_FILE_UPDATED"); adnCache.reset(); fetchRuimRecords(); break; case CommandsInterface.SIM_REFRESH_INIT: - if (DBG) log("handleRuimRefresh with SIM_REFRESH_INIT"); + if (DBG) log("handleRuimRefresh with SIM_REFRESH_INIT"); // need to reload all files (that we care about) fetchRuimRecords(); break; case CommandsInterface.SIM_REFRESH_RESET: - if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET"); + if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET"); phone.mCM.setRadioPower(false, null); /* Note: no need to call setRadioPower(true). Assuming the desired * radio power state is still ON (as tracked by ServiceStateTracker), @@ -396,7 +428,7 @@ public final class RuimRecords extends IccRecords { break; default: // unknown refresh operation - if (DBG) log("handleRuimRefresh with unknown operation"); + if (DBG) log("handleRuimRefresh with unknown operation"); break; } } diff --git a/telephony/java/com/android/internal/telephony/cdma/SignalToneUtil.java b/telephony/java/com/android/internal/telephony/cdma/SignalToneUtil.java new file mode 100644 index 0000000..444dec3 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/cdma/SignalToneUtil.java @@ -0,0 +1,272 @@ +/* + * Copyright (C) 2009 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.cdma; + +import java.util.HashMap; +import java.util.HashSet; +import android.util.Log; +import android.media.ToneGenerator; + +public class SignalToneUtil { + // public final int int IS95_CONST_IR_SIGNAL_TYPE_TYPE; + static public final int IS95_CONST_IR_SIGNAL_TONE = 0; + static public final int IS95_CONST_IR_SIGNAL_ISDN = 1; + static public final int IS95_CONST_IR_SIGNAL_IS54B = 2; + static public final int IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT = 4; + + // public final int int IS95_CONST_IR_ALERT_PITCH_TYPE; + static public final int IS95_CONST_IR_ALERT_MED = 0; + static public final int IS95_CONST_IR_ALERT_HIGH = 1; + static public final int IS95_CONST_IR_ALERT_LOW = 2; + static public final int TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN = 255; + + // public final int int IS95_CONST_IR_SIGNAL_TYPE; + static public final int IS95_CONST_IR_SIG_ISDN_NORMAL = 0; + static public final int IS95_CONST_IR_SIG_ISDN_INTGRP = 1; + static public final int IS95_CONST_IR_SIG_ISDN_SP_PRI = 2; + static public final int IS95_CONST_IR_SIG_ISDN_PAT_3 = 3; + static public final int IS95_CONST_IR_SIG_ISDN_PING = 4; + static public final int IS95_CONST_IR_SIG_ISDN_PAT_5 = 5; + static public final int IS95_CONST_IR_SIG_ISDN_PAT_6 = 6; + static public final int IS95_CONST_IR_SIG_ISDN_PAT_7 = 7; + static public final int IS95_CONST_IR_SIG_ISDN_OFF = 15; + static public final int IS95_CONST_IR_SIG_TONE_DIAL = 0; + static public final int IS95_CONST_IR_SIG_TONE_RING = 1; + static public final int IS95_CONST_IR_SIG_TONE_INT = 2; + static public final int IS95_CONST_IR_SIG_TONE_ABB_INT = 3; + static public final int IS95_CONST_IR_SIG_TONE_REORDER = 4; + static public final int IS95_CONST_IR_SIG_TONE_ABB_RE = 5; + static public final int IS95_CONST_IR_SIG_TONE_BUSY = 6; + static public final int IS95_CONST_IR_SIG_TONE_CONFIRM = 7; + static public final int IS95_CONST_IR_SIG_TONE_ANSWER = 8; + static public final int IS95_CONST_IR_SIG_TONE_CALL_W = 9; + static public final int IS95_CONST_IR_SIG_TONE_PIP = 10; + static public final int IS95_CONST_IR_SIG_TONE_NO_TONE = 63; + static public final int IS95_CONST_IR_SIG_IS54B_NO_TONE = 0; + static public final int IS95_CONST_IR_SIG_IS54B_L = 1; + static public final int IS95_CONST_IR_SIG_IS54B_SS = 2; + static public final int IS95_CONST_IR_SIG_IS54B_SSL = 3; + static public final int IS95_CONST_IR_SIG_IS54B_SS_2 = 4; + static public final int IS95_CONST_IR_SIG_IS54B_SLS = 5; + static public final int IS95_CONST_IR_SIG_IS54B_S_X4 = 6; + static public final int IS95_CONST_IR_SIG_IS54B_PBX_L = 7; + static public final int IS95_CONST_IR_SIG_IS54B_PBX_SS = 8; + static public final int IS95_CONST_IR_SIG_IS54B_PBX_SSL = 9; + static public final int IS95_CONST_IR_SIG_IS54B_PBX_SLS = 10; + static public final int IS95_CONST_IR_SIG_IS54B_PBX_S_X4 = 11; + static public final int IS95_CONST_IR_SIG_TONE_ABBR_ALRT = 0; + + // Hashmap to map signalInfo To AudioTone + static private HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>(); + + private static Integer signalParamHash(int signalType, int alertPitch, int signal) { + // TODO(Moto): The input should get checked before usage + return new Integer(signalType * 256 * 256 + alertPitch * 256 + signal); + } + + public static int getAudioToneFromSignalInfo(int signalType, int alertPitch, int signal) { + int result = ToneGenerator.TONE_CDMA_INVALID; + result = hm.get(signalParamHash(signalType, alertPitch, signal)); + return result; + } + + static { + + /* SIGNAL_TYPE_ISDN */ + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_NORMAL), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_INTGRP), + ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_SP_PRI), ToneGenerator.TONE_CDMA_CALL_SIGNAL_SP_PRI); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_PAT_3), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT3); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_PING), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_RING_RING); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_PAT_5), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT5); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_PAT_6), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT6); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_PAT_7), ToneGenerator.TONE_CDMA_CALL_SIGNAL_ISDN_PAT7); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_ISDN, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_ISDN_OFF), ToneGenerator.TONE_CDMA_SIGNAL_OFF); + + /* SIGNAL_TYPE_TONE */ + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_DIAL), ToneGenerator.TONE_CDMA_DIAL_TONE_LITE); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_RING), ToneGenerator.TONE_CDMA_NETWORK_USA_RINGBACK); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_INT), ToneGenerator.TONE_SUP_INTERCEPT); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_ABB_INT), ToneGenerator.TONE_SUP_INTERCEPT_ABBREV); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_REORDER), ToneGenerator.TONE_CDMA_REORDER); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_ABB_RE), ToneGenerator.TONE_CDMA_ABBR_REORDER); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_BUSY), ToneGenerator.TONE_CDMA_NETWORK_BUSY); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_CONFIRM), ToneGenerator.TONE_SUP_CONFIRM); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_ANSWER), ToneGenerator.TONE_CDMA_ANSWER); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_ABB_RE), ToneGenerator.TONE_CDMA_NETWORK_CALLWAITING); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_PIP), ToneGenerator.TONE_CDMA_PIP); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_TONE, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_TONE_NO_TONE), ToneGenerator.TONE_CDMA_SIGNAL_OFF); + + /* SIGNAL_TYPE_IS54B */ + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_HIGH_L); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_INVALID); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_L), ToneGenerator.TONE_CDMA_LOW_L); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_HIGH_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_MED_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_SS), ToneGenerator.TONE_CDMA_LOW_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_HIGH_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_MED_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_SSL), ToneGenerator.TONE_CDMA_LOW_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_HIGH_SS_2); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_MED_SS_2); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_SS_2), ToneGenerator.TONE_CDMA_LOW_SS_2); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_HIGH_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_MED_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_SLS), ToneGenerator.TONE_CDMA_LOW_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_HIGH_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_MED_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_S_X4), ToneGenerator.TONE_CDMA_LOW_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_HIGH_PBX_L); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_MED_PBX_L); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_PBX_L), ToneGenerator.TONE_CDMA_LOW_PBX_L); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_HIGH_PBX_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_MED_PBX_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_PBX_SS), ToneGenerator.TONE_CDMA_LOW_PBX_SS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_HIGH_PBX_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_MED_PBX_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_PBX_SSL), ToneGenerator.TONE_CDMA_LOW_PBX_SSL); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_HIGH_PBX_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_MED_PBX_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_PBX_SLS), ToneGenerator.TONE_CDMA_LOW_PBX_SLS); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_HIGH, + IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_HIGH_PBX_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_MED, + IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_MED_PBX_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, IS95_CONST_IR_ALERT_LOW, + IS95_CONST_IR_SIG_IS54B_PBX_S_X4), ToneGenerator.TONE_CDMA_LOW_PBX_S_X4); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_IS54B, TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, + IS95_CONST_IR_SIG_IS54B_NO_TONE), ToneGenerator.TONE_CDMA_SIGNAL_OFF); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT, + TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, IS95_CONST_IR_SIG_TONE_ABBR_ALRT), + ToneGenerator.TONE_CDMA_ABBR_ALERT); + + hm.put(signalParamHash(IS95_CONST_IR_SIGNAL_USR_DEFD_ALERT, + TAPIAMSSCDMA_SIGNAL_PITCH_UNKNOWN, IS95_CONST_IR_SIG_TONE_NO_TONE), + ToneGenerator.TONE_CDMA_ABBR_ALERT); + + } + + // suppress default constructor for noninstantiability + private SignalToneUtil() { + } +} diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index 3459dcd..70d71fc 100755 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -878,11 +878,6 @@ public class GSMPhone extends PhoneBase { return ret; } - public String getMin() { - Log.e(LOG_TAG, "[GSMPhone] getMin() is a CDMA method"); - return "0"; - } - public String getDeviceId() { return mImei; } diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java index 42bb2e0..19679aa 100644 --- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java +++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java @@ -1137,7 +1137,7 @@ public final class SimulatedCommands extends BaseCommands String number, Message result) {unimplemented(result);} public void setNetworkSelectionModeAutomatic(Message result) {unimplemented(result);} - + public void exitEmergencyCallbackMode(Message result) {unimplemented(result);} public void setNetworkSelectionModeManual( String operatorNumeric, Message result) {unimplemented(result);} @@ -1460,10 +1460,6 @@ public final class SimulatedCommands extends BaseCommands } - public void exitEmergencyCallbackMode(Message response) { - // TODO method stub - } - public void forceDataDormancy(Message response) { // TODO method stub } |