FileDocCategorySizeDatePackage
BroadcastRecord.javaAPI DocAndroid 5.1 API9667Thu Mar 12 22:22:42 GMT 2015com.android.server.am

BroadcastRecord

public final class BroadcastRecord extends android.os.Binder
An active intent broadcast.

Fields Summary
final android.content.Intent
intent
final android.content.ComponentName
targetComp
final ProcessRecord
callerApp
final String
callerPackage
final int
callingPid
final int
callingUid
final boolean
ordered
final boolean
sticky
final boolean
initialSticky
final int
userId
final String
resolvedType
final String
requiredPermission
final int
appOp
final List
receivers
android.content.IIntentReceiver
resultTo
long
dispatchTime
long
dispatchClockTime
long
receiverTime
long
finishTime
int
resultCode
String
resultData
android.os.Bundle
resultExtras
boolean
resultAbort
int
nextReceiver
android.os.IBinder
receiver
int
state
int
anrCount
BroadcastQueue
queue
static final int
IDLE
static final int
APP_RECEIVE
static final int
CALL_IN_RECEIVE
static final int
CALL_DONE_RECEIVE
static final int
WAITING_SERVICES
BroadcastFilter
curFilter
ProcessRecord
curApp
android.content.ComponentName
curComponent
android.content.pm.ActivityInfo
curReceiver
Constructors Summary
BroadcastRecord(BroadcastQueue _queue, android.content.Intent _intent, ProcessRecord _callerApp, String _callerPackage, int _callingPid, int _callingUid, String _resolvedType, String _requiredPermission, int _appOp, List _receivers, android.content.IIntentReceiver _resultTo, int _resultCode, String _resultData, android.os.Bundle _resultExtras, boolean _serialized, boolean _sticky, boolean _initialSticky, int _userId)

        queue = _queue;
        intent = _intent;
        targetComp = _intent.getComponent();
        callerApp = _callerApp;
        callerPackage = _callerPackage;
        callingPid = _callingPid;
        callingUid = _callingUid;
        resolvedType = _resolvedType;
        requiredPermission = _requiredPermission;
        appOp = _appOp;
        receivers = _receivers;
        resultTo = _resultTo;
        resultCode = _resultCode;
        resultData = _resultData;
        resultExtras = _resultExtras;
        ordered = _serialized;
        sticky = _sticky;
        initialSticky = _initialSticky;
        userId = _userId;
        nextReceiver = 0;
        state = IDLE;
    
Methods Summary
voiddump(java.io.PrintWriter pw, java.lang.String prefix)

   // info about the receiver that is currently running.

         
        final long now = SystemClock.uptimeMillis();

        pw.print(prefix); pw.print(this); pw.print(" to user "); pw.println(userId);
        pw.print(prefix); pw.println(intent.toInsecureString());
        if (targetComp != null && targetComp != intent.getComponent()) {
            pw.print(prefix); pw.print("  targetComp: "); pw.println(targetComp.toShortString());
        }
        Bundle bundle = intent.getExtras();
        if (bundle != null) {
            pw.print(prefix); pw.print("  extras: "); pw.println(bundle.toString());
        }
        pw.print(prefix); pw.print("caller="); pw.print(callerPackage); pw.print(" ");
                pw.print(callerApp != null ? callerApp.toShortString() : "null");
                pw.print(" pid="); pw.print(callingPid);
                pw.print(" uid="); pw.println(callingUid);
        if (requiredPermission != null || appOp != AppOpsManager.OP_NONE) {
            pw.print(prefix); pw.print("requiredPermission="); pw.print(requiredPermission);
                    pw.print("  appOp="); pw.println(appOp);
        }
        pw.print(prefix); pw.print("dispatchClockTime=");
                pw.println(new Date(dispatchClockTime));
        pw.print(prefix); pw.print("dispatchTime=");
                TimeUtils.formatDuration(dispatchTime, now, pw);
        if (finishTime != 0) {
            pw.print(" finishTime="); TimeUtils.formatDuration(finishTime, now, pw);
        } else {
            pw.print(" receiverTime="); TimeUtils.formatDuration(receiverTime, now, pw);
        }
        pw.println("");
        if (anrCount != 0) {
            pw.print(prefix); pw.print("anrCount="); pw.println(anrCount);
        }
        if (resultTo != null || resultCode != -1 || resultData != null) {
            pw.print(prefix); pw.print("resultTo="); pw.print(resultTo);
                    pw.print(" resultCode="); pw.print(resultCode);
                    pw.print(" resultData="); pw.println(resultData);
        }
        if (resultExtras != null) {
            pw.print(prefix); pw.print("resultExtras="); pw.println(resultExtras);
        }
        if (resultAbort || ordered || sticky || initialSticky) {
            pw.print(prefix); pw.print("resultAbort="); pw.print(resultAbort);
                    pw.print(" ordered="); pw.print(ordered);
                    pw.print(" sticky="); pw.print(sticky);
                    pw.print(" initialSticky="); pw.println(initialSticky);
        }
        if (nextReceiver != 0 || receiver != null) {
            pw.print(prefix); pw.print("nextReceiver="); pw.print(nextReceiver);
                    pw.print(" receiver="); pw.println(receiver);
        }
        if (curFilter != null) {
            pw.print(prefix); pw.print("curFilter="); pw.println(curFilter);
        }
        if (curReceiver != null) {
            pw.print(prefix); pw.print("curReceiver="); pw.println(curReceiver);
        }
        if (curApp != null) {
            pw.print(prefix); pw.print("curApp="); pw.println(curApp);
            pw.print(prefix); pw.print("curComponent=");
                    pw.println((curComponent != null ? curComponent.toShortString() : "--"));
            if (curReceiver != null && curReceiver.applicationInfo != null) {
                pw.print(prefix); pw.print("curSourceDir=");
                        pw.println(curReceiver.applicationInfo.sourceDir);
            }
        }
        if (state != IDLE) {
            String stateStr = " (?)";
            switch (state) {
                case APP_RECEIVE:       stateStr=" (APP_RECEIVE)"; break;
                case CALL_IN_RECEIVE:   stateStr=" (CALL_IN_RECEIVE)"; break;
                case CALL_DONE_RECEIVE: stateStr=" (CALL_DONE_RECEIVE)"; break;
                case WAITING_SERVICES:  stateStr=" (WAITING_SERVICES)"; break;
            }
            pw.print(prefix); pw.print("state="); pw.print(state); pw.println(stateStr);
        }
        final int N = receivers != null ? receivers.size() : 0;
        String p2 = prefix + "  ";
        PrintWriterPrinter printer = new PrintWriterPrinter(pw);
        for (int i=0; i<N; i++) {
            Object o = receivers.get(i);
            pw.print(prefix); pw.print("Receiver #"); pw.print(i);
                    pw.print(": "); pw.println(o);
            if (o instanceof BroadcastFilter)
                ((BroadcastFilter)o).dumpBrief(pw, p2);
            else if (o instanceof ResolveInfo)
                ((ResolveInfo)o).dump(printer, p2);
        }
    
public java.lang.StringtoString()

        return "BroadcastRecord{"
            + Integer.toHexString(System.identityHashCode(this))
            + " u" + userId + " " + intent.getAction() + "}";