Package org.robolectric.shadows
Class ShadowRoleManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowRoleManager
-
@Implements(value=android.app.role.RoleManager.class, minSdk=29) public class ShadowRoleManager extends Object
A shadow implementation ofRoleManager
.
-
-
Field Summary
Fields Modifier and Type Field Description protected RoleManager
roleManager
-
Constructor Summary
Constructors Constructor Description ShadowRoleManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAvailableRole(String roleName)
Add a role that will be recognized as available when invokingRoleManager.isRoleAvailable(String)
.void
addHeldRole(String roleName)
Add a role that would be held by the calling app when invokingRoleManager.isRoleHeld(String)
.protected boolean
isRoleAvailable(String roleName)
Check whether a particular role is available on the device.protected boolean
isRoleHeld(String roleName)
Check whether the calling application is holding a particular role.void
removeAvailableRole(String roleName)
void
removeHeldRole(String roleName)
-
-
-
Field Detail
-
roleManager
@RealObject protected RoleManager roleManager
-
-
Method Detail
-
isRoleHeld
@Implementation protected boolean isRoleHeld(@NonNull String roleName)
Check whether the calling application is holding a particular role.Callers can add held roles via
addHeldRole(String)
- Parameters:
roleName
- the name of the role to check for- Returns:
- whether the calling application is holding the role
-
addHeldRole
public void addHeldRole(@NonNull String roleName)
Add a role that would be held by the calling app when invokingRoleManager.isRoleHeld(String)
.
-
removeHeldRole
public void removeHeldRole(@NonNull String roleName)
-
isRoleAvailable
@Implementation protected boolean isRoleAvailable(@NonNull String roleName)
Check whether a particular role is available on the device.Callers can add available roles via
addAvailableRole(String)
- Parameters:
roleName
- the name of the role to check for- Returns:
- whether the role is available
-
addAvailableRole
public void addAvailableRole(@NonNull String roleName)
Add a role that will be recognized as available when invokingRoleManager.isRoleAvailable(String)
.
-
removeAvailableRole
public void removeAvailableRole(@NonNull String roleName)
-
-