FileDocCategorySizeDatePackage
BroadcastInterceptingContext.javaAPI DocAndroid 5.1 API5249Thu Mar 12 22:22:42 GMT 2015com.android.server

BroadcastInterceptingContext

public class BroadcastInterceptingContext extends android.content.ContextWrapper
{@link ContextWrapper} that can attach listeners for upcoming {@link Context#sendBroadcast(Intent)}.

Fields Summary
private static final String
TAG
private final List
mInterceptors
Constructors Summary
public BroadcastInterceptingContext(android.content.Context base)

        super(base);
    
Methods Summary
public java.util.concurrent.FuturenextBroadcastIntent(java.lang.String action)

        return nextBroadcastIntent(new IntentFilter(action));
    
public java.util.concurrent.FuturenextBroadcastIntent(android.content.IntentFilter filter)

        final BroadcastInterceptor interceptor = new BroadcastInterceptor(null, filter);
        synchronized (mInterceptors) {
            mInterceptors.add(interceptor);
        }
        return interceptor;
    
public android.content.IntentregisterReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter)

        synchronized (mInterceptors) {
            mInterceptors.add(new BroadcastInterceptor(receiver, filter));
        }
        return null;
    
public android.content.IntentregisterReceiver(android.content.BroadcastReceiver receiver, android.content.IntentFilter filter, java.lang.String broadcastPermission, android.os.Handler scheduler)

        return registerReceiver(receiver, filter);
    
public voidremoveStickyBroadcast(android.content.Intent intent)

        // ignored
    
public voidsendBroadcast(android.content.Intent intent)

        synchronized (mInterceptors) {
            final Iterator<BroadcastInterceptor> i = mInterceptors.iterator();
            while (i.hasNext()) {
                final BroadcastInterceptor interceptor = i.next();
                if (interceptor.dispatchBroadcast(intent)) {
                    i.remove();
                }
            }
        }
    
public voidsendBroadcast(android.content.Intent intent, java.lang.String receiverPermission)

        sendBroadcast(intent);
    
public voidsendBroadcastAsUser(android.content.Intent intent, android.os.UserHandle user, java.lang.String receiverPermission)

        sendBroadcast(intent);
    
public voidsendBroadcastAsUser(android.content.Intent intent, android.os.UserHandle user)

        sendBroadcast(intent);
    
public voidsendStickyBroadcast(android.content.Intent intent)

        sendBroadcast(intent);
    
public voidsendStickyBroadcastAsUser(android.content.Intent intent, android.os.UserHandle user)

        sendBroadcast(intent);
    
public voidunregisterReceiver(android.content.BroadcastReceiver receiver)

        synchronized (mInterceptors) {
            final Iterator<BroadcastInterceptor> i = mInterceptors.iterator();
            while (i.hasNext()) {
                final BroadcastInterceptor interceptor = i.next();
                if (receiver.equals(interceptor.mReceiver)) {
                    i.remove();
                }
            }
        }