diff options
author | 2020-10-06 11:18:09 -0600 | |
---|---|---|
committer | 2020-10-06 11:18:09 -0600 | |
commit | 2d2e07e2ff43a13bf039fa755e5069849b5a8c51 (patch) | |
tree | 19ac12f8732b1ed31cfef385391f24d2aa20c72e /services/restrictions | |
parent | a3e52bf4e492786d3937d8926ea447e310f6ec98 (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 'services/restrictions')
-rw-r--r-- | services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java b/services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java index 946d28ee3210..62dbd89c48cb 100644 --- a/services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java +++ b/services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java @@ -76,7 +76,7 @@ public final class RestrictionsManagerService extends SystemService { public boolean hasRestrictionsProvider() throws RemoteException { int userHandle = UserHandle.getCallingUserId(); if (mDpm != null) { - long ident = Binder.clearCallingIdentity(); + final long ident = Binder.clearCallingIdentity(); try { return mDpm.getRestrictionsProvider(userHandle) != null; } finally { @@ -97,7 +97,7 @@ public final class RestrictionsManagerService extends SystemService { int callingUid = Binder.getCallingUid(); int userHandle = UserHandle.getUserId(callingUid); if (mDpm != null) { - long ident = Binder.clearCallingIdentity(); + final long ident = Binder.clearCallingIdentity(); try { ComponentName restrictionsProvider = mDpm.getRestrictionsProvider(userHandle); @@ -130,7 +130,7 @@ public final class RestrictionsManagerService extends SystemService { } final int userHandle = UserHandle.getCallingUserId(); if (mDpm != null) { - long ident = Binder.clearCallingIdentity(); + final long ident = Binder.clearCallingIdentity(); try { ComponentName restrictionsProvider = mDpm.getRestrictionsProvider(userHandle); @@ -163,7 +163,7 @@ public final class RestrictionsManagerService extends SystemService { int callingUid = Binder.getCallingUid(); int userHandle = UserHandle.getUserId(callingUid); if (mDpm != null) { - long ident = Binder.clearCallingIdentity(); + final long ident = Binder.clearCallingIdentity(); try { ComponentName permProvider = mDpm.getRestrictionsProvider(userHandle); if (permProvider == null) { |