ShadowApplication
, ShadowContextThemeWrapper
, ShadowService
@Implements(android.content.ContextWrapper.class) public class ShadowContextWrapper extends Object
Constructor | Description |
---|---|
ShadowContextWrapper() |
Modifier and Type | Method | Description |
---|---|---|
void |
clearBroadcastIntents() |
Clears the broadcast intents sent during the tests (for all users).
|
void |
clearNextStartedActivities() |
Clears all
Intent s started by ContextWrapper.startActivity(android.content.Intent) . |
void |
clearStartedServices() |
Clears all
Intent started by
Context.startService(android.content.Intent) . |
void |
denyPermissions(int pid,
int uid,
String... permissions) |
Revoke the given permissions for the given process and user.
|
void |
denyPermissions(String... permissionNames) |
Revoke the given permissions for the current process and user.
|
List<Intent> |
getBroadcastIntents() |
Returns the broadcast intents sent during the tests (for all users).
|
List<Intent> |
getBroadcastIntentsForUser(UserHandle userHandle) |
Returns the broadcast intents sent to the given user.
|
Bundle |
getBroadcastOptions(Intent intent) |
Returns the broadcast options when the intent was last sent.
|
Intent |
getNextStartedActivity() |
Consumes the most recent
Intent started by ContextWrapper.startActivity(android.content.Intent) and returns it. |
ShadowActivity.IntentForResult |
getNextStartedActivityForResult() |
Consumes the most recent
IntentForResult started by {@link *
ContextWrapper#startActivity(android.content.Intent, android.os.Bundle)} and returns it. |
Intent |
getNextStartedService() |
Consumes the most recent
Intent started by Context.startService(android.content.Intent) and returns it. |
Intent |
getNextStoppedService() |
Consumes the
Intent requested to stop a service by
Context.stopService(android.content.Intent)
from the bottom of the stack of stop requests. |
void |
grantPermissions(int pid,
int uid,
String... permissions) |
Grant the given permissions for the given process and user.
|
void |
grantPermissions(String... permissionNames) |
Grant the given permissions for the current process and user.
|
Intent |
peekNextStartedActivity() |
Returns the most recent
Intent started by ContextWrapper.startActivity(android.content.Intent) without consuming it. |
ShadowActivity.IntentForResult |
peekNextStartedActivityForResult() |
Returns the most recent
IntentForResult started by ContextWrapper.startActivity(android.content.Intent, android.os.Bundle) without consuming it. |
Intent |
peekNextStartedService() |
Returns the most recent
Intent started by
Context.startService(android.content.Intent) without consuming it. |
void |
removeSystemService(String name) |
Makes
Context.getSystemService(String) return null for the given system service
name, mimicking a device that doesn't have that system service. |
public List<Intent> getBroadcastIntents()
public Bundle getBroadcastOptions(Intent intent)
public List<Intent> getBroadcastIntentsForUser(UserHandle userHandle)
public void clearBroadcastIntents()
public Intent getNextStartedActivity()
Intent
started by ContextWrapper.startActivity(android.content.Intent)
and returns it.Intent
public Intent peekNextStartedActivity()
Intent
started by ContextWrapper.startActivity(android.content.Intent)
without consuming it.Intent
public void clearNextStartedActivities()
Intent
s started by ContextWrapper.startActivity(android.content.Intent)
.public ShadowActivity.IntentForResult getNextStartedActivityForResult()
IntentForResult
started by {@link *
ContextWrapper#startActivity(android.content.Intent, android.os.Bundle)} and returns it.IntentForResult
public ShadowActivity.IntentForResult peekNextStartedActivityForResult()
IntentForResult
started by ContextWrapper.startActivity(android.content.Intent, android.os.Bundle)
without consuming it.IntentForResult
public Intent getNextStartedService()
Intent
started by Context.startService(android.content.Intent)
and returns it.Intent
public Intent peekNextStartedService()
Intent
started by
Context.startService(android.content.Intent)
without consuming it.Intent
public void clearStartedServices()
Intent
started by
Context.startService(android.content.Intent)
.public Intent getNextStoppedService()
Intent
requested to stop a service by
Context.stopService(android.content.Intent)
from the bottom of the stack of stop requests.public void grantPermissions(String... permissionNames)
public void grantPermissions(int pid, int uid, String... permissions)
public void denyPermissions(String... permissionNames)
public void denyPermissions(int pid, int uid, String... permissions)
public void removeSystemService(String name)
Context.getSystemService(String)
return null
for the given system service
name, mimicking a device that doesn't have that system service.