summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorNaveen Kalla <nkalla@codeaurora.org>2010-03-03 18:54:36 -0800
committerNaveen Kalla <nkalla@codeaurora.org>2010-03-03 18:54:36 -0800
commit1a61b586b59243dab6c70984ab4418451f7d78fa (patch)
tree3f5932dd5b74f5816d80bd4cc5a2fe1b881d1929 /telephony
parent7bb2581e6f404da0edba9ebb81b0d0593715eb40 (diff)
downloadframeworks_base-1a61b586b59243dab6c70984ab4418451f7d78fa.zip
frameworks_base-1a61b586b59243dab6c70984ab4418451f7d78fa.tar.gz
frameworks_base-1a61b586b59243dab6c70984ab4418451f7d78fa.tar.bz2
Retry pending memory status update to modem when radio is ON.
When radio is powered off / airplane mode, memory status updates are ignored by RIL. With this fix, pending memory status updates are sent again when radio is powered back on.
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/SMSDispatcher.java33
1 files changed, 31 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/SMSDispatcher.java b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
index 53c0bef..fc0aa06 100644
--- a/telephony/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/SMSDispatcher.java
@@ -109,6 +109,12 @@ public abstract class SMSDispatcher extends Handler {
/** Stop the sending */
static final protected int EVENT_STOP_SENDING = 10;
+ /** Memory status reporting is acknowledged by RIL */
+ static final protected int EVENT_REPORT_MEMORY_STATUS_DONE = 11;
+
+ /** Radio is ON */
+ static final protected int EVENT_RADIO_ON = 12;
+
protected Phone mPhone;
protected Context mContext;
protected ContentResolver mResolver;
@@ -152,6 +158,7 @@ public abstract class SMSDispatcher extends Handler {
private SmsMessageBase.SubmitPduBase mSubmitPduBase;
protected boolean mStorageAvailable = true;
+ protected boolean mReportMemoryStatusPending = false;
protected static int getNextConcatenatedRef() {
sConcatenatedRef += 1;
@@ -235,6 +242,7 @@ public abstract class SMSDispatcher extends Handler {
mCm.setOnNewSMS(this, EVENT_NEW_SMS, null);
mCm.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null);
mCm.setOnIccSmsFull(this, EVENT_ICC_FULL, null);
+ mCm.registerForOn(this, EVENT_RADIO_ON, null);
// Don't always start message ref at 0.
sConcatenatedRef = new Random().nextInt(256);
@@ -253,6 +261,7 @@ public abstract class SMSDispatcher extends Handler {
mCm.unSetOnNewSMS(this);
mCm.unSetOnSmsStatus(this);
mCm.unSetOnIccSmsFull(this);
+ mCm.unregisterForOn(this);
}
protected void finalize() {
@@ -370,6 +379,26 @@ public abstract class SMSDispatcher extends Handler {
removeMessages(EVENT_ALERT_TIMEOUT, msg.obj);
}
break;
+
+ case EVENT_REPORT_MEMORY_STATUS_DONE:
+ ar = (AsyncResult)msg.obj;
+ if (ar.exception != null) {
+ mReportMemoryStatusPending = true;
+ Log.v(TAG, "Memory status report to modem pending : mStorageAvailable = "
+ + mStorageAvailable);
+ } else {
+ mReportMemoryStatusPending = false;
+ }
+ break;
+
+ case EVENT_RADIO_ON:
+ if (mReportMemoryStatusPending) {
+ Log.v(TAG, "Sending pending memory status report : mStorageAvailable = "
+ + mStorageAvailable);
+ mCm.reportSmsMemoryStatus(mStorageAvailable,
+ obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
+ }
+ break;
}
}
@@ -940,10 +969,10 @@ public abstract class SMSDispatcher extends Handler {
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_LOW)) {
mStorageAvailable = false;
- mCm.reportSmsMemoryStatus(false, null);
+ mCm.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
} else if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_OK)) {
mStorageAvailable = true;
- mCm.reportSmsMemoryStatus(true, null);
+ mCm.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE));
} else {
// Assume the intent is one of the SMS receive intents that
// was sent as an ordered broadcast. Check result and ACK.