Search in sources :

Example 96 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by AOSPA.

the class DisplayManagerService method dumpInternal.

private void dumpInternal(PrintWriter pw) {
    pw.println("DISPLAY MANAGER (dumpsys display)");
    synchronized (mSyncRoot) {
        pw.println("  mOnlyCode=" + mOnlyCore);
        pw.println("  mSafeMode=" + mSafeMode);
        pw.println("  mPendingTraversal=" + mPendingTraversal);
        pw.println("  mGlobalDisplayState=" + Display.stateToString(mGlobalDisplayState));
        pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
        pw.println("  mDefaultViewport=" + mDefaultViewport);
        pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
        pw.println("  mDefaultDisplayDefaultColorMode=" + mDefaultDisplayDefaultColorMode);
        pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
        pw.println("  mWifiDisplayScanRequestCount=" + mWifiDisplayScanRequestCount);
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
        ipw.increaseIndent();
        pw.println();
        pw.println("Display Adapters: size=" + mDisplayAdapters.size());
        for (DisplayAdapter adapter : mDisplayAdapters) {
            pw.println("  " + adapter.getName());
            adapter.dumpLocked(ipw);
        }
        pw.println();
        pw.println("Display Devices: size=" + mDisplayDevices.size());
        for (DisplayDevice device : mDisplayDevices) {
            pw.println("  " + device.getDisplayDeviceInfoLocked());
            device.dumpLocked(ipw);
        }
        final int logicalDisplayCount = mLogicalDisplays.size();
        pw.println();
        pw.println("Logical Displays: size=" + logicalDisplayCount);
        for (int i = 0; i < logicalDisplayCount; i++) {
            int displayId = mLogicalDisplays.keyAt(i);
            LogicalDisplay display = mLogicalDisplays.valueAt(i);
            pw.println("  Display " + displayId + ":");
            display.dumpLocked(ipw);
        }
        final int callbackCount = mCallbacks.size();
        pw.println();
        pw.println("Callbacks: size=" + callbackCount);
        for (int i = 0; i < callbackCount; i++) {
            CallbackRecord callback = mCallbacks.valueAt(i);
            pw.println("  " + i + ": mPid=" + callback.mPid + ", mWifiDisplayScanRequested=" + callback.mWifiDisplayScanRequested);
        }
        if (mDisplayPowerController != null) {
            mDisplayPowerController.dump(pw);
        }
        pw.println();
        mPersistentDataStore.dump(pw);
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 97 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by AOSPA.

the class NetworkStatsService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter rawWriter, String[] args) {
    mContext.enforceCallingOrSelfPermission(DUMP, TAG);
    long duration = DateUtils.DAY_IN_MILLIS;
    final HashSet<String> argSet = new HashSet<String>();
    for (String arg : args) {
        argSet.add(arg);
        if (arg.startsWith("--duration=")) {
            try {
                duration = Long.parseLong(arg.substring(11));
            } catch (NumberFormatException ignored) {
            }
        }
    }
    // usage: dumpsys netstats --full --uid --tag --poll --checkin
    final boolean poll = argSet.contains("--poll") || argSet.contains("poll");
    final boolean checkin = argSet.contains("--checkin");
    final boolean fullHistory = argSet.contains("--full") || argSet.contains("full");
    final boolean includeUid = argSet.contains("--uid") || argSet.contains("detail");
    final boolean includeTag = argSet.contains("--tag") || argSet.contains("detail");
    final IndentingPrintWriter pw = new IndentingPrintWriter(rawWriter, "  ");
    synchronized (mStatsLock) {
        if (poll) {
            performPollLocked(FLAG_PERSIST_ALL | FLAG_PERSIST_FORCE);
            pw.println("Forced poll");
            return;
        }
        if (checkin) {
            final long end = System.currentTimeMillis();
            final long start = end - duration;
            pw.print("v1,");
            pw.print(start / SECOND_IN_MILLIS);
            pw.print(',');
            pw.print(end / SECOND_IN_MILLIS);
            pw.println();
            pw.println("xt");
            mXtRecorder.dumpCheckin(rawWriter, start, end);
            if (includeUid) {
                pw.println("uid");
                mUidRecorder.dumpCheckin(rawWriter, start, end);
            }
            if (includeTag) {
                pw.println("tag");
                mUidTagRecorder.dumpCheckin(rawWriter, start, end);
            }
            return;
        }
        pw.println("Active interfaces:");
        pw.increaseIndent();
        for (int i = 0; i < mActiveIfaces.size(); i++) {
            pw.printPair("iface", mActiveIfaces.keyAt(i));
            pw.printPair("ident", mActiveIfaces.valueAt(i));
            pw.println();
        }
        pw.decreaseIndent();
        pw.println("Active UID interfaces:");
        pw.increaseIndent();
        for (int i = 0; i < mActiveUidIfaces.size(); i++) {
            pw.printPair("iface", mActiveUidIfaces.keyAt(i));
            pw.printPair("ident", mActiveUidIfaces.valueAt(i));
            pw.println();
        }
        pw.decreaseIndent();
        pw.println("Dev stats:");
        pw.increaseIndent();
        mDevRecorder.dumpLocked(pw, fullHistory);
        pw.decreaseIndent();
        pw.println("Xt stats:");
        pw.increaseIndent();
        mXtRecorder.dumpLocked(pw, fullHistory);
        pw.decreaseIndent();
        if (includeUid) {
            pw.println("UID stats:");
            pw.increaseIndent();
            mUidRecorder.dumpLocked(pw, fullHistory);
            pw.decreaseIndent();
        }
        if (includeTag) {
            pw.println("UID tag stats:");
            pw.increaseIndent();
            mUidTagRecorder.dumpLocked(pw, fullHistory);
            pw.decreaseIndent();
        }
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter) HashSet(java.util.HashSet)

Example 98 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by AOSPA.

the class ContentService method dump.

@Override
protected synchronized void dump(FileDescriptor fd, PrintWriter pw_, String[] args) {
    mContext.enforceCallingOrSelfPermission(Manifest.permission.DUMP, "caller doesn't have the DUMP permission");
    final IndentingPrintWriter pw = new IndentingPrintWriter(pw_, "  ");
    // This makes it so that future permission checks will be in the context of this
    // process rather than the caller's process. We will restore this before returning.
    final long identityToken = clearCallingIdentity();
    try {
        if (mSyncManager == null) {
            pw.println("No SyncManager created!  (Disk full?)");
        } else {
            mSyncManager.dump(fd, pw);
        }
        pw.println();
        pw.println("Observer tree:");
        synchronized (mRootNode) {
            int[] counts = new int[2];
            final SparseIntArray pidCounts = new SparseIntArray();
            mRootNode.dumpLocked(fd, pw, args, "", "  ", counts, pidCounts);
            pw.println();
            ArrayList<Integer> sorted = new ArrayList<Integer>();
            for (int i = 0; i < pidCounts.size(); i++) {
                sorted.add(pidCounts.keyAt(i));
            }
            Collections.sort(sorted, new Comparator<Integer>() {

                @Override
                public int compare(Integer lhs, Integer rhs) {
                    int lc = pidCounts.get(lhs);
                    int rc = pidCounts.get(rhs);
                    if (lc < rc) {
                        return 1;
                    } else if (lc > rc) {
                        return -1;
                    }
                    return 0;
                }
            });
            for (int i = 0; i < sorted.size(); i++) {
                int pid = sorted.get(i);
                pw.print("  pid ");
                pw.print(pid);
                pw.print(": ");
                pw.print(pidCounts.get(pid));
                pw.println(" observers");
            }
            pw.println();
            pw.print(" Total number of nodes: ");
            pw.println(counts[0]);
            pw.print(" Total number of observers: ");
            pw.println(counts[1]);
        }
        synchronized (mCache) {
            pw.println();
            pw.println("Cached content:");
            pw.increaseIndent();
            for (int i = 0; i < mCache.size(); i++) {
                pw.println("User " + mCache.keyAt(i) + ":");
                pw.increaseIndent();
                pw.println(mCache.valueAt(i));
                pw.decreaseIndent();
            }
            pw.decreaseIndent();
        }
    } finally {
        restoreCallingIdentity(identityToken);
    }
}
Also used : SparseIntArray(android.util.SparseIntArray) ArrayList(java.util.ArrayList) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 99 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by DirtyUnicorns.

the class ConnectivityService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump ConnectivityService " + "from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    if (argsContain(args, "--diag")) {
        dumpNetworkDiagnostics(pw);
        return;
    }
    pw.print("NetworkFactories for:");
    for (NetworkFactoryInfo nfi : mNetworkFactoryInfos.values()) {
        pw.print(" " + nfi.name);
    }
    pw.println();
    pw.println();
    final NetworkAgentInfo defaultNai = getDefaultNetwork();
    pw.print("Active default network: ");
    if (defaultNai == null) {
        pw.println("none");
    } else {
        pw.println(defaultNai.network.netId);
    }
    pw.println();
    pw.println("Current Networks:");
    pw.increaseIndent();
    for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
        pw.println(nai.toString());
        pw.increaseIndent();
        pw.println(String.format("Requests: REQUEST:%d LISTEN:%d BACKGROUND_REQUEST:%d total:%d", nai.numForegroundNetworkRequests(), nai.numNetworkRequests() - nai.numRequestNetworkRequests(), nai.numBackgroundNetworkRequests(), nai.numNetworkRequests()));
        pw.increaseIndent();
        for (int i = 0; i < nai.numNetworkRequests(); i++) {
            pw.println(nai.requestAt(i).toString());
        }
        pw.decreaseIndent();
        pw.println("Lingered:");
        pw.increaseIndent();
        nai.dumpLingerTimers(pw);
        pw.decreaseIndent();
        pw.decreaseIndent();
    }
    pw.decreaseIndent();
    pw.println();
    pw.println("Metered Interfaces:");
    pw.increaseIndent();
    for (String value : mMeteredIfaces) {
        pw.println(value);
    }
    pw.decreaseIndent();
    pw.println();
    pw.print("Restrict background: ");
    pw.println(mRestrictBackground);
    pw.println();
    pw.println("Status for known UIDs:");
    pw.increaseIndent();
    final int size = mUidRules.size();
    for (int i = 0; i < size; i++) {
        final int uid = mUidRules.keyAt(i);
        pw.print("UID=");
        pw.print(uid);
        final int uidRules = mUidRules.get(uid, RULE_NONE);
        pw.print(" rules=");
        pw.print(uidRulesToString(uidRules));
        pw.println();
    }
    pw.println();
    pw.decreaseIndent();
    pw.println("Network Requests:");
    pw.increaseIndent();
    for (NetworkRequestInfo nri : mNetworkRequests.values()) {
        pw.println(nri.toString());
    }
    pw.println();
    pw.decreaseIndent();
    mLegacyTypeTracker.dump(pw);
    synchronized (this) {
        pw.print("mNetTransitionWakeLock: currently " + (mNetTransitionWakeLock.isHeld() ? "" : "not ") + "held");
        if (!TextUtils.isEmpty(mNetTransitionWakeLockCausedBy)) {
            pw.println(", last requested for " + mNetTransitionWakeLockCausedBy);
        } else {
            pw.println(", last requested never");
        }
    }
    pw.println();
    mTethering.dump(fd, pw, args);
    pw.println();
    mKeepaliveTracker.dump(pw);
    pw.println();
    dumpAvoidBadWifiSettings(pw);
    pw.println();
    if (mInetLog != null && mInetLog.size() > 0) {
        pw.println();
        pw.println("Inet condition reports:");
        pw.increaseIndent();
        for (int i = 0; i < mInetLog.size(); i++) {
            pw.println(mInetLog.get(i));
        }
        pw.decreaseIndent();
    }
    if (argsContain(args, "--short") == false) {
        pw.println();
        synchronized (mValidationLogs) {
            pw.println("mValidationLogs (most recent first):");
            for (ValidationLog p : mValidationLogs) {
                pw.println(p.mNetwork + " - " + p.mNetworkExtraInfo);
                pw.increaseIndent();
                p.mLog.dump(fd, pw, args);
                pw.decreaseIndent();
            }
        }
        pw.println();
        pw.println("mNetworkRequestInfoLogs (most recent first):");
        pw.increaseIndent();
        mNetworkRequestInfoLogs.reverseDump(fd, pw, args);
        pw.decreaseIndent();
        pw.println();
        pw.println("mNetworkInfoBlockingLogs (most recent first):");
        pw.increaseIndent();
        mNetworkInfoBlockingLogs.reverseDump(fd, pw, args);
        pw.decreaseIndent();
    }
}
Also used : NetworkAgentInfo(com.android.server.connectivity.NetworkAgentInfo) NetworkPolicyManager.uidRulesToString(android.net.NetworkPolicyManager.uidRulesToString) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 100 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by DirtyUnicorns.

