Search in sources :

Example 76 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project platform_frameworks_base by android.

the class BroadcastFilter method dump.

public void dump(PrintWriter pw, String prefix) {
    dumpInReceiverList(pw, new PrintWriterPrinter(pw), prefix);
    receiverList.dumpLocal(pw, prefix);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter)

Example 77 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project platform_frameworks_base by android.

the class BroadcastRecord method dump.

void dump(PrintWriter pw, String prefix, SimpleDateFormat sdf) {
    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 ((requiredPermissions != null && requiredPermissions.length > 0) || appOp != AppOpsManager.OP_NONE) {
        pw.print(prefix);
        pw.print("requiredPermissions=");
        pw.print(Arrays.toString(requiredPermissions));
        pw.print("  appOp=");
        pw.println(appOp);
    }
    if (options != null) {
        pw.print(prefix);
        pw.print("options=");
        pw.println(options.toBundle());
    }
    pw.print(prefix);
    pw.print("enqueueClockTime=");
    pw.print(sdf.format(new Date(enqueueClockTime)));
    pw.print(" dispatchClockTime=");
    pw.println(sdf.format(new Date(dispatchClockTime)));
    pw.print(prefix);
    pw.print("dispatchTime=");
    TimeUtils.formatDuration(dispatchTime, now, pw);
    pw.print(" (");
    TimeUtils.formatDuration(dispatchClockTime - enqueueClockTime, pw);
    pw.print(" since enq)");
    if (finishTime != 0) {
        pw.print(" finishTime=");
        TimeUtils.formatDuration(finishTime, now, pw);
        pw.print(" (");
        TimeUtils.formatDuration(finishTime - dispatchTime, pw);
        pw.print(" since disp)");
    } 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);
        switch(delivery[i]) {
            case DELIVERY_PENDING:
                pw.print("Pending");
                break;
            case DELIVERY_DELIVERED:
                pw.print("Deliver");
                break;
            case DELIVERY_SKIPPED:
                pw.print("Skipped");
                break;
            case DELIVERY_TIMEOUT:
                pw.print("Timeout");
                break;
            default:
                pw.print("???????");
                break;
        }
        pw.print(" #");
        pw.print(i);
        pw.print(": ");
        if (o instanceof BroadcastFilter) {
            pw.println(o);
            ((BroadcastFilter) o).dumpBrief(pw, p2);
        } else if (o instanceof ResolveInfo) {
            pw.println("(manifest)");
            ((ResolveInfo) o).dump(printer, p2, 0);
        } else {
            pw.println(o);
        }
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) ResolveInfo(android.content.pm.ResolveInfo) Bundle(android.os.Bundle) Date(java.util.Date)

Example 78 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project platform_frameworks_base by android.

the class PackageManagerShellCommand method runQueryIntentReceivers.

private int runQueryIntentReceivers() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        List<ResolveInfo> result = mInterface.queryIntentReceivers(intent, null, 0, mTargetUser).getList();
        PrintWriter pw = getOutPrintWriter();
        if (result == null || result.size() <= 0) {
            pw.println("No receivers found");
        } else {
            if (!mComponents) {
                pw.print(result.size());
                pw.println(" receivers found:");
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    pw.print("  Receiver #");
                    pw.print(i);
                    pw.println(":");
                    printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
                }
            } else {
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
                }
            }
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 79 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project platform_frameworks_base by android.

the class PackageManagerShellCommand method runResolveActivity.

