@Implements(className="android.app.ContextImpl") public class ShadowContextImpl extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_NAME |
Constructor and Description |
---|
ShadowContextImpl() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
bindService(android.content.Intent intent,
android.content.ServiceConnection serviceConnection,
int i) |
protected boolean |
bindServiceAsUser(android.content.Intent intent,
android.content.ServiceConnection serviceConnection,
int i,
android.os.UserHandle userHandle)
Binds to a service but ignores the given UserHandle.
|
protected int |
checkCallingOrSelfPermission(java.lang.String permission) |
protected int |
checkCallingPermission(java.lang.String permission) |
protected int |
checkPermission(java.lang.String permission,
int pid,
int uid) |
protected java.lang.ClassLoader |
getClassLoader() |
protected android.content.ContentResolver |
getContentResolver() |
protected java.io.File |
getExternalCacheDir() |
protected java.io.File |
getExternalFilesDir(java.lang.String type) |
protected java.io.File[] |
getExternalFilesDirs(java.lang.String type) |
protected java.lang.Object |
getSystemService(java.lang.String name)
Returns the handle to a system-level service by name.
|
protected int |
getUserId() |
protected android.content.Intent |
registerReceiver(android.content.BroadcastReceiver receiver,
android.content.IntentFilter filter) |
protected android.content.Intent |
registerReceiver(android.content.BroadcastReceiver receiver,
android.content.IntentFilter filter,
java.lang.String broadcastPermission,
android.os.Handler scheduler) |
protected android.content.Intent |
registerReceiverAsUser(android.content.BroadcastReceiver receiver,
android.os.UserHandle user,
android.content.IntentFilter filter,
java.lang.String broadcastPermission,
android.os.Handler scheduler) |
void |
removeSystemService(java.lang.String name)
Makes
getSystemService(String) return null for the given system service name, mimicking a device that doesn’t have that system service. |
static void |
reset() |
protected void |
sendBroadcast(android.content.Intent intent) |
protected void |
sendBroadcast(android.content.Intent intent,
java.lang.String receiverPermission) |
protected void |
sendOrderedBroadcast(android.content.Intent intent,
java.lang.String receiverPermission) |
protected void |
sendOrderedBroadcast(android.content.Intent intent,
java.lang.String receiverPermission,
android.content.BroadcastReceiver resultReceiver,
android.os.Handler scheduler,
int initialCode,
java.lang.String initialData,
android.os.Bundle initialExtras) |
protected void |
sendStickyBroadcast(android.content.Intent intent) |
void |
setSystemService(java.lang.String key,
java.lang.Object service) |
protected android.content.ComponentName |
startForegroundService(android.content.Intent service) |
protected void |
startIntentSender(android.content.IntentSender intent,
android.content.Intent fillInIntent,
int flagsMask,
int flagsValues,
int extraFlags,
android.os.Bundle options) |
protected android.content.ComponentName |
startService(android.content.Intent service) |
protected boolean |
stopService(android.content.Intent name) |
protected void |
unbindService(android.content.ServiceConnection serviceConnection) |
protected void |
unregisterReceiver(android.content.BroadcastReceiver broadcastReceiver) |
public static final java.lang.String CLASS_NAME
@Implementation protected java.lang.Object getSystemService(java.lang.String name)
Returns the handle to a system-level service by name. If the service is not available in Roboletric, or it is set to unavailable in ShadowServiceManager.setServiceAvailability(java.lang.String, boolean)
, null
will be returned.
public void setSystemService(java.lang.String key, java.lang.Object service)
public void removeSystemService(java.lang.String name)
Makes getSystemService(String)
return null
for the given system service name, mimicking a device that doesn’t have that system service.
@Implementation protected void startIntentSender(android.content.IntentSender intent, android.content.Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, android.os.Bundle options) throws android.content.IntentSender.SendIntentException
android.content.IntentSender.SendIntentException
@Implementation protected java.lang.ClassLoader getClassLoader()
@Implementation protected int checkCallingPermission(java.lang.String permission)
@Implementation protected int checkCallingOrSelfPermission(java.lang.String permission)
@Implementation protected android.content.ContentResolver getContentResolver()
@Implementation protected void sendBroadcast(android.content.Intent intent)
@Implementation protected void sendBroadcast(android.content.Intent intent, java.lang.String receiverPermission)
@Implementation protected void sendOrderedBroadcast(android.content.Intent intent, java.lang.String receiverPermission)
@Implementation protected void sendOrderedBroadcast(android.content.Intent intent, java.lang.String receiverPermission, android.content.BroadcastReceiver resultReceiver, android.os.Handler scheduler, int initialCode, java.lang.String initialData, android.os.Bundle initialExtras)
@Implementation protected void sendStickyBroadcast(android.content.Intent intent)
@Implementation protected int checkPermission(java.lang.String permission, int pid, int uid)
@Implementation protected android.content.Intent registerReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter)
@Implementation protected android.content.Intent registerReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter, java.lang.String broadcastPermission, android.os.Handler scheduler)
@Implementation(minSdk=17) protected android.content.Intent registerReceiverAsUser(android.content.BroadcastReceiver receiver, android.os.UserHandle user, android.content.IntentFilter filter, java.lang.String broadcastPermission, android.os.Handler scheduler)
@Implementation protected void unregisterReceiver(android.content.BroadcastReceiver broadcastReceiver)
@Implementation protected android.content.ComponentName startService(android.content.Intent service)
@Implementation(minSdk=26) protected android.content.ComponentName startForegroundService(android.content.Intent service)
@Implementation protected boolean stopService(android.content.Intent name)
@Implementation protected boolean bindService(android.content.Intent intent, android.content.ServiceConnection serviceConnection, int i)
@Implementation(minSdk=21) protected boolean bindServiceAsUser(android.content.Intent intent, android.content.ServiceConnection serviceConnection, int i, android.os.UserHandle userHandle)
Binds to a service but ignores the given UserHandle.
@Implementation protected void unbindService(android.content.ServiceConnection serviceConnection)
@Implementation(minSdk=17) protected int getUserId()
@Implementation protected java.io.File getExternalCacheDir()
@Implementation(maxSdk=18) protected java.io.File getExternalFilesDir(java.lang.String type)
@Implementation(minSdk=19) protected java.io.File[] getExternalFilesDirs(java.lang.String type)
@Resetter public static void reset()