Search in sources :

Example 6 with PrintWriterPrinter

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

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 7 with PrintWriterPrinter

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

the class ActivityManagerService method dumpBroadcastsLocked.

boolean dumpBroadcastsLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage) {
    boolean needSep = false;
    boolean onlyHistory = false;
    if ("history".equals(dumpPackage)) {
        if (opti < args.length && "-s".equals(args[opti])) {
            dumpAll = false;
        }
        onlyHistory = true;
        dumpPackage = null;
    }
    pw.println("ACTIVITY MANAGER BROADCAST STATE (dumpsys activity broadcasts)");
    if (!onlyHistory && dumpAll) {
        if (mRegisteredReceivers.size() > 0) {
            boolean printed = false;
            Iterator it = mRegisteredReceivers.values().iterator();
            while (it.hasNext()) {
                ReceiverList r = (ReceiverList) it.next();
                if (dumpPackage != null && (r.app == null || !dumpPackage.equals(r.app.info.packageName))) {
                    continue;
                }
                if (!printed) {
                    pw.println("  Registered Receivers:");
                    needSep = true;
                    printed = true;
                }
                pw.print("  * ");
                pw.println(r);
                r.dump(pw, "    ");
            }
        }
        if (mReceiverResolver.dump(pw, needSep ? "\n  Receiver Resolver Table:" : "  Receiver Resolver Table:", "    ", dumpPackage, false)) {
            needSep = true;
        }
    }
    for (BroadcastQueue q : mBroadcastQueues) {
        needSep = q.dumpLocked(fd, pw, args, opti, dumpAll, dumpPackage, needSep);
    }
    needSep = true;
    if (!onlyHistory && mStickyBroadcasts != null && dumpPackage == null) {
        for (int user = 0; user < mStickyBroadcasts.size(); user++) {
            if (needSep) {
                pw.println();
            }
            needSep = true;
            pw.print("  Sticky broadcasts for user ");
            pw.print(mStickyBroadcasts.keyAt(user));
            pw.println(":");
            StringBuilder sb = new StringBuilder(128);
            for (Map.Entry<String, ArrayList<Intent>> ent : mStickyBroadcasts.valueAt(user).entrySet()) {
                pw.print("  * Sticky action ");
                pw.print(ent.getKey());
                if (dumpAll) {
                    pw.println(":");
                    ArrayList<Intent> intents = ent.getValue();
                    final int N = intents.size();
                    for (int i = 0; i < N; i++) {
                        sb.setLength(0);
                        sb.append("    Intent: ");
                        intents.get(i).toShortString(sb, false, true, false, false);
                        pw.println(sb.toString());
                        Bundle bundle = intents.get(i).getExtras();
                        if (bundle != null) {
                            pw.print("      ");
                            pw.println(bundle.toString());
                        }
                    }
                } else {
                    pw.println("");
                }
            }
        }
    }
    if (!onlyHistory && dumpAll) {
        pw.println();
        for (BroadcastQueue queue : mBroadcastQueues) {
            pw.println("  mBroadcastsScheduled [" + queue.mQueueName + "]=" + queue.mBroadcastsScheduled);
        }
        pw.println("  mHandler:");
        mHandler.dump(new PrintWriterPrinter(pw), "    ");
        needSep = true;
    }
    return needSep;
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) PrintWriterPrinter(android.util.PrintWriterPrinter) Iterator(java.util.Iterator) ProcessMap(com.android.server.ProcessMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 8 with PrintWriterPrinter

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

the class BatteryStatsImpl method dumpLocked.

public void dumpLocked(Context context, PrintWriter pw, int flags, int reqUid, long histStart) {
    if (DEBUG) {
        pw.println("mOnBatteryTimeBase:");
        mOnBatteryTimeBase.dump(pw, "  ");
        pw.println("mOnBatteryScreenOffTimeBase:");
        mOnBatteryScreenOffTimeBase.dump(pw, "  ");
        Printer pr = new PrintWriterPrinter(pw);
        pr.println("*** Screen timer:");
        mScreenOnTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
            pr.println("*** Screen brightness #" + i + ":");
            mScreenBrightnessTimer[i].logState(pr, "  ");
        }
        pr.println("*** Interactive timer:");
        mInteractiveTimer.logState(pr, "  ");
        pr.println("*** Power save mode timer:");
        mPowerSaveModeEnabledTimer.logState(pr, "  ");
        pr.println("*** Device idle mode light timer:");
        mDeviceIdleModeLightTimer.logState(pr, "  ");
        pr.println("*** Device idle mode full timer:");
        mDeviceIdleModeFullTimer.logState(pr, "  ");
        pr.println("*** Device light idling timer:");
        mDeviceLightIdlingTimer.logState(pr, "  ");
        pr.println("*** Device idling timer:");
        mDeviceIdlingTimer.logState(pr, "  ");
        pr.println("*** Phone timer:");
        mPhoneOnTimer.logState(pr, "  ");
        for (int i = 0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            pr.println("*** Phone signal strength #" + i + ":");
            mPhoneSignalStrengthsTimer[i].logState(pr, "  ");
        }
        pr.println("*** Signal scanning :");
        mPhoneSignalScanningTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; i++) {
            pr.println("*** Data connection type #" + i + ":");
            mPhoneDataConnectionsTimer[i].logState(pr, "  ");
        }
        pr.println("*** mMobileRadioPowerState=" + mMobileRadioPowerState);
        pr.println("*** Mobile network active timer:");
        mMobileRadioActiveTimer.logState(pr, "  ");
        pr.println("*** Mobile network active adjusted timer:");
        mMobileRadioActiveAdjustedTime.logState(pr, "  ");
        pr.println("*** mWifiRadioPowerState=" + mWifiRadioPowerState);
        pr.println("*** Wifi timer:");
        mWifiOnTimer.logState(pr, "  ");
        pr.println("*** WifiRunning timer:");
        mGlobalWifiRunningTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_WIFI_STATES; i++) {
            pr.println("*** Wifi state #" + i + ":");
            mWifiStateTimer[i].logState(pr, "  ");
        }
        for (int i = 0; i < NUM_WIFI_SUPPL_STATES; i++) {
            pr.println("*** Wifi suppl state #" + i + ":");
            mWifiSupplStateTimer[i].logState(pr, "  ");
        }
        for (int i = 0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
            pr.println("*** Wifi signal strength #" + i + ":");
            mWifiSignalStrengthsTimer[i].logState(pr, "  ");
        }
        pr.println("*** Flashlight timer:");
        mFlashlightOnTimer.logState(pr, "  ");
        pr.println("*** Camera timer:");
        mCameraOnTimer.logState(pr, "  ");
    }
    super.dumpLocked(context, pw, flags, reqUid, histStart);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 9 with PrintWriterPrinter

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

