Merge "Add new error codes in MbmsException"
diff --git a/telephony/java/android/telephony/MbmsStreamingManager.java b/telephony/java/android/telephony/MbmsStreamingManager.java
index 6754426..e90a63c 100644
--- a/telephony/java/android/telephony/MbmsStreamingManager.java
+++ b/telephony/java/android/telephony/MbmsStreamingManager.java
@@ -156,7 +156,6 @@
      *
      * This may throw an {@link MbmsException} containing one of the following errors:
      * {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
-     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION}
      * {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
      * {@link MbmsException#ERROR_SERVICE_LOST}
      *
@@ -174,12 +173,10 @@
             if (returnCode != MbmsException.SUCCESS) {
                 throw new MbmsException(returnCode);
             }
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             Log.w(LOG_TAG, "Remote process died");
             mService = null;
             throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-        } catch (RemoteException e) {
-            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
         }
     }
 
@@ -191,7 +188,6 @@
      *
      * May throw an {@link MbmsException} containing any of the following error codes:
      * {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
-     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION}
      * {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
      * {@link MbmsException#ERROR_SERVICE_LOST}
      *
@@ -211,12 +207,10 @@
             if (returnCode != MbmsException.SUCCESS) {
                 throw new MbmsException(returnCode);
             }
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             Log.w(LOG_TAG, "Remote process died");
             mService = null;
             throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-        } catch (RemoteException e) {
-            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
         }
 
         return new StreamingService(
@@ -280,11 +274,7 @@
             } catch (RemoteException e) {
                 mService = null;
                 Log.e(LOG_TAG, "Service died before initialization");
-                if (e instanceof DeadObjectException) {
-                    throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-                } else {
-                    throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
-                }
+                throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
             }
         }
     }
diff --git a/telephony/java/android/telephony/mbms/MbmsException.java b/telephony/java/android/telephony/mbms/MbmsException.java
index ac14c4f..6b90592 100644
--- a/telephony/java/android/telephony/mbms/MbmsException.java
+++ b/telephony/java/android/telephony/mbms/MbmsException.java
@@ -22,7 +22,7 @@
     public static final int ERROR_NO_SERVICE_INSTALLED = 1;
     public static final int ERROR_MULTIPLE_SERVICES_INSTALLED = 2;
     public static final int ERROR_BIND_TIMEOUT_OR_FAILURE = 3;
-    public static final int ERROR_UNKNOWN_REMOTE_EXCEPTION = 4;
+    public static final int ERROR_UNABLE_TO_INITIALIZE = 4;
     public static final int ERROR_ALREADY_INITIALIZED = 5;
     public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 6;
     public static final int ERROR_MIDDLEWARE_NOT_BOUND = 7;
@@ -30,6 +30,12 @@
     public static final int ERROR_STREAM_ALREADY_STARTED = 9;
     public static final int ERROR_END_OF_SESSION = 10;
     public static final int ERROR_SERVICE_LOST = 11;
+    public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 12;
+    public static final int ERROR_IN_E911 = 13;
+    public static final int ERROR_OUT_OF_MEMORY = 14;
+    public static final int ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE = 15;
+    public static final int ERROR_UNABLE_TO_READ_SIM = 16;
+    public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 17;
 
     private final int mErrorCode;
 
diff --git a/telephony/java/android/telephony/mbms/StreamingService.java b/telephony/java/android/telephony/mbms/StreamingService.java
index 745cb98..85ba625 100644
--- a/telephony/java/android/telephony/mbms/StreamingService.java
+++ b/telephony/java/android/telephony/mbms/StreamingService.java
@@ -55,8 +55,7 @@
     /**
      * Retreive the Uri used to play this stream.
      *
-     * This may throw a {@link MbmsException} with the error codes
-     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION} or
+     * This may throw a {@link MbmsException} with the error code
      * {@link MbmsException#ERROR_SERVICE_LOST}
      *
      * @return The {@link Uri} to pass to the streaming client.
@@ -68,13 +67,10 @@
 
         try {
             return mService.getPlaybackUri(mAppName, mSubscriptionId, mServiceInfo.getServiceId());
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             Log.w(LOG_TAG, "Remote process died");
             mService = null;
             throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-        } catch (RemoteException e) {
-            Log.w(LOG_TAG, "Caught remote exception calling getPlaybackUri: " + e);
-            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
         }
     }
 
@@ -88,7 +84,6 @@
     /**
      * Stop streaming this service.
      * This may throw a {@link MbmsException} with the error code
-     * {@link MbmsException#ERROR_UNKNOWN_REMOTE_EXCEPTION} or
      * {@link MbmsException#ERROR_SERVICE_LOST}
      */
     public void stopStreaming() throws MbmsException {
@@ -98,13 +93,10 @@
 
         try {
             mService.stopStreaming(mAppName, mSubscriptionId, mServiceInfo.getServiceId());
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             Log.w(LOG_TAG, "Remote process died");
             mService = null;
             throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-        } catch (RemoteException e) {
-            Log.w(LOG_TAG, "Caught remote exception calling stopStreaming: " + e);
-            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
         }
     }
 
@@ -115,13 +107,10 @@
 
         try {
             mService.disposeStream(mAppName, mSubscriptionId, mServiceInfo.getServiceId());
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             Log.w(LOG_TAG, "Remote process died");
             mService = null;
             throw new MbmsException(MbmsException.ERROR_SERVICE_LOST);
-        } catch (RemoteException e) {
-            Log.w(LOG_TAG, "Caught remote exception calling dispose: " + e);
-            throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
         }
     }
 }