Bug 1110050 - Support RIL_REQUEST_REPORT_SMS_MEMORY_STATUS to inform SMS Device Storage to modem. r=echen

This commit is contained in:
Bevis Tseng 2014-12-15 17:25:21 +08:00
Родитель bc4de955f9
Коммит 002fe0c8b2
3 изменённых файлов: 63 добавлений и 3 удалений

Просмотреть файл

@ -22,6 +22,8 @@ const kPrefDefaultServiceId = "dom.sms.defaultServiceId";
const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
const kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
const kDiskSpaceWatcherObserverTopic = "disk-space-watcher";
const kSmsReceivedObserverTopic = "sms-received";
const kSilentSmsReceivedObserverTopic = "silent-sms-received";
const kSmsSendingObserverTopic = "sms-sending";
@ -106,6 +108,7 @@ function SmsService() {
Services.prefs.addObserver(kPrefRilDebuggingEnabled, this, false);
Services.prefs.addObserver(kPrefDefaultServiceId, this, false);
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
Services.obs.addObserver(this, kDiskSpaceWatcherObserverTopic, false);
}
SmsService.prototype = {
classID: GONK_SMSSERVICE_CID,
@ -755,6 +758,26 @@ SmsService.prototype = {
},
/**
* Report SMS storage status to modem.
*
* Note: GonkDiskSpaceWatcher repeats the notification every 5 seconds when
* storage is full.
* Report status to modem only when the availability is changed.
* Set |_smsStorageAvailable| to |null| to ensure the first run after
* bootup.
*/
_smsStorageAvailable: null,
_reportSmsMemoryStatus: function(aIsAvailable) {
if (this._smsStorageAvailable !== aIsAvailable) {
this._smsStorageAvailable = aIsAvailable;
for (let serviceId = 0; serviceId < gRadioInterfaces.length; serviceId++) {
gRadioInterfaces[serviceId]
.sendWorkerMessage("reportSmsMemoryStatus", { isAvailable: aIsAvailable });
}
}
},
// An array of slient numbers.
_silentNumbers: null,
_isSilentNumber: function(aNumber) {
@ -1029,12 +1052,19 @@ SmsService.prototype = {
this.smsDefaultServiceId = this._getDefaultServiceId();
}
break;
case kDiskSpaceWatcherObserverTopic:
if (DEBUG) {
debug("Observe " + kDiskSpaceWatcherObserverTopic + ": " + aData);
}
this._reportSmsMemoryStatus(aData != "full");
break;
case NS_XPCOM_SHUTDOWN_OBSERVER_ID:
// Release the CPU wake lock for handling the received SMS.
this._releaseSmsHandledWakeLock();
Services.prefs.removeObserver(kPrefRilDebuggingEnabled, this);
Services.prefs.removeObserver(kPrefDefaultServiceId, this);
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
Services.obs.removeObserver(this, kDiskSpaceWatcherObserverTopic);
break;
}
}

Просмотреть файл

@ -3,4 +3,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
component {f9b9b5e2-73b4-11e4-83ff-a33e27428c86} SmsService.js
contract @mozilla.org/sms/gonksmsservice;1 {f9b9b5e2-73b4-11e4-83ff-a33e27428c86}
contract @mozilla.org/sms/gonksmsservice;1 {f9b9b5e2-73b4-11e4-83ff-a33e27428c86}
category profile-after-change SmsService @mozilla.org/sms/gonksmsservice;1

Просмотреть файл

@ -546,6 +546,12 @@ RilObject.prototype = {
* { options: options of the corresponding dialing request }
*/
this.pendingMO = null;
/**
* True when the request to report SMS Memory Status is pending.
*/
this.pendingToReportSmsMemoryStatus = false;
this.smsStorageAvailable = true;
},
/**
@ -2064,6 +2070,23 @@ RilObject.prototype = {
}
},
/**
* Report SMS storage status to modem.
*/
_updateSmsMemoryStatus: function() {
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_REPORT_SMS_MEMORY_STATUS);
Buf.writeInt32(1);
Buf.writeInt32(this.smsStorageAvailable ? 1 : 0);
Buf.sendParcel();
},
reportSmsMemoryStatus: function(options) {
this.pendingToReportSmsMemoryStatus = true;
this.smsStorageAvailable = options.isAvailable;
this._updateSmsMemoryStatus();
},
setCellBroadcastDisabled: function(options) {
this.cellBroadcastDisabled = options.disabled;
@ -4786,7 +4809,7 @@ RilObject.prototype = {
// MSG_TYPE | 8
// TOTAL_SEGMENTS | 8
// SEGMENT_NUMBER | 8
// DATAGRAM | (NUM_FIELDS 3) * 8
// DATAGRAM | (NUM_FIELDS - 3) * 8
let index = 0;
if (message.data[index++] !== 0) {
if (DEBUG) this.context.debug("Ignore a WAP Message which is not WDP.");
@ -6562,7 +6585,9 @@ RilObject.prototype[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRES
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_SET_SMSC_ADDRESS] = null;
RilObject.prototype[REQUEST_REPORT_SMS_MEMORY_STATUS] = null;
RilObject.prototype[REQUEST_REPORT_SMS_MEMORY_STATUS] = function REQUEST_REPORT_SMS_MEMORY_STATUS(length, options) {
this.pendingToReportSmsMemoryStatus = options.rilRequestError != ERROR_SUCCESS;
};
RilObject.prototype[REQUEST_REPORT_STK_SERVICE_IS_RUNNING] = null;
RilObject.prototype[REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE] = null;
RilObject.prototype[REQUEST_ISIM_AUTHENTICATION] = null;
@ -6710,6 +6735,10 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
this._attachDataRegistration) {
this.setDataRegistration({attach: true});
}
if (this.pendingToReportSmsMemoryStatus) {
this._updateSmsMemoryStatus();
}
}
this.radioState = newState;