diff options
Diffstat (limited to 'framework/java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothUtils.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothUtils.java b/framework/java/android/bluetooth/BluetoothUtils.java index 2665af1bac..c7aff6aa44 100644 --- a/framework/java/android/bluetooth/BluetoothUtils.java +++ b/framework/java/android/bluetooth/BluetoothUtils.java @@ -346,6 +346,22 @@ public final class BluetoothUtils { } } + /** A {@link Runnable} that automatically logs {@link RemoteException} @hide */ + @FunctionalInterface + public interface RemoteExceptionIgnoringRunnable { + /** Called by {@code accept}. */ + void runOrThrow() throws RemoteException; + + @RequiresNoPermission + default void run() { + try { + runOrThrow(); + } catch (RemoteException ex) { + logRemoteException(TAG, ex); + } + } + } + /** A {@link Consumer} that automatically logs {@link RemoteException} @hide */ @FunctionalInterface public interface RemoteExceptionIgnoringConsumer<T> { |