Bug 1147736 - Part 1: Extend TelephonyCallInfo. r=aknow
☠☠ backed out by deb124404f67 ☠ ☠
authorBen Hsu <bhsu@mozilla.com>
Mon, 27 Apr 2015 23:22:00 -0400
changeset 273903 5a0f9070dd9441a39d5d759f19e88303d768ad6d
parent 273902 0e78345db8b6364b3f62f3652051ec7f8d9c9d4b
child 273904 a78ad976faf317828b6cb268dced774e863b6b80
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaknow
bugs1147736
milestone40.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 1147736 - Part 1: Extend TelephonyCallInfo. r=aknow
dom/telephony/TelephonyCallInfo.cpp
dom/telephony/TelephonyCallInfo.h
dom/telephony/gonk/TelephonyService.js
dom/telephony/ipc/TelephonyIPCSerializer.h
dom/telephony/nsITelephonyCallInfo.idl
--- a/dom/telephony/TelephonyCallInfo.cpp
+++ b/dom/telephony/TelephonyCallInfo.cpp
@@ -10,32 +10,38 @@ namespace mozilla {
 namespace dom {
 namespace telephony {
 
 NS_IMPL_ISUPPORTS(TelephonyCallInfo, nsITelephonyCallInfo)
 
 TelephonyCallInfo::TelephonyCallInfo(uint32_t aClientId,
                                      uint32_t aCallIndex,
                                      uint16_t aCallState,
+                                     const nsAString& aDisconnectedReason,
+
                                      const nsAString& aNumber,
                                      uint16_t aNumberPresentation,
                                      const nsAString& aName,
                                      uint16_t aNamePresentation,
+
                                      bool aIsOutgoing,
                                      bool aIsEmergency,
                                      bool aIsConference,
                                      bool aIsSwitchable,
                                      bool aIsMergeable)
   : mClientId(aClientId),
     mCallIndex(aCallIndex),
     mCallState(aCallState),
+    mDisconnectedReason(aDisconnectedReason),
+
     mNumber(aNumber),
     mNumberPresentation(aNumberPresentation),
     mName(aName),
     mNamePresentation(aNamePresentation),
+
     mIsOutgoing(aIsOutgoing),
     mIsEmergency(aIsEmergency),
     mIsConference(aIsConference),
     mIsSwitchable(aIsSwitchable),
     mIsMergeable(aIsMergeable)
 {
 }
 
@@ -56,16 +62,23 @@ TelephonyCallInfo::GetCallIndex(uint32_t
 NS_IMETHODIMP
 TelephonyCallInfo::GetCallState(uint16_t* aCallState)
 {
   *aCallState = mCallState;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+TelephonyCallInfo::GetDisconnectedReason(nsAString& aDisconnectedReason)
+{
+  aDisconnectedReason = mDisconnectedReason;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 TelephonyCallInfo::GetNumber(nsAString& aNumber)
 {
   aNumber = mNumber;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyCallInfo::GetNumberPresentation(uint16_t* aNumberPresentation)
--- a/dom/telephony/TelephonyCallInfo.h
+++ b/dom/telephony/TelephonyCallInfo.h
@@ -16,36 +16,48 @@ namespace dom {
 namespace telephony {
 
 class TelephonyCallInfo final : public nsITelephonyCallInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSITELEPHONYCALLINFO
 
-  TelephonyCallInfo(uint32_t aClientId, uint32_t aCallIndex,
-                    uint16_t aCallState, const nsAString& aNumber,
-                    uint16_t aNumberPresentation, const nsAString& aName,
-                    uint16_t aNamePresentation, bool aIsOutgoing,
-                    bool aIsEmergency, bool aIsConference,
-                    bool aIsSwitchable, bool aIsMergeable);
+  TelephonyCallInfo(uint32_t aClientId,
+                    uint32_t aCallIndex,
+                    uint16_t aCallState,
+                    const nsAString& aDisconnectedReason,
+
+                    const nsAString& aNumber,
+                    uint16_t aNumberPresentation,
+                    const nsAString& aName,
+                    uint16_t aNamePresentation,
+
+                    bool aIsOutgoing,
+                    bool aIsEmergency,
+                    bool aIsConference,
+                    bool aIsSwitchable,
+                    bool aIsMergeable);
 
 private:
   // Don't try to use the default constructor.
   TelephonyCallInfo() {}
 
   ~TelephonyCallInfo() {}
 
   uint32_t mClientId;
   uint32_t mCallIndex;
   uint16_t mCallState;
+  nsString mDisconnectedReason;
+
   nsString mNumber;
   uint16_t mNumberPresentation;
   nsString mName;
   uint16_t mNamePresentation;
+
   bool mIsOutgoing;
   bool mIsEmergency;
   bool mIsConference;
   bool mIsSwitchable;
   bool mIsMergeable;
 };
 
 } // namespace telephony
--- a/dom/telephony/gonk/TelephonyService.js
+++ b/dom/telephony/gonk/TelephonyService.js
@@ -125,20 +125,23 @@ MobileCallForwardingOptions.prototype = 
   timeSeconds: -1,
   serviceClass: nsIMobileConnection.ICC_SERVICE_CLASS_NONE
 };
 
 function TelephonyCallInfo(aCall) {
   this.clientId = aCall.clientId;
   this.callIndex = aCall.callIndex;
   this.callState = aCall.state;
+  this.disconnectedReason = aCall.disconnectedReason || "";
+
   this.number = aCall.number;
   this.numberPresentation = aCall.numberPresentation;
   this.name = aCall.name;
   this.namePresentation = aCall.namePresentation;
+
   this.isOutgoing = aCall.isOutgoing;
   this.isEmergency = aCall.isEmergency;
   this.isConference = aCall.isConference;
   this.isSwitchable = aCall.isSwitchable;
   this.isMergeable = aCall.isMergeable;
 }
 TelephonyCallInfo.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyCallInfo]),
@@ -149,20 +152,23 @@ TelephonyCallInfo.prototype = {
     interfaces:       [Ci.nsITelephonyCallInfo]
   }),
 
   // nsITelephonyCallInfo
 
   clientId: 0,
   callIndex: 0,
   callState: nsITelephonyService.CALL_STATE_UNKNOWN,
+  disconnectedReason: "",
+
   number: "",
   numberPresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
   name: "",
   namePresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
+
   isOutgoing: true,
   isEmergency: false,
   isConference: false,
   isSwitchable: true,
   isMergeable: true
 };
 
 function Call(aClientId, aCallIndex) {
--- a/dom/telephony/ipc/TelephonyIPCSerializer.h
+++ b/dom/telephony/ipc/TelephonyIPCSerializer.h
@@ -85,47 +85,64 @@ struct ParamTraits<nsITelephonyCallInfo*
     if (isNull) {
       *aResult = nullptr;
       return true;
     }
 
     uint32_t clientId;
     uint32_t callIndex;
     uint16_t callState;
+    nsString disconnectedReason;
+
     nsString number;
     uint16_t numberPresentation;
     nsString name;
     uint16_t namePresentation;
+
     bool isOutgoing;
     bool isEmergency;
     bool isConference;
     bool isSwitchable;
     bool isMergeable;
 
     // It's not important to us where it fails, but rather if it fails
     if (!(ReadParam(aMsg, aIter, &clientId) &&
           ReadParam(aMsg, aIter, &callIndex) &&
           ReadParam(aMsg, aIter, &callState) &&
+          ReadParam(aMsg, aIter, &disconnectedReason) &&
+
           ReadParam(aMsg, aIter, &number) &&
           ReadParam(aMsg, aIter, &numberPresentation) &&
           ReadParam(aMsg, aIter, &name) &&
           ReadParam(aMsg, aIter, &namePresentation) &&
+
           ReadParam(aMsg, aIter, &isOutgoing) &&
           ReadParam(aMsg, aIter, &isEmergency) &&
           ReadParam(aMsg, aIter, &isConference) &&
           ReadParam(aMsg, aIter, &isSwitchable) &&
           ReadParam(aMsg, aIter, &isMergeable))) {
       return false;
     }
 
     nsCOMPtr<nsITelephonyCallInfo> info =
-        new TelephonyCallInfo(clientId, callIndex, callState, number,
-                              numberPresentation, name, namePresentation,
-                              isOutgoing, isEmergency, isConference,
-                              isSwitchable, isMergeable);
+        new TelephonyCallInfo(clientId,
+                              callIndex,
+                              callState,
+                              disconnectedReason,
+
+                              number,
+                              numberPresentation,
+                              name,
+                              namePresentation,
+
+                              isOutgoing,
+                              isEmergency,
+                              isConference,
+                              isSwitchable,
+                              isMergeable);
 
     info.forget(aResult);
 
     return true;
   }
 };
 
 
--- a/dom/telephony/nsITelephonyCallInfo.idl
+++ b/dom/telephony/nsITelephonyCallInfo.idl
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(3ea2d155-8ea2-42be-85d7-bd8ede8afc40)]
+[scriptable, uuid(e5e1be26-a3d4-49b3-8d9f-c1df5192b364)]
 interface nsITelephonyCallInfo : nsISupports
 {
   /**
    * Indicate the RIL client, 0 ~ (number of client - 1).
    */
   readonly attribute unsigned long clientId;
 
   /**
@@ -18,16 +18,24 @@ interface nsITelephonyCallInfo : nsISupp
   readonly attribute unsigned long callIndex;
 
   /**
    * One of the nsITelephonyService::CALL_STATE_* values.
    */
   readonly attribute unsigned short callState;
 
   /**
+   * The disconnectedReason of a call is defualt to an empty string when the
+   * call is "not disconnected", but once the call becomes "disconnected" the
+   * disconnectedReason should be a non-empty string no matter the call is
+   * disconnected for a noraml reason or an error.
+   */
+  readonly attribute DOMString disconnectedReason;
+
+  /**
    * Number of the other party.
    */
   readonly attribute DOMString number;
 
   /**
    * Presentation of the call number.
    * One of the nsITelephonyService::CALL_PRESENTATION_* values.
    */