Bug 1091454 - Part 1.2: Reuse MozStkTextMessage as the container of Text/Icon to be displayed for SET_UP_CALL/LAUNCH_BROWSER. r=hsinyi r=echen
authorBevis Tseng <btseng@mozilla.com>
Thu, 06 Nov 2014 14:30:01 +0800
changeset 243787 7d723aa478316bbde5deea1560c9c449408a53a3
parent 243786 22da7cf68b33b0fc381b0c006ca4936273892849
child 243788 f55b542c195cddbc0a712ce5ca922402e6b99de8
push id660
push userraliiev@mozilla.com
push dateWed, 18 Feb 2015 20:30:48 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi, echen
bugs1091454
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1091454 - Part 1.2: Reuse MozStkTextMessage as the container of Text/Icon to be displayed for SET_UP_CALL/LAUNCH_BROWSER. r=hsinyi r=echen
dom/system/gonk/ril_worker.js
dom/webidl/MozStkCommandEvent.webidl
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -10958,83 +10958,112 @@ StkCommandParamsFactoryObject.prototype 
     this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
                                textMsg,
                                onComplete);
   },
 
   processSetupCall: function(cmdDetails, ctlvs, onComplete) {
     let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
     let call = {};
+    let confirmMessage = {};
+    let callMessage = {};
 
     let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
       COMPREHENSIONTLV_TAG_ADDRESS,
       COMPREHENSIONTLV_TAG_ALPHA_ID,
       COMPREHENSIONTLV_TAG_ICON_ID,
       COMPREHENSIONTLV_TAG_DURATION
     ]);
 
-    let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
+    let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ADDRESS);
+    if (!ctlv) {
+      this.context.RIL.sendStkTerminalResponse({
+        command: cmdDetails,
+        resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
+      throw new Error("Stk Set Up Call: Required value missing : Address");
+    }
+    call.address = ctlv.value.number;
+
+    ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
     if (ctlv) {
-      call.confirmMessage = ctlv.value.identifier;
+      confirmMessage.text = ctlv.value.identifier;
+      call.confirmMessage = confirmMessage;
     }
 
     ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
     if (ctlv) {
-      call.callMessage = ctlv.value.identifier;
-    }
-
-    ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ADDRESS);
-    if (!ctlv) {
-      this.context.RIL.sendStkTerminalResponse({
-        command: cmdDetails,
-        resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
-      throw new Error("Stk Set Up Call: Required value missing : Adress");
-    }
-    call.address = ctlv.value.number;
+      callMessage.text = ctlv.value.identifier;
+      call.callMessage = callMessage;
+    }
 
     // see 3GPP TS 31.111 section 6.4.13
     ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
     if (ctlv) {
       call.duration = ctlv.value;
     }
 
-    this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
-                               call,
-                               onComplete);
+    let iconIdCtlvs = selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null;
+    this.loadIcons(iconIdCtlvs, (aIcons) => {
+      if (aIcons) {
+        confirmMessage.icons = aIcons[0];
+        confirmMessage.iconSelfExplanatory =
+          (iconIdCtlvs[0].value.qualifier == 0) ? true: false;
+        call.confirmMessage = confirmMessage;
+
+        if (aIcons.length > 1) {
+          callMessage.icons = aIcons[1];
+          callMessage.iconSelfExplanatory =
+            (iconIdCtlvs[1].value.qualifier == 0) ? true: false;
+          call.callMessage = callMessage;
+        }
+      }
+
+      onComplete(call);
+    });
   },
 
   processLaunchBrowser: function(cmdDetails, ctlvs, onComplete) {
     let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
     let browser = {};
+    let confirmMessage = {};
 
     let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
       COMPREHENSIONTLV_TAG_URL,
       COMPREHENSIONTLV_TAG_ALPHA_ID,
       COMPREHENSIONTLV_TAG_ICON_ID
     ]);
 
     let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_URL);
     if (!ctlv) {
       this.context.RIL.sendStkTerminalResponse({
         command: cmdDetails,
         resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
       throw new Error("Stk Launch Browser: Required value missing : URL");
     }
     browser.url = ctlv.value.url;
 
+    browser.mode = cmdDetails.commandQualifier & 0x03;
+
     ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
     if (ctlv) {
-      browser.confirmMessage = ctlv.value.identifier;
-    }
-
-    browser.mode = cmdDetails.commandQualifier & 0x03;
-
-    this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
-                               browser,
-                               onComplete);
+      confirmMessage.text = ctlv.value.identifier;
+      browser.confirmMessage = confirmMessage;
+    }
+
+    let iconIdCtlvs = selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null;
+    this.loadIcons(iconIdCtlvs, (aIcons) => {
+       if (aIcons) {
+         confirmMessage.icons = aIcons[0];
+         confirmMessage.iconSelfExplanatory =
+           (iconIdCtlvs[0].value.qualifier == 0) ? true: false;
+         browser.confirmMessage = confirmMessage;
+       }
+
+       onComplete(browser);
+    });
   },
 
   processPlayTone: function(cmdDetails, ctlvs, onComplete) {
     let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
     let playTone = {};
 
     let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
       COMPREHENSIONTLV_TAG_ALPHA_ID,
--- a/dom/webidl/MozStkCommandEvent.webidl
+++ b/dom/webidl/MozStkCommandEvent.webidl
@@ -275,17 +275,17 @@ dictionary MozStkInput : MozStkIconConta
    * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
    *
    * true: help information available.
    * false: no help information available.
    */
   boolean isHelpAvailable;
 };
 
-dictionary MozStkBrowserSetting : MozStkIconContainer
+dictionary MozStkBrowserSetting
 {
   /**
    * Confirm message to launch browser.
    */
   MozStkTextMessage confirmMessage;
 
   /**
    * The URL to be opened by browser.
@@ -295,17 +295,17 @@ dictionary MozStkBrowserSetting : MozStk
   /**
    * One of STK_BROWSER_MODE_*.
    *
    * @see nsIDOMMozIccManager.STK_BROWSER_MODE_*
    */
   unsigned short mode;
 };
 
-dictionary MozStkSetUpCall : MozStkIconContainer
+dictionary MozStkSetUpCall
 {
   /**
    * The Dialling number.
    */
   DOMString address;
 
   /**
    * The text message used in user confirmation phase.