summaryrefslogtreecommitdiff
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
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
-rw-r--r--apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java14
-rw-r--r--apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java36
-rw-r--r--apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java14
-rw-r--r--apex/statsd/framework/java/android/app/StatsManager.java2
-rw-r--r--core/java/android/app/AppOpsManager.java2
-rw-r--r--core/java/android/app/backup/BackupAgent.java12
-rw-r--r--core/java/android/app/role/RoleControllerManager.java4
-rw-r--r--core/java/android/app/role/RoleManager.java4
-rw-r--r--core/java/android/os/Binder.java4
-rw-r--r--core/java/android/permission/PermissionControllerManager.java8
-rw-r--r--core/java/android/view/accessibility/AccessibilityManager.java2
-rw-r--r--core/java/com/android/internal/util/LocationPermissionChecker.java2
-rw-r--r--errorprone/tests/java/com/google/errorprone/bugpatterns/android/BinderIdentityCheckerTest.java2
-rw-r--r--graphics/java/android/graphics/GraphicsStatsService.java4
-rw-r--r--media/java/android/media/midi/MidiDeviceServer.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java42
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilitySecurityPolicy.java2
-rw-r--r--services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java6
-rw-r--r--services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java2
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java4
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java4
-rw-r--r--services/backup/java/com/android/server/backup/UserBackupManagerService.java20
-rw-r--r--services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java8
-rw-r--r--services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java2
-rw-r--r--services/core/java/com/android/server/BatteryService.java6
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java6
-rw-r--r--services/core/java/com/android/server/MmsServiceBroker.java2
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java2
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java8
-rw-r--r--services/core/java/com/android/server/UpdateLockService.java2
-rw-r--r--services/core/java/com/android/server/VibratorService.java4
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java106
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java24
-rw-r--r--services/core/java/com/android/server/am/AppErrors.java2
-rw-r--r--services/core/java/com/android/server/am/AppExitInfoTracker.java2
-rw-r--r--services/core/java/com/android/server/am/BatteryStatsService.java6
-rw-r--r--services/core/java/com/android/server/am/ContentProviderHelper.java4
-rw-r--r--services/core/java/com/android/server/am/ProcessRecord.java2
-rw-r--r--services/core/java/com/android/server/am/ProcessStatsService.java2
-rw-r--r--services/core/java/com/android/server/am/UserController.java2
-rw-r--r--services/core/java/com/android/server/appop/AppOpsService.java10
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java2
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java10
-rw-r--r--services/core/java/com/android/server/content/ContentService.java38
-rw-r--r--services/core/java/com/android/server/content/SyncManager.java2
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java2
-rw-r--r--services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java2
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java6
-rw-r--r--services/core/java/com/android/server/location/AbstractLocationProvider.java8
-rw-r--r--services/core/java/com/android/server/location/LocationProviderManager.java26
-rw-r--r--services/core/java/com/android/server/location/PassiveLocationProviderManager.java2
-rw-r--r--services/core/java/com/android/server/location/geofence/GeofenceManager.java4
-rw-r--r--services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java4
-rw-r--r--services/core/java/com/android/server/location/gnss/GnssLocationProvider.java2
-rw-r--r--services/core/java/com/android/server/location/util/SystemAppForegroundHelper.java2
-rw-r--r--services/core/java/com/android/server/location/util/SystemAppOpsHelper.java10
-rw-r--r--services/core/java/com/android/server/location/util/SystemLocationPermissionsHelper.java2
-rw-r--r--services/core/java/com/android/server/location/util/SystemSettingsHelper.java16
-rw-r--r--services/core/java/com/android/server/location/util/SystemUserInfoHelper.java6
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsService.java6
-rw-r--r--services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java4
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java46
-rw-r--r--services/core/java/com/android/server/notification/NotificationShellCmd.java2
-rw-r--r--services/core/java/com/android/server/notification/ScheduleConditionProvider.java2
-rw-r--r--services/core/java/com/android/server/notification/SnoozeHelper.java2
-rw-r--r--services/core/java/com/android/server/pm/InstantAppResolverConnection.java2
-rw-r--r--services/core/java/com/android/server/pm/LauncherAppsService.java14
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerService.java2
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java20
-rw-r--r--services/core/java/com/android/server/pm/Settings.java2
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java14
-rw-r--r--services/core/java/com/android/server/pm/dex/ArtManagerService.java2
-rw-r--r--services/core/java/com/android/server/pm/dex/ViewCompiler.java2
-rw-r--r--services/core/java/com/android/server/pm/permission/PermissionManagerService.java8
-rw-r--r--services/core/java/com/android/server/role/RoleManagerService.java4
-rw-r--r--services/core/java/com/android/server/search/Searchables.java2
-rw-r--r--services/core/java/com/android/server/slice/SliceManagerService.java6
-rw-r--r--services/core/java/com/android/server/slice/SliceShellCommand.java2
-rw-r--r--services/core/java/com/android/server/stats/pull/StatsPullAtomService.java6
-rw-r--r--services/core/java/com/android/server/statusbar/StatusBarManagerService.java44
-rw-r--r--services/core/java/com/android/server/timedetector/TimeDetectorService.java2
-rw-r--r--services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java6
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java6
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java4
-rw-r--r--services/core/java/com/android/server/webkit/WebViewUpdateService.java6
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java34
-rw-r--r--services/core/java/com/android/server/wm/AppTaskImpl.java6
-rw-r--r--services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java2
-rw-r--r--services/core/java/com/android/server/wm/Session.java16
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java28
-rw-r--r--services/core/java/com/android/server/wm/WindowOrganizerController.java8
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java2
-rw-r--r--services/midi/java/com/android/server/midi/MidiService.java4
-rw-r--r--services/restrictions/java/com/android/server/restrictions/RestrictionsManagerService.java8
-rw-r--r--services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java2
-rw-r--r--services/usb/java/com/android/server/usb/UsbSerialReader.java2
-rw-r--r--services/usb/java/com/android/server/usb/UsbService.java4
-rw-r--r--services/usb/java/com/android/server/usb/UsbUserPermissionManager.java2
-rw-r--r--services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java4
-rw-r--r--services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java4
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java2
-rw-r--r--telecomm/java/android/telecom/DefaultDialerManager.java4
-rw-r--r--telephony/common/android/telephony/LocationAccessPolicy.java2
-rw-r--r--telephony/common/com/android/internal/telephony/util/TelephonyUtils.java4
-rw-r--r--telephony/java/android/telephony/ims/ImsMmTelManager.java2
-rw-r--r--telephony/java/android/telephony/ims/ImsRcsManager.java2
-rw-r--r--telephony/java/android/telephony/ims/ProvisioningManager.java4
-rw-r--r--telephony/java/android/telephony/ims/RcsUceAdapter.java6
-rw-r--r--telephony/java/android/telephony/ims/RegistrationManager.java10
-rw-r--r--telephony/java/android/telephony/mbms/InternalDownloadProgressListener.java2
-rw-r--r--telephony/java/android/telephony/mbms/InternalDownloadSessionCallback.java6
-rw-r--r--telephony/java/android/telephony/mbms/InternalDownloadStatusListener.java2
-rw-r--r--telephony/java/android/telephony/mbms/InternalGroupCallCallback.java6
-rw-r--r--telephony/java/android/telephony/mbms/InternalGroupCallSessionCallback.java8
-rw-r--r--telephony/java/android/telephony/mbms/InternalStreamingServiceCallback.java10
-rw-r--r--telephony/java/android/telephony/mbms/InternalStreamingSessionCallback.java6
116 files changed, 477 insertions, 477 deletions
diff --git a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
index 75fad82d3fff..d6b6077a187f 100644
--- a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
+++ b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java
@@ -66,7 +66,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
SchemaProto schema = SchemaProto.parseFrom(schemaBytes);
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
@@ -88,7 +88,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
String databaseName = makeDatabaseName(callingUid);
@@ -119,7 +119,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
String databaseName = makeDatabaseName(callingUid);
@@ -161,7 +161,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
SearchSpecProto searchSpecProto = SearchSpecProto.parseFrom(searchSpecBytes);
ResultSpecProto resultSpecProto = ResultSpecProto.parseFrom(resultSpecBytes);
@@ -194,7 +194,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
String databaseName = makeDatabaseName(callingUid);
@@ -224,7 +224,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
String databaseName = makeDatabaseName(callingUid);
@@ -252,7 +252,7 @@ public class AppSearchManagerService extends SystemService {
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
int callingUserId = UserHandle.getUserId(callingUid);
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
String databaseName = makeDatabaseName(callingUid);
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
index 59915e145c49..1a81587990f2 100644
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
@@ -1682,7 +1682,7 @@ public class DeviceIdleController extends SystemService
}
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return addPowerSaveWhitelistAppsInternal(packageNames);
} finally {
@@ -1696,7 +1696,7 @@ public class DeviceIdleController extends SystemService
}
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (!removePowerSaveWhitelistAppInternal(name)
&& mPowerSaveWhitelistAppsExceptIdle.containsKey(name)) {
@@ -1713,7 +1713,7 @@ public class DeviceIdleController extends SystemService
}
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
removeSystemPowerWhitelistAppInternal(name);
} finally {
@@ -1727,7 +1727,7 @@ public class DeviceIdleController extends SystemService
}
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
restoreSystemPowerWhitelistAppInternal(name);
} finally {
@@ -1815,7 +1815,7 @@ public class DeviceIdleController extends SystemService
@Override public void exitIdle(String reason) {
getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
exitIdleInternal(reason);
} finally {
@@ -1826,7 +1826,7 @@ public class DeviceIdleController extends SystemService
@Override public int setPreIdleTimeoutMode(int mode) {
getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return DeviceIdleController.this.setPreIdleTimeoutMode(mode);
} finally {
@@ -1837,7 +1837,7 @@ public class DeviceIdleController extends SystemService
@Override public void resetPreIdleTimeoutMode() {
getContext().enforceCallingOrSelfPermission(Manifest.permission.DEVICE_POWER,
null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
DeviceIdleController.this.resetPreIdleTimeoutMode();
} finally {
@@ -4031,7 +4031,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
String arg = shell.getNextArg();
try {
if (arg == null || "deep".equals(arg)) {
@@ -4052,7 +4052,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
String arg = shell.getNextArg();
try {
if (arg == null || "deep".equals(arg)) {
@@ -4100,7 +4100,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mForceIdle = true;
becomeInactiveIfAppropriateLocked();
@@ -4116,7 +4116,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
exitForceIdleLocked();
pw.print("Light state: ");
@@ -4133,7 +4133,7 @@ public class DeviceIdleController extends SystemService
synchronized (this) {
String arg = shell.getNextArg();
if (arg != null) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
switch (arg) {
case "light": pw.println(lightStateToString(mLightState)); break;
@@ -4156,7 +4156,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
String arg = shell.getNextArg();
try {
boolean becomeActive = false;
@@ -4193,7 +4193,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
String arg = shell.getNextArg();
try {
boolean becomeInactive = false;
@@ -4242,7 +4242,7 @@ public class DeviceIdleController extends SystemService
if (arg != null) {
getContext().enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
do {
if (arg.length() < 1 || (arg.charAt(0) != '-'
@@ -4418,7 +4418,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
motionLocked();
pw.print("Light state: ");
@@ -4433,7 +4433,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
int ret = SET_IDLE_FACTOR_RESULT_UNINIT;
try {
String arg = shell.getNextArg();
@@ -4468,7 +4468,7 @@ public class DeviceIdleController extends SystemService
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
synchronized (this) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
resetPreIdleTimeoutMode();
} finally {
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index 4512d77e650e..6c14233dba13 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -2673,7 +2673,7 @@ public class JobSchedulerService extends com.android.server.SystemService
validateJobFlags(job, uid);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return JobSchedulerService.this.scheduleAsPackage(job, null, uid, null, userId,
null);
@@ -2701,7 +2701,7 @@ public class JobSchedulerService extends com.android.server.SystemService
validateJobFlags(job, uid);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return JobSchedulerService.this.scheduleAsPackage(job, work, uid, null, userId,
null);
@@ -2732,7 +2732,7 @@ public class JobSchedulerService extends com.android.server.SystemService
validateJobFlags(job, callerUid);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return JobSchedulerService.this.scheduleAsPackage(job, null, callerUid,
packageName, userId, tag);
@@ -2745,7 +2745,7 @@ public class JobSchedulerService extends com.android.server.SystemService
public ParceledListSlice<JobInfo> getAllPendingJobs() throws RemoteException {
final int uid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return new ParceledListSlice<>(JobSchedulerService.this.getPendingJobs(uid));
} finally {
@@ -2757,7 +2757,7 @@ public class JobSchedulerService extends com.android.server.SystemService
public JobInfo getPendingJob(int jobId) throws RemoteException {
final int uid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return JobSchedulerService.this.getPendingJob(uid, jobId);
} finally {
@@ -2768,7 +2768,7 @@ public class JobSchedulerService extends com.android.server.SystemService
@Override
public void cancelAll() throws RemoteException {
final int uid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
JobSchedulerService.this.cancelJobsForUid(uid,
"cancelAll() called by app, callingUid=" + uid);
@@ -2781,7 +2781,7 @@ public class JobSchedulerService extends com.android.server.SystemService
public void cancel(int jobId) throws RemoteException {
final int uid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
JobSchedulerService.this.cancelJob(uid, jobId, uid);
} finally {
diff --git a/apex/statsd/framework/java/android/app/StatsManager.java b/apex/statsd/framework/java/android/app/StatsManager.java
index a7d20572ca96..41803cfd6960 100644
--- a/apex/statsd/framework/java/android/app/StatsManager.java
+++ b/apex/statsd/framework/java/android/app/StatsManager.java
@@ -547,7 +547,7 @@ public final class StatsManager {
@Override
public void onPullAtom(int atomTag, IPullAtomResultReceiver resultReceiver) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> {
List<StatsEvent> data = new ArrayList<>();
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index ef4f099f441d..a8cd9aac39b1 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -8477,7 +8477,7 @@ public class AppOpsManager {
public void opNoted(AsyncNotedAppOp op) {
Objects.requireNonNull(op);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
getAsyncNotedExecutor().execute(() -> onAsyncNoted(op));
} finally {
diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java
index 056cfc7c28f1..a62459523c83 100644
--- a/core/java/android/app/backup/BackupAgent.java
+++ b/core/java/android/app/backup/BackupAgent.java
@@ -1055,7 +1055,7 @@ public abstract class BackupAgent extends ContextWrapper {
IBackupCallback callbackBinder,
int transportFlags) throws RemoteException {
// Ensure that we're running with the app's normal permission level
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
if (DEBUG) Log.v(TAG, "doBackup() invoked");
BackupDataOutput output = new BackupDataOutput(
@@ -1112,7 +1112,7 @@ public abstract class BackupAgent extends ContextWrapper {
ParcelFileDescriptor newState, int token, IBackupManager callbackBinder,
List<String> excludedKeys) throws RemoteException {
// Ensure that we're running with the app's normal permission level
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
if (DEBUG) Log.v(TAG, "doRestore() invoked");
@@ -1153,7 +1153,7 @@ public abstract class BackupAgent extends ContextWrapper {
public void doFullBackup(ParcelFileDescriptor data,
long quotaBytes, int token, IBackupManager callbackBinder, int transportFlags) {
// Ensure that we're running with the app's normal permission level
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
if (DEBUG) Log.v(TAG, "doFullBackup() invoked");
@@ -1228,7 +1228,7 @@ public abstract class BackupAgent extends ContextWrapper {
public void doRestoreFile(ParcelFileDescriptor data, long size,
int type, String domain, String path, long mode, long mtime,
int token, IBackupManager callbackBinder) throws RemoteException {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
BackupAgent.this.onRestoreFile(data, size, type, domain, path, mode, mtime);
} catch (IOException e) {
@@ -1255,7 +1255,7 @@ public abstract class BackupAgent extends ContextWrapper {
@Override
public void doRestoreFinished(int token, IBackupManager callbackBinder) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
BackupAgent.this.onRestoreFinished();
} catch (Exception e) {
@@ -1284,7 +1284,7 @@ public abstract class BackupAgent extends ContextWrapper {
long backupDataBytes,
long quotaBytes,
IBackupCallback callbackBinder) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
long result = RESULT_ERROR;
try {
diff --git a/core/java/android/app/role/RoleControllerManager.java b/core/java/android/app/role/RoleControllerManager.java
index 96a4debd3d6a..8dde2c55d7d3 100644
--- a/core/java/android/app/role/RoleControllerManager.java
+++ b/core/java/android/app/role/RoleControllerManager.java
@@ -258,7 +258,7 @@ public class RoleControllerManager {
Consumer<Boolean> destination) {
operation.orTimeout(REQUEST_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.whenComplete((res, err) -> executor.execute(() -> {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (err != null) {
Log.e(LOG_TAG, "Error calling " + opName + "()", err);
@@ -276,7 +276,7 @@ public class RoleControllerManager {
RemoteCallback destination) {
operation.orTimeout(REQUEST_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
.whenComplete((res, err) -> {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (err != null) {
Log.e(LOG_TAG, "Error calling " + opName + "()", err);
diff --git a/core/java/android/app/role/RoleManager.java b/core/java/android/app/role/RoleManager.java
index 87e1df3fb234..82159235ae28 100644
--- a/core/java/android/app/role/RoleManager.java
+++ b/core/java/android/app/role/RoleManager.java
@@ -413,7 +413,7 @@ public final class RoleManager {
@NonNull Consumer<Boolean> callback) {
return new RemoteCallback(result -> executor.execute(() -> {
boolean successful = result != null;
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
callback.accept(successful);
} finally {
@@ -660,7 +660,7 @@ public final class RoleManager {
@Override
public void onRoleHoldersChanged(@NonNull String roleName, @UserIdInt int userId) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(PooledLambda.obtainRunnable(
OnRoleHoldersChangedListener::onRoleHoldersChanged, mListener, roleName,
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index bec96f98dbcd..b737c9f49c18 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -391,7 +391,7 @@ public class Binder implements IBinder {
* @hide
*/
public static final void withCleanCallingIdentity(@NonNull ThrowingRunnable action) {
- long callingIdentity = clearCallingIdentity();
+ final long callingIdentity = clearCallingIdentity();
Throwable throwableToPropagate = null;
try {
action.runOrThrow();
@@ -415,7 +415,7 @@ public class Binder implements IBinder {
* @hide
*/
public static final <T> T withCleanCallingIdentity(@NonNull ThrowingSupplier<T> action) {
- long callingIdentity = clearCallingIdentity();
+ final long callingIdentity = clearCallingIdentity();
Throwable throwableToPropagate = null;
try {
return action.getOrThrow();
diff --git a/core/java/android/permission/PermissionControllerManager.java b/core/java/android/permission/PermissionControllerManager.java
index 17a78a8f301e..d6c95db95e85 100644
--- a/core/java/android/permission/PermissionControllerManager.java
+++ b/core/java/android/permission/PermissionControllerManager.java
@@ -308,7 +308,7 @@ public final class PermissionControllerManager {
revokeRuntimePermissionsResult);
return revokeRuntimePermissionsResult;
}).whenCompleteAsync((revoked, err) -> {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (err != null) {
Log.e(TAG, "Failure when revoking runtime permissions " + revoked, err);
@@ -358,7 +358,7 @@ public final class PermissionControllerManager {
setRuntimePermissionGrantStateResult);
return setRuntimePermissionGrantStateResult;
}).whenCompleteAsync((setRuntimePermissionGrantStateResult, err) -> {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (err != null) {
Log.e(TAG, "Error setting permissions state for device admin " + packageName,
@@ -477,7 +477,7 @@ public final class PermissionControllerManager {
applyStagedRuntimePermissionBackupResult);
return applyStagedRuntimePermissionBackupResult;
}).whenCompleteAsync((applyStagedRuntimePermissionBackupResult, err) -> {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (err != null) {
Log.e(TAG, "Error restoring delayed permissions for " + packageName, err);
@@ -623,7 +623,7 @@ public final class PermissionControllerManager {
Log.e(TAG, "Error getting permission usages", err);
callback.onPermissionUsageResult(Collections.emptyList());
} else {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
callback.onPermissionUsageResult(
CollectionUtils.emptyIfNull(getPermissionUsagesResult));
diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java
index 16f35ad8c24c..aed9b89747d0 100644
--- a/core/java/android/view/accessibility/AccessibilityManager.java
+++ b/core/java/android/view/accessibility/AccessibilityManager.java
@@ -606,7 +606,7 @@ public final class AccessibilityManager {
// it is possible that this manager is in the same process as the service but
// client using it is called through Binder from another process. Example: MMS
// app adds a SMS notification and the NotificationManagerService calls this method
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
try {
service.sendAccessibilityEvent(dispatchedEvent, userId);
} finally {
diff --git a/core/java/com/android/internal/util/LocationPermissionChecker.java b/core/java/com/android/internal/util/LocationPermissionChecker.java
index cd8fc350362d..59c0c0009640 100644
--- a/core/java/com/android/internal/util/LocationPermissionChecker.java
+++ b/core/java/com/android/internal/util/LocationPermissionChecker.java
@@ -218,7 +218,7 @@ public class LocationPermissionChecker {
}
private boolean isTargetSdkLessThan(String packageName, int versionCode, int callingUid) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (mContext.getPackageManager().getApplicationInfoAsUser(
packageName, 0,
diff --git a/errorprone/tests/java/com/google/errorprone/bugpatterns/android/BinderIdentityCheckerTest.java b/errorprone/tests/java/com/google/errorprone/bugpatterns/android/BinderIdentityCheckerTest.java
index 9448344f7abb..a009d578039b 100644
--- a/errorprone/tests/java/com/google/errorprone/bugpatterns/android/BinderIdentityCheckerTest.java
+++ b/errorprone/tests/java/com/google/errorprone/bugpatterns/android/BinderIdentityCheckerTest.java
@@ -89,7 +89,7 @@ public class BinderIdentityCheckerTest {
" }",
" void noFinal() {",
" // BUG: Diagnostic contains:",
- " long token = Binder.clearCallingIdentity();",
+ " final long token = Binder.clearCallingIdentity();",
" try {",
" FooService.class.toString();",
" } finally {",
diff --git a/graphics/java/android/graphics/GraphicsStatsService.java b/graphics/java/android/graphics/GraphicsStatsService.java
index 2d6848b618a1..dc785c5b0309 100644
--- a/graphics/java/android/graphics/GraphicsStatsService.java
+++ b/graphics/java/android/graphics/GraphicsStatsService.java
@@ -175,7 +175,7 @@ public class GraphicsStatsService extends IGraphicsStats.Stub {
int uid = Binder.getCallingUid();
int pid = Binder.getCallingPid();
ParcelFileDescriptor pfd = null;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mAppOps.checkPackage(uid, packageName);
PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(
@@ -214,7 +214,7 @@ public class GraphicsStatsService extends IGraphicsStats.Stub {
}
}
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
pullGraphicsStatsImpl(lastFullDay, pulledData);
} finally {
diff --git a/media/java/android/media/midi/MidiDeviceServer.java b/media/java/android/media/midi/MidiDeviceServer.java
index 51d552066bc6..e0fcc67218d4 100644
--- a/media/java/android/media/midi/MidiDeviceServer.java
+++ b/media/java/android/media/midi/MidiDeviceServer.java
@@ -384,7 +384,7 @@ public final class MidiDeviceServer implements Closeable {
private void updateDeviceStatus() {
// clear calling identity, since we may be in a Binder call from one of our clients
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
MidiDeviceStatus status = new MidiDeviceStatus(mDeviceInfo, mInputPortOpen,
mOutputPortOpenCount);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
index 3b0415b31eb5..5279a20a67a7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java
@@ -168,7 +168,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("startScreenPinning")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> {
mStatusBarOptionalLazy.ifPresent(
@@ -185,7 +185,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("stopScreenPinning")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> {
try {
@@ -205,7 +205,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("onStatusBarMotionEvent")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
// TODO move this logic to message queue
mStatusBarOptionalLazy.ifPresent(statusBarLazy -> {
@@ -240,7 +240,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("onOverviewShown")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> {
for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
@@ -257,7 +257,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("getNonMinimizedSplitScreenSecondaryBounds")) {
return null;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
return mSplitScreenOptional.map(splitScreen ->
splitScreen.getDividerView().getNonMinimizedSplitScreenSecondaryBounds())
@@ -272,7 +272,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("setNavBarButtonAlpha")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mNavBarButtonAlpha = alpha;
mHandler.post(() -> notifyNavBarButtonAlphaChanged(alpha, animate));
@@ -291,7 +291,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("onAssistantProgress")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> notifyAssistantProgress(progress));
} finally {
@@ -304,7 +304,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("onAssistantGestureCompletion")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> notifyAssistantGestureCompletion(velocity));
} finally {
@@ -317,7 +317,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("startAssistant")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> notifyStartAssistant(bundle));
} finally {
@@ -330,7 +330,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("monitorGestureInput")) {
return null;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
final InputMonitor monitor =
InputManager.getInstance().monitorGestureInput(name, displayId);
@@ -348,7 +348,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("notifyAccessibilityButtonClicked")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
AccessibilityManager.getInstance(mContext)
.notifyAccessibilityButtonClicked(displayId);
@@ -362,7 +362,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("notifyAccessibilityButtonLongClicked")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
final Intent intent =
new Intent(AccessibilityManager.ACTION_CHOOSE_ACCESSIBILITY_BUTTON);
@@ -382,7 +382,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
"ByPass setShelfHeight, FEATURE_PICTURE_IN_PICTURE:" + mHasPipFeature);
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mPipOptional.ifPresent(
pip -> pip.setShelfHeight(visible, shelfHeight));
@@ -410,7 +410,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
+ mHasPipFeature);
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mPipOptional.ifPresent(
pip -> pip.setPinnedStackAnimationType(
@@ -428,7 +428,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
return;
}
mIPinnedStackAnimationListener = listener;
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mPipOptional.ifPresent(
pip -> pip.setPinnedStackAnimationListener(mPinnedStackAnimationCallback));
@@ -442,7 +442,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("onQuickSwitchToNewTask")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mHandler.post(() -> notifyQuickSwitchToNewTask(rotation));
} finally {
@@ -455,7 +455,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("startOneHandedMode")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mOneHandedOptional.ifPresent(oneHanded -> oneHanded.startOneHanded());
} finally {
@@ -468,7 +468,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("stopOneHandedMode")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mOneHandedOptional.ifPresent(oneHanded -> oneHanded.stopOneHanded(
OneHandedEvents.EVENT_ONE_HANDED_TRIGGER_GESTURE_OUT));
@@ -497,7 +497,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("expandNotificationPanel")) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mCommandQueue.handleSystemKey(KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN);
} finally {
@@ -512,7 +512,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("startSwipePipToHome") || !mHasPipFeature) {
return null;
}
- long binderToken = Binder.clearCallingIdentity();
+ final long binderToken = Binder.clearCallingIdentity();
try {
return mPipOptional.map(pip ->
pip.startSwipePipToHome(componentName, activityInfo,
@@ -528,7 +528,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
if (!verifyCaller("stopSwipePipToHome") || !mHasPipFeature) {
return;
}
- long binderToken = Binder.clearCallingIdentity();
+ final long binderToken = Binder.clearCallingIdentity();
try {
mPipOptional.ifPresent(pip -> pip.stopSwipePipToHome(
componentName, destinationBounds));
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilitySecurityPolicy.java b/services/accessibility/java/com/android/server/accessibility/AccessibilitySecurityPolicy.java
index 41f32075fb77..d7664312e2e6 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilitySecurityPolicy.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilitySecurityPolicy.java
@@ -456,7 +456,7 @@ public class AccessibilitySecurityPolicy {
}
private boolean isShellAllowedToRetrieveWindowLocked(int userId, int windowId) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
IBinder windowToken = mAccessibilityWindowManager
.getWindowTokenForUserAndWindowIdLocked(userId, windowId);
diff --git a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
index 96418aac7ffa..c9ec16edc54e 100644
--- a/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
+++ b/services/accessibility/java/com/android/server/accessibility/FingerprintGestureDispatcher.java
@@ -118,7 +118,7 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
public boolean isFingerprintGestureDetectionAvailable() {
if (!mHardwareSupportsGestures) return false;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return !mFingerprintService.isClientActive();
} catch (RemoteException re) {
@@ -173,7 +173,7 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
@Override
public boolean handleMessage(Message message) {
if (message.what == MSG_REGISTER) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mFingerprintService.addClientActiveCallback(this);
mRegisteredReadOnlyExceptInHandler = true;
@@ -184,7 +184,7 @@ public class FingerprintGestureDispatcher extends IFingerprintClientActiveCallba
}
return false;
} else if (message.what == MSG_UNREGISTER) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mFingerprintService.removeClientActiveCallback(this);
} catch (RemoteException re) {
diff --git a/services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java b/services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java
index 59ba82e4616a..e9a099ae43a9 100644
--- a/services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java
+++ b/services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java
@@ -189,7 +189,7 @@ public class AppPredictionManagerService extends
throw new SecurityException(msg);
}
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
final AppPredictionPerUserService service = getServiceForUserLocked(userId);
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 060d0971e391..824653d93bca 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -2408,7 +2408,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
intent.setComponent(provider.info.provider);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
provider.broadcast = PendingIntent.getBroadcastAsUser(mContext, 1, intent,
PendingIntent.FLAG_UPDATE_CURRENT, provider.info.getProfile());
@@ -3616,7 +3616,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
}
private boolean isProfileWithLockedParent(int userId) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
UserInfo userInfo = mUserManager.getUserInfo(userId);
if (userInfo != null && userInfo.isManagedProfile()) {
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 186812bc15c7..81f4798aa860 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -478,7 +478,7 @@ public class BackupManagerService extends IBackupManager.Stub {
if (getUserManager().isUserUnlocked(userId)) {
// Clear calling identity as initialization enforces the system identity but we
// can be coming from shell.
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
startServiceForUser(userId);
} finally {
@@ -1412,7 +1412,7 @@ public class BackupManagerService extends IBackupManager.Stub {
return null;
}
int callingUserId = Binder.getCallingUserHandle().getIdentifier();
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
final int[] userIds;
try {
userIds = getUserManager().getProfileIds(callingUserId, false);
diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
index e68c07ed73f7..b6659cb31128 100644
--- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
@@ -2889,7 +2889,7 @@ public class UserBackupManagerService {
mBackupHandler.sendMessageDelayed(msg, TRANSPORT_RETRY_INTERVAL);
return;
}
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
OnTaskFinishedListener listener =
caller ->
mTransportManager.disposeOfTransportClient(transportClient, caller);
@@ -2910,7 +2910,7 @@ public class UserBackupManagerService {
public void backupNow() {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "backupNow");
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
final PowerSaveState result =
mPowerManager.getPowerSaveState(ServiceType.KEYVALUE_BACKUP);
@@ -2999,7 +2999,7 @@ public class UserBackupManagerService {
}
}
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
if (!mSetupComplete) {
Slog.i(TAG, addUserIdToLogMessage(mUserId, "Backup not supported before setup"));
@@ -3156,7 +3156,7 @@ public class UserBackupManagerService {
throw new IllegalStateException("Restore supported only for the device owner");
}
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
if (!mSetupComplete) {
@@ -3287,7 +3287,7 @@ public class UserBackupManagerService {
mContext.enforceCallingPermission(android.Manifest.permission.BACKUP,
"acknowledgeAdbBackupOrRestore");
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
AdbParams params;
@@ -3348,7 +3348,7 @@ public class UserBackupManagerService {
Slog.i(TAG, addUserIdToLogMessage(mUserId, "Backup enabled => " + enable));
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
boolean wasEnabled = mEnabled;
synchronized (this) {
@@ -3477,7 +3477,7 @@ public class UserBackupManagerService {
public ComponentName getCurrentTransportComponent() {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BACKUP, "getCurrentTransportComponent");
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
return mTransportManager.getCurrentTransportComponent();
} catch (TransportNotRegisteredException e) {
@@ -4165,7 +4165,7 @@ public class UserBackupManagerService {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BACKUP, "isAppEligibleForBackup");
- long oldToken = Binder.clearCallingIdentity();
+ final long oldToken = Binder.clearCallingIdentity();
try {
String callerLogString = "BMS.isAppEligibleForBackup";
TransportClient transportClient =
@@ -4187,7 +4187,7 @@ public class UserBackupManagerService {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BACKUP, "filterAppsEligibleForBackup");
- long oldToken = Binder.clearCallingIdentity();
+ final long oldToken = Binder.clearCallingIdentity();
try {
String callerLogString = "BMS.filterAppsEligibleForBackup";
TransportClient transportClient =
@@ -4221,7 +4221,7 @@ public class UserBackupManagerService {
/** Prints service state for 'dumpsys backup'. */
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
try {
if (args != null) {
for (String arg : args) {
diff --git a/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java b/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java
index 3102b5f4a04d..602dc24541b2 100644
--- a/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java
+++ b/services/backup/java/com/android/server/backup/restore/ActiveRestoreSession.java
@@ -98,7 +98,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
return -1;
}
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
TransportClient transportClient =
mTransportManager.getTransportClient(
@@ -173,7 +173,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
synchronized (mBackupManagerService.getQueueLock()) {
for (int i = 0; i < mRestoreSets.length; i++) {
if (token == mRestoreSets[i].token) {
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
return sendRestoreToHandlerLocked(
(transportClient, listener) ->
@@ -265,7 +265,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
synchronized (mBackupManagerService.getQueueLock()) {
for (int i = 0; i < mRestoreSets.length; i++) {
if (token == mRestoreSets[i].token) {
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
return sendRestoreToHandlerLocked(
(transportClient, listener) ->
@@ -341,7 +341,7 @@ public class ActiveRestoreSession extends IRestoreSession.Stub {
}
// So far so good; we're allowed to try to restore this package.
- long oldId = Binder.clearCallingIdentity();
+ final long oldId = Binder.clearCallingIdentity();
try {
// Check whether there is data for it in the current dataset, falling back
// to the ancestral dataset if not.
diff --git a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
index 40b171869cf2..61570043de16 100644
--- a/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
+++ b/services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java
@@ -408,7 +408,7 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
PackageItemInfo.SAFE_LABEL_FLAG_TRIM
| PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE)
.toString());
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return PendingIntent.getActivityAsUser(getContext(),
0 /* request code */,
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index d92706d2dd19..9455051ad740 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -916,7 +916,7 @@ public final class BatteryService extends SystemService {
mHealthInfo.chargerAcOnline = false;
mHealthInfo.chargerUsbOnline = false;
mHealthInfo.chargerWirelessOnline = false;
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mUpdatesStopped = true;
processValuesFromShellLocked(pw, opts);
@@ -979,7 +979,7 @@ public final class BatteryService extends SystemService {
break;
}
if (update) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mUpdatesStopped = true;
processValuesFromShellLocked(pw, opts);
@@ -996,7 +996,7 @@ public final class BatteryService extends SystemService {
int opts = parseOptions(shell);
getContext().enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (mUpdatesStopped) {
mUpdatesStopped = false;
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 4e405cc7f7ea..011231c016e2 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -604,7 +604,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
Slog.d(TAG, "Persisting Bluetooth Setting: " + value);
}
// waive WRITE_SECURE_SETTINGS permission check
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.BLUETOOTH_ON, value);
Binder.restoreCallingIdentity(callingIdentity);
}
@@ -2378,7 +2378,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
int foregroundUser;
int callingUser = UserHandle.getCallingUserId();
int callingUid = Binder.getCallingUid();
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
UserInfo ui = um.getProfileParent(callingUser);
int parentUser = (ui != null) ? ui.id : UserHandle.USER_NULL;
@@ -2605,7 +2605,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
}
private boolean isBluetoothDisallowed() {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
return mContext.getSystemService(UserManager.class)
.hasUserRestriction(UserManager.DISALLOW_BLUETOOTH, UserHandle.SYSTEM);
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java
index 1804b7f66fa2..593c406ed47b 100644
--- a/services/core/java/com/android/server/MmsServiceBroker.java
+++ b/services/core/java/com/android/server/MmsServiceBroker.java
@@ -511,7 +511,7 @@ public class MmsServiceBroker extends SystemService {
contentUri = ContentProvider.maybeAddUserId(contentUri, callingUserId);
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
final UriGrantsManagerInternal ugm = LocalServices
.getService(UriGrantsManagerInternal.class);
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 7775354a8077..ab933a8c2be8 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -1742,7 +1742,7 @@ class StorageManagerService extends IStorageManager.Stub
UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
final int callingUserId = UserHandle.getCallingUserId();
boolean isAdmin;
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
isAdmin = um.getUserInfo(callingUserId).isAdmin();
} finally {
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index ba2e147a2acf..b6a3e234ebe9 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -2418,7 +2418,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
public static final String ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR";
private void broadcastServiceStateChanged(ServiceState state, int phoneId, int subId) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.notePhoneState(state.getState());
} catch (RemoteException re) {
@@ -2442,7 +2442,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private void broadcastSignalStrengthChanged(SignalStrength signalStrength, int phoneId,
int subId) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mBatteryStats.notePhoneSignalStrength(signalStrength);
} catch (RemoteException e) {
@@ -2487,7 +2487,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
*/
private void broadcastCallStateChanged(int state, String incomingNumber, int phoneId,
int subId) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (state == TelephonyManager.CALL_STATE_IDLE) {
mBatteryStats.notePhoneOff();
@@ -2676,7 +2676,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private boolean validateEventsAndUserLocked(Record r, int events) {
int foregroundUser;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
boolean valid = false;
try {
foregroundUser = ActivityManager.getCurrentUser();
diff --git a/services/core/java/com/android/server/UpdateLockService.java b/services/core/java/com/android/server/UpdateLockService.java
index 06f73e28829e..38bbbdf742df 100644
--- a/services/core/java/com/android/server/UpdateLockService.java
+++ b/services/core/java/com/android/server/UpdateLockService.java
@@ -74,7 +74,7 @@ public class UpdateLockService extends IUpdateLock.Stub {
void sendLockChangedBroadcast(boolean state) {
// Safe early during boot because this broadcast only goes to registered receivers.
- long oldIdent = Binder.clearCallingIdentity();
+ final long oldIdent = Binder.clearCallingIdentity();
try {
Intent intent = new Intent(UpdateLock.UPDATE_LOCK_CHANGED)
.putExtra(UpdateLock.NOW_IS_CONVENIENT, state)
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index cb6f616f5078..7e7b403c95b9 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -845,7 +845,7 @@ public class VibratorService extends IVibratorService.Stub
return;
}
linkVibration(vib);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
doCancelVibrateLocked();
startVibrationLocked(vib);
@@ -897,7 +897,7 @@ public class VibratorService extends IVibratorService.Stub
if (DEBUG) {
Slog.d(TAG, "Canceling vibration.");
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
doCancelVibrateLocked();
} finally {
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index aaff831aeb96..5ddc0b846dd9 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -477,7 +477,7 @@ public class AccountManagerService
* TODO: Only allow accounts that were shared to be added by a limited user.
*/
// fails if the account already exists
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return addAccountInternal(accounts, account, password, extras, callingUid,
@@ -506,7 +506,7 @@ public class AccountManagerService
managedTypes.add(accountType);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return getAccountsAndVisibilityForPackage(packageName, managedTypes, callingUid,
@@ -555,7 +555,7 @@ public class AccountManagerService
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
synchronized (accounts.dbLock) {
@@ -604,7 +604,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
if (AccountManager.PACKAGE_NAME_KEY_LEGACY_VISIBLE.equals(packageName)) {
@@ -664,7 +664,7 @@ public class AccountManagerService
Objects.requireNonNull(packageName, "packageName cannot be null");
int uid = -1;
try {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
uid = mPackageManager.getPackageUidAsUser(packageName, accounts.userId);
} finally {
@@ -736,7 +736,7 @@ public class AccountManagerService
*/
private boolean isPreOApplication(String packageName) {
try {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
ApplicationInfo applicationInfo;
try {
applicationInfo = mPackageManager.getApplicationInfo(packageName, 0);
@@ -769,7 +769,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return setAccountVisibility(account, packageName, newVisibility, true /* notify */,
@@ -883,7 +883,7 @@ public class AccountManagerService
mAppOpsManager.checkPackage(callingUid, opPackageName);
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
registerAccountListener(accountTypes, opPackageName, accounts);
@@ -916,7 +916,7 @@ public class AccountManagerService
int callingUid = Binder.getCallingUid();
mAppOpsManager.checkPackage(callingUid, opPackageName);
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
unregisterAccountListener(accountTypes, opPackageName, accounts);
@@ -1033,7 +1033,7 @@ public class AccountManagerService
private boolean packageExistsForUser(String packageName, int userId) {
try {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
mPackageManager.getPackageUidAsUser(packageName, userId);
return true;
@@ -1499,7 +1499,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return readPasswordInternal(accounts, account);
@@ -1534,7 +1534,7 @@ public class AccountManagerService
}
Objects.requireNonNull(account, "account cannot be null");
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return readPreviousNameInternal(accounts, account);
@@ -1584,7 +1584,7 @@ public class AccountManagerService
Log.w(TAG, "User " + userId + " data is locked. callingUid " + callingUid);
return null;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
if (!accountExistsCache(accounts, account)) {
@@ -1679,7 +1679,7 @@ public class AccountManagerService
Slog.d(TAG, "Copying account " + account.toSafeString()
+ " from user " + userFrom + " to user " + userTo);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
new Session(fromAccounts, response, account.type, false,
false /* stripAuthTokenFromResult */, account.name,
@@ -1737,7 +1737,7 @@ public class AccountManagerService
return false;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return updateLastAuthenticatedTime(account);
@@ -1759,7 +1759,7 @@ public class AccountManagerService
final Bundle accountCredentials, final Account account, final UserAccounts targetUser,
final int parentUserId){
Bundle.setDefusable(accountCredentials, true);
- long id = clearCallingIdentity();
+ final long id = clearCallingIdentity();
try {
new Session(targetUser, response, account.type, false,
false /* stripAuthTokenFromResult */, account.name,
@@ -1926,7 +1926,7 @@ public class AccountManagerService
checkReadAccountsPermitted(callingUid, account.type, userId,
opPackageName);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new TestFeaturesSession(accounts, response, account, features).bind();
@@ -2010,7 +2010,7 @@ public class AccountManagerService
accountToRename.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
Account resultingAccount = renameAccountInternal(accounts, accountToRename, newName);
@@ -2193,7 +2193,7 @@ public class AccountManagerService
}
return;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
UserAccounts accounts = getUserAccounts(userId);
cancelNotification(getSigninRequiredNotificationId(accounts, account), user);
synchronized(accounts.credentialsPermissionNotificationIds) {
@@ -2250,7 +2250,7 @@ public class AccountManagerService
accountId,
accounts,
callingUid);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
return removeAccountInternal(accounts, account, callingUid);
} finally {
@@ -2367,7 +2367,7 @@ public class AccountManagerService
}
}
}
- long id = Binder.clearCallingIdentity();
+ final long id = Binder.clearCallingIdentity();
try {
int parentUserId = accounts.userId;
if (canHaveProfile(parentUserId)) {
@@ -2413,7 +2413,7 @@ public class AccountManagerService
+ ", pid " + Binder.getCallingPid());
}
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
List<Pair<Account, String>> deletedTokens;
@@ -2537,7 +2537,7 @@ public class AccountManagerService
+ callingUid);
return null;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return readAuthTokenInternal(accounts, account, authTokenType);
@@ -2565,7 +2565,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
saveAuthTokenToDatabase(accounts, account, authTokenType, authToken);
@@ -2591,7 +2591,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
setPasswordInternal(accounts, account, password, callingUid);
@@ -2657,7 +2657,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
setPasswordInternal(accounts, account, null, callingUid);
@@ -2685,7 +2685,7 @@ public class AccountManagerService
account.type);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
if (!accountExistsCache(accounts, account)) {
@@ -2771,7 +2771,7 @@ public class AccountManagerService
throw new SecurityException("can only call from system");
}
int userId = UserHandle.getUserId(callingUid);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new Session(accounts, response, accountType, false /* expectActivityLaunch */,
@@ -2843,7 +2843,7 @@ public class AccountManagerService
return;
}
int userId = UserHandle.getCallingUserId();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
final UserAccounts accounts;
final RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> authenticatorInfo;
try {
@@ -2887,7 +2887,7 @@ public class AccountManagerService
loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
// Distill the caller's package signatures into a single digest.
final byte[] callerPkgSigDigest = calculatePackageSignatureDigest(callerPkg);
@@ -3194,7 +3194,7 @@ public class AccountManagerService
options.putInt(AccountManager.KEY_CALLER_PID, pid);
int usrId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(usrId);
logRecordWithUid(
@@ -3275,7 +3275,7 @@ public class AccountManagerService
options.putInt(AccountManager.KEY_CALLER_UID, uid);
options.putInt(AccountManager.KEY_CALLER_PID, pid);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
logRecordWithUid(
@@ -3358,7 +3358,7 @@ public class AccountManagerService
boolean isPasswordForwardingAllowed = checkPermissionAndNote(
callerPkg, uid, Manifest.permission.GET_PASSWORD);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
logRecordWithUid(accounts, AccountsDb.DEBUG_ACTION_CALLED_START_ACCOUNT_ADD,
@@ -3599,7 +3599,7 @@ public class AccountManagerService
return;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
logRecordWithUid(
@@ -3648,7 +3648,7 @@ public class AccountManagerService
if (intent == null) {
intent = getDefaultCantAddAccountIntent(errorCode);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
mContext.startActivityAsUser(intent, new UserHandle(userId));
} finally {
@@ -3692,7 +3692,7 @@ public class AccountManagerService
}
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new Session(accounts, response, account.type, expectActivityLaunch,
@@ -3729,7 +3729,7 @@ public class AccountManagerService
if (response == null) throw new IllegalArgumentException("response is null");
if (account == null) throw new IllegalArgumentException("account is null");
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new Session(accounts, response, account.type, expectActivityLaunch,
@@ -3783,7 +3783,7 @@ public class AccountManagerService
boolean isPasswordForwardingAllowed = checkPermissionAndNote(
callerPkg, uid, Manifest.permission.GET_PASSWORD);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new StartAccountSession(
@@ -3839,7 +3839,7 @@ public class AccountManagerService
}
int usrId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(usrId);
new Session(accounts, response, account.type, false /* expectActivityLaunch */,
@@ -3924,7 +3924,7 @@ public class AccountManagerService
accountType);
throw new SecurityException(msg);
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
new Session(accounts, response, accountType, expectActivityLaunch,
@@ -4228,7 +4228,7 @@ public class AccountManagerService
if (visibleAccountTypes.isEmpty()) {
return EMPTY_ACCOUNT_ARRAY;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return getAccountsInternal(
@@ -4352,7 +4352,7 @@ public class AccountManagerService
} // else aggregate all the visible accounts (it won't matter if the
// list is empty).
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
return getAccountsInternal(
@@ -4558,7 +4558,7 @@ public class AccountManagerService
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts userAccounts = getUserAccounts(userId);
if (ArrayUtils.isEmpty(features)) {
@@ -4636,7 +4636,7 @@ public class AccountManagerService
return;
}
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
UserAccounts userAccounts = getUserAccounts(userId);
if (features == null || features.length == 0) {
@@ -4781,7 +4781,7 @@ public class AccountManagerService
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
| Intent.FLAG_GRANT_PREFIX_URI_PERMISSION));
- long bid = Binder.clearCallingIdentity();
+ final long bid = Binder.clearCallingIdentity();
try {
PackageManager pm = mContext.getPackageManager();
ResolveInfo resolveInfo = pm.resolveActivityAsUser(intent, 0, mAccounts.userId);
@@ -5281,7 +5281,7 @@ public class AccountManagerService
private void doNotification(UserAccounts accounts, Account account, CharSequence message,
Intent intent, String packageName, final int userId) {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "doNotification: " + message + " intent:" + intent);
@@ -5340,7 +5340,7 @@ public class AccountManagerService
}
private void cancelNotification(NotificationId id, String packageName, UserHandle user) {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
INotificationManager service = mInjector.getNotificationManager();
service.cancelNotificationWithTag(
@@ -5409,7 +5409,7 @@ public class AccountManagerService
private boolean isPrivileged(int callingUid) {
String[] packages;
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
try {
packages = mPackageManager.getPackagesForUid(callingUid);
if (packages == null) {
@@ -5501,7 +5501,7 @@ public class AccountManagerService
if (accountType == null) {
return false;
}
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
Collection<RegisteredServicesCache.ServiceInfo<AuthenticatorDescription>> serviceInfos;
try {
serviceInfos = mAuthenticatorCache.getAllServices(userId);
@@ -5530,7 +5530,7 @@ public class AccountManagerService
return SIGNATURE_CHECK_MISMATCH;
}
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
Collection<RegisteredServicesCache.ServiceInfo<AuthenticatorDescription>> serviceInfos;
try {
serviceInfos = mAuthenticatorCache.getAllServices(userId);
@@ -5576,7 +5576,7 @@ public class AccountManagerService
private List<String> getTypesForCaller(
int callingUid, int userId, boolean isOtherwisePermitted) {
List<String> managedAccountTypes = new ArrayList<>();
- long identityToken = Binder.clearCallingIdentity();
+ final long identityToken = Binder.clearCallingIdentity();
Collection<RegisteredServicesCache.ServiceInfo<AuthenticatorDescription>> serviceInfos;
try {
serviceInfos = mAuthenticatorCache.getAllServices(userId);
@@ -5659,7 +5659,7 @@ public class AccountManagerService
private boolean isSystemUid(int callingUid) {
String[] packages = null;
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
packages = mPackageManager.getPackagesForUid(callingUid);
if (packages != null) {
@@ -6188,7 +6188,7 @@ public class AccountManagerService
final int uid;
try {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
uid = mPackageManager.getPackageUidAsUser(packageName, userId);
} finally {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 1fe0012615da..74cbeba46370 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3356,7 +3356,7 @@ public class ActivityManagerService extends IActivityManager.Stub
final ApplicationInfo appInfo;
final boolean isInstantApp;
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
synchronized(this) {
@@ -3497,7 +3497,7 @@ public class ActivityManagerService extends IActivityManager.Stub
userId, true, ALLOW_FULL_ONLY, "killBackgroundProcesses", null);
final int[] userIds = mUserController.expandUserId(userId);
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
for (int targetUserId : userIds) {
@@ -3596,7 +3596,7 @@ public class ActivityManagerService extends IActivityManager.Stub
final int callingPid = Binder.getCallingPid();
userId = mUserController.handleIncomingUser(callingPid, Binder.getCallingUid(),
userId, true, ALLOW_FULL_ONLY, "forceStopPackage", null);
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
synchronized(this) {
@@ -6155,7 +6155,7 @@ public class ActivityManagerService extends IActivityManager.Stub
enforceCallingPermission(android.Manifest.permission.SET_DEBUG_APP,
"setDebugApp()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
// Note that this is not really thread safe if there are multiple
// callers into it at the same time, but that's not a situation we
@@ -6256,7 +6256,7 @@ public class ActivityManagerService extends IActivityManager.Stub
enforceCallingPermission(android.Manifest.permission.SET_ALWAYS_FINISH,
"setAlwaysFinish()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
Settings.Global.putInt(
mContext.getContentResolver(),
@@ -7022,7 +7022,7 @@ public class ActivityManagerService extends IActivityManager.Stub
+ android.Manifest.permission.FORCE_STOP_PACKAGES);
}
int callerUid = Binder.getCallingUid();
- long iden = Binder.clearCallingIdentity();
+ final long iden = Binder.clearCallingIdentity();
try {
mProcessList.killProcessesWhenImperceptible(pids, reason, callerUid);
} finally {
@@ -7407,7 +7407,7 @@ public class ActivityManagerService extends IActivityManager.Stub
t.traceBegin("sendUserStartBroadcast");
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
Intent intent = new Intent(Intent.ACTION_USER_STARTED);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
@@ -8171,7 +8171,7 @@ public class ActivityManagerService extends IActivityManager.Stub
*/
int enforceDumpPermissionForPackage(String packageName, int userId, int callingUid,
String function) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
int uid = Process.INVALID_UID;
try {
uid = mPackageManagerInt.getPackageUid(packageName,
@@ -8431,7 +8431,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
if (useProto) {
final ProtoOutputStream proto = new ProtoOutputStream(fd);
@@ -12699,7 +12699,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
}
- long oldIdent = Binder.clearCallingIdentity();
+ final long oldIdent = Binder.clearCallingIdentity();
try {
IBackupManager bm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
@@ -15060,7 +15060,7 @@ public class ActivityManagerService extends IActivityManager.Stub
final int callingPid = Binder.getCallingPid();
userId = mUserController.handleIncomingUser(callingPid, Binder.getCallingUid(),
userId, true, ALLOW_FULL_ONLY, "makePackageIdle", null);
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
synchronized(this) {
try {
IPackageManager pm = AppGlobals.getPackageManager();
@@ -16752,7 +16752,7 @@ public class ActivityManagerService extends IActivityManager.Stub
"Cannot kill the dependents of a package without its name.");
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
IPackageManager pm = AppGlobals.getPackageManager();
int pkgUid = -1;
try {
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
index 3f55bffc1f3e..138f998394d6 100644
--- a/services/core/java/com/android/server/am/AppErrors.java
+++ b/services/core/java/com/android/server/am/AppErrors.java
@@ -546,7 +546,7 @@ class AppErrors {
}
}
if (res == AppErrorDialog.FORCE_QUIT) {
- long orig = Binder.clearCallingIdentity();
+ final long orig = Binder.clearCallingIdentity();
try {
// Kill it with fire!
mService.mAtmInternal.onHandleAppCrash(r.getWindowProcessController());
diff --git a/services/core/java/com/android/server/am/AppExitInfoTracker.java b/services/core/java/com/android/server/am/AppExitInfoTracker.java
index 374c215fc6d0..20cad185d8d0 100644
--- a/services/core/java/com/android/server/am/AppExitInfoTracker.java
+++ b/services/core/java/com/android/server/am/AppExitInfoTracker.java
@@ -503,7 +503,7 @@ public final class AppExitInfoTracker {
@VisibleForTesting
void getExitInfo(final String packageName, final int filterUid,
final int filterPid, final int maxNum, final ArrayList<ApplicationExitInfo> results) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
boolean emptyPackageName = TextUtils.isEmpty(packageName);
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index 76125aabc978..3eb4ddebaf06 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -2090,7 +2090,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
return;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (BatteryStatsHelper.checkWifiOnly(mContext)) {
flags |= BatteryStats.DUMP_DEVICE_WIFI_ONLY;
@@ -2250,7 +2250,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BATTERY_STATS, null);
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
// Wait for the completion of pending works if there is any
awaitCompletion();
@@ -2277,7 +2277,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BATTERY_STATS, null);
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
int i=-1;
try {
// Wait for the completion of pending works if there is any
diff --git a/services/core/java/com/android/server/am/ContentProviderHelper.java b/services/core/java/com/android/server/am/ContentProviderHelper.java
index 1155569c6b36..950f0a0f56a3 100644
--- a/services/core/java/com/android/server/am/ContentProviderHelper.java
+++ b/services/core/java/com/android/server/am/ContentProviderHelper.java
@@ -682,7 +682,7 @@ public class ContentProviderHelper {
*/
void removeContentProvider(IBinder connection, boolean stable) {
mService.enforceNotIsolatedCaller("removeContentProvider");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mService) {
ContentProviderConnection conn;
@@ -711,7 +711,7 @@ public class ContentProviderHelper {
mService.enforceCallingPermission(
android.Manifest.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY,
"Do not have permission in call removeContentProviderExternal()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
removeContentProviderExternalUnchecked(name, token, userId);
} finally {
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index ebc5b59363df..fbcfcf949d18 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -887,7 +887,7 @@ class ProcessRecord implements WindowProcessListener {
Slog.w(TAG, "scheduleCrash: trying to crash system process!");
return;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
thread.scheduleCrash(message);
} catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/am/ProcessStatsService.java b/services/core/java/com/android/server/am/ProcessStatsService.java
index d925defdbc73..c10a07862123 100644
--- a/services/core/java/com/android/server/am/ProcessStatsService.java
+++ b/services/core/java/com/android/server/am/ProcessStatsService.java
@@ -855,7 +855,7 @@ public final class ProcessStatsService extends IProcessStats.Stub {
if (!com.android.internal.util.DumpUtils.checkDumpAndUsageStatsPermission(mAm.mContext,
TAG, pw)) return;
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
if (args.length > 0) {
if ("--proto".equals(args[0])) {
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 6c088262a7bf..f1bad9819394 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -1814,7 +1814,7 @@ class UserController implements Handler.Callback {
void sendUserSwitchBroadcasts(int oldUserId, int newUserId) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
Intent intent;
if (oldUserId >= 0) {
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
index 7dbb39e3cb39..53a27941573e 100644
--- a/services/core/java/com/android/server/appop/AppOpsService.java
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
@@ -2356,7 +2356,7 @@ public class AppOpsService extends IAppOpsService.Stub {
+ permissionInfo.backgroundPermission);
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
packageManager.updatePermissionFlags(permissionInfo.backgroundPermission,
packageName, PackageManager.FLAG_PERMISSION_REVOKED_COMPAT,
@@ -2380,7 +2380,7 @@ public class AppOpsService extends IAppOpsService.Stub {
+ switchCode + ", mode=" + mode + ", permission=" + permissionName);
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
packageManager.updatePermissionFlags(permissionName, packageName,
PackageManager.FLAG_PERMISSION_REVOKED_COMPAT, isRevokedCompat
@@ -3261,7 +3261,7 @@ public class AppOpsService extends IAppOpsService.Stub {
int callingUid = Binder.getCallingUid();
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
synchronized (this) {
Pair<String, Integer> key = getAsyncNotedOpsKey(packageName, uid);
@@ -4937,7 +4937,7 @@ public class AppOpsService extends IAppOpsService.Stub {
case "write-settings": {
shell.mInternal.enforceManageAppOpsModes(Binder.getCallingPid(),
Binder.getCallingUid(), -1);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
synchronized (shell.mInternal) {
shell.mInternal.mHandler.removeCallbacks(shell.mInternal.mWriteRunner);
@@ -4952,7 +4952,7 @@ public class AppOpsService extends IAppOpsService.Stub {
case "read-settings": {
shell.mInternal.enforceManageAppOpsModes(Binder.getCallingPid(),
Binder.getCallingUid(), -1);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
shell.mInternal.readState();
pw.println("Last settings read.");
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 7ad0f21c2f69..ff6367b96626 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -9384,7 +9384,7 @@ public class AudioService extends IAudioService.Stub
if (DEBUG_VOL) {
Log.d(TAG, "Persisting Volume Behavior for DeviceType: " + deviceType);
}
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
System.putIntForUser(mContentResolver,
getSettingsNameForDeviceVolumeBehavior(deviceType),
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index a45d94bfc002..b3e9c402d9af 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -966,7 +966,7 @@ public class Vpn {
/** Prepare the VPN for the given package. Does not perform permission checks. */
@GuardedBy("this")
private void prepareInternal(String newPackage) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
// Reset the interface.
if (mInterface != null) {
@@ -1251,7 +1251,7 @@ public class Vpn {
mNetworkCapabilities.setAdministratorUids(new int[] {mOwnerUID});
mNetworkCapabilities.setUids(createUserAndRestrictedProfilesRanges(mUserId,
mConfig.allowedApplications, mConfig.disallowedApplications));
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mNetworkAgent = new NetworkAgent(mLooper, mContext, NETWORKTYPE /* logtag */,
mNetworkInfo, mNetworkCapabilities, lp,
@@ -1270,7 +1270,7 @@ public class Vpn {
}
private boolean canHaveRestrictedProfile(int userId) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
return UserManager.get(mContext).canHaveRestrictedProfile(userId);
} finally {
@@ -1317,7 +1317,7 @@ public class Vpn {
// Check if the service is properly declared.
Intent intent = new Intent(VpnConfig.SERVICE_INTERFACE);
intent.setClassName(mPackage, config.user);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
// Restricted users are not allowed to create VPNs, they are tied to Owner
enforceNotRestrictedUser();
@@ -2045,7 +2045,7 @@ public class Vpn {
*/
public void startLegacyVpn(VpnProfile profile, KeyStore keyStore, LinkProperties egress) {
enforceControlPermission();
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
startLegacyVpnPrivileged(profile, keyStore, egress);
} finally {
diff --git a/services/core/java/com/android/server/content/ContentService.java b/services/core/java/com/android/server/content/ContentService.java
index 1294e9030f62..a2c427b8036a 100644
--- a/services/core/java/com/android/server/content/ContentService.java
+++ b/services/core/java/com/android/server/content/ContentService.java
@@ -596,7 +596,7 @@ public final class ContentService extends IContentService.Stub {
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -650,7 +650,7 @@ public final class ContentService extends IContentService.Stub {
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager == null) {
@@ -718,7 +718,7 @@ public final class ContentService extends IContentService.Stub {
"no permission to modify the sync settings for user " + userId);
// This makes it so that future permission checks will be in the context of this
// process rather than the caller's process. We will restore this before returning.
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
if (cname != null) {
Slog.e(TAG, "cname not null.");
return;
@@ -751,7 +751,7 @@ public final class ContentService extends IContentService.Stub {
Bundle extras = new Bundle(request.getBundle());
validateExtras(callingUid, extras);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncStorageEngine.EndPoint info;
@@ -834,7 +834,7 @@ public final class ContentService extends IContentService.Stub {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -866,7 +866,7 @@ public final class ContentService extends IContentService.Stub {
final int callingPid = Binder.getCallingPid();
final int syncExemptionFlag = getSyncExemptionForCaller(callingUid);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -899,7 +899,7 @@ public final class ContentService extends IContentService.Stub {
pollFrequency = clampPeriod(pollFrequency);
long defaultFlex = SyncStorageEngine.calculateDefaultFlexTime(pollFrequency);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncStorageEngine.EndPoint info =
new SyncStorageEngine.EndPoint(account, authority, userId);
@@ -927,7 +927,7 @@ public final class ContentService extends IContentService.Stub {
final int callingUid = Binder.getCallingUid();
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
getSyncManager()
.removePeriodicSync(
@@ -951,7 +951,7 @@ public final class ContentService extends IContentService.Stub {
"no permission to read the sync settings");
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
return getSyncManager().getPeriodicSyncs(
new SyncStorageEngine.EndPoint(account, providerName, userId));
@@ -976,7 +976,7 @@ public final class ContentService extends IContentService.Stub {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -1012,7 +1012,7 @@ public final class ContentService extends IContentService.Stub {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -1040,7 +1040,7 @@ public final class ContentService extends IContentService.Stub {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -1067,7 +1067,7 @@ public final class ContentService extends IContentService.Stub {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
@@ -1084,7 +1084,7 @@ public final class ContentService extends IContentService.Stub {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
int userId = UserHandle.getCallingUserId();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager == null) {
@@ -1116,7 +1116,7 @@ public final class ContentService extends IContentService.Stub {
final boolean canAccessAccounts =
mContext.checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)
== PackageManager.PERMISSION_GRANTED;
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
return getSyncManager().getSyncStorageEngine()
.getCurrentSyncsCopy(userId, canAccessAccounts);
@@ -1146,7 +1146,7 @@ public final class ContentService extends IContentService.Stub {
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
"no permission to read the sync stats");
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager == null) {
@@ -1176,7 +1176,7 @@ public final class ContentService extends IContentService.Stub {
"no permission to read the sync stats");
enforceCrossUserPermission(userId,
"no permission to retrieve the sync settings for user " + userId);
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
SyncManager syncManager = getSyncManager();
if (syncManager == null) return false;
@@ -1196,7 +1196,7 @@ public final class ContentService extends IContentService.Stub {
@Override
public void addStatusChangeListener(int mask, ISyncStatusObserver callback) {
final int callingUid = Binder.getCallingUid();
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null && callback != null) {
@@ -1210,7 +1210,7 @@ public final class ContentService extends IContentService.Stub {
@Override
public void removeStatusChangeListener(ISyncStatusObserver callback) {
- long identityToken = clearCallingIdentity();
+ final long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null && callback != null) {
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 91fa15a913a3..c686ba4c4b5c 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -2773,7 +2773,7 @@ public class SyncManager {
}
private void onReady() {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mOnReadyCallback.onReady();
} finally {
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index a60a676cfa95..27bd0563cea5 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -2240,7 +2240,7 @@ public class HdmiControlService extends SystemService {
@Override
public void setHdmiCecVolumeControlEnabled(final boolean isHdmiCecVolumeControlEnabled) {
enforceAccessPermission();
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
HdmiControlService.this.setHdmiCecVolumeControlEnabled(
isHdmiCecVolumeControlEnabled);
diff --git a/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java b/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java
index 845fca1127dd..78c414452ddd 100644
--- a/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java
+++ b/services/core/java/com/android/server/inputmethod/InputContentUriTokenHandler.java
@@ -73,7 +73,7 @@ final class InputContentUriTokenHandler extends IInputContentUriToken.Stub {
}
private void doTakeLocked(@NonNull IBinder permissionOwner) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
try {
UriGrantsManager.getService().grantUriPermissionFromOwner(
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 2eccaf1434b4..aa4936d9fa61 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -1517,7 +1517,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
@Override
public void sessionCreated(IInputMethodSession session) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mParentIMMS.onSessionCreated(mMethod, session, mChannel);
} finally {
@@ -4174,7 +4174,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (!calledWithValidTokenLocked(token)) {
return;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
hideCurrentInputLocked(
mLastImeTargetWindow, flags, null,
@@ -4192,7 +4192,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
if (!calledWithValidTokenLocked(token)) {
return;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
showCurrentInputLocked(mLastImeTargetWindow, flags, null,
SoftInputShowHideReason.SHOW_MY_SOFT_INPUT);
diff --git a/services/core/java/com/android/server/location/AbstractLocationProvider.java b/services/core/java/com/android/server/location/AbstractLocationProvider.java
index 56982a81f83b..bd2676e60825 100644
--- a/services/core/java/com/android/server/location/AbstractLocationProvider.java
+++ b/services/core/java/com/android/server/location/AbstractLocationProvider.java
@@ -222,7 +222,7 @@ public abstract class AbstractLocationProvider {
// we know that we only updated the state, so the listener for the old state is the same as
// the listener for the new state.
if (oldInternalState.listener != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
oldInternalState.listener.onStateChanged(oldInternalState.state, newState);
} finally {
@@ -246,7 +246,7 @@ public abstract class AbstractLocationProvider {
// we know that we only updated the state, so the listener for the old state is the same as
// the listener for the new state.
if (oldInternalState.listener != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
oldInternalState.listener.onStateChanged(oldInternalState.state, newState);
} finally {
@@ -305,7 +305,7 @@ public abstract class AbstractLocationProvider {
protected void reportLocation(Location location) {
Listener listener = mInternalState.get().listener;
if (listener != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// copy location so if provider makes further changes they do not propagate
listener.onReportLocation(new Location(location));
@@ -321,7 +321,7 @@ public abstract class AbstractLocationProvider {
protected void reportLocation(List<Location> locations) {
Listener listener = mInternalState.get().listener;
if (listener != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// copy location so if provider makes further changes they do not propagate
ArrayList<Location> copy = new ArrayList<>(locations.size());
diff --git a/services/core/java/com/android/server/location/LocationProviderManager.java b/services/core/java/com/android/server/location/LocationProviderManager.java
index ecf82e8f8bd6..3b3c6f0c6cf9 100644
--- a/services/core/java/com/android/server/location/LocationProviderManager.java
+++ b/services/core/java/com/android/server/location/LocationProviderManager.java
@@ -1232,7 +1232,7 @@ class LocationProviderManager extends
mUserHelper.addListener(mUserChangedListener);
mSettingsHelper.addOnLocationEnabledChangedListener(mLocationEnabledChangedListener);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// initialize enabled state
onUserStarted(UserHandle.USER_ALL);
@@ -1249,7 +1249,7 @@ class LocationProviderManager extends
mStarted = false;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
onEnabledChanged(UserHandle.USER_ALL);
removeRegistrationIf(key -> true);
@@ -1317,7 +1317,7 @@ class LocationProviderManager extends
synchronized (mLock) {
Preconditions.checkState(mStarted);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mProvider.setRealProvider(provider);
} finally {
@@ -1332,7 +1332,7 @@ class LocationProviderManager extends
mLocationEventLog.logProviderMocked(mName, provider != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mProvider.setMockProvider(provider);
} finally {
@@ -1359,7 +1359,7 @@ class LocationProviderManager extends
throw new IllegalArgumentException(mName + " provider is not a test provider");
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mProvider.setMockProviderAllowed(enabled);
} finally {
@@ -1374,7 +1374,7 @@ class LocationProviderManager extends
throw new IllegalArgumentException(mName + " provider is not a test provider");
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
String locationProvider = location.getProvider();
if (!TextUtils.isEmpty(locationProvider) && !mName.equals(locationProvider)) {
@@ -1537,7 +1537,7 @@ class LocationProviderManager extends
permissionLevel);
synchronized (mLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
addRegistration(callback.asBinder(), registration);
if (!registration.isActive()) {
@@ -1561,7 +1561,7 @@ class LocationProviderManager extends
}
public void sendExtraCommand(int uid, int pid, String command, Bundle extras) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mProvider.sendExtraCommand(uid, pid, command, extras);
} finally {
@@ -1578,7 +1578,7 @@ class LocationProviderManager extends
permissionLevel);
synchronized (mLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
addRegistration(listener.asBinder(), registration);
} finally {
@@ -1596,7 +1596,7 @@ class LocationProviderManager extends
permissionLevel);
synchronized (mLock) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
addRegistration(pendingIntent, registration);
} finally {
@@ -1607,7 +1607,7 @@ class LocationProviderManager extends
public void unregisterLocationRequest(ILocationListener listener) {
synchronized (mLock) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
removeRegistration(listener.asBinder());
} finally {
@@ -1618,7 +1618,7 @@ class LocationProviderManager extends
public void unregisterLocationRequest(PendingIntent pendingIntent) {
synchronized (mLock) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
removeRegistration(pendingIntent);
} finally {
@@ -2394,7 +2394,7 @@ class LocationProviderManager extends
return;
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
callback.run();
} catch (RuntimeException e) {
diff --git a/services/core/java/com/android/server/location/PassiveLocationProviderManager.java b/services/core/java/com/android/server/location/PassiveLocationProviderManager.java
index 2870d41e5248..fc10d5fcf1b7 100644
--- a/services/core/java/com/android/server/location/PassiveLocationProviderManager.java
+++ b/services/core/java/com/android/server/location/PassiveLocationProviderManager.java
@@ -52,7 +52,7 @@ class PassiveLocationProviderManager extends LocationProviderManager {
PassiveProvider passiveProvider = (PassiveProvider) mProvider.getProvider();
Preconditions.checkState(passiveProvider != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
passiveProvider.updateLocation(location);
} finally {
diff --git a/services/core/java/com/android/server/location/geofence/GeofenceManager.java b/services/core/java/com/android/server/location/geofence/GeofenceManager.java
index baa01b1506af..c91ee824ff61 100644
--- a/services/core/java/com/android/server/location/geofence/GeofenceManager.java
+++ b/services/core/java/com/android/server/location/geofence/GeofenceManager.java
@@ -302,7 +302,7 @@ public class GeofenceManager extends
CallerIdentity callerIdentity = CallerIdentity.fromBinder(mContext, packageName,
attributionTag, AppOpsManager.toReceiverId(pendingIntent));
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
addRegistration(new GeofenceKey(pendingIntent, geofence),
new GeofenceRegistration(geofence, callerIdentity, pendingIntent));
@@ -315,7 +315,7 @@ public class GeofenceManager extends
* Removes the geofence associated with the PendingIntent.
*/
public void removeGeofence(PendingIntent pendingIntent) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
removeRegistrationIf(key -> key.getPendingIntent().equals(pendingIntent));
} finally {
diff --git a/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java b/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
index 1cdb118f5787..b94f1555cfaa 100644
--- a/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
+++ b/services/core/java/com/android/server/location/gnss/GnssListenerMultiplexer.java
@@ -229,7 +229,7 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
*/
protected void addListener(TRequest request, CallerIdentity callerIdentity,
TListener listener) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
addRegistration(listener.asBinder(),
new GnssListenerRegistration(request, callerIdentity, listener));
@@ -242,7 +242,7 @@ public abstract class GnssListenerMultiplexer<TRequest, TListener extends IInter
* Removes the given listener.
*/
public void removeListener(TListener listener) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
removeRegistration(listener.asBinder());
} finally {
diff --git a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
index f879b1929236..e144b403240c 100644
--- a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
@@ -1120,7 +1120,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
@Override
public void onExtraCommand(int uid, int pid, String command, Bundle extras) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
if ("delete_aiding_data".equals(command)) {
deleteAidingData(extras);
diff --git a/services/core/java/com/android/server/location/util/SystemAppForegroundHelper.java b/services/core/java/com/android/server/location/util/SystemAppForegroundHelper.java
index d8b1d5b88260..3ff572b0a8e6 100644
--- a/services/core/java/com/android/server/location/util/SystemAppForegroundHelper.java
+++ b/services/core/java/com/android/server/location/util/SystemAppForegroundHelper.java
@@ -63,7 +63,7 @@ public class SystemAppForegroundHelper extends AppForegroundHelper {
public boolean isAppForeground(int uid) {
Preconditions.checkState(mActivityManager != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return isForeground(mActivityManager.getUidImportance(uid));
} finally {
diff --git a/services/core/java/com/android/server/location/util/SystemAppOpsHelper.java b/services/core/java/com/android/server/location/util/SystemAppOpsHelper.java
index cfb7697a8dfc..8742d65df97c 100644
--- a/services/core/java/com/android/server/location/util/SystemAppOpsHelper.java
+++ b/services/core/java/com/android/server/location/util/SystemAppOpsHelper.java
@@ -60,7 +60,7 @@ public class SystemAppOpsHelper extends AppOpsHelper {
public boolean startOpNoThrow(int appOp, CallerIdentity callerIdentity) {
Preconditions.checkState(mAppOps != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return mAppOps.startOpNoThrow(
appOp,
@@ -78,7 +78,7 @@ public class SystemAppOpsHelper extends AppOpsHelper {
public void finishOp(int appOp, CallerIdentity callerIdentity) {
Preconditions.checkState(mAppOps != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mAppOps.finishOp(
appOp,
@@ -94,7 +94,7 @@ public class SystemAppOpsHelper extends AppOpsHelper {
public boolean checkOpNoThrow(int appOp, CallerIdentity callerIdentity) {
Preconditions.checkState(mAppOps != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return mAppOps.checkOpNoThrow(
appOp,
@@ -109,7 +109,7 @@ public class SystemAppOpsHelper extends AppOpsHelper {
public boolean noteOp(int appOp, CallerIdentity callerIdentity) {
Preconditions.checkState(mAppOps != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return mAppOps.noteOp(
appOp,
@@ -126,7 +126,7 @@ public class SystemAppOpsHelper extends AppOpsHelper {
public boolean noteOpNoThrow(int appOp, CallerIdentity callerIdentity) {
Preconditions.checkState(mAppOps != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return mAppOps.noteOpNoThrow(
appOp,
diff --git a/services/core/java/com/android/server/location/util/SystemLocationPermissionsHelper.java b/services/core/java/com/android/server/location/util/SystemLocationPermissionsHelper.java
index b9c0ddef04ab..4f1f7a0038d2 100644
--- a/services/core/java/com/android/server/location/util/SystemLocationPermissionsHelper.java
+++ b/services/core/java/com/android/server/location/util/SystemLocationPermissionsHelper.java
@@ -54,7 +54,7 @@ public class SystemLocationPermissionsHelper extends LocationPermissionsHelper {
@Override
protected boolean hasPermission(String permission, CallerIdentity callerIdentity) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return mContext.checkPermission(permission, callerIdentity.getPid(),
callerIdentity.getUid()) == PERMISSION_GRANTED;
diff --git a/services/core/java/com/android/server/location/util/SystemSettingsHelper.java b/services/core/java/com/android/server/location/util/SystemSettingsHelper.java
index 39aeaba16579..560cd3c719d7 100644
--- a/services/core/java/com/android/server/location/util/SystemSettingsHelper.java
+++ b/services/core/java/com/android/server/location/util/SystemSettingsHelper.java
@@ -123,7 +123,7 @@ public class SystemSettingsHelper extends SettingsHelper {
*/
@Override
public void setLocationEnabled(boolean enabled, int userId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
Settings.Secure.putIntForUser(
mContext.getContentResolver(),
@@ -314,7 +314,7 @@ public class SystemSettingsHelper extends SettingsHelper {
*/
@Override
public long getBackgroundThrottleProximityAlertIntervalMs() {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return Settings.Global.getLong(mContext.getContentResolver(),
LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
@@ -330,7 +330,7 @@ public class SystemSettingsHelper extends SettingsHelper {
*/
@Override
public float getCoarseLocationAccuracyM() {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
final ContentResolver cr = mContext.getContentResolver();
try {
return Settings.Secure.getFloatForUser(
@@ -458,7 +458,7 @@ public class SystemSettingsHelper extends SettingsHelper {
}
public int getValueForUser(int defaultValue, int userId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return Settings.Secure.getIntForUser(mContext.getContentResolver(), mSettingName,
defaultValue, userId);
@@ -496,7 +496,7 @@ public class SystemSettingsHelper extends SettingsHelper {
List<String> value = mCachedValue;
if (userId != mCachedUserId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
String setting = Settings.Secure.getStringForUser(mContext.getContentResolver(),
mSettingName, userId);
@@ -548,7 +548,7 @@ public class SystemSettingsHelper extends SettingsHelper {
}
public boolean getValue(boolean defaultValue) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return Settings.Global.getInt(mContext.getContentResolver(), mSettingName,
defaultValue ? 1 : 0) != 0;
@@ -574,7 +574,7 @@ public class SystemSettingsHelper extends SettingsHelper {
}
public long getValue(long defaultValue) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return Settings.Global.getLong(mContext.getContentResolver(), mSettingName,
defaultValue);
@@ -612,7 +612,7 @@ public class SystemSettingsHelper extends SettingsHelper {
public synchronized Set<String> getValue() {
ArraySet<String> value = mCachedValue;
if (!mValid) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
value = new ArraySet<>(mBaseValuesSupplier.get());
String setting = Settings.Global.getString(mContext.getContentResolver(),
diff --git a/services/core/java/com/android/server/location/util/SystemUserInfoHelper.java b/services/core/java/com/android/server/location/util/SystemUserInfoHelper.java
index e9836aad0472..141afa7eef4c 100644
--- a/services/core/java/com/android/server/location/util/SystemUserInfoHelper.java
+++ b/services/core/java/com/android/server/location/util/SystemUserInfoHelper.java
@@ -97,7 +97,7 @@ public class SystemUserInfoHelper extends UserInfoHelper {
public int[] getRunningUserIds() {
IActivityManager activityManager = getActivityManager();
if (activityManager != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return activityManager.getRunningUserIds();
} catch (RemoteException e) {
@@ -118,7 +118,7 @@ public class SystemUserInfoHelper extends UserInfoHelper {
public boolean isCurrentUserId(@UserIdInt int userId) {
ActivityManagerInternal activityManagerInternal = getActivityManagerInternal();
if (activityManagerInternal != null) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return activityManagerInternal.isCurrentProfile(userId);
} finally {
@@ -136,7 +136,7 @@ public class SystemUserInfoHelper extends UserInfoHelper {
// if you're hitting this precondition then you are invoking this before the system is ready
Preconditions.checkState(userManager != null);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return userManager.getEnabledProfileIds(userId);
} finally {
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 7e53e6f3e2c3..c42c84f75051 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -1388,7 +1388,7 @@ public class LockSettingsService extends ILockSettings.Stub {
// Now we have unlocked the parent user and attempted to unlock the profile we should
// show notifications if the profile is still locked.
if (!alreadyUnlocked) {
- long ident = clearCallingIdentity();
+ final long ident = clearCallingIdentity();
try {
maybeShowEncryptionNotificationForUser(profile.id);
} finally {
@@ -2227,7 +2227,7 @@ public class LockSettingsService extends ILockSettings.Stub {
final IStorageManager service = mInjector.getStorageManager();
// TODO(b/120484642): Update vold to return a password as a byte array
String password;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
password = service.getPassword();
service.clearPassword();
@@ -3447,7 +3447,7 @@ public class LockSettingsService extends ILockSettings.Stub {
@Override
public PasswordMetrics getUserPasswordMetrics(int userHandle) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
if (isManagedProfileWithUnifiedLock(userHandle)) {
// A managed profile with unified challenge is supposed to be protected by the
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 94776f8c7cb4..3ce8e4659737 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -261,7 +261,7 @@ public final class MediaProjectionManagerService extends SystemService
@Override // Binder call
public boolean hasProjectionPermission(int uid, String packageName) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
boolean hasPermission = false;
try {
hasPermission |= checkPermission(packageName,
@@ -288,7 +288,7 @@ public final class MediaProjectionManagerService extends SystemService
}
final UserHandle callingUser = Binder.getCallingUserHandle();
- long callingToken = Binder.clearCallingIdentity();
+ final long callingToken = Binder.clearCallingIdentity();
MediaProjection projection;
try {
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cab33770c0fc..e6147ab96b61 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -868,7 +868,7 @@ public class NotificationManagerService extends SystemService {
(status & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
if (disableNotificationEffects(null) != null) {
// cancel whatever's going on
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
final IRingtonePlayer player = mAudioManager.getRingtonePlayer();
if (player != null) {
@@ -1339,7 +1339,7 @@ public class NotificationManagerService extends SystemService {
@GuardedBy("mNotificationLock")
void clearSoundLocked() {
mSoundNotificationKey = null;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
final IRingtonePlayer player = mAudioManager.getRingtonePlayer();
if (player != null) {
@@ -1354,7 +1354,7 @@ public class NotificationManagerService extends SystemService {
@GuardedBy("mNotificationLock")
void clearVibrateLocked() {
mVibrateNotificationKey = null;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mVibrator.cancel();
} finally {
@@ -2865,7 +2865,7 @@ public class NotificationManagerService extends SystemService {
callingUid);
final boolean appIsForeground;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
appIsForeground = mActivityManager.getUidImportance(callingUid)
== IMPORTANCE_FOREGROUND;
@@ -2885,7 +2885,7 @@ public class NotificationManagerService extends SystemService {
if (isAppRenderedToast && !isSystemToast && !isPackageInForegroundForToast(pkg,
callingUid)) {
boolean block;
- long id = Binder.clearCallingIdentity();
+ final long id = Binder.clearCallingIdentity();
try {
// CHANGE_BACKGROUND_CUSTOM_TOAST_BLOCK is gated on targetSdk, so block will be
// false for apps with targetSdk < R. For apps with targetSdk R+, text toasts
@@ -2911,7 +2911,7 @@ public class NotificationManagerService extends SystemService {
synchronized (mToastQueue) {
int callingPid = Binder.getCallingPid();
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
ToastRecord record;
int index = indexOfToastLocked(pkg, token);
@@ -2990,7 +2990,7 @@ public class NotificationManagerService extends SystemService {
}
synchronized (mToastQueue) {
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
int index = indexOfToastLocked(pkg, token);
if (index >= 0) {
@@ -3008,7 +3008,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void finishToken(String pkg, IBinder token) {
synchronized (mToastQueue) {
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
int index = indexOfToastLocked(pkg, token);
if (index >= 0) {
@@ -3950,7 +3950,7 @@ public class NotificationManagerService extends SystemService {
public void cancelNotificationsFromListener(INotificationListener token, String[] keys) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
@@ -3988,7 +3988,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void requestBindListener(ComponentName component) {
checkCallerIsSystemOrSameApp(component.getPackageName());
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
ManagedServices manager =
mAssistants.isComponentEnabledForCurrentProfiles(component)
@@ -4002,7 +4002,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void requestUnbindListener(INotificationListener token) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// allow bound services to disable themselves
synchronized (mNotificationLock) {
@@ -4016,7 +4016,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void setNotificationsShownFromListener(INotificationListener token, String[] keys) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
@@ -4075,7 +4075,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void snoozeNotificationUntilContextFromListener(INotificationListener token,
String key, String snoozeCriterionId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
@@ -4094,7 +4094,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void snoozeNotificationUntilFromListener(INotificationListener token, String key,
long duration) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
@@ -4112,7 +4112,7 @@ public class NotificationManagerService extends SystemService {
*/
@Override
public void unsnoozeNotificationFromAssistant(INotificationListener token, String key) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info =
@@ -4132,7 +4132,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void unsnoozeNotificationFromSystemListener(INotificationListener token,
String key) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info =
@@ -4159,7 +4159,7 @@ public class NotificationManagerService extends SystemService {
String tag, int id) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
synchronized (mNotificationLock) {
final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token);
@@ -4456,7 +4456,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void requestUnbindProvider(IConditionProvider provider) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// allow bound services to disable themselves
final ManagedServiceInfo info = mConditionProviders.checkServiceToken(provider);
@@ -4469,7 +4469,7 @@ public class NotificationManagerService extends SystemService {
@Override
public void requestBindProvider(ComponentName component) {
checkCallerIsSystemOrSameApp(component.getPackageName());
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mConditionProviders.setComponentState(component, true);
} finally {
@@ -5036,7 +5036,7 @@ public class NotificationManagerService extends SystemService {
private int getUidForPackageAndUser(String pkg, UserHandle user) throws RemoteException {
int uid = 0;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
uid = mPackageManager.getPackageUid(pkg, 0, user.getIdentifier());
} finally {
@@ -7111,7 +7111,7 @@ public class NotificationManagerService extends SystemService {
boolean delayVibForSound) {
// Escalate privileges so we can use the vibrator even if the
// notifying app does not have the VIBRATE permission.
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
final VibrationEffect effect;
try {
@@ -7719,7 +7719,7 @@ public class NotificationManagerService extends SystemService {
// vibrate
if (canceledKey.equals(mVibrateNotificationKey)) {
mVibrateNotificationKey = null;
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mVibrator.cancel();
}
@@ -8644,7 +8644,7 @@ public class NotificationManagerService extends SystemService {
if (mCompanionManager == null) {
return false;
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
List<String> associations = mCompanionManager.getAssociations(
info.component.getPackageName(), info.userid);
diff --git a/services/core/java/com/android/server/notification/NotificationShellCmd.java b/services/core/java/com/android/server/notification/NotificationShellCmd.java
index 927dc25ac6ce..73272a012671 100644
--- a/services/core/java/com/android/server/notification/NotificationShellCmd.java
+++ b/services/core/java/com/android/server/notification/NotificationShellCmd.java
@@ -133,7 +133,7 @@ public class NotificationShellCmd extends ShellCommand {
}
String callingPackage = null;
final int callingUid = Binder.getCallingUid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
if (callingUid == Process.ROOT_UID) {
callingPackage = NotificationManagerService.ROOT_PKG;
diff --git a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
index 35170332a077..14affe7b4dd5 100644
--- a/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
+++ b/services/core/java/com/android/server/notification/ScheduleConditionProvider.java
@@ -302,7 +302,7 @@ public class ScheduleConditionProvider extends SystemConditionProviderService {
private void readSnoozed() {
synchronized (mSnoozedForAlarm) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
final String setting = Settings.Secure.getStringForUser(
mContext.getContentResolver(),
diff --git a/services/core/java/com/android/server/notification/SnoozeHelper.java b/services/core/java/com/android/server/notification/SnoozeHelper.java
index 9a9e733cb390..f7d69fdc09d2 100644
--- a/services/core/java/com/android/server/notification/SnoozeHelper.java
+++ b/services/core/java/com/android/server/notification/SnoozeHelper.java
@@ -496,7 +496,7 @@ public class SnoozeHelper {
private void scheduleRepostAtTime(String pkg, String key, int userId, long time) {
Runnable runnable = () -> {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
final PendingIntent pi = createPendingIntent(pkg, key, userId);
mAm.cancel(pi);
diff --git a/services/core/java/com/android/server/pm/InstantAppResolverConnection.java b/services/core/java/com/android/server/pm/InstantAppResolverConnection.java
index a9a4589fdb94..4f75f04b11b6 100644
--- a/services/core/java/com/android/server/pm/InstantAppResolverConnection.java
+++ b/services/core/java/com/android/server/pm/InstantAppResolverConnection.java
@@ -139,7 +139,7 @@ final class InstantAppResolverConnection implements DeathRecipient {
@WorkerThread
private IInstantAppResolver getRemoteInstanceLazy(String token)
throws ConnectionException, TimeoutException, InterruptedException {
- long binderToken = Binder.clearCallingIdentity();
+ final long binderToken = Binder.clearCallingIdentity();
try {
return bind(token);
} finally {
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index 4c1b700d958e..9bb6f7892972 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -261,7 +261,7 @@ public class LauncherAppsService extends SystemService {
verifyCallingPackage(callingPackage);
List<SessionInfo> sessionInfos = new ArrayList<>();
int[] userIds = mUm.getEnabledProfileIds(getCallingUserId());
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
for (int userId : userIds) {
sessionInfos.addAll(getPackageInstallerService().getAllSessions(userId)
@@ -541,7 +541,7 @@ public class LauncherAppsService extends SystemService {
}
final int callingUid = injectBinderCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final PackageManagerInternal pmInt =
LocalServices.getService(PackageManagerInternal.class);
@@ -615,7 +615,7 @@ public class LauncherAppsService extends SystemService {
}
final int callingUid = injectBinderCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final PackageManagerInternal pmInt =
LocalServices.getService(PackageManagerInternal.class);
@@ -649,7 +649,7 @@ public class LauncherAppsService extends SystemService {
}
final int callingUid = injectBinderCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final PackageManagerInternal pmInt =
LocalServices.getService(PackageManagerInternal.class);
@@ -928,7 +928,7 @@ public class LauncherAppsService extends SystemService {
}
final int callingUid = injectBinderCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final int state = mIPM.getComponentEnabledSetting(component, user.getIdentifier());
switch (state) {
@@ -999,7 +999,7 @@ public class LauncherAppsService extends SystemService {
boolean canLaunch = false;
final int callingUid = injectBinderCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final PackageManagerInternal pmInt =
LocalServices.getService(PackageManagerInternal.class);
@@ -1050,7 +1050,7 @@ public class LauncherAppsService extends SystemService {
}
final Intent intent;
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
String packageName = component.getPackageName();
intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 31ee59717dba..b9893f1a85d9 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -980,7 +980,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
} else if (canSilentlyInstallPackage) {
// Allow the device owner and affiliated profile owner to silently delete packages
// Need to clear the calling identity to get DELETE_PACKAGES permission
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mPm.deletePackageVersioned(versionedPackage, adapter.getBinder(), userId, flags);
} finally {
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 0f9a5cc331a0..9f1df735693f 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -5699,7 +5699,7 @@ public class PackageManagerService extends IPackageManager.Stub
continue;
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
PackageInfo packageInfo = getPackageInfoVersioned(declaringPackage, flags
| PackageManager.MATCH_STATIC_SHARED_LIBRARIES, userId);
@@ -7632,7 +7632,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
private boolean isUserEnabled(int userId) {
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
UserInfo userInfo = mUserManager.getUserInfo(userId);
return userInfo != null && userInfo.isEnabled();
@@ -8043,7 +8043,7 @@ public class PackageManagerService extends IPackageManager.Stub
private ResolveInfo createForwardingResolveInfoUnchecked(IntentFilter filter,
int sourceUserId, int targetUserId) {
ResolveInfo forwardingResolveInfo = new ResolveInfo();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
boolean targetIsProfile;
try {
targetIsProfile = mUserManager.getUserInfo(targetUserId).isManagedProfile();
@@ -10178,7 +10178,7 @@ public class PackageManagerService extends IPackageManager.Stub
mPackageUsage.maybeWriteAsync(mSettings.mPackages);
mCompilerStats.maybeWriteAsync();
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
synchronized (mInstallLock) {
return performDexOptInternalWithDependenciesLI(p, pkgSetting, options);
@@ -13173,7 +13173,7 @@ public class PackageManagerService extends IPackageManager.Stub
return false;
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
boolean sendAdded = false;
boolean sendRemoved = false;
@@ -13340,7 +13340,7 @@ public class PackageManagerService extends IPackageManager.Stub
true /* requireFullPermission */, false /* checkShell */,
"getApplicationHidden for user " + userId);
PackageSetting ps;
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
// writer
synchronized (mLock) {
@@ -13395,7 +13395,7 @@ public class PackageManagerService extends IPackageManager.Stub
return PackageManager.INSTALL_FAILED_USER_RESTRICTED;
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
boolean installed = false;
final boolean instantApp =
@@ -14486,7 +14486,7 @@ public class PackageManagerService extends IPackageManager.Stub
// was never set.
EventLog.writeEvent(0x534e4554, "150857253", callingUid, "");
- long binderToken = Binder.clearCallingIdentity();
+ final long binderToken = Binder.clearCallingIdentity();
try {
if (mInjector.getCompatibility().isChangeEnabledByUid(
THROW_EXCEPTION_ON_REQUIRE_INSTALL_PACKAGES_TO_ADD_INSTALLER_PACKAGE,
@@ -21154,7 +21154,7 @@ public class PackageManagerService extends IPackageManager.Stub
if (packageName == null) {
return null;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (getPackageInfo(packageName, MATCH_FACTORY_ONLY, UserHandle.USER_SYSTEM) == null) {
PackageInfo packageInfo = getPackageInfo(packageName, 0, UserHandle.USER_SYSTEM);
@@ -21515,7 +21515,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
if (sendNow) {
int packageUid = UserHandle.getUid(userId, pkgSetting.appId);
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 1dc035f26d83..4c8d2b9b0a9e 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -4387,7 +4387,7 @@ public final class Settings {
*/
private static List<UserInfo> getUsers(UserManagerService userManager, boolean excludeDying,
boolean excludePreCreated) {
- long id = Binder.clearCallingIdentity();
+ final long id = Binder.clearCallingIdentity();
try {
return userManager.getUsers(/* excludePartial= */ true, excludeDying,
excludePreCreated);
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 0a8c8f6cbebc..2ada6131b0d2 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -1660,7 +1660,7 @@ public class UserManagerService extends IUserManager.Stub {
}
}
if (changed) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
sendUserInfoChangedBroadcast(userId);
} finally {
@@ -3769,7 +3769,7 @@ public class UserManagerService extends IUserManager.Stub {
if (user == null) {
return null;
}
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
setUserRestriction(UserManager.DISALLOW_MODIFY_ACCOUNTS, true, user.id);
// Change the setting before applying the DISALLOW_SHARE_LOCATION restriction, otherwise
@@ -3822,7 +3822,7 @@ public class UserManagerService extends IUserManager.Stub {
return false;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final UserData userData;
synchronized (mPackagesLock) {
@@ -3883,7 +3883,7 @@ public class UserManagerService extends IUserManager.Stub {
}
private boolean removeUserUnchecked(@UserIdInt int userId) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final UserData userData;
int currentUser = ActivityManager.getCurrentUser();
@@ -3991,7 +3991,7 @@ public class UserManagerService extends IUserManager.Stub {
// Let other services shutdown any activity and clean up their state before completely
// wiping the user's system directory and removing from the user list
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
Intent removedIntent = new Intent(Intent.ACTION_USER_REMOVED);
removedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
@@ -4153,7 +4153,7 @@ public class UserManagerService extends IUserManager.Stub {
}
private int getUidForPackage(String packageName) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return mContext.getPackageManager().getApplicationInfo(packageName,
PackageManager.MATCH_ANY_USER).uid;
@@ -5067,7 +5067,7 @@ public class UserManagerService extends IUserManager.Stub {
@Override
public void setUserIcon(@UserIdInt int userId, Bitmap bitmap) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mPackagesLock) {
UserData userData = getUserDataNoChecks(userId);
diff --git a/services/core/java/com/android/server/pm/dex/ArtManagerService.java b/services/core/java/com/android/server/pm/dex/ArtManagerService.java
index 37127233be13..f74913c03ce2 100644
--- a/services/core/java/com/android/server/pm/dex/ArtManagerService.java
+++ b/services/core/java/com/android/server/pm/dex/ArtManagerService.java
@@ -501,7 +501,7 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
}
Log.i("PackageManager", "Compiling layouts in " + packageName + " (" + apkPath +
") to " + outDexFile);
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
synchronized (mInstallLock) {
return mInstaller.compileLayouts(apkPath, packageName, outDexFile,
diff --git a/services/core/java/com/android/server/pm/dex/ViewCompiler.java b/services/core/java/com/android/server/pm/dex/ViewCompiler.java
index a5672664f6fd..8afe62aabd59 100644
--- a/services/core/java/com/android/server/pm/dex/ViewCompiler.java
+++ b/services/core/java/com/android/server/pm/dex/ViewCompiler.java
@@ -46,7 +46,7 @@ public class ViewCompiler {
final String outDexFile = dataDir.getAbsolutePath() + "/code_cache/compiled_view.dex";
Log.i("PackageManager", "Compiling layouts in " + packageName + " (" + apkPath +
") to " + outDexFile);
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
synchronized (mInstallLock) {
return mInstaller.compileLayouts(apkPath, packageName, outDexFile,
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index d7ff9a117e9d..40f4748e6781 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -695,7 +695,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
boolean overridePolicy = false;
if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
if ((flagMask & FLAG_PERMISSION_POLICY_FIXED) != 0) {
if (checkAdjustPolicyFlagPermission) {
@@ -1051,7 +1051,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
// check.
if (packageName != null) {
// Allow access to a package that has been granted the READ_DEVICE_IDENTIFIERS appop.
- long token = mInjector.clearCallingIdentity();
+ final long token = mInjector.clearCallingIdentity();
AppOpsManager appOpsManager = (AppOpsManager) mInjector.getSystemService(
Context.APP_OPS_SERVICE);
try {
@@ -3192,7 +3192,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
+ " to register permissions as one time.");
Objects.requireNonNull(packageName);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
getOneTimePermissionUserManager(userId).startPackageOneTimeSession(packageName,
timeoutMillis, importanceToResetTimer, importanceToKeepSessionAlive);
@@ -3208,7 +3208,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
+ " to remove permissions as one time.");
Objects.requireNonNull(packageName);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
getOneTimePermissionUserManager(userId).stopPackageOneTimeSession(packageName);
} finally {
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index a291cef5b39e..e7b1b4e4a687 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -660,7 +660,7 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
@Override
public String getDefaultSmsPackage(int userId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return CollectionUtils.firstOrNull(
getRoleHoldersAsUser(RoleManager.ROLE_SMS, userId));
@@ -699,7 +699,7 @@ public class RoleManagerService extends SystemService implements RoleUserState.C
}
private int getUidForPackage(String packageName) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return getContext().getPackageManager().getApplicationInfo(packageName,
PackageManager.MATCH_ANY_USER).uid;
diff --git a/services/core/java/com/android/server/search/Searchables.java b/services/core/java/com/android/server/search/Searchables.java
index ca7f0366df60..6e1e979b1bac 100644
--- a/services/core/java/com/android/server/search/Searchables.java
+++ b/services/core/java/com/android/server/search/Searchables.java
@@ -234,7 +234,7 @@ public class Searchables {
List<ResolveInfo> searchList;
final Intent intent = new Intent(Intent.ACTION_SEARCH);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
searchList = queryIntentActivities(intent,
PackageManager.GET_META_DATA | PackageManager.MATCH_DEBUG_TRIAGED_MISSING);
diff --git a/services/core/java/com/android/server/slice/SliceManagerService.java b/services/core/java/com/android/server/slice/SliceManagerService.java
index 2a74b3d23829..ee9694f90216 100644
--- a/services/core/java/com/android/server/slice/SliceManagerService.java
+++ b/services/core/java/com/android/server/slice/SliceManagerService.java
@@ -281,7 +281,7 @@ public class SliceManagerService extends ISliceManager.Stub {
String providerPkg = getProviderPkg(grantUri, providerUser);
mPermissions.grantSliceAccess(pkg, userId, providerPkg, providerUser, grantUri);
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mContext.getContentResolver().notifyChange(uri, null);
} finally {
@@ -402,7 +402,7 @@ public class SliceManagerService extends ISliceManager.Stub {
}
private String getProviderPkg(Uri uri, int user) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
String providerName = getUriWithoutUserId(uri).getAuthority();
ProviderInfo provider = mContext.getPackageManager().resolveContentProviderAsUser(
@@ -438,7 +438,7 @@ public class SliceManagerService extends ISliceManager.Stub {
}
private boolean hasFullSliceAccess(String pkg, int userId) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
boolean ret = isDefaultHomeApp(pkg, userId) || isAssistant(pkg, userId)
|| isGrantedFullAccess(pkg, userId);
diff --git a/services/core/java/com/android/server/slice/SliceShellCommand.java b/services/core/java/com/android/server/slice/SliceShellCommand.java
index 9137a3bcbf2b..bdc8bbd13509 100644
--- a/services/core/java/com/android/server/slice/SliceShellCommand.java
+++ b/services/core/java/com/android/server/slice/SliceShellCommand.java
@@ -69,7 +69,7 @@ public class SliceShellCommand extends ShellCommand {
return -1;
}
Context context = mService.getContext();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
Uri uri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index c871a5e9647f..e0b671f38426 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -1574,7 +1574,7 @@ public class StatsPullAtomService extends SystemService {
}
int pullWifiActivityInfoLocked(int atomTag, List<StatsEvent> pulledData) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
SynchronousResultReceiver wifiReceiver = new SynchronousResultReceiver("wifi");
mWifiManager.getWifiActivityEnergyInfoAsync(
@@ -1622,7 +1622,7 @@ public class StatsPullAtomService extends SystemService {
}
int pullModemActivityInfoLocked(int atomTag, List<StatsEvent> pulledData) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
SynchronousResultReceiver modemReceiver = new SynchronousResultReceiver("telephony");
mTelephony.requestModemActivityInfo(modemReceiver);
@@ -2723,7 +2723,7 @@ public class StatsPullAtomService extends SystemService {
// Add a RoleHolder atom for each package that holds a role.
int pullRoleHolderLocked(int atomTag, List<StatsEvent> pulledData) {
- long callingToken = Binder.clearCallingIdentity();
+ final long callingToken = Binder.clearCallingIdentity();
try {
PackageManager pm = mContext.getPackageManager();
RoleManagerInternal rmi = LocalServices.getService(RoleManagerInternal.class);
diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
index d1fd0adb44c2..6a68dc1fb2a2 100644
--- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
+++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java
@@ -1158,7 +1158,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onPanelRevealed(boolean clearNotificationEffects, int numItems) {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onPanelRevealed(clearNotificationEffects, numItems);
} finally {
@@ -1169,7 +1169,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void clearNotificationEffects() throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.clearEffects();
} finally {
@@ -1180,7 +1180,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onPanelHidden() throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onPanelHidden();
} finally {
@@ -1196,7 +1196,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
String reason = PowerManager.SHUTDOWN_USER_REQUESTED;
ShutdownCheckPoints.recordCheckPoint(Binder.getCallingPid(), reason);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.prepareForPossibleShutdown();
// ShutdownThread displays UI, so give it a UI context.
@@ -1217,7 +1217,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
? PowerManager.REBOOT_SAFE_MODE
: PowerManager.SHUTDOWN_USER_REQUESTED;
ShutdownCheckPoints.recordCheckPoint(Binder.getCallingPid(), reason);
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.prepareForPossibleShutdown();
mHandler.post(() -> {
@@ -1236,7 +1236,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onGlobalActionsShown() {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
if (mGlobalActionListener == null) return;
mGlobalActionListener.onGlobalActionsShown();
@@ -1248,7 +1248,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onGlobalActionsHidden() {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
if (mGlobalActionListener == null) return;
mGlobalActionListener.onGlobalActionsDismissed();
@@ -1262,7 +1262,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationClick(callingUid, callingPid, key, nv);
} finally {
@@ -1277,7 +1277,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationActionClick(callingUid, callingPid, key,
actionIndex, action, nv, generatedByAssistant);
@@ -1292,7 +1292,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
// WARNING: this will call back into us to do the remove. Don't hold any locks.
mNotificationDelegate.onNotificationError(callingUid, callingPid,
@@ -1310,7 +1310,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationClear(callingUid, callingPid, pkg, tag, id, userId,
key, dismissalSurface, dismissalSentiment, nv);
@@ -1324,7 +1324,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
NotificationVisibility[] newlyVisibleKeys, NotificationVisibility[] noLongerVisibleKeys)
throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationVisibilityChanged(
newlyVisibleKeys, noLongerVisibleKeys);
@@ -1337,7 +1337,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
public void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded,
int location) throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationExpansionChanged(
key, userAction, expanded, location);
@@ -1349,7 +1349,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onNotificationDirectReplied(String key) throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationDirectReplied(key);
} finally {
@@ -1361,7 +1361,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
public void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount,
int smartActionCount, boolean generatedByAssistant, boolean editBeforeSending) {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationSmartSuggestionsAdded(key, smartReplyCount,
smartActionCount, generatedByAssistant, editBeforeSending);
@@ -1375,7 +1375,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
String key, int replyIndex, CharSequence reply, int notificationLocation,
boolean modifiedBeforeSending) throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationSmartReplySent(key, replyIndex, reply,
notificationLocation, modifiedBeforeSending);
@@ -1387,7 +1387,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onNotificationSettingsViewed(String key) throws RemoteException {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationSettingsViewed(key);
} finally {
@@ -1400,7 +1400,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
enforceStatusBarService();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onClearAll(callingUid, callingPid, userId);
} finally {
@@ -1411,7 +1411,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onNotificationBubbleChanged(String key, boolean isBubble, int flags) {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onNotificationBubbleChanged(key, isBubble, flags);
} finally {
@@ -1422,7 +1422,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
@Override
public void onBubbleNotificationSuppressionChanged(String key, boolean isNotifSuppressed) {
enforceStatusBarService();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.onBubbleNotificationSuppressionChanged(key, isNotifSuppressed);
} finally {
@@ -1446,7 +1446,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
String packageName) {
enforceStatusBarService();
int callingUid = Binder.getCallingUid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.grantInlineReplyUriPermission(key, uri, user, packageName,
callingUid);
@@ -1459,7 +1459,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
public void clearInlineReplyUriPermissions(String key) {
enforceStatusBarService();
int callingUid = Binder.getCallingUid();
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
mNotificationDelegate.clearInlineReplyUriPermissions(key, callingUid);
} finally {
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorService.java b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
index 70ab48b9005b..59cebf769a4e 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorService.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorService.java
@@ -114,7 +114,7 @@ public final class TimeDetectorService extends ITimeDetectorService.Stub {
enforceSuggestManualTimePermission();
Objects.requireNonNull(timeSignal);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
return mTimeDetectorStrategy.suggestManualTime(timeSignal);
} finally {
diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
index 6e1f89b3919d..d09cd38d7680 100644
--- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
+++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java
@@ -148,7 +148,7 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub
enforceManageTimeZoneDetectorPermission();
int userId = mCallerIdentityInjector.getCallingUserId();
- long token = mCallerIdentityInjector.clearCallingIdentity();
+ final long token = mCallerIdentityInjector.clearCallingIdentity();
try {
ConfigurationInternal configurationInternal =
mTimeZoneDetectorStrategy.getConfigurationInternal(userId);
@@ -164,7 +164,7 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub
Objects.requireNonNull(configuration);
int callingUserId = mCallerIdentityInjector.getCallingUserId();
- long token = mCallerIdentityInjector.clearCallingIdentity();
+ final long token = mCallerIdentityInjector.clearCallingIdentity();
try {
return mTimeZoneDetectorStrategy.updateConfiguration(callingUserId, configuration);
} finally {
@@ -278,7 +278,7 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub
Objects.requireNonNull(timeZoneSuggestion);
int userId = mCallerIdentityInjector.getCallingUserId();
- long token = mCallerIdentityInjector.clearCallingIdentity();
+ final long token = mCallerIdentityInjector.clearCallingIdentity();
try {
return mTimeZoneDetectorStrategy.suggestManualTimeZone(userId, timeZoneSuggestion);
} finally {
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 89b108c24630..0e8fd8fa9f8a 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -1125,7 +1125,7 @@ public class TrustManagerService extends SystemService {
userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId,
false /* allowAll */, true /* requireFull */, "isDeviceLocked", null);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
userId = resolveProfileParent(userId);
@@ -1141,7 +1141,7 @@ public class TrustManagerService extends SystemService {
userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId,
false /* allowAll */, true /* requireFull */, "isDeviceSecure", null);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
userId = resolveProfileParent(userId);
@@ -1328,7 +1328,7 @@ public class TrustManagerService extends SystemService {
}
private int resolveProfileParent(int userId) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
UserInfo parent = mUserManager.getProfileParent(userId);
if (parent != null) {
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 5f4d46cabdc0..8b0963b9f535 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -1444,7 +1444,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
public void engineShown(IWallpaperEngine engine) {
synchronized (mLock) {
if (mReply != null) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mReply.sendResult(null);
} catch (RemoteException e) {
@@ -2009,7 +2009,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
public boolean hasNamedWallpaper(String name) {
synchronized (mLock) {
List<UserInfo> users;
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
users = ((UserManager) mContext.getSystemService(Context.USER_SERVICE)).getUsers();
} finally {
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateService.java b/services/core/java/com/android/server/webkit/WebViewUpdateService.java
index 90a153be8800..ee46ce13ee73 100644
--- a/services/core/java/com/android/server/webkit/WebViewUpdateService.java
+++ b/services/core/java/com/android/server/webkit/WebViewUpdateService.java
@@ -171,7 +171,7 @@ public class WebViewUpdateService extends SystemService {
return;
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
WebViewUpdateService.this.mImpl.notifyRelroCreationCompleted();
} finally {
@@ -232,7 +232,7 @@ public class WebViewUpdateService extends SystemService {
throw new SecurityException(msg);
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
return WebViewUpdateService.this.mImpl.changeProviderAndSetting(
newProvider);
@@ -285,7 +285,7 @@ public class WebViewUpdateService extends SystemService {
throw new SecurityException(msg);
}
- long callingId = Binder.clearCallingIdentity();
+ final long callingId = Binder.clearCallingIdentity();
try {
WebViewUpdateService.this.mImpl.enableMultiProcess(enable);
} finally {
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index e06c156bceab..16a5c3ffff51 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -2172,7 +2172,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public RootTaskInfo getFocusedRootTaskInfo() throws RemoteException {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "getFocusedRootTaskInfo()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
Task focusedStack = getTopDisplayFocusedStack();
@@ -2357,7 +2357,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public Rect getTaskBounds(int taskId) {
mAmInternal.enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "getTaskBounds()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
Rect rect = new Rect();
try {
synchronized (mGlobalLock) {
@@ -2921,7 +2921,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public List<RootTaskInfo> getAllRootTaskInfos() {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "getAllRootTaskInfos()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mRootWindowContainer.getAllRootTaskInfos(INVALID_DISPLAY);
@@ -2934,7 +2934,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public RootTaskInfo getRootTaskInfo(int windowingMode, int activityType) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "getRootTaskInfo()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mRootWindowContainer.getRootTaskInfo(windowingMode, activityType);
@@ -2948,7 +2948,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
public List<RootTaskInfo> getAllRootTaskInfosOnDisplay(int displayId) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS,
"getAllRootTaskInfosOnDisplay()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mRootWindowContainer.getAllRootTaskInfos(displayId);
@@ -2962,7 +2962,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
public RootTaskInfo getRootTaskInfoOnDisplay(int windowingMode, int activityType,
int displayId) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "getRootTaskInfoOnDisplay()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mRootWindowContainer.getRootTaskInfo(windowingMode, activityType, displayId);
@@ -3004,7 +3004,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
public void startSystemLockTaskMode(int taskId) {
mAmInternal.enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "startSystemLockTaskMode");
// This makes inner call to look as if it was initiated by system.
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
final Task task = mRootWindowContainer.anyTaskForId(taskId,
@@ -3055,7 +3055,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
// - will put the device in fully locked mode (LockTask), if the app is allowlisted
// - will start the pinned mode, otherwise
final int callingUid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
// When a task is locked, dismiss the pinned stack if it exists
mRootWindowContainer.removeRootTasksInWindowingModes(WINDOWING_MODE_PINNED);
@@ -3068,7 +3068,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
private void stopLockTaskModeInternal(@Nullable IBinder token, boolean isSystemCaller) {
final int callingUid = Binder.getCallingUid();
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
Task task = null;
@@ -3149,7 +3149,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
public List<IBinder> getAppTasks(String callingPackage) {
int callingUid = Binder.getCallingUid();
assertPackageMatchesCallingUid(callingPackage);
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mRecentTasks.getAppTasksList(callingUid, callingPackage);
@@ -3368,7 +3368,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public boolean resizeTask(int taskId, Rect bounds, int resizeMode) {
mAmInternal.enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "resizeTask()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
final Task task = mRootWindowContainer.anyTaskForId(taskId,
@@ -3433,7 +3433,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
synchronized (mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
if (mKeyguardShown != keyguardShowing) {
mKeyguardShown = keyguardShowing;
final Message msg = PooledLambda.obtainMessage(
@@ -3498,7 +3498,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public void toggleFreeformWindowingMode(IBinder token) {
synchronized (mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (r == null) {
@@ -3818,7 +3818,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override
public boolean showAssistFromActivity(IBinder token, Bundle args) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
ActivityRecord caller = ActivityRecord.forTokenLocked(token);
@@ -3862,7 +3862,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
try {
activityToCallback.app.getThread().scheduleLocalVoiceInteractionStarted(activity,
voiceInteractor);
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
startRunningVoiceLocked(voiceSession, activityToCallback.info.applicationInfo.uid);
} finally {
@@ -3999,7 +3999,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
+ "Device doesn't support picture-in-picture mode");
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return mRootWindowContainer.moveTopStackActivityToPinnedRootTask(rootTaskId);
} finally {
@@ -4177,7 +4177,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
Rect tempDockedTaskInsetBounds,
Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "resizePrimarySplitScreen()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
final TaskDisplayArea tc = mRootWindowContainer.getDefaultTaskDisplayArea();
diff --git a/services/core/java/com/android/server/wm/AppTaskImpl.java b/services/core/java/com/android/server/wm/AppTaskImpl.java
index dd1d55b2d54d..3e798790f45e 100644
--- a/services/core/java/com/android/server/wm/AppTaskImpl.java
+++ b/services/core/java/com/android/server/wm/AppTaskImpl.java
@@ -58,7 +58,7 @@ class AppTaskImpl extends IAppTask.Stub {
checkCaller();
synchronized (mService.mGlobalLock) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
// We remove the task from recents to preserve backwards
if (!mService.mStackSupervisor.removeTaskById(mTaskId, false,
@@ -76,7 +76,7 @@ class AppTaskImpl extends IAppTask.Stub {
checkCaller();
synchronized (mService.mGlobalLock) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
Task task = mService.mRootWindowContainer.anyTaskForId(mTaskId,
MATCH_TASK_IN_STACKS_OR_RECENT_TASKS);
@@ -162,7 +162,7 @@ class AppTaskImpl extends IAppTask.Stub {
checkCaller();
synchronized (mService.mGlobalLock) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
Task task = mService.mRootWindowContainer.anyTaskForId(mTaskId,
MATCH_TASK_IN_STACKS_OR_RECENT_TASKS);
diff --git a/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java b/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java
index c5c236416013..14880ed30f24 100644
--- a/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java
+++ b/services/core/java/com/android/server/wm/DragAndDropPermissionsHandler.java
@@ -71,7 +71,7 @@ class DragAndDropPermissionsHandler extends IDragAndDropPermissions.Stub
}
private void doTake(IBinder permissionOwner) throws RemoteException {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
for (int i = 0; i < mUris.size(); i++) {
UriGrantsManager.getService().grantUriPermissionFromOwner(
diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java
index 9ff99f5093d6..1fdb49f38cf5 100644
--- a/services/core/java/com/android/server/wm/Session.java
+++ b/services/core/java/com/android/server/wm/Session.java
@@ -255,7 +255,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public boolean performHapticFeedback(int effectId, boolean always) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return mService.mPolicy.performHapticFeedback(mUid, mPackageName,
effectId, always, null);
@@ -313,7 +313,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
if (DEBUG_TASK_POSITIONING) Slog.d(
TAG_WM, "startMovingTask: {" + startX + "," + startY + "}");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
return mService.mTaskPositioningController.startMovingTask(window, startX, startY);
} finally {
@@ -325,7 +325,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
public void finishMovingTask(IWindow window) {
if (DEBUG_TASK_POSITIONING) Slog.d(TAG_WM, "finishMovingTask");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mService.mTaskPositioningController.finishTaskPositioning(window);
} finally {
@@ -335,7 +335,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public void reportSystemGestureExclusionChanged(IWindow window, List<Rect> exclusionRects) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mService.reportSystemGestureExclusionChanged(this, window, exclusionRects);
} finally {
@@ -352,7 +352,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public void setWallpaperPosition(IBinder window, float x, float y, float xStep, float yStep) {
synchronized (mService.mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
actionOnWallpaper(window, (wpController, windowState) ->
wpController.setWindowWallpaperPosition(windowState, x, y, xStep, yStep));
@@ -369,7 +369,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
+ zoom);
}
synchronized (mService.mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
actionOnWallpaper(window, (wpController, windowState) ->
wpController.setWallpaperZoomOut(windowState, zoom));
@@ -398,7 +398,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
@Override
public void setWallpaperDisplayOffset(IBinder window, int x, int y) {
synchronized (mService.mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
actionOnWallpaper(window, (wpController, windowState) ->
wpController.setWindowWallpaperDisplayOffset(windowState, x, y));
@@ -412,7 +412,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
public Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
int z, Bundle extras, boolean sync) {
synchronized (mService.mGlobalLock) {
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
final WindowState windowState = mService.windowForClientLocked(this, window, true);
return windowState.getDisplayContent().mWallpaperController
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 19cfcb21c8ac..f15877d600a8 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2013,7 +2013,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
void setTransparentRegionWindow(Session session, IWindow client, Region region) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
WindowState w = windowForClientLocked(session, client, false);
@@ -2031,7 +2031,7 @@ public class WindowManagerService extends IWindowManager.Stub
void setInsetsWindow(Session session, IWindow client, int touchableInsets, Rect contentInsets,
Rect visibleInsets, Region touchableRegion) {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
WindowState w = windowForClientLocked(session, client, false);
@@ -2110,7 +2110,7 @@ public class WindowManagerService extends IWindowManager.Stub
boolean configChanged;
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
synchronized (mGlobalLock) {
final WindowState win = windowForClientLocked(session, client, false);
if (win == null) {
@@ -3057,7 +3057,7 @@ public class WindowManagerService extends IWindowManager.Stub
throw new SecurityException("Requires INTERACT_ACROSS_USERS permission");
}
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
return mPolicy.isKeyguardSecure(userId);
} finally {
@@ -3723,7 +3723,7 @@ public class WindowManagerService extends IWindowManager.Stub
+ "rotation constant.");
}
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
final DisplayContent display = mRoot.getDisplayContent(displayId);
@@ -3758,7 +3758,7 @@ public class WindowManagerService extends IWindowManager.Stub
ProtoLog.v(WM_DEBUG_ORIENTATION, "thawRotation: mRotation=%d", getDefaultDisplayRotation());
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
final DisplayContent display = mRoot.getDisplayContent(displayId);
@@ -3811,7 +3811,7 @@ public class WindowManagerService extends IWindowManager.Stub
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateRotation");
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
@@ -4104,7 +4104,7 @@ public class WindowManagerService extends IWindowManager.Stub
throw new SecurityException("Must hold permission " + WRITE_SECURE_SETTINGS);
}
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
mPolicy.setOverrideFoldedArea(area);
@@ -4118,7 +4118,7 @@ public class WindowManagerService extends IWindowManager.Stub
* Get the display folded area.
*/
@NonNull Rect getFoldedArea() {
- long origId = Binder.clearCallingIdentity();
+ final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
return mPolicy.getFoldedArea();
@@ -4135,7 +4135,7 @@ public class WindowManagerService extends IWindowManager.Stub
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Must hold permission " + MANAGE_ACTIVITY_STACKS);
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
mDisplayNotificationController.registerListener(listener);
} finally {
@@ -7856,7 +7856,7 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public void syncInputTransactions() {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
waitForAnimationsToComplete();
@@ -8054,7 +8054,7 @@ public class WindowManagerService extends IWindowManager.Stub
public boolean isLayerTracing() {
mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.DUMP,
"isLayerTracing");
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
Parcel data = null;
Parcel reply = null;
@@ -8087,7 +8087,7 @@ public class WindowManagerService extends IWindowManager.Stub
public void setLayerTracing(boolean enabled) {
mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.DUMP,
"setLayerTracing");
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
Parcel data = null;
try {
@@ -8114,7 +8114,7 @@ public class WindowManagerService extends IWindowManager.Stub
public void setLayerTracingFlags(int flags) {
mAtmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.DUMP,
"setLayerTracingFlags");
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
Parcel data = null;
try {
diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java
index f1641cdfcf67..0b200e2bd6d2 100644
--- a/services/core/java/com/android/server/wm/WindowOrganizerController.java
+++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java
@@ -120,7 +120,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
public IBinder startTransition(int type, @Nullable IBinder transitionToken,
@Nullable WindowContainerTransaction t) {
enforceStackPermission("startTransition()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
Transition transition = Transition.fromBinder(transitionToken);
@@ -147,7 +147,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
@Nullable WindowContainerTransaction t,
@Nullable IWindowContainerTransactionCallback callback) {
enforceStackPermission("finishTransition()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
int syncId = -1;
@@ -176,7 +176,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
throw new IllegalArgumentException(
"Null transaction passed to applySyncTransaction");
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
int effects = 0;
@@ -589,7 +589,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
@Override
public void registerTransitionPlayer(ITransitionPlayer player) {
enforceStackPermission("registerTransitionPlayer()");
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
mTransitionController.registerTransitionPlayer(player);
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 5f6ac10bee40..8ba2bdee3d4f 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -1124,7 +1124,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
}
boolean storageManagerIsNonDefaultBlockEncrypted() {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return StorageManager.isNonDefaultBlockEncrypted();
} finally {
diff --git a/services/midi/java/com/android/server/midi/MidiService.java b/services/midi/java/com/android/server/midi/MidiService.java
index 2cfdf3fd4f6f..47505a398a6f 100644
--- a/services/midi/java/com/android/server/midi/MidiService.java
+++ b/services/midi/java/com/android/server/midi/MidiService.java
@@ -667,7 +667,7 @@ public class MidiService extends IMidiManager.Stub {
}
// clear calling identity so bindService does not fail
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
client.addDeviceConnection(device, callback);
} finally {
@@ -692,7 +692,7 @@ public class MidiService extends IMidiManager.Stub {
}
// clear calling identity so bindService does not fail
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
client.addDeviceConnection(device, callback);
} finally {
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) {
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
index 09b6d7b0cd7e..cb49a519d10a 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmMockContext.java
@@ -113,7 +113,7 @@ public class DpmMockContext extends MockContext {
}
public void withCleanCallingIdentity(@NonNull FunctionalUtils.ThrowingRunnable action) {
- long callingIdentity = clearCallingIdentity();
+ final long callingIdentity = clearCallingIdentity();
Throwable throwableToPropagate = null;
try {
action.runOrThrow();
diff --git a/services/usb/java/com/android/server/usb/UsbSerialReader.java b/services/usb/java/com/android/server/usb/UsbSerialReader.java
index 095e8e9b7b5b..f241e65ba755 100644
--- a/services/usb/java/com/android/server/usb/UsbSerialReader.java
+++ b/services/usb/java/com/android/server/usb/UsbSerialReader.java
@@ -77,7 +77,7 @@ class UsbSerialReader extends IUsbSerialReader.Stub {
UserHandle user = Binder.getCallingUserHandle();
int packageTargetSdkVersion;
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
PackageInfo pkg;
try {
diff --git a/services/usb/java/com/android/server/usb/UsbService.java b/services/usb/java/com/android/server/usb/UsbService.java
index 14c7f04b9e82..444cb5cb89c7 100644
--- a/services/usb/java/com/android/server/usb/UsbService.java
+++ b/services/usb/java/com/android/server/usb/UsbService.java
@@ -281,7 +281,7 @@ public class UsbService extends IUsbManager.Stub {
int pid = Binder.getCallingPid();
int user = UserHandle.getUserId(uid);
- long ident = clearCallingIdentity();
+ final long ident = clearCallingIdentity();
try {
synchronized (mLock) {
if (mUserManager.isSameProfileGroup(user, mCurrentUserId)) {
@@ -318,7 +318,7 @@ public class UsbService extends IUsbManager.Stub {
int uid = Binder.getCallingUid();
int user = UserHandle.getUserId(uid);
- long ident = clearCallingIdentity();
+ final long ident = clearCallingIdentity();
try {
synchronized (mLock) {
if (mUserManager.isSameProfileGroup(user, mCurrentUserId)) {
diff --git a/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java b/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
index 333edfd91b16..44ae481d85bd 100644
--- a/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
+++ b/services/usb/java/com/android/server/usb/UsbUserPermissionManager.java
@@ -505,7 +505,7 @@ class UsbUserPermissionManager {
int uid,
@NonNull Context userContext,
@NonNull PendingIntent pi) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
Intent intent = new Intent();
if (device != null) {
intent.putExtra(UsbManager.EXTRA_DEVICE, device);
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
index b6506b408714..64f8c585c80b 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerHelper.java
@@ -1027,7 +1027,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
// internalClearGlobalStateLocked() cleans up the telephony and power save listeners.
private void internalClearGlobalStateLocked() {
// Unregister from call state changes.
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
} finally {
@@ -1100,7 +1100,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
if (mRecognitionRequested) {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
// Get the current call state synchronously for the first recognition.
mCallActive = mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK;
diff --git a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
index a73e73e37fff..5999044d9427 100644
--- a/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
+++ b/services/voiceinteraction/java/com/android/server/soundtrigger/SoundTriggerService.java
@@ -899,7 +899,7 @@ public class SoundTriggerService extends SystemService {
mClient = new ISoundTriggerDetectionServiceClient.Stub() {
@Override
public void onOpFinished(int opId) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
synchronized (mRemoteServiceLock) {
mRunningOpIds.remove(opId);
@@ -1013,7 +1013,7 @@ public class SoundTriggerService extends SystemService {
* Verify that the service has the expected properties and then bind to the service
*/
private void bind() {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
Intent i = new Intent();
i.setComponent(mServiceName);
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
index 0ff92739f8b6..cfdc5682a117 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java
@@ -309,7 +309,7 @@ final class VoiceInteractionSessionConnection implements ServiceConnection,
if (!"content".equals(uri.getScheme())) {
return;
}
- long ident = Binder.clearCallingIdentity();
+ final long ident = Binder.clearCallingIdentity();
try {
// This will throw SecurityException for us.
mUgmInternal.checkGrantUriPermission(srcUid, null,
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index 5b806a6e57da..1c070748400d 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -74,7 +74,7 @@ public class DefaultDialerManager {
* */
public static boolean setDefaultDialerApplication(Context context, String packageName,
int user) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
CompletableFuture<Void> future = new CompletableFuture<>();
Consumer<Boolean> callback = successful -> {
@@ -128,7 +128,7 @@ public class DefaultDialerManager {
* @hide
* */
public static String getDefaultDialerApplication(Context context, int user) {
- long identity = Binder.clearCallingIdentity();
+ final long identity = Binder.clearCallingIdentity();
try {
return CollectionUtils.firstOrNull(context.getSystemService(RoleManager.class)
.getRoleHoldersAsUser(RoleManager.ROLE_DIALER, UserHandle.of(user)));
diff --git a/telephony/common/android/telephony/LocationAccessPolicy.java b/telephony/common/android/telephony/LocationAccessPolicy.java
index 502bfa3749eb..85d59a216f25 100644
--- a/telephony/common/android/telephony/LocationAccessPolicy.java
+++ b/telephony/common/android/telephony/LocationAccessPolicy.java
@@ -377,7 +377,7 @@ public final class LocationAccessPolicy {
}
private static boolean isCurrentProfile(@NonNull Context context, int uid) {
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
if (UserHandle.getUserHandleForUid(uid).getIdentifier()
== ActivityManager.getCurrentUser()) {
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 {
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index ee2fce7e7dd5..3a0e49e204cb 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -161,7 +161,7 @@ public class ImsMmTelManager implements RegistrationManager {
public void onCapabilitiesStatusChanged(int config) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onCapabilitiesStatusChanged(
new MmTelFeature.MmTelCapabilities(config)));
diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java
index 94407f1dcd3a..a7586ec4ec18 100644
--- a/telephony/java/android/telephony/ims/ImsRcsManager.java
+++ b/telephony/java/android/telephony/ims/ImsRcsManager.java
@@ -99,7 +99,7 @@ public class ImsRcsManager {
public void onCapabilitiesStatusChanged(int config) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onAvailabilityChanged(
new RcsFeature.RcsImsCapabilities(config)));
diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java
index 2a073a1f1d81..3affdf64aae7 100644
--- a/telephony/java/android/telephony/ims/ProvisioningManager.java
+++ b/telephony/java/android/telephony/ims/ProvisioningManager.java
@@ -879,7 +879,7 @@ public class ProvisioningManager {
@Override
public final void onIntConfigChanged(int item, int value) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalConfigurationCallback.onProvisioningIntChanged(item, value));
@@ -890,7 +890,7 @@ public class ProvisioningManager {
@Override
public final void onStringConfigChanged(int item, String value) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalConfigurationCallback.onProvisioningStringChanged(item, value));
diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java
index a427d056f915..4606f7d625aa 100644
--- a/telephony/java/android/telephony/ims/RcsUceAdapter.java
+++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java
@@ -206,7 +206,7 @@ public class RcsUceAdapter {
public void onPublishStateChanged(int publishState) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onChanged(publishState));
} finally {
@@ -322,7 +322,7 @@ public class RcsUceAdapter {
IRcsUceControllerCallback internalCallback = new IRcsUceControllerCallback.Stub() {
@Override
public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() ->
c.onCapabilitiesReceived(contactCapabilities));
@@ -332,7 +332,7 @@ public class RcsUceAdapter {
}
@Override
public void onError(int errorCode) {
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() -> c.onError(errorCode));
} finally {
diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java
index e085dec10546..1a78e166932a 100644
--- a/telephony/java/android/telephony/ims/RegistrationManager.java
+++ b/telephony/java/android/telephony/ims/RegistrationManager.java
@@ -105,7 +105,7 @@ public interface RegistrationManager {
public void onRegistered(int imsRadioTech) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalCallback.onRegistered(getAccessType(imsRadioTech)));
@@ -118,7 +118,7 @@ public interface RegistrationManager {
public void onRegistering(int imsRadioTech) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() ->
mLocalCallback.onRegistering(getAccessType(imsRadioTech)));
@@ -131,7 +131,7 @@ public interface RegistrationManager {
public void onDeregistered(ImsReasonInfo info) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onUnregistered(info));
} finally {
@@ -143,7 +143,7 @@ public interface RegistrationManager {
public void onTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed(
getAccessType(imsRadioTech), info));
@@ -155,7 +155,7 @@ public interface RegistrationManager {
public void onSubscriberAssociatedUriChanged(Uri[] uris) {
if (mLocalCallback == null) return;
- long callingIdentity = Binder.clearCallingIdentity();
+ final long callingIdentity = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> mLocalCallback.onSubscriberAssociatedUriChanged(uris));
} finally {
diff --git a/telephony/java/android/telephony/mbms/InternalDownloadProgressListener.java b/telephony/java/android/telephony/mbms/InternalDownloadProgressListener.java
index 6a135694869c..a413ef8a8738 100644
--- a/telephony/java/android/telephony/mbms/InternalDownloadProgressListener.java
+++ b/telephony/java/android/telephony/mbms/InternalDownloadProgressListener.java
@@ -43,7 +43,7 @@ public class InternalDownloadProgressListener extends IDownloadProgressListener.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalDownloadSessionCallback.java b/telephony/java/android/telephony/mbms/InternalDownloadSessionCallback.java
index ce32477b443b..67539a0ad7ee 100644
--- a/telephony/java/android/telephony/mbms/InternalDownloadSessionCallback.java
+++ b/telephony/java/android/telephony/mbms/InternalDownloadSessionCallback.java
@@ -40,7 +40,7 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -59,7 +59,7 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -78,7 +78,7 @@ public class InternalDownloadSessionCallback extends IMbmsDownloadSessionCallbac
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalDownloadStatusListener.java b/telephony/java/android/telephony/mbms/InternalDownloadStatusListener.java
index 87163ff8b32c..ce96a8faeb49 100644
--- a/telephony/java/android/telephony/mbms/InternalDownloadStatusListener.java
+++ b/telephony/java/android/telephony/mbms/InternalDownloadStatusListener.java
@@ -42,7 +42,7 @@ public class InternalDownloadStatusListener extends IDownloadStatusListener.Stub
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalGroupCallCallback.java b/telephony/java/android/telephony/mbms/InternalGroupCallCallback.java
index c7600b6c7843..5e1f1f170f60 100644
--- a/telephony/java/android/telephony/mbms/InternalGroupCallCallback.java
+++ b/telephony/java/android/telephony/mbms/InternalGroupCallCallback.java
@@ -38,7 +38,7 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -57,7 +57,7 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -76,7 +76,7 @@ public class InternalGroupCallCallback extends IGroupCallCallback.Stub {
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalGroupCallSessionCallback.java b/telephony/java/android/telephony/mbms/InternalGroupCallSessionCallback.java
index 0b7667ec525c..ca4190c6b4f1 100644
--- a/telephony/java/android/telephony/mbms/InternalGroupCallSessionCallback.java
+++ b/telephony/java/android/telephony/mbms/InternalGroupCallSessionCallback.java
@@ -39,7 +39,7 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -58,7 +58,7 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -77,7 +77,7 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -96,7 +96,7 @@ public class InternalGroupCallSessionCallback extends IMbmsGroupCallSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalStreamingServiceCallback.java b/telephony/java/android/telephony/mbms/InternalStreamingServiceCallback.java
index 3a4ed08ed954..d62add193e77 100644
--- a/telephony/java/android/telephony/mbms/InternalStreamingServiceCallback.java
+++ b/telephony/java/android/telephony/mbms/InternalStreamingServiceCallback.java
@@ -39,7 +39,7 @@ public class InternalStreamingServiceCallback extends IStreamingServiceCallback.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -58,7 +58,7 @@ public class InternalStreamingServiceCallback extends IStreamingServiceCallback.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -77,7 +77,7 @@ public class InternalStreamingServiceCallback extends IStreamingServiceCallback.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -96,7 +96,7 @@ public class InternalStreamingServiceCallback extends IStreamingServiceCallback.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -115,7 +115,7 @@ public class InternalStreamingServiceCallback extends IStreamingServiceCallback.
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
diff --git a/telephony/java/android/telephony/mbms/InternalStreamingSessionCallback.java b/telephony/java/android/telephony/mbms/InternalStreamingSessionCallback.java
index 2eb280e74106..f4ee4dc069a9 100644
--- a/telephony/java/android/telephony/mbms/InternalStreamingSessionCallback.java
+++ b/telephony/java/android/telephony/mbms/InternalStreamingSessionCallback.java
@@ -40,7 +40,7 @@ public class InternalStreamingSessionCallback extends IMbmsStreamingSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -60,7 +60,7 @@ public class InternalStreamingSessionCallback extends IMbmsStreamingSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override
@@ -79,7 +79,7 @@ public class InternalStreamingSessionCallback extends IMbmsStreamingSessionCallb
return;
}
- long token = Binder.clearCallingIdentity();
+ final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(new Runnable() {
@Override