Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e7057cc authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Add new error codes in MbmsException"

parents 725e212d 80a8687a
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -156,7 +156,6 @@ public class MbmsStreamingManager {
     *
     * 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 @@ public class MbmsStreamingManager {
            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 @@ public class MbmsStreamingManager {
     *
     * 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 @@ public class MbmsStreamingManager {
            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 @@ public class MbmsStreamingManager {
            } 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);
                }
            }
        }
    }
+7 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ public class MbmsException extends Exception {
    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 class MbmsException extends Exception {
    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;

+4 −15
Original line number Diff line number Diff line
@@ -55,8 +55,7 @@ public class StreamingService {
    /**
     * 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 @@ public class StreamingService {

        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 @@ public class StreamingService {
    /**
     * 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 @@ public class StreamingService {

        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 @@ public class StreamingService {

        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);
        }
    }
}