From 17a262fa913088d521bfd3af14baf33d047d93cf Mon Sep 17 00:00:00 2001 From: William Escande <wescande@google.com> Date: Wed, 6 Sep 2023 21:48:54 -0700 Subject: [PATCH] Headset: App exception aren't from SystemServer Calling into IBluetoothHeadset will call the HeadsetService 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: I617c28686fc3af639b2ca980129974633403ff2f --- framework/java/android/bluetooth/BluetoothHeadset.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/java/android/bluetooth/BluetoothHeadset.java b/framework/java/android/bluetooth/BluetoothHeadset.java index 4241fff489f..6a130fb5066 100644 --- a/framework/java/android/bluetooth/BluetoothHeadset.java +++ b/framework/java/android/bluetooth/BluetoothHeadset.java @@ -852,7 +852,7 @@ public final class BluetoothHeadset implements BluetoothProfile { return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); - throw e.rethrowFromSystemServer(); + throw e.rethrowAsRuntimeException(); } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); return BluetoothStatusCodes.ERROR_TIMEOUT; @@ -919,7 +919,7 @@ public final class BluetoothHeadset implements BluetoothProfile { return BluetoothStatusCodes.ERROR_TIMEOUT; } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); - e.rethrowFromSystemServer(); + throw e.rethrowAsRuntimeException(); } } @@ -959,7 +959,7 @@ public final class BluetoothHeadset implements BluetoothProfile { return BluetoothStatusCodes.ERROR_TIMEOUT; } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); - e.rethrowFromSystemServer(); + throw e.rethrowAsRuntimeException(); } } @@ -1044,7 +1044,7 @@ public final class BluetoothHeadset implements BluetoothProfile { return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); - throw e.rethrowFromSystemServer(); + throw e.rethrowAsRuntimeException(); } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); return BluetoothStatusCodes.ERROR_TIMEOUT; @@ -1099,7 +1099,7 @@ public final class BluetoothHeadset implements BluetoothProfile { return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue); } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); - throw e.rethrowFromSystemServer(); + throw e.rethrowAsRuntimeException(); } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); return BluetoothStatusCodes.ERROR_TIMEOUT; -- GitLab