summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jay Thomas Sullivan <jaysullivan@google.com> 2023-11-21 17:58:02 -0800
committer Jay Sullivan <jaysullivan@google.com> 2023-11-22 02:04:22 +0000
commit99f92e4a0a7ce3405d2f7bb22bafcd73eea18561 (patch)
treebf8ad1b40a513e185ad6ad9a5c9dcee6fc029fde
parent4ab5669edd6ac0c92d1bfb808f39517d55787bf1 (diff)
[Role Logic Move] Fix isApplicationVisibleForRole
In a previous CL, some code was left out, causing an issue. (Only results in an issue when the feature flag is enabled.) Fix: 309139048 Test: atest CtsRoleTestCases (with flag enabled) Change-Id: I8c548ecf20820f39eb467fe92ddc788f4648301c
-rw-r--r--framework-s/java/android/app/role/RoleManager.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/framework-s/java/android/app/role/RoleManager.java b/framework-s/java/android/app/role/RoleManager.java
index 231c72c2c..aeb229cae 100644
--- a/framework-s/java/android/app/role/RoleManager.java
+++ b/framework-s/java/android/app/role/RoleManager.java
@@ -1023,11 +1023,20 @@ public final class RoleManager {
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
if (SdkLevel.isAtLeastV() && Flags.roleControllerInSystemServer()) {
int userId = getContextUserIfAppropriate().getIdentifier();
+ boolean visible;
try {
- mService.isApplicationVisibleForRoleAsUser(roleName, packageName, userId);
+ visible = mService.isApplicationVisibleForRoleAsUser(roleName, packageName, userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
+ executor.execute(() -> {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ callback.accept(visible);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ });
} else {
getRoleControllerManager().isApplicationVisibleForRole(roleName, packageName, executor,
callback);