IMS: IMS Registration and handover error codes support

- Add support for propagating IMS Registration error codes and error
 messages.
- Propagate the call session handover info to the UI
Change-Id: If2f2008734735f52614bd046fee144843a465ecf
diff --git a/src/java/com/android/ims/ImsCall.java b/src/java/com/android/ims/ImsCall.java
index a50d06c..37e93c1 100644
--- a/src/java/com/android/ims/ImsCall.java
+++ b/src/java/com/android/ims/ImsCall.java
@@ -374,6 +374,30 @@
         public void onCallSessionTtyModeReceived(ImsCall call, int mode) {
             // no-op
         }
+
+        /**
+         * Called when handover occurs from one access technology to another.
+         *
+         * @param session IMS session object
+         * @param srcAccessTech original access technology
+         * @param targetAccessTech new access technology
+         * @param reasonInfo
+         */
+        public void onCallHandover(ImsCall imsCall, int srcAccessTech, int targetAccessTech,
+            ImsReasonInfo reasonInfo) {
+        }
+
+        /**
+         * Called when handover from one access technology to another fails.
+         *
+         * @param session IMS session object
+         * @param srcAccessTech original access technology
+         * @param targetAccessTech new access technology
+         * @param reasonInfo
+         */
+        public void onCallHandoverFailed(ImsCall imsCall, int srcAccessTech, int targetAccessTech,
+            ImsReasonInfo reasonInfo) {
+        }
     }
 
 
@@ -2693,6 +2717,55 @@
                 }
             }
         }
+
+        public void callSessionHandover(ImsCallSession session, int srcAccessTech,
+            int targetAccessTech, ImsReasonInfo reasonInfo) {
+            if (DBG) {
+                log("callSessionHandover :: session=" + session + ", srcAccessTech=" +
+                    srcAccessTech + ", targetAccessTech=" + targetAccessTech + ", reasonInfo=" +
+                    reasonInfo);
+            }
+
+            ImsCall.Listener listener;
+
+            synchronized(ImsCall.this) {
+                listener = mListener;
+            }
+
+            if (listener != null) {
+                try {
+                    listener.onCallHandover(ImsCall.this, srcAccessTech, targetAccessTech,
+                        reasonInfo);
+                } catch (Throwable t) {
+                    loge("callSessionHandover :: ", t);
+                }
+            }
+        }
+
+        @Override
+        public void callSessionHandoverFailed(ImsCallSession session, int srcAccessTech,
+            int targetAccessTech, ImsReasonInfo reasonInfo) {
+            if (DBG) {
+                log("callSessionHandoverFailed :: session=" + session + ", srcAccessTech=" +
+                    srcAccessTech + ", targetAccessTech=" + targetAccessTech + ", reasonInfo=" +
+                    reasonInfo);
+            }
+
+            ImsCall.Listener listener;
+
+            synchronized(ImsCall.this) {
+                listener = mListener;
+            }
+
+            if (listener != null) {
+                try {
+                    listener.onCallHandoverFailed(ImsCall.this, srcAccessTech, targetAccessTech,
+                        reasonInfo);
+                } catch (Throwable t) {
+                    loge("callSessionHandoverFailed :: ", t);
+                }
+            }
+        }
     }
 
     /**
diff --git a/src/java/com/android/ims/ImsConnectionStateListener.java b/src/java/com/android/ims/ImsConnectionStateListener.java
index 4962591..b19141e 100644
--- a/src/java/com/android/ims/ImsConnectionStateListener.java
+++ b/src/java/com/android/ims/ImsConnectionStateListener.java
@@ -32,9 +32,16 @@
     }
 
     /**
+     * Called when the device is trying to connect to the IMS network.
+     */
+    public void onImsProgressing() {
+        // no-op
+    }
+
+    /**
      * Called when the device is disconnected from the IMS network.
      */
-    public void onImsDisconnected() {
+    public void onImsDisconnected(ImsReasonInfo imsReasonInfo) {
         // no-op
     }
 
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 26389a1..eaae299 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -968,13 +968,24 @@
         }
 
         @Override
-        public void registrationDisconnected() {
+        public void registrationProgressing() {
             if (DBG) {
-                log("registrationDisconnected ::");
+                log("registrationProgressing ::");
             }
 
             if (mListener != null) {
-                mListener.onImsDisconnected();
+                mListener.onImsProgressing();
+            }
+        }
+
+        @Override
+        public void registrationDisconnected(ImsReasonInfo imsReasonInfo) {
+            if (DBG) {
+                log("registrationDisconnected :: imsReasonInfo" + imsReasonInfo);
+            }
+
+            if (mListener != null) {
+                mListener.onImsDisconnected(imsReasonInfo);
             }
         }
 
diff --git a/src/java/com/android/ims/internal/ImsCallSession.java b/src/java/com/android/ims/internal/ImsCallSession.java
index 7e2f65c..227c6be 100644
--- a/src/java/com/android/ims/internal/ImsCallSession.java
+++ b/src/java/com/android/ims/internal/ImsCallSession.java
@@ -1178,6 +1178,9 @@
             }
         }
 
+        /**
+         * Notifies of handover failure info for this call
+         */
         @Override
         public void callSessionHandoverFailed(IImsCallSession session,
                                        int srcAccessTech, int targetAccessTech,