diff options
author | 2024-11-21 19:08:30 -0800 | |
---|---|---|
committer | 2024-11-22 21:25:57 +0000 | |
commit | c5f070d68f30f04745c85c23753b229e1ed0ccfb (patch) | |
tree | 08c8bc54e325a5a98f1725f3ecf3c3551bdf487e | |
parent | 5fc26449f4f04407de25a6d548dc30549182fb21 (diff) |
clear binder identity before executing on executor
Bug: 370815283
Test: m .
Flag: com.android.bluetooth.flags.get_profile_use_lock
Change-Id: Ib1efe9e1ae2ddfab179058d1691ffe37746669cb
-rw-r--r-- | framework/java/android/bluetooth/BluetoothUtils.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/framework/java/android/bluetooth/BluetoothUtils.java b/framework/java/android/bluetooth/BluetoothUtils.java index d7a09929f0..b734ff2fef 100644 --- a/framework/java/android/bluetooth/BluetoothUtils.java +++ b/framework/java/android/bluetooth/BluetoothUtils.java @@ -338,15 +338,12 @@ public final class BluetoothUtils { * @hide */ public static void executeFromBinder(@NonNull Executor executor, @NonNull Runnable callback) { - executor.execute( - () -> { - final long identity = Binder.clearCallingIdentity(); - try { - callback.run(); - } finally { - Binder.restoreCallingIdentity(identity); - } - }); + final long identity = Binder.clearCallingIdentity(); + try { + executor.execute(() -> callback.run()); + } finally { + Binder.restoreCallingIdentity(identity); + } } /** A {@link Consumer} that automatically logs {@link RemoteException} @hide */ |