Package org.robolectric.shadows
Class ShadowServiceManager
java.lang.Object
org.robolectric.shadows.ShadowServiceManager
@Implements(value=android.os.ServiceManager.class,
isInAndroidSdk=false)
public class ShadowServiceManager
extends Object
Shadow for
ServiceManager.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddBinderService(Map<String, org.robolectric.shadows.ShadowServiceManager.BinderService> binderServices, String name, Class<? extends IInterface> clazz) protected static voidaddService(String name, IBinder service) protected static IBindercheckService(String name) Same asgetService(java.lang.String).protected static IBindergetService(String name) Returns theIBinderassociated with the given system service.protected static voidinitServiceCache(Map<String, IBinder> cache) protected static String[]static voidreset()static voidsetServiceAvailability(String service, boolean available) Sets the availability of the given system service.
-
Field Details
-
binderServices
-
-
Constructor Details
-
ShadowServiceManager
public ShadowServiceManager()
-
-
Method Details
-
addBinderService
protected static void addBinderService(Map<String, org.robolectric.shadows.ShadowServiceManager.BinderService> binderServices, String name, Class<? extends IInterface> clazz) -
getService
Returns theIBinderassociated with the given system service. If the given service is set to unavailable insetServiceAvailability(java.lang.String, boolean),nullwill be returned. -
addService
-
checkService
Same asgetService(java.lang.String).The real implementation of
checkService(java.lang.String)differs fromgetService(java.lang.String)in that it is not a blocking call; so it is more likely to returnnullin cases where the service isn't available (whereasgetService(java.lang.String)will block until it becomes available, until a timeout or error happens). -
listServices
- Throws:
RemoteException
-
initServiceCache
-
setServiceAvailability
Sets the availability of the given system service. If the service is set as unavailable, subsequent calls toContext.getSystemService(java.lang.String)for that service will returnnull.A service is considered available by default.
-
reset
-