Search in sources :

Example 71 with IndentingPrintWriter

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

the class SyncManager method dump.

protected void dump(FileDescriptor fd, PrintWriter pw) {
    final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
    dumpSyncState(ipw);
    dumpSyncHistory(ipw);
    dumpSyncAdapters(ipw);
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 72 with IndentingPrintWriter

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

the class NetworkStatsService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    mContext.enforceCallingOrSelfPermission(DUMP, TAG);
    final HashSet<String> argSet = new HashSet<String>();
    for (String arg : args) {
        argSet.add(arg);
    }
    // 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(writer, "  ");
    synchronized (mStatsLock) {
        if (poll) {
            performPollLocked(FLAG_PERSIST_ALL | FLAG_PERSIST_FORCE);
            pw.println("Forced poll");
            return;
        }
        if (checkin) {
            // list current stats files to verify rotation
            pw.println("Current files:");
            pw.increaseIndent();
            for (String file : mBaseDir.list()) {
                pw.println(file);
            }
            pw.decreaseIndent();
            return;
        }
        pw.println("Active interfaces:");
        pw.increaseIndent();
        for (String iface : mActiveIfaces.keySet()) {
            final NetworkIdentitySet ident = mActiveIfaces.get(iface);
            pw.print("iface=");
            pw.print(iface);
            pw.print(" ident=");
            pw.println(ident.toString());
        }
        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 73 with IndentingPrintWriter

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

the class NetworkPolicyManagerService method dump.

@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    mContext.enforceCallingOrSelfPermission(DUMP, TAG);
    final IndentingPrintWriter fout = new IndentingPrintWriter(writer, "  ");
    final HashSet<String> argSet = new HashSet<String>();
    for (String arg : args) {
        argSet.add(arg);
    }
    synchronized (mRulesLock) {
        if (argSet.contains("--unsnooze")) {
            for (NetworkPolicy policy : mNetworkPolicy.values()) {
                policy.clearSnooze();
            }
            updateNetworkEnabledLocked();
            updateNetworkRulesLocked();
            updateNotificationsLocked();
            writePolicyLocked();
            fout.println("Cleared snooze timestamps");
            return;
        }
        fout.print("Restrict background: ");
        fout.println(mRestrictBackground);
        fout.println("Network policies:");
        fout.increaseIndent();
        for (NetworkPolicy policy : mNetworkPolicy.values()) {
            fout.println(policy.toString());
        }
        fout.decreaseIndent();
        fout.println("Policy for UIDs:");
        fout.increaseIndent();
        int size = mUidPolicy.size();
        for (int i = 0; i < size; i++) {
            final int uid = mUidPolicy.keyAt(i);
            final int policy = mUidPolicy.valueAt(i);
            fout.print("UID=");
            fout.print(uid);
            fout.print(" policy=");
            dumpPolicy(fout, policy);
            fout.println();
        }
        fout.decreaseIndent();
        final SparseBooleanArray knownUids = new SparseBooleanArray();
        collectKeys(mUidForeground, knownUids);
        collectKeys(mUidRules, knownUids);
        fout.println("Status for known UIDs:");
        fout.increaseIndent();
        size = knownUids.size();
        for (int i = 0; i < size; i++) {
            final int uid = knownUids.keyAt(i);
            fout.print("UID=");
            fout.print(uid);
            fout.print(" foreground=");
            final int foregroundIndex = mUidPidForeground.indexOfKey(uid);
            if (foregroundIndex < 0) {
                fout.print("UNKNOWN");
            } else {
                dumpSparseBooleanArray(fout, mUidPidForeground.valueAt(foregroundIndex));
            }
            fout.print(" rules=");
            final int rulesIndex = mUidRules.indexOfKey(uid);
            if (rulesIndex < 0) {
                fout.print("UNKNOWN");
            } else {
                dumpRules(fout, mUidRules.valueAt(rulesIndex));
            }
            fout.println();
        }
        fout.decreaseIndent();
    }
}
Also used : NetworkPolicy(android.net.NetworkPolicy) SparseBooleanArray(android.util.SparseBooleanArray) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter) HashSet(java.util.HashSet)

Example 74 with IndentingPrintWriter

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

the class SearchManagerService method dump.

@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
    synchronized (mSearchables) {
        for (int i = 0; i < mSearchables.size(); i++) {
            ipw.print("\nUser: ");
            ipw.println(mSearchables.keyAt(i));
            ipw.increaseIndent();
            mSearchables.valueAt(i).dump(fd, ipw, args);
            ipw.decreaseIndent();
        }
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 75 with IndentingPrintWriter

use of com.android.internal.util.IndentingPrintWriter in project platform_frameworks_base by android.

the class ExternalStorageProvider method dump.

@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ", 160);
    synchronized (mRootsLock) {
        for (int i = 0; i < mRoots.size(); i++) {
            final RootInfo root = mRoots.valueAt(i);
            pw.println("Root{" + root.rootId + "}:");
            pw.increaseIndent();
            pw.printPair("flags", DebugUtils.flagsToString(Root.class, "FLAG_", root.flags));
            pw.println();
            pw.printPair("title", root.title);
            pw.printPair("docId", root.docId);
            pw.println();
            pw.printPair("path", root.path);
            pw.printPair("visiblePath", root.visiblePath);
            pw.decreaseIndent();
            pw.println();
        }
    }
}
Also used : Root(android.provider.DocumentsContract.Root) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter) Point(android.graphics.Point)

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