Fix mCachedAssociations for multiple users

There's no need clearCallingIdentity for add a new association
since we setup our mCachedAssociations as an array and the index
is the user id. We will store all the associations at index 0, if we use
clearCallingIdentity. Furthermore we alreay called withCleanCallingIdentity
when call updateSpecialAccessPermissionForAssociatedPackage.

Fix: 185617756, 186795393
Test: Manual
Change-Id: I16d443b33e15873d29e6c5a652af9b29274fbf29
This commit is contained in:
Evan Chen
2021-06-15 03:43:40 +00:00
parent e6fb6087aa
commit d20c7c084f

View File

@@ -454,19 +454,13 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
}).cancelTimeout();
}, FgThread.getExecutor()).whenComplete(uncheckExceptions((association, err) -> {
final long callingIdentity = Binder.clearCallingIdentity();
try {
if (err == null) {
addAssociation(association);
} else {
Slog.e(LOG_TAG, "Failed to discover device(s)", err);
callback.onFailure("No devices found: " + err.getMessage());
}
cleanup();
} finally {
Binder.restoreCallingIdentity(callingIdentity);
if (err == null) {
addAssociation(association);
} else {
Slog.e(LOG_TAG, "Failed to discover device(s)", err);
callback.onFailure("No devices found: " + err.getMessage());
}
cleanup();
}));
}