summaryrefslogtreecommitdiff
path: root/telephony/common/com
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2020-10-06 11:18:09 -0600
committerJeff Sharkey <jsharkey@android.com>2020-10-06 11:18:09 -0600
commit2d2e07e2ff43a13bf039fa755e5069849b5a8c51 (patch)
tree19ac12f8732b1ed31cfef385391f24d2aa20c72e /telephony/common/com
parenta3e52bf4e492786d3937d8926ea447e310f6ec98 (diff)
Tighten up Binder.clearCallingIdentity() usage.
The recently added AndroidFrameworkBinderIdentity Error Prone checker examines code to ensure that any cleared identities are restored to avoid obscure security vulnerabilities. This change is a purely mechanical refactoring that adds the "final" keyword to the cleared identity to ensure that it's not accidentally modified before eventually being cleared. Here's the exact command used to generate this CL: $ find . -name "*.java" -exec sed -Ei \ 's/ (long \w+ = .+?clearCallingIdentity)/ final \1/' \ {} \; Bug: 155703208 Test: make Exempt-From-Owner-Approval: trivial refactoring Change-Id: I832c9d70c3dfcd8d669cf71939d97837becc973a
Diffstat (limited to 'telephony/common/com')
-rw-r--r--telephony/common/com/android/internal/telephony/util/TelephonyUtils.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
index 7736473feafb..b8ca3267cf9e 100644
--- a/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
+++ b/telephony/common/com/android/internal/telephony/util/TelephonyUtils.java
@@ -96,7 +96,7 @@ public final class TelephonyUtils {
*/
public static void runWithCleanCallingIdentity(
@NonNull Runnable action) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
action.run();
} finally {
@@ -115,7 +115,7 @@ public final class TelephonyUtils {
*/
public static <T> T runWithCleanCallingIdentity(
@NonNull Supplier<T> action) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
return action.get();
} finally {