Revert "Expose role API for Settings on RoleManager."
Revert "Expose role API for Settings on RoleManager." Revert "Expose role API for Settings on RoleManager." Revert submission 13261069-role-settings-api Reason for revert: Might be breaking RcsProvisioningMonitorTest Bug: 177227549 Test: RcsProvisioningMonitor Reverted Changes: Idbd0db119:Expose role API for Settings on RoleManager. Iafe1d2460:Expose role API for Settings on RoleManager. I6a3e5a26c:Expose role API for Settings on RoleManager. Change-Id: Ifa79bcf603c6553579c0d9dbcab4df60f9d5369c
This commit is contained in:
@@ -1365,8 +1365,6 @@ package android.app.role {
|
||||
method @NonNull @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public java.util.List<java.lang.String> getHeldRolesFromController(@NonNull String);
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public java.util.List<java.lang.String> getRoleHolders(@NonNull String);
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public java.util.List<java.lang.String> getRoleHoldersAsUser(@NonNull String, @NonNull android.os.UserHandle);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void isApplicationVisibleForRole(@NonNull String, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void isRoleVisible(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
method @RequiresPermission(android.Manifest.permission.OBSERVE_ROLE_HOLDERS) public void removeOnRoleHoldersChangedListenerAsUser(@NonNull android.app.role.OnRoleHoldersChangedListener, @NonNull android.os.UserHandle);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void removeRoleHolderAsUser(@NonNull String, @NonNull String, int, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
method @RequiresPermission("com.android.permissioncontroller.permission.MANAGE_ROLES_FROM_CONTROLLER") public boolean removeRoleHolderFromController(@NonNull String, @NonNull String);
|
||||
|
||||
@@ -431,6 +431,11 @@ package android.app.prediction {
|
||||
|
||||
package android.app.role {
|
||||
|
||||
public class RoleControllerManager {
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void isApplicationVisibleForRole(@NonNull String, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public void isRoleVisible(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
|
||||
}
|
||||
|
||||
public final class RoleManager {
|
||||
method @Nullable public String getSmsRoleHolder(int);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.app.contentsuggestions.ContentSuggestionsManager;
|
||||
import android.app.contentsuggestions.IContentSuggestionsManager;
|
||||
import android.app.job.JobSchedulerFrameworkInitializer;
|
||||
import android.app.prediction.AppPredictionManager;
|
||||
import android.app.role.RoleControllerManager;
|
||||
import android.app.role.RoleManager;
|
||||
import android.app.search.SearchUiManager;
|
||||
import android.app.slice.SliceManager;
|
||||
@@ -1290,6 +1291,14 @@ public final class SystemServiceRegistry {
|
||||
return new RoleManager(ctx.getOuterContext());
|
||||
}});
|
||||
|
||||
registerService(Context.ROLE_CONTROLLER_SERVICE, RoleControllerManager.class,
|
||||
new CachedServiceFetcher<RoleControllerManager>() {
|
||||
@Override
|
||||
public RoleControllerManager createService(ContextImpl ctx)
|
||||
throws ServiceNotFoundException {
|
||||
return new RoleControllerManager(ctx.getOuterContext());
|
||||
}});
|
||||
|
||||
registerService(Context.DYNAMIC_SYSTEM_SERVICE, DynamicSystemManager.class,
|
||||
new CachedServiceFetcher<DynamicSystemManager>() {
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ import android.Manifest;
|
||||
import android.annotation.CallbackExecutor;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
import android.app.ActivityThread;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -46,6 +48,8 @@ import java.util.function.Consumer;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemService(Context.ROLE_CONTROLLER_SERVICE)
|
||||
@TestApi
|
||||
public class RoleControllerManager {
|
||||
|
||||
private static final String LOG_TAG = RoleControllerManager.class.getSimpleName();
|
||||
@@ -194,12 +198,33 @@ public class RoleControllerManager {
|
||||
propagateCallback(operation, "onClearRoleHolders", callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RoleControllerService#onIsApplicationQualifiedForRole(String, String)
|
||||
*
|
||||
* @deprecated Use {@link #isApplicationVisibleForRole(String, String, Executor, Consumer)}
|
||||
* instead.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
|
||||
public void isApplicationQualifiedForRole(@NonNull String roleName, @NonNull String packageName,
|
||||
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
|
||||
AndroidFuture<Bundle> operation = mRemoteService.postAsync(service -> {
|
||||
AndroidFuture<Bundle> future = new AndroidFuture<>();
|
||||
service.isApplicationQualifiedForRole(roleName, packageName,
|
||||
new RemoteCallback(future::complete));
|
||||
return future;
|
||||
});
|
||||
propagateCallback(operation, "isApplicationQualifiedForRole", executor, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RoleControllerService#onIsApplicationVisibleForRole(String, String)
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
|
||||
@TestApi
|
||||
public void isApplicationVisibleForRole(@NonNull String roleName, @NonNull String packageName,
|
||||
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
|
||||
AndroidFuture<Bundle> operation = mRemoteService.postAsync(service -> {
|
||||
@@ -217,6 +242,7 @@ public class RoleControllerManager {
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
|
||||
@TestApi
|
||||
public void isRoleVisible(@NonNull String roleName,
|
||||
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
|
||||
AndroidFuture<Bundle> operation = mRemoteService.postAsync(service -> {
|
||||
|
||||
@@ -174,9 +174,6 @@ public final class RoleManager {
|
||||
@NonNull
|
||||
private final Object mListenersLock = new Object();
|
||||
|
||||
@NonNull
|
||||
private final RoleControllerManager mRoleControllerManager;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -184,7 +181,6 @@ public final class RoleManager {
|
||||
mContext = context;
|
||||
mService = IRoleManager.Stub.asInterface(ServiceManager.getServiceOrThrow(
|
||||
Context.ROLE_SERVICE));
|
||||
mRoleControllerManager = new RoleControllerManager(context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,44 +676,6 @@ public final class RoleManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a role should be visible to user.
|
||||
*
|
||||
* @param roleName name of the role to check for
|
||||
* @param executor the executor to execute callback on
|
||||
* @param callback the callback to receive whether the role should be visible to user
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
|
||||
@SystemApi
|
||||
public void isRoleVisible(@NonNull String roleName,
|
||||
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
|
||||
mRoleControllerManager.isRoleVisible(roleName, executor, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an application is visible for a role.
|
||||
*
|
||||
* While an application can be qualified for a role, it can still stay hidden from user (thus
|
||||
* not visible). If an application is visible for a role, we may show things related to the role
|
||||
* for it, e.g. showing an entry pointing to the role settings in its application info page.
|
||||
*
|
||||
* @param roleName the name of the role to check for
|
||||
* @param packageName the package name of the application to check for
|
||||
* @param executor the executor to execute callback on
|
||||
* @param callback the callback to receive whether the application is visible for the role
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(Manifest.permission.MANAGE_ROLE_HOLDERS)
|
||||
@SystemApi
|
||||
public void isApplicationVisibleForRole(@NonNull String roleName, @NonNull String packageName,
|
||||
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
|
||||
mRoleControllerManager.isApplicationVisibleForRole(roleName, packageName, executor,
|
||||
callback);
|
||||
}
|
||||
|
||||
private static class OnRoleHoldersChangedListenerDelegate
|
||||
extends IOnRoleHoldersChangedListener.Stub {
|
||||
|
||||
|
||||
@@ -4820,6 +4820,16 @@ public abstract class Context {
|
||||
*/
|
||||
public static final String ROLE_SERVICE = "role";
|
||||
|
||||
/**
|
||||
* Official published name of the (internal) role controller service.
|
||||
*
|
||||
* @see #getSystemService(String)
|
||||
* @see android.app.role.RoleControllerService
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String ROLE_CONTROLLER_SERVICE = "role_controller";
|
||||
|
||||
/**
|
||||
* Use with {@link #getSystemService(String)} to retrieve a
|
||||
* {@link android.hardware.camera2.CameraManager} for interacting with
|
||||
|
||||
Reference in New Issue
Block a user