FileDocCategorySizeDatePackage
IsolatedContext.javaAPI DocAndroid 1.5 API2478Wed May 06 22:42:02 BST 2009android.test

IsolatedContext

public class IsolatedContext extends android.content.ContextWrapper
A mock context which prevents its users from talking to the rest of the device while stubbing enough methods to satify code that tries to talk to other packages.

Fields Summary
private android.content.ContentResolver
mResolver
private List
mBroadcastIntents
Constructors Summary
public IsolatedContext(android.content.ContentResolver resolver, android.content.Context targetContext)


     
                
        super(targetContext);
        mResolver = resolver;
    
Methods Summary
public booleanbindService(android.content.Intent service, android.content.ServiceConnection conn, int flags)

        return false;
    
public intcheckUriPermission(android.net.Uri uri, java.lang.String readPermission, java.lang.String writePermission, int pid, int uid, int modeFlags)

        return PackageManager.PERMISSION_GRANTED;
    
public intcheckUriPermission(android.net.Uri uri, int pid, int uid, int modeFlags)

        return PackageManager.PERMISSION_GRANTED;
    
public java.util.ListgetAndClearBroadcastIntents()
Returns the list of intents that were broadcast since the last call to this method.

        List<Intent> intents = mBroadcastIntents;
        mBroadcastIntents = Lists.newArrayList();
        return intents;
    
public android.content.ContentResolvergetContentResolver()

        // We need to return the real resolver so that MailEngine.makeRight can get to the
        // subscribed feeds provider. TODO: mock out subscribed feeds too.
        return mResolver;
    
public java.lang.ObjectgetSystemService(java.lang.String name)

        // No services exist in this context.
        return null;
    
public android.content.IntentregisterReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter)

        return null;
    
public voidsendBroadcast(android.content.Intent intent)

        mBroadcastIntents.add(intent);
    
public voidsendOrderedBroadcast(android.content.Intent intent, java.lang.String receiverPermission)

        mBroadcastIntents.add(intent);