IMS-VT: Fix propagation of device orientation.
Rekha Kumar [Tue, 24 Mar 2015 18:00:34 +0000 (11:00 -0700)]
Orientation received at VT Service is incorrect.
Fixed propagation of device orientation to VT service

Notify listeners of video quality changed event
- Propagate the video quality changed message.

IMS: Add support for video quality
- Add Config interface to get/set video quality

IMS-VT: Change call data usage parameters
Change call data usage methods to take parameter of long type
instead of int

Change-Id: I543aa082337d437ec7c2bf249bafb9658f34dd1b

Propagate the call substate changed message to the UI

Change-Id: I695736ccfa4e4446912ba6c3df1713bae6d4486a

src/java/com/android/ims/ImsCall.java
src/java/com/android/ims/ImsConfig.java
src/java/com/android/ims/internal/ImsCallSession.java
src/java/com/android/ims/internal/ImsVideoCallProvider.java
src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java

index 5f842a3..57afdb2 100644 (file)
@@ -29,6 +29,7 @@ import android.net.Uri;
 import android.os.Bundle;
 import android.os.Message;
 import android.telecom.ConferenceParticipant;
+import android.telecom.Connection;
 import android.util.Log;
 
 import com.android.ims.internal.ICall;
@@ -687,6 +688,26 @@ public class ImsCall implements ICall {
     }
 
     /**
+     * Gets the call substate.
+     *
+     * @return int callsubstate
+     */
+    public int getCallSubstate() throws ImsException {
+        synchronized(mLockObj) {
+            if (mSession == null) {
+                throw new ImsException("No call session",
+                    ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED);
+            }
+            try {
+                return mSession.getCallSubstate();
+            } catch (Throwable t) {
+                loge("getCallSubstate :: ", t);
+                throw new ImsException("getCallSubstate()", t, 0);
+            }
+        }
+    }
+
+    /**
      * Gets the last reason information when the call is not established, cancelled or terminated.
      *
      * @return the last reason information
index 00552b1..b039fc0 100644 (file)
@@ -246,6 +246,18 @@ public class ImsConfig {
         public static final int UNSUPPORTED_CAUSE_DISABLED = 4;
     }
 
+    /**
+     * Defines IMS get operation values.
+     */
+    public static class OperationValuesConstants {
+        /**
+         * Values related to Video Quality
+         */
+        public static final int VIDEO_QUALITY_UNKNOWN = -1;
+        public static final int VIDEO_QUALITY_LOW = 0;
+        public static final int VIDEO_QUALITY_HIGH = 1;
+    }
+
    /**
     * Defines IMS feature value.
     */
@@ -443,4 +455,39 @@ public class ImsConfig {
                     ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
         }
     }
+
+    /**
+     * Gets the value for IMS feature item for video call quality.
+     *
+     * @param listener, provided if caller needs to be notified for set result.
+     * @return void
+     *
+     * @throws ImsException if calling the IMS service results in an error.
+     */
+    public void getVideoQuality(ImsConfigListener listener) throws ImsException {
+        try {
+            miConfig.getVideoQuality(listener);
+        } catch (RemoteException e) {
+            throw new ImsException("getVideoQuality()", e,
+                    ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
+        }
+    }
+
+    /**
+     * Sets the value for IMS feature item video quality.
+     *
+     * @param quality, defines the value of video quality.
+     * @param listener, provided if caller needs to be notified for set result.
+     * @return void
+     *
+     * @throws ImsException if calling the IMS service results in an error.
+     */
+     public void setVideoQuality(int quality, ImsConfigListener listener) throws ImsException {
+        try {
+            miConfig.setVideoQuality(quality, listener);
+        } catch (RemoteException e) {
+            throw new ImsException("setVideoQuality()", e,
+                    ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE);
+        }
+     }
 }
index 227c6be..3e3d1df 100644 (file)
@@ -18,6 +18,7 @@ package com.android.ims.internal;
 
 import android.os.Message;
 import android.os.RemoteException;
+import android.telecom.Connection;
 
 import com.android.ims.ImsCallProfile;
 import com.android.ims.ImsConferenceState;
@@ -502,6 +503,23 @@ public class ImsCallSession {
     }
 
     /**
+     * Gets the call substate for this session.
+     *
+     * @return the call substate for this session.
+     */
+    public int getCallSubstate() {
+        if (mClosed) {
+            return Connection.SUBSTATE_NONE;
+        }
+
+        try {
+            return miSession.getCallSubstate();
+        } catch (RemoteException e) {
+            return Connection.SUBSTATE_NONE;
+        }
+    }
+
+    /**
      * Gets the value associated with the specified property of this session.
      *
      * @return the string value associated with the specified property
index 8eb3b27..ae70e92 100644 (file)
@@ -109,7 +109,7 @@ public abstract class ImsVideoCallProvider {
         }
 
         public void setDeviceOrientation(int rotation) {
-            mProviderHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
+            mProviderHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation, 0).sendToTarget();
         }
 
         public void setZoom(float value) {
@@ -222,7 +222,7 @@ public abstract class ImsVideoCallProvider {
     }
 
     /** @see Connection.VideoProvider#changeCallDataUsage */
-    public void changeCallDataUsage(int dataUsage) {
+    public void changeCallDataUsage(long dataUsage) {
         if (mCallback != null) {
             try {
                 mCallback.changeCallDataUsage(dataUsage);
@@ -240,4 +240,14 @@ public abstract class ImsVideoCallProvider {
             }
         }
     }
-}
\ No newline at end of file
+
+    /** @see Connection.VideoProvider#changeVideoQuality */
+    public void changeVideoQuality(int videoQuality) {
+        if (mCallback != null) {
+            try {
+                mCallback.changeVideoQuality(videoQuality);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
+}
index d438220..36fb131 100644 (file)
@@ -46,6 +46,7 @@ public class ImsVideoCallProviderWrapper extends Connection.VideoProvider {
     private static final int MSG_CHANGE_PEER_DIMENSIONS = 4;
     private static final int MSG_CHANGE_CALL_DATA_USAGE = 5;
     private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6;
+    private static final int MSG_CHANGE_VIDEO_QUALITY = 7;
 
     private final IImsVideoCallProvider mVideoCallProvider;
     private final ImsVideoCallCallback mBinder;
@@ -91,7 +92,12 @@ public class ImsVideoCallProviderWrapper extends Connection.VideoProvider {
         }
 
         @Override
-        public void changeCallDataUsage(int dataUsage) {
+        public void changeVideoQuality(int videoQuality) {
+            mHandler.obtainMessage(MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0).sendToTarget();
+        }
+
+        @Override
+        public void changeCallDataUsage(long dataUsage) {
             mHandler.obtainMessage(MSG_CHANGE_CALL_DATA_USAGE, dataUsage).sendToTarget();
         }
 
@@ -137,11 +143,14 @@ public class ImsVideoCallProviderWrapper extends Connection.VideoProvider {
                     }
                     break;
                 case MSG_CHANGE_CALL_DATA_USAGE:
-                    changeCallDataUsage(msg.arg1);
+                    changeCallDataUsage((long) msg.obj);
                     break;
                 case MSG_CHANGE_CAMERA_CAPABILITIES:
                     changeCameraCapabilities((CameraCapabilities) msg.obj);
                     break;
+                case MSG_CHANGE_VIDEO_QUALITY:
+                    changeVideoQuality(msg.arg1);
+                    break;
                 default:
                     break;
             }
@@ -242,4 +251,4 @@ public class ImsVideoCallProviderWrapper extends Connection.VideoProvider {
         } catch (RemoteException e) {
         }
     }
-}
\ No newline at end of file
+}