private int runResolveActivity() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        ResolveInfo ri = mInterface.resolveIntent(intent, null, 0, mTargetUser);
        PrintWriter pw = getOutPrintWriter();
        if (ri == null) {
            pw.println("No activity found");
        } else {
            PrintWriterPrinter pr = new PrintWriterPrinter(pw);
            printResolveInfo(pr, "", ri, mBrief, mComponents);
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 80 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class ProcessRecord method dump.

void dump(PrintWriter pw, String prefix) {
    final long now = SystemClock.uptimeMillis();
    pw.print(prefix);
    pw.print("user #");
    pw.print(userId);
    pw.print(" uid=");
    pw.print(info.uid);
    if (uid != info.uid) {
        pw.print(" ISOLATED uid=");
        pw.print(uid);
    }
    pw.print(" gids={");
    if (gids != null) {
        for (int gi = 0; gi < gids.length; gi++) {
            if (gi != 0)
                pw.print(", ");
            pw.print(gids[gi]);
        }
    }
    pw.println("}");
    pw.print(prefix);
    pw.print("requiredAbi=");
    pw.print(requiredAbi);
    pw.print(" instructionSet=");
    pw.println(instructionSet);
    if (info.className != null) {
        pw.print(prefix);
        pw.print("class=");
        pw.println(info.className);
    }
    if (info.manageSpaceActivityName != null) {
        pw.print(prefix);
        pw.print("manageSpaceActivityName=");
        pw.println(info.manageSpaceActivityName);
    }
    pw.print(prefix);
    pw.print("dir=");
    pw.print(info.sourceDir);
    pw.print(" publicDir=");
    pw.print(info.publicSourceDir);
    pw.print(" data=");
    pw.println(info.dataDir);
    pw.print(prefix);
    pw.print("packageList={");
    for (int i = 0; i < pkgList.size(); i++) {
        if (i > 0)
            pw.print(", ");
        pw.print(pkgList.keyAt(i));
    }
    pw.println("}");
    if (pkgDeps != null) {
        pw.print(prefix);
        pw.print("packageDependencies={");
        for (int i = 0; i < pkgDeps.size(); i++) {
            if (i > 0)
                pw.print(", ");
            pw.print(pkgDeps.valueAt(i));
        }
        pw.println("}");
    }
    pw.print(prefix);
    pw.print("compat=");
    pw.println(compat);
    if (instrumentationClass != null || instrumentationProfileFile != null || instrumentationArguments != null) {
        pw.print(prefix);
        pw.print("instrumentationClass=");
        pw.print(instrumentationClass);
        pw.print(" instrumentationProfileFile=");
        pw.println(instrumentationProfileFile);
        pw.print(prefix);
        pw.print("instrumentationArguments=");
        pw.println(instrumentationArguments);
        pw.print(prefix);
        pw.print("instrumentationInfo=");
        pw.println(instrumentationInfo);
        if (instrumentationInfo != null) {
            instrumentationInfo.dump(new PrintWriterPrinter(pw), prefix + "  ");
        }
    }
    pw.print(prefix);
    pw.print("thread=");
    pw.println(thread);
    pw.print(prefix);
    pw.print("pid=");
    pw.print(pid);
    pw.print(" starting=");
    pw.println(starting);
    pw.print(prefix);
    pw.print("lastActivityTime=");
    TimeUtils.formatDuration(lastActivityTime, now, pw);
    pw.print(" lastPssTime=");
    TimeUtils.formatDuration(lastPssTime, now, pw);
    pw.print(" nextPssTime=");
    TimeUtils.formatDuration(nextPssTime, now, pw);
    pw.println();
    pw.print(prefix);
    pw.print("adjSeq=");
    pw.print(adjSeq);
    pw.print(" lruSeq=");
    pw.print(lruSeq);
    pw.print(" lastPss=");
    DebugUtils.printSizeValue(pw, lastPss * 1024);
    pw.print(" lastSwapPss=");
    DebugUtils.printSizeValue(pw, lastSwapPss * 1024);
    pw.print(" lastCachedPss=");
    DebugUtils.printSizeValue(pw, lastCachedPss * 1024);
    pw.print(" lastCachedSwapPss=");
    DebugUtils.printSizeValue(pw, lastCachedSwapPss * 1024);
    pw.println();
    pw.print(prefix);
    pw.print("cached=");
    pw.print(cached);
    pw.print(" empty=");
    pw.println(empty);
    if (serviceb) {
        pw.print(prefix);
        pw.print("serviceb=");
        pw.print(serviceb);
        pw.print(" serviceHighRam=");
        pw.println(serviceHighRam);
    }
    if (notCachedSinceIdle) {
        pw.print(prefix);
        pw.print("notCachedSinceIdle=");
        pw.print(notCachedSinceIdle);
        pw.print(" initialIdlePss=");
        pw.println(initialIdlePss);
    }
    pw.print(prefix);
    pw.print("oom: max=");
    pw.print(maxAdj);
    pw.print(" curRaw=");
    pw.print(curRawAdj);
    pw.print(" setRaw=");
    pw.print(setRawAdj);
    pw.print(" cur=");
    pw.print(curAdj);
    pw.print(" set=");
    pw.println(setAdj);
    pw.print(prefix);
    pw.print("curSchedGroup=");
    pw.print(curSchedGroup);
    pw.print(" setSchedGroup=");
    pw.print(setSchedGroup);
    pw.print(" systemNoUi=");
    pw.print(systemNoUi);
    pw.print(" trimMemoryLevel=");
    pw.println(trimMemoryLevel);
    pw.print(prefix);
    pw.print("vrThreadTid=");
    pw.print(vrThreadTid);
    pw.print(prefix);
    pw.print("curProcState=");
    pw.print(curProcState);
    pw.print(" repProcState=");
    pw.print(repProcState);
    pw.print(" pssProcState=");
    pw.print(pssProcState);
    pw.print(" setProcState=");
    pw.print(setProcState);
    pw.print(" lastStateTime=");
    TimeUtils.formatDuration(lastStateTime, now, pw);
    pw.println();
    if (hasShownUi || pendingUiClean || hasAboveClient || treatLikeActivity) {
        pw.print(prefix);
        pw.print("hasShownUi=");
        pw.print(hasShownUi);
        pw.print(" pendingUiClean=");
        pw.print(pendingUiClean);
        pw.print(" hasAboveClient=");
        pw.print(hasAboveClient);
        pw.print(" treatLikeActivity=");
        pw.println(treatLikeActivity);
    }
    if (setIsForeground || foregroundServices || forcingToForeground != null) {
        pw.print(prefix);
        pw.print("setIsForeground=");
        pw.print(setIsForeground);
        pw.print(" foregroundServices=");
        pw.print(foregroundServices);
        pw.print(" forcingToForeground=");
        pw.println(forcingToForeground);
    }
    if (reportedInteraction || fgInteractionTime != 0) {
        pw.print(prefix);
        pw.print("reportedInteraction=");
        pw.print(reportedInteraction);
        if (interactionEventTime != 0) {
            pw.print(" time=");
            TimeUtils.formatDuration(interactionEventTime, SystemClock.elapsedRealtime(), pw);
        }
        if (fgInteractionTime != 0) {
            pw.print(" fgInteractionTime=");
            TimeUtils.formatDuration(fgInteractionTime, SystemClock.elapsedRealtime(), pw);
        }
        pw.println();
    }
    if (persistent || removed) {
        pw.print(prefix);
        pw.print("persistent=");
        pw.print(persistent);
        pw.print(" removed=");
        pw.println(removed);
    }
    if (hasClientActivities || foregroundActivities || repForegroundActivities) {
        pw.print(prefix);
        pw.print("hasClientActivities=");
        pw.print(hasClientActivities);
        pw.print(" foregroundActivities=");
        pw.print(foregroundActivities);
        pw.print(" (rep=");
        pw.print(repForegroundActivities);
        pw.println(")");
    }
    if (lastProviderTime > 0) {
        pw.print(prefix);
        pw.print("lastProviderTime=");
        TimeUtils.formatDuration(lastProviderTime, now, pw);
        pw.println();
    }
    if (hasStartedServices) {
        pw.print(prefix);
        pw.print("hasStartedServices=");
        pw.println(hasStartedServices);
    }
    if (setProcState >= ActivityManager.PROCESS_STATE_SERVICE) {
        long wtime;
        synchronized (mBatteryStats) {
            wtime = mBatteryStats.getProcessWakeTime(info.uid, pid, SystemClock.elapsedRealtime());
        }
        pw.print(prefix);
        pw.print("lastWakeTime=");
        pw.print(lastWakeTime);
        pw.print(" timeUsed=");
        TimeUtils.formatDuration(wtime - lastWakeTime, pw);
        pw.println("");
        pw.print(prefix);
        pw.print("lastCpuTime=");
        pw.print(lastCpuTime);
        pw.print(" timeUsed=");
        TimeUtils.formatDuration(curCpuTime - lastCpuTime, pw);
        pw.println("");
    }
    pw.print(prefix);
    pw.print("lastRequestedGc=");
    TimeUtils.formatDuration(lastRequestedGc, now, pw);
    pw.print(" lastLowMemory=");
    TimeUtils.formatDuration(lastLowMemory, now, pw);
    pw.print(" reportLowMemory=");
    pw.println(reportLowMemory);
    if (killed || killedByAm || waitingToKill != null) {
        pw.print(prefix);
        pw.print("killed=");
        pw.print(killed);
        pw.print(" killedByAm=");
        pw.print(killedByAm);
        pw.print(" waitingToKill=");
        pw.println(waitingToKill);
    }
    if (debugging || crashing || crashDialog != null || notResponding || anrDialog != null || bad) {
        pw.print(prefix);
        pw.print("debugging=");
        pw.print(debugging);
        pw.print(" crashing=");
        pw.print(crashing);
        pw.print(" ");
        pw.print(crashDialog);
        pw.print(" notResponding=");
        pw.print(notResponding);
        pw.print(" ");
        pw.print(anrDialog);
        pw.print(" bad=");
        pw.print(bad);
        // crashing or notResponding is always set before errorReportReceiver
        if (errorReportReceiver != null) {
            pw.print(" errorReportReceiver=");
            pw.print(errorReportReceiver.flattenToShortString());
        }
        pw.println();
    }
    if (whitelistManager) {
        pw.print(prefix);
        pw.print("whitelistManager=");
        pw.println(whitelistManager);
    }
    if (activities.size() > 0) {
        pw.print(prefix);
        pw.println("Activities:");
        for (int i = 0; i < activities.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(activities.get(i));
        }
    }
    if (services.size() > 0) {
        pw.print(prefix);
        pw.println("Services:");
        for (int i = 0; i < services.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(services.valueAt(i));
        }
    }
    if (executingServices.size() > 0) {
        pw.print(prefix);
        pw.print("Executing Services (fg=");
        pw.print(execServicesFg);
        pw.println(")");
        for (int i = 0; i < executingServices.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(executingServices.valueAt(i));
        }
    }
    if (connections.size() > 0) {
        pw.print(prefix);
        pw.println("Connections:");
        for (int i = 0; i < connections.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(connections.valueAt(i));
        }
    }
    if (pubProviders.size() > 0) {
        pw.print(prefix);
        pw.println("Published Providers:");
        for (int i = 0; i < pubProviders.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(pubProviders.keyAt(i));
            pw.print(prefix);
            pw.print("    -> ");
            pw.println(pubProviders.valueAt(i));
        }
    }
    if (conProviders.size() > 0) {
        pw.print(prefix);
        pw.println("Connected Providers:");
        for (int i = 0; i < conProviders.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(conProviders.get(i).toShortString());
        }
    }
    if (!curReceivers.isEmpty()) {
        pw.print(prefix);
        pw.println("Current Receivers:");
        for (int i = 0; i < curReceivers.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(curReceivers.valueAt(i));
        }
    }
    if (receivers.size() > 0) {
        pw.print(prefix);
        pw.println("Receivers:");
        for (int i = 0; i < receivers.size(); i++) {
            pw.print(prefix);
            pw.print("  - ");
            pw.println(receivers.valueAt(i));
        }
    }
    if (hasTopUi) {
        pw.print(prefix);
        pw.print("hasTopUi=");
        pw.print(hasTopUi);
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter)

Aggregations

PrintWriterPrinter (android.util.PrintWriterPrinter)109 Printer (android.util.Printer)47 RemoteException (android.os.RemoteException)28 ResolveInfo (android.content.pm.ResolveInfo)22 Intent (android.content.Intent)20 PrintWriter (java.io.PrintWriter)16 URISyntaxException (java.net.URISyntaxException)16 Bundle (android.os.Bundle)10 ArrayMap (android.util.ArrayMap)7 LogPrinter (android.util.LogPrinter)7 HashMap (java.util.HashMap)7 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 IInputMethod (com.android.internal.view.IInputMethod)6 Date (java.util.Date)6 Map (java.util.Map)6 MutableInt (android.util.MutableInt)5 ArrayList (java.util.ArrayList)5 PendingIntent (android.app.PendingIntent)4 Iterator (java.util.Iterator)4 Point (android.graphics.Point)2