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

Commit 3e6e78b9 authored by Alex Dadukin's avatar Alex Dadukin
Browse files

Rethrow RemoteExceptions from MediaRouter2 instead of logging them

Bug: b/259025372
Test: atest MediaRouter2Test
Change-Id: I90d4197555e37ac5b484b36a594ead4390334e64
parent 7119c3e5
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ public final class MediaRouter2 {
            currentSystemRoutes = mMediaRouterService.getSystemRoutes();
            currentSystemSessionInfo = mMediaRouterService.getSystemSessionInfo();
        } catch (RemoteException ex) {
            Log.e(TAG, "Unable to get current system's routes / session info", ex);
            ex.rethrowFromSystemServer();
        }

        if (currentSystemRoutes == null || currentSystemRoutes.isEmpty()) {
@@ -407,14 +407,14 @@ public final class MediaRouter2 {
                    mMediaRouterService.registerRouter2(stub, mPackageName);
                    mStub = stub;
                } catch (RemoteException ex) {
                    Log.e(TAG, "registerRouteCallback: Unable to register MediaRouter2.", ex);
                    ex.rethrowFromSystemServer();
                }
            }
            if (mStub != null && updateDiscoveryPreferenceIfNeededLocked()) {
                try {
                    mMediaRouterService.setDiscoveryRequestWithRouter2(mStub, mDiscoveryPreference);
                } catch (RemoteException ex) {
                    Log.e(TAG, "registerRouteCallback: Unable to set discovery request.", ex);
                    ex.rethrowFromSystemServer();
                }
            }
        }
@@ -454,7 +454,7 @@ public final class MediaRouter2 {
                try {
                    mMediaRouterService.unregisterRouter2(mStub);
                } catch (RemoteException ex) {
                    Log.e(TAG, "Unable to unregister media router.", ex);
                    ex.rethrowFromSystemServer();
                }
                mStub = null;
            }
@@ -1769,7 +1769,7 @@ public final class MediaRouter2 {
                    try {
                        mMediaRouterService.releaseSessionWithRouter2(mStub, getId());
                    } catch (RemoteException ex) {
                        Log.e(TAG, "Unable to release session", ex);
                        ex.rethrowFromSystemServer();
                    }
                }

@@ -1787,7 +1787,7 @@ public final class MediaRouter2 {
                    try {
                        mMediaRouterService.unregisterRouter2(mStub);
                    } catch (RemoteException ex) {
                        Log.e(TAG, "releaseInternal: Unable to unregister media router.", ex);
                        ex.rethrowFromSystemServer();
                    }
                    mStub = null;
                }
+3 −0
Original line number Diff line number Diff line
@@ -348,6 +348,9 @@ class MediaRouter2ServiceImpl {
            @NonNull String uniqueSessionId, int volume) {
        Objects.requireNonNull(router, "router must not be null");
        Objects.requireNonNull(uniqueSessionId, "uniqueSessionId must not be null");
        if (TextUtils.isEmpty(uniqueSessionId)) {
            throw new IllegalArgumentException("uniqueSessionId must not be empty");
        }

        final long token = Binder.clearCallingIdentity();
        try {