Loading src/java/com/android/internal/telephony/InboundSmsHandler.java +19 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.content.SharedPreferences; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; Loading @@ -42,6 +43,7 @@ import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.PreferenceManager; import android.provider.Telephony; import android.provider.Telephony.Sms.Intents; import android.telephony.Rlog; Loading Loading @@ -939,6 +941,23 @@ public abstract class InboundSmsHandler extends StateMachine { return (PHONE_TYPE_CDMA == activePhone); } protected void storeVoiceMailCount() { // Store the voice mail count in persistent memory. String imsi = mPhone.getSubscriberId(); int mwi = mPhone.getVoiceMessageCount(); log("Storing Voice Mail Count = " + mwi + " for mVmCountKey = " + ((PhoneBase)mPhone).VM_COUNT + " vmId = " + ((PhoneBase)mPhone).VM_ID + " in preferences."); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sp.edit(); editor.putInt(mPhone.VM_COUNT, mwi); editor.putString(mPhone.VM_ID, imsi); editor.commit(); } /** * Handler for an {@link InboundSmsTracker} broadcast. Deletes PDUs from the raw table and * logs the broadcast duration (as an error if the other receivers were especially slow). Loading src/java/com/android/internal/telephony/PhoneBase.java +38 −15 Original line number Diff line number Diff line Loading @@ -157,6 +157,11 @@ public abstract class PhoneBase extends Handler implements Phone { // Key used to read/write current CLIR setting public static final String CLIR_KEY = "clir_key"; // Key used for storing voice mail count public static final String VM_COUNT = "vm_count_key"; // Key used to read/write the ID for storing the voice mail public static final String VM_ID = "vm_id_key"; // Key used to read/write "disable DNS server check" pref (used for testing) public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key"; Loading @@ -174,6 +179,7 @@ public abstract class PhoneBase extends Handler implements Phone { /* Instance Variables */ public CommandsInterface mCi; private int mVmCount = 0; boolean mDnsCheckDisabled; public DcTrackerBase mDcTracker; boolean mDoesRilSendMultipleCallRing; Loading Loading @@ -1169,9 +1175,9 @@ public abstract class PhoneBase extends Handler implements Phone { } @Override /** @return true if there are messages waiting, false otherwise. */ public boolean getMessageWaitingIndicator() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getVoiceMessageWaiting() : false; return mVmCount != 0; } @Override Loading Loading @@ -1372,9 +1378,36 @@ public abstract class PhoneBase extends Handler implements Phone { public abstract int getPhoneType(); /** @hide */ /** @return number of voicemails */ @Override public int getVoiceMessageCount(){ return 0; return mVmCount; } /** sets the voice mail count of the phone and notifies listeners. */ public void setVoiceMessageCount(int countWaiting) { mVmCount = countWaiting; // notify listeners of voice mail notifyMessageWaitingIndicator(); } /** gets the voice mail count from preferences */ protected int getStoredVoiceMessageCount() { int countVoiceMessages = 0; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); String subscriberId = sp.getString(VM_ID, null); String currentSubscriberId = getSubscriberId(); Rlog.d(LOG_TAG, "Voicemail count retrieval for subscriberId = " + subscriberId + " current subscriberId = " + currentSubscriberId); if ((subscriberId != null) && (currentSubscriberId != null) && (currentSubscriberId.equals(subscriberId))) { // get voice mail count from preferences countVoiceMessages = sp.getInt(VM_COUNT, 0); Rlog.d(LOG_TAG, "Voice Mail Count from preference = " + countVoiceMessages); } return countVoiceMessages; } /** Loading Loading @@ -1724,19 +1757,9 @@ public abstract class PhoneBase extends Handler implements Phone { return mCi.getLteOnCdmaMode(); } /** * Sets the SIM voice message waiting indicator records. * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported * @param countWaiting The number of messages waiting, if known. Use * -1 to indicate that an unknown number of * messages are waiting */ @Override public void setVoiceMessageWaiting(int line, int countWaiting) { IccRecords r = mIccRecords.get(); if (r != null) { r.setVoiceMessageWaiting(line, countWaiting); } // This function should be overridden by class GSMPhone and CDMAPhone. Rlog.e(LOG_TAG, "Error! This function should never be executed, inactive Phone."); } /** Loading src/java/com/android/internal/telephony/TelephonyCapabilities.java +4 −4 Original line number Diff line number Diff line Loading @@ -73,12 +73,12 @@ public class TelephonyCapabilities { } /** * Return true if the current phone can retrieve the voice message count. * * Currently this is assumed to be true on CDMA phones and false otherwise. * Return true if the current phone supports voice message count. * and the count is available * Both CDMA and GSM phones support voice message count */ public static boolean supportsVoiceMessageCount(Phone phone) { return (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA); return (phone.getVoiceMessageCount() != -1); } /** Loading src/java/com/android/internal/telephony/cdma/CDMAPhone.java +18 −41 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ public class CDMAPhone extends PhoneBase { // Default Emergency Callback Mode exit timer private static final int DEFAULT_ECM_EXIT_TIMER_VALUE = 300000; static final String VM_COUNT_CDMA = "vm_count_key_cdma"; private static final String VM_NUMBER_CDMA = "vm_number_key_cdma"; private String mVmNumber = null; Loading Loading @@ -456,12 +455,6 @@ public class CDMAPhone extends PhoneBase { throw new CallStateException("Sending UUS information NOT supported in CDMA!"); } @Override public boolean getMessageWaitingIndicator() { return (getVoiceMessageCount() > 0); } @Override public List<? extends MmiCode> getPendingMmiCodes() { Loading Loading @@ -940,21 +933,9 @@ public class CDMAPhone extends PhoneBase { return number; } /* Returns Number of Voicemails * @hide */ @Override public int getVoiceMessageCount() { IccRecords r = mIccRecords.get(); int voicemailCount = (r != null) ? r.getVoiceMessageCount() : 0; // If mRuimRecords.getVoiceMessageCount returns zero, then there is possibility // that phone was power cycled and would have lost the voicemail count. // So get the count from preferences. if (voicemailCount == 0) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); voicemailCount = sp.getInt(VM_COUNT_CDMA + getPhoneId(), 0); } return voicemailCount; // pending voice mail count updated after phone creation private void updateVoiceMail() { setVoiceMessageCount(getStoredVoiceMessageCount()); } @Override Loading Loading @@ -1216,11 +1197,6 @@ public class CDMAPhone extends PhoneBase { } break; case EVENT_ICC_RECORD_EVENTS: ar = (AsyncResult)msg.obj; processIccRecordEvents((Integer)ar.result); break; case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{ handleExitEmergencyCallbackMode(msg); } Loading @@ -1232,6 +1208,7 @@ public class CDMAPhone extends PhoneBase { // Notify voicemails. log("notifyMessageWaitingChanged"); mNotifier.notifyMessageWaitingChanged(this); updateVoiceMail(); } break; Loading Loading @@ -1272,6 +1249,7 @@ public class CDMAPhone extends PhoneBase { // Notify voicemails. log("notifyMessageWaitingChanged"); mNotifier.notifyMessageWaitingChanged(this); updateVoiceMail(); } break; Loading Loading @@ -1332,18 +1310,6 @@ public class CDMAPhone extends PhoneBase { } } private void processIccRecordEvents(int eventCode) { switch (eventCode) { case RuimRecords.EVENT_MWI: notifyMessageWaitingIndicator(); break; default: Rlog.e(LOG_TAG,"Unknown icc records event code " + eventCode); break; } } /** * Handles the call to get the subscription source * Loading Loading @@ -1751,7 +1717,6 @@ public class CDMAPhone extends PhoneBase { if (r == null) { return; } r.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null); r.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null); } Loading @@ -1760,10 +1725,22 @@ public class CDMAPhone extends PhoneBase { if (r == null) { return; } r.unregisterForRecordsEvents(this); r.unregisterForRecordsLoaded(this); } /** * Sets the SIM voice message count * @param line Subscriber Profile Number, one-based. Only '1' is supported * @param countWaiting The number of messages waiting, if known. Use * -1 to indicate that an unknown number of * messages are waiting * This is a wrapper function for setVoiceMessageCount */ @Override public void setVoiceMessageWaiting(int line, int countWaiting) { setVoiceMessageCount(countWaiting); } protected void log(String s) { if (DBG) Rlog.d(LOG_TAG, s); Loading src/java/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java +12 −8 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package com.android.internal.telephony.cdma; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Message; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.provider.Telephony.Sms.Intents; import android.telephony.SmsCbMessage; Loading Loading @@ -252,12 +250,18 @@ public class CdmaInboundSmsHandler extends InboundSmsHandler { int voicemailCount = sms.getNumOfVoicemails(); if (DBG) log("Voicemail count=" + voicemailCount); // Store the voicemail count in preferences. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sp.edit(); editor.putInt(CDMAPhone.VM_COUNT_CDMA + mPhone.getPhoneId(), voicemailCount); editor.apply(); mPhone.setVoiceMessageWaiting(1, voicemailCount); // range check if (voicemailCount < 0) { voicemailCount = -1; } else if (voicemailCount > 99) { // C.S0015-B v2, 4.5.12 // range: 0-99 voicemailCount = 99; } // update voice mail count in phone mPhone.setVoiceMessageCount(voicemailCount); // store voice mail count in preferences storeVoiceMailCount(); } /** Loading Loading
src/java/com/android/internal/telephony/InboundSmsHandler.java +19 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.content.SharedPreferences; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; Loading @@ -42,6 +43,7 @@ import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.PreferenceManager; import android.provider.Telephony; import android.provider.Telephony.Sms.Intents; import android.telephony.Rlog; Loading Loading @@ -939,6 +941,23 @@ public abstract class InboundSmsHandler extends StateMachine { return (PHONE_TYPE_CDMA == activePhone); } protected void storeVoiceMailCount() { // Store the voice mail count in persistent memory. String imsi = mPhone.getSubscriberId(); int mwi = mPhone.getVoiceMessageCount(); log("Storing Voice Mail Count = " + mwi + " for mVmCountKey = " + ((PhoneBase)mPhone).VM_COUNT + " vmId = " + ((PhoneBase)mPhone).VM_ID + " in preferences."); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sp.edit(); editor.putInt(mPhone.VM_COUNT, mwi); editor.putString(mPhone.VM_ID, imsi); editor.commit(); } /** * Handler for an {@link InboundSmsTracker} broadcast. Deletes PDUs from the raw table and * logs the broadcast duration (as an error if the other receivers were especially slow). Loading
src/java/com/android/internal/telephony/PhoneBase.java +38 −15 Original line number Diff line number Diff line Loading @@ -157,6 +157,11 @@ public abstract class PhoneBase extends Handler implements Phone { // Key used to read/write current CLIR setting public static final String CLIR_KEY = "clir_key"; // Key used for storing voice mail count public static final String VM_COUNT = "vm_count_key"; // Key used to read/write the ID for storing the voice mail public static final String VM_ID = "vm_id_key"; // Key used to read/write "disable DNS server check" pref (used for testing) public static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key"; Loading @@ -174,6 +179,7 @@ public abstract class PhoneBase extends Handler implements Phone { /* Instance Variables */ public CommandsInterface mCi; private int mVmCount = 0; boolean mDnsCheckDisabled; public DcTrackerBase mDcTracker; boolean mDoesRilSendMultipleCallRing; Loading Loading @@ -1169,9 +1175,9 @@ public abstract class PhoneBase extends Handler implements Phone { } @Override /** @return true if there are messages waiting, false otherwise. */ public boolean getMessageWaitingIndicator() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getVoiceMessageWaiting() : false; return mVmCount != 0; } @Override Loading Loading @@ -1372,9 +1378,36 @@ public abstract class PhoneBase extends Handler implements Phone { public abstract int getPhoneType(); /** @hide */ /** @return number of voicemails */ @Override public int getVoiceMessageCount(){ return 0; return mVmCount; } /** sets the voice mail count of the phone and notifies listeners. */ public void setVoiceMessageCount(int countWaiting) { mVmCount = countWaiting; // notify listeners of voice mail notifyMessageWaitingIndicator(); } /** gets the voice mail count from preferences */ protected int getStoredVoiceMessageCount() { int countVoiceMessages = 0; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); String subscriberId = sp.getString(VM_ID, null); String currentSubscriberId = getSubscriberId(); Rlog.d(LOG_TAG, "Voicemail count retrieval for subscriberId = " + subscriberId + " current subscriberId = " + currentSubscriberId); if ((subscriberId != null) && (currentSubscriberId != null) && (currentSubscriberId.equals(subscriberId))) { // get voice mail count from preferences countVoiceMessages = sp.getInt(VM_COUNT, 0); Rlog.d(LOG_TAG, "Voice Mail Count from preference = " + countVoiceMessages); } return countVoiceMessages; } /** Loading Loading @@ -1724,19 +1757,9 @@ public abstract class PhoneBase extends Handler implements Phone { return mCi.getLteOnCdmaMode(); } /** * Sets the SIM voice message waiting indicator records. * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported * @param countWaiting The number of messages waiting, if known. Use * -1 to indicate that an unknown number of * messages are waiting */ @Override public void setVoiceMessageWaiting(int line, int countWaiting) { IccRecords r = mIccRecords.get(); if (r != null) { r.setVoiceMessageWaiting(line, countWaiting); } // This function should be overridden by class GSMPhone and CDMAPhone. Rlog.e(LOG_TAG, "Error! This function should never be executed, inactive Phone."); } /** Loading
src/java/com/android/internal/telephony/TelephonyCapabilities.java +4 −4 Original line number Diff line number Diff line Loading @@ -73,12 +73,12 @@ public class TelephonyCapabilities { } /** * Return true if the current phone can retrieve the voice message count. * * Currently this is assumed to be true on CDMA phones and false otherwise. * Return true if the current phone supports voice message count. * and the count is available * Both CDMA and GSM phones support voice message count */ public static boolean supportsVoiceMessageCount(Phone phone) { return (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA); return (phone.getVoiceMessageCount() != -1); } /** Loading
src/java/com/android/internal/telephony/cdma/CDMAPhone.java +18 −41 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ public class CDMAPhone extends PhoneBase { // Default Emergency Callback Mode exit timer private static final int DEFAULT_ECM_EXIT_TIMER_VALUE = 300000; static final String VM_COUNT_CDMA = "vm_count_key_cdma"; private static final String VM_NUMBER_CDMA = "vm_number_key_cdma"; private String mVmNumber = null; Loading Loading @@ -456,12 +455,6 @@ public class CDMAPhone extends PhoneBase { throw new CallStateException("Sending UUS information NOT supported in CDMA!"); } @Override public boolean getMessageWaitingIndicator() { return (getVoiceMessageCount() > 0); } @Override public List<? extends MmiCode> getPendingMmiCodes() { Loading Loading @@ -940,21 +933,9 @@ public class CDMAPhone extends PhoneBase { return number; } /* Returns Number of Voicemails * @hide */ @Override public int getVoiceMessageCount() { IccRecords r = mIccRecords.get(); int voicemailCount = (r != null) ? r.getVoiceMessageCount() : 0; // If mRuimRecords.getVoiceMessageCount returns zero, then there is possibility // that phone was power cycled and would have lost the voicemail count. // So get the count from preferences. if (voicemailCount == 0) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); voicemailCount = sp.getInt(VM_COUNT_CDMA + getPhoneId(), 0); } return voicemailCount; // pending voice mail count updated after phone creation private void updateVoiceMail() { setVoiceMessageCount(getStoredVoiceMessageCount()); } @Override Loading Loading @@ -1216,11 +1197,6 @@ public class CDMAPhone extends PhoneBase { } break; case EVENT_ICC_RECORD_EVENTS: ar = (AsyncResult)msg.obj; processIccRecordEvents((Integer)ar.result); break; case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{ handleExitEmergencyCallbackMode(msg); } Loading @@ -1232,6 +1208,7 @@ public class CDMAPhone extends PhoneBase { // Notify voicemails. log("notifyMessageWaitingChanged"); mNotifier.notifyMessageWaitingChanged(this); updateVoiceMail(); } break; Loading Loading @@ -1272,6 +1249,7 @@ public class CDMAPhone extends PhoneBase { // Notify voicemails. log("notifyMessageWaitingChanged"); mNotifier.notifyMessageWaitingChanged(this); updateVoiceMail(); } break; Loading Loading @@ -1332,18 +1310,6 @@ public class CDMAPhone extends PhoneBase { } } private void processIccRecordEvents(int eventCode) { switch (eventCode) { case RuimRecords.EVENT_MWI: notifyMessageWaitingIndicator(); break; default: Rlog.e(LOG_TAG,"Unknown icc records event code " + eventCode); break; } } /** * Handles the call to get the subscription source * Loading Loading @@ -1751,7 +1717,6 @@ public class CDMAPhone extends PhoneBase { if (r == null) { return; } r.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null); r.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null); } Loading @@ -1760,10 +1725,22 @@ public class CDMAPhone extends PhoneBase { if (r == null) { return; } r.unregisterForRecordsEvents(this); r.unregisterForRecordsLoaded(this); } /** * Sets the SIM voice message count * @param line Subscriber Profile Number, one-based. Only '1' is supported * @param countWaiting The number of messages waiting, if known. Use * -1 to indicate that an unknown number of * messages are waiting * This is a wrapper function for setVoiceMessageCount */ @Override public void setVoiceMessageWaiting(int line, int countWaiting) { setVoiceMessageCount(countWaiting); } protected void log(String s) { if (DBG) Rlog.d(LOG_TAG, s); Loading
src/java/com/android/internal/telephony/cdma/CdmaInboundSmsHandler.java +12 −8 Original line number Diff line number Diff line Loading @@ -18,11 +18,9 @@ package com.android.internal.telephony.cdma; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Message; import android.os.SystemProperties; import android.preference.PreferenceManager; import android.provider.Telephony.Sms.Intents; import android.telephony.SmsCbMessage; Loading Loading @@ -252,12 +250,18 @@ public class CdmaInboundSmsHandler extends InboundSmsHandler { int voicemailCount = sms.getNumOfVoicemails(); if (DBG) log("Voicemail count=" + voicemailCount); // Store the voicemail count in preferences. SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext); SharedPreferences.Editor editor = sp.edit(); editor.putInt(CDMAPhone.VM_COUNT_CDMA + mPhone.getPhoneId(), voicemailCount); editor.apply(); mPhone.setVoiceMessageWaiting(1, voicemailCount); // range check if (voicemailCount < 0) { voicemailCount = -1; } else if (voicemailCount > 99) { // C.S0015-B v2, 4.5.12 // range: 0-99 voicemailCount = 99; } // update voice mail count in phone mPhone.setVoiceMessageCount(voicemailCount); // store voice mail count in preferences storeVoiceMailCount(); } /** Loading