summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2021-06-03 20:05:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-06-03 20:05:50 +0000
commitd6eba76780663cfd84dd8321c7be3da3e8b7a247 (patch)
tree386392945ba90f9f545a5d5b2b2fdd9f8525801f
parent6f61cdcc1dd585e17d963900effb01318d31fc7a (diff)
parent013cb91a69b0da5f1b0f8c66ddbdc972b3436447 (diff)
Merge "Use finally block for Binder.restoreCallingIdentity"
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 992ef2657a65..12a94e199624 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -601,8 +601,12 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
}
// waive WRITE_SECURE_SETTINGS permission check
long callingIdentity = Binder.clearCallingIdentity();
- Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.BLUETOOTH_ON, value);
- Binder.restoreCallingIdentity(callingIdentity);
+ try {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.BLUETOOTH_ON, value);
+ } finally {
+ Binder.restoreCallingIdentity(callingIdentity);
+ }
}
/**