From 65229f5c56f3f4dad98f1fb7ef0ff2d1d8247324 Mon Sep 17 00:00:00 2001 From: Philipp von Weitershausen Date: Mon, 12 Mar 2012 16:45:57 -0700 Subject: [PATCH] Bug 734299 - Part 1: Detect a datacall quirk on the SGS2. r=qDot --- dom/system/b2g/ril_worker.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/dom/system/b2g/ril_worker.js b/dom/system/b2g/ril_worker.js index dddfd1c3993..c1d20026e72 100644 --- a/dom/system/b2g/ril_worker.js +++ b/dom/system/b2g/ril_worker.js @@ -76,6 +76,7 @@ const UINT32_SIZE = 4; const PARCEL_SIZE_SIZE = UINT32_SIZE; let RILQUIRKS_CALLSTATE_EXTRA_UINT32 = false; +let RILQUIRKS_DATACALLSTATE_DOWN_IS_UP = false; /** * This object contains helpers buffering incoming data & deconstructing it @@ -553,17 +554,26 @@ let RIL = { /** * Set quirk flags based on the RIL model detected. Note that this * requires the RIL being "warmed up" first, which happens when on - * an incoming or outgoing call. + * an incoming or outgoing voice call or data call. */ rilQuirksInitialized: false, initRILQuirks: function initRILQuirks() { + if (this.rilQuirksInitialized) { + return; + } + // The Samsung Galaxy S2 I-9100 radio sends an extra Uint32 in the // call state. let model_id = libcutils.property_get("ril.model_id"); if (DEBUG) debug("Detected RIL model " + model_id); if (model_id == "I9100") { - if (DEBUG) debug("Enabling RILQUIRKS_CALLSTATE_EXTRA_UINT32 for I9100."); + if (DEBUG) { + debug("Detected I9100, enabling " + + "RILQUIRKS_CALLSTATE_EXTRA_UINT32, " + + "RILQUIRKS_DATACALLSTATE_DOWN_IS_UP."); + } RILQUIRKS_CALLSTATE_EXTRA_UINT32 = true; + RILQUIRKS_DATACALLSTATE_DOWN_IS_UP = true; } this.rilQuirksInitialized = true; @@ -1045,9 +1055,7 @@ RIL[REQUEST_CHANGE_SIM_PIN] = function REQUEST_CHANGE_SIM_PIN() { RIL[REQUEST_CHANGE_SIM_PIN2] = null; RIL[REQUEST_ENTER_NETWORK_DEPERSONALIZATION] = null; RIL[REQUEST_GET_CURRENT_CALLS] = function REQUEST_GET_CURRENT_CALLS(length) { - if (!this.rilQuirksInitialized) { - this.initRILQuirks(); - } + this.initRILQuirks(); let calls_length = 0; // The RIL won't even send us the length integer if there are no active calls. @@ -1221,6 +1229,8 @@ RIL[REQUEST_GET_MUTE] = null; RIL[REQUEST_QUERY_CLIP] = null; RIL[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null; RIL[REQUEST_DATA_CALL_LIST] = function REQUEST_DATA_CALL_LIST(length) { + this.initRILQuirks(); + let num = 0; if (length) { num = Buf.readUint32(); @@ -2036,6 +2046,9 @@ let Phone = { break; case DATACALL_ACTIVE_DOWN: newDataCall.state = GECKO_NETWORK_STATE_SUSPENDED; + if (RILQUIRKS_DATACALLSTATE_DOWN_IS_UP) { + newDataCall.state = GECKO_NETWORK_STATE_CONNECTED; + } break; case DATACALL_ACTIVE_UP: newDataCall.state = GECKO_NETWORK_STATE_CONNECTED;