the class DisplayManagerService method dumpInternal.

private void dumpInternal(PrintWriter pw) {
    pw.println("DISPLAY MANAGER (dumpsys display)");
    synchronized (mSyncRoot) {
        pw.println("  mOnlyCode=" + mOnlyCore);
        pw.println("  mSafeMode=" + mSafeMode);
        pw.println("  mPendingTraversal=" + mPendingTraversal);
        pw.println("  mGlobalDisplayState=" + Display.stateToString(mGlobalDisplayState));
        pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
        pw.println("  mDefaultViewport=" + mDefaultViewport);
        pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
        pw.println("  mDefaultDisplayDefaultColorMode=" + mDefaultDisplayDefaultColorMode);
        pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
        pw.println("  mWifiDisplayScanRequestCount=" + mWifiDisplayScanRequestCount);
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
        ipw.increaseIndent();
        pw.println();
        pw.println("Display Adapters: size=" + mDisplayAdapters.size());
        for (DisplayAdapter adapter : mDisplayAdapters) {
            pw.println("  " + adapter.getName());
            adapter.dumpLocked(ipw);
        }
        pw.println();
        pw.println("Display Devices: size=" + mDisplayDevices.size());
        for (DisplayDevice device : mDisplayDevices) {
            pw.println("  " + device.getDisplayDeviceInfoLocked());
            device.dumpLocked(ipw);
        }
        final int logicalDisplayCount = mLogicalDisplays.size();
        pw.println();
        pw.println("Logical Displays: size=" + logicalDisplayCount);
        for (int i = 0; i < logicalDisplayCount; i++) {
            int displayId = mLogicalDisplays.keyAt(i);
            LogicalDisplay display = mLogicalDisplays.valueAt(i);
            pw.println("  Display " + displayId + ":");
            display.dumpLocked(ipw);
        }
        final int callbackCount = mCallbacks.size();
        pw.println();
        pw.println("Callbacks: size=" + callbackCount);
        for (int i = 0; i < callbackCount; i++) {
            CallbackRecord callback = mCallbacks.valueAt(i);
            pw.println("  " + i + ": mPid=" + callback.mPid + ", mWifiDisplayScanRequested=" + callback.mWifiDisplayScanRequested);
        }
        if (mDisplayPowerController != null) {
            mDisplayPowerController.dump(pw);
        }
        pw.println();
        mPersistentDataStore.dump(pw);
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Aggregations

IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)126 CharArrayWriter (java.io.CharArrayWriter)21 NetworkPolicyManager.uidRulesToString (android.net.NetworkPolicyManager.uidRulesToString)10 ArrayList (java.util.ArrayList)10 ArraySet (android.util.ArraySet)9 HashSet (java.util.HashSet)7 PackageParser (android.content.pm.PackageParser)6 UserInfo (android.content.pm.UserInfo)6 ArrayMap (android.util.ArrayMap)6 SparseBooleanArray (android.util.SparseBooleanArray)6 Map (java.util.Map)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 Point (android.graphics.Point)5 INetworkPolicyManager (android.net.INetworkPolicyManager)5 NetworkPolicyManager (android.net.NetworkPolicyManager)5 IBinder (android.os.IBinder)5 RemoteCallbackList (android.os.RemoteCallbackList)5 DiskInfo (android.os.storage.DiskInfo)5 VolumeInfo (android.os.storage.VolumeInfo)5 VolumeRecord (android.os.storage.VolumeRecord)5