the class InputMethodManagerService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    IInputMethod method;
    ClientState client;
    ClientState focusedWindowClient;
    final Printer p = new PrintWriterPrinter(pw);
    synchronized (mMethodMap) {
        p.println("Current Input Method Manager state:");
        int N = mMethodList.size();
        p.println("  Input Methods:");
        for (int i = 0; i < N; i++) {
            InputMethodInfo info = mMethodList.get(i);
            p.println("  InputMethod #" + i + ":");
            info.dump(p, "    ");
        }
        p.println("  Clients:");
        for (ClientState ci : mClients.values()) {
            p.println("  Client " + ci + ":");
            p.println("    client=" + ci.client);
            p.println("    inputContext=" + ci.inputContext);
            p.println("    sessionRequested=" + ci.sessionRequested);
            p.println("    curSession=" + ci.curSession);
        }
        p.println("  mCurMethodId=" + mCurMethodId);
        client = mCurClient;
        p.println("  mCurClient=" + client + " mCurSeq=" + mCurSeq);
        p.println("  mCurFocusedWindow=" + mCurFocusedWindow);
        focusedWindowClient = mCurFocusedWindowClient;
        p.println("  mCurFocusedWindowClient=" + focusedWindowClient);
        p.println("  mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
        p.println("  mCurToken=" + mCurToken);
        p.println("  mCurIntent=" + mCurIntent);
        method = mCurMethod;
        p.println("  mCurMethod=" + mCurMethod);
        p.println("  mEnabledSession=" + mEnabledSession);
        p.println("  mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
        p.println("  mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
        p.println("  mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
        p.println("  mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
        p.println("  mSettingsObserver=" + mSettingsObserver);
        p.println("  mSwitchingController:");
        mSwitchingController.dump(p);
        p.println("  mSettings:");
        mSettings.dumpLocked(p, "    ");
    }
    p.println(" ");
    if (client != null) {
        pw.flush();
        try {
            TransferPipe.dumpAsync(client.client.asBinder(), fd, args);
        } catch (IOException | RemoteException e) {
            p.println("Failed to dump input method client: " + e);
        }
    } else {
        p.println("No input method client.");
    }
    if (focusedWindowClient != null && client != focusedWindowClient) {
        p.println(" ");
        p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
        p.println("Dumping input method client in the last focused window just in case.");
        p.println(" ");
        pw.flush();
        try {
            TransferPipe.dumpAsync(focusedWindowClient.client.asBinder(), fd, args);
        } catch (IOException | RemoteException e) {
            p.println("Failed to dump input method client in focused window: " + e);
        }
    }
    p.println(" ");
    if (method != null) {
        pw.flush();
        try {
            TransferPipe.dumpAsync(method.asBinder(), fd, args);
        } catch (IOException | RemoteException e) {
            p.println("Failed to dump input method service: " + e);
        }
    } else {
        p.println("No input method service.");
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) IInputMethod(com.android.internal.view.IInputMethod) IOException(java.io.IOException) Printer(android.util.Printer) PrintWriterPrinter(android.util.PrintWriterPrinter) RemoteException(android.os.RemoteException) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 10 with PrintWriterPrinter

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

the class ActivityManagerService method dumpBroadcastsLocked.

void dumpBroadcastsLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage) {
    boolean needSep = false;
    boolean onlyHistory = false;
    boolean printedAnything = false;
    if ("history".equals(dumpPackage)) {
        if (opti < args.length && "-s".equals(args[opti])) {
            dumpAll = false;
        }
        onlyHistory = true;
        dumpPackage = null;
    }
    pw.println("ACTIVITY MANAGER BROADCAST STATE (dumpsys activity broadcasts)");
    if (!onlyHistory && dumpAll) {
        if (mRegisteredReceivers.size() > 0) {
            boolean printed = false;
            Iterator it = mRegisteredReceivers.values().iterator();
            while (it.hasNext()) {
                ReceiverList r = (ReceiverList) it.next();
                if (dumpPackage != null && (r.app == null || !dumpPackage.equals(r.app.info.packageName))) {
                    continue;
                }
                if (!printed) {
                    pw.println("  Registered Receivers:");
                    needSep = true;
                    printed = true;
                    printedAnything = true;
                }
                pw.print("  * ");
                pw.println(r);
                r.dump(pw, "    ");
            }
        }
        if (mReceiverResolver.dump(pw, needSep ? "\n  Receiver Resolver Table:" : "  Receiver Resolver Table:", "    ", dumpPackage, false, false)) {
            needSep = true;
            printedAnything = true;
        }
    }
    for (BroadcastQueue q : mBroadcastQueues) {
        needSep = q.dumpLocked(fd, pw, args, opti, dumpAll, dumpPackage, needSep);
        printedAnything |= needSep;
    }
    needSep = true;
    if (!onlyHistory && mStickyBroadcasts != null && dumpPackage == null) {
        for (int user = 0; user < mStickyBroadcasts.size(); user++) {
            if (needSep) {
                pw.println();
            }
            needSep = true;
            printedAnything = true;
            pw.print("  Sticky broadcasts for user ");
            pw.print(mStickyBroadcasts.keyAt(user));
            pw.println(":");
            StringBuilder sb = new StringBuilder(128);
            for (Map.Entry<String, ArrayList<Intent>> ent : mStickyBroadcasts.valueAt(user).entrySet()) {
                pw.print("  * Sticky action ");
                pw.print(ent.getKey());
                if (dumpAll) {
                    pw.println(":");
                    ArrayList<Intent> intents = ent.getValue();
                    final int N = intents.size();
                    for (int i = 0; i < N; i++) {
                        sb.setLength(0);
                        sb.append("    Intent: ");
                        intents.get(i).toShortString(sb, false, true, false, false);
                        pw.println(sb.toString());
                        Bundle bundle = intents.get(i).getExtras();
                        if (bundle != null) {
                            pw.print("      ");
                            pw.println(bundle.toString());
                        }
                    }
                } else {
                    pw.println("");
                }
            }
        }
    }
    if (!onlyHistory && dumpAll) {
        pw.println();
        for (BroadcastQueue queue : mBroadcastQueues) {
            pw.println("  mBroadcastsScheduled [" + queue.mQueueName + "]=" + queue.mBroadcastsScheduled);
        }
        pw.println("  mHandler:");
        mHandler.dump(new PrintWriterPrinter(pw), "    ");
        needSep = true;
        printedAnything = true;
    }
    if (!printedAnything) {
        pw.println("  (nothing)");
    }
}
Also used : Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ArrayList(java.util.ArrayList) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) Point(android.graphics.Point) PrintWriterPrinter(android.util.PrintWriterPrinter) Iterator(java.util.Iterator) Map(java.util.Map) ArrayMap(android.util.ArrayMap) HashMap(java.util.HashMap) ProcessMap(com.android.internal.app.ProcessMap)

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