From c927f80dd9f5edcda32c14adc7e1fd8eb70a7b94 Mon Sep 17 00:00:00 2001
From: William Escande <wescande@google.com>
Date: Wed, 6 Sep 2023 21:52:09 -0700
Subject: [PATCH] LeAudio: App exception aren't from SystemServer

Calling into IBluetoothLeAudio will call the LeAudioService from
Bluetooth app that does not live in the systemServer.
Therefore, exception should be rethrown as runtimeException

Bug: 298264617
Test: atest CtsBluetoothTestCases | Cts does not handled failure in the
      binder nor any of the Test framework we currently have
Change-Id: Idfb7ae662fcadf33358bfd728554fcdb25e92a4c
---
 framework/java/android/bluetooth/BluetoothLeAudio.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/framework/java/android/bluetooth/BluetoothLeAudio.java b/framework/java/android/bluetooth/BluetoothLeAudio.java
index 1f749be4eb9..ce0cd1023d0 100644
--- a/framework/java/android/bluetooth/BluetoothLeAudio.java
+++ b/framework/java/android/bluetooth/BluetoothLeAudio.java
@@ -961,7 +961,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                 } catch (TimeoutException e) {
                     Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
                 } catch (RemoteException e) {
-                    throw e.rethrowFromSystemServer();
+                    throw e.rethrowAsRuntimeException();
                 }
             }
 
@@ -1013,7 +1013,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
             } catch (TimeoutException e) {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
             } catch (RemoteException e) {
-                throw e.rethrowFromSystemServer();
+                throw e.rethrowAsRuntimeException();
             }
         }
     }
@@ -1281,7 +1281,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
             } catch (RemoteException e) {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
-                e.rethrowFromSystemServer();
+                throw e.rethrowAsRuntimeException();
             }
         }
         return defaultValue;
@@ -1432,7 +1432,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
             } catch (RemoteException e) {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
-                e.rethrowFromSystemServer();
+                throw e.rethrowAsRuntimeException();
             }
         }
         return defaultValue;
@@ -1474,7 +1474,7 @@ public final class BluetoothLeAudio implements BluetoothProfile, AutoCloseable {
                                         mAttributionSource);
             } catch (RemoteException e) {
                 Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
-                e.rethrowFromSystemServer();
+                throw e.rethrowAsRuntimeException();
             }
         }
     }
-- 
GitLab