Search in sources :

Example 1 with IndentingPrintWriter

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

the class AppWidgetService method dump.

@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    // Dump the state of all the app widget providers
    synchronized (mAppWidgetServices) {
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
        for (int i = 0; i < mAppWidgetServices.size(); i++) {
            pw.println("User: " + mAppWidgetServices.keyAt(i));
            ipw.increaseIndent();
            AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
            service.dump(fd, ipw, args);
            ipw.decreaseIndent();
        }
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 2 with IndentingPrintWriter

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

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;
    }
    // TODO: add locking to get atomic snapshot
    pw.println();
    for (int i = 0; i < mNetTrackers.length; i++) {
        final NetworkStateTracker nst = mNetTrackers[i];
        if (nst != null) {
            pw.println("NetworkStateTracker for " + getNetworkTypeName(i) + ":");
            pw.increaseIndent();
            if (nst.getNetworkInfo().isConnected()) {
                pw.println("Active network: " + nst.getNetworkInfo().getTypeName());
            }
            pw.println(nst.getNetworkInfo());
            pw.println(nst.getLinkProperties());
            pw.println(nst);
            pw.println();
            pw.decreaseIndent();
        }
    }
    pw.println("Network Requester Pids:");
    pw.increaseIndent();
    for (int net : mPriorityList) {
        String pidString = net + ": ";
        for (Integer pid : mNetRequestersPids[net]) {
            pidString = pidString + pid.toString() + ", ";
        }
        pw.println(pidString);
    }
    pw.println();
    pw.decreaseIndent();
    pw.println("FeatureUsers:");
    pw.increaseIndent();
    for (Object requester : mFeatureUsers) {
        pw.println(requester.toString());
    }
    pw.println();
    pw.decreaseIndent();
    synchronized (this) {
        pw.println("NetworkTranstionWakeLock is currently " + (mNetTransitionWakeLock.isHeld() ? "" : "not ") + "held.");
        pw.println("It was last requested for " + mNetTransitionWakeLockCausedBy);
    }
    pw.println();
    mTethering.dump(fd, pw, args);
    if (mInetLog != null) {
        pw.println();
        pw.println("Inet condition reports:");
        pw.increaseIndent();
        for (int i = 0; i < mInetLog.size(); i++) {
            pw.println(mInetLog.get(i));
        }
        pw.decreaseIndent();
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NetworkStateTracker(android.net.NetworkStateTracker) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 3 with IndentingPrintWriter

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

the class DisplayManagerService method dump.

// Binder call
@Override
public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (mContext == null || mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump DisplayManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    pw.println("DISPLAY MANAGER (dumpsys display)");
    synchronized (mSyncRoot) {
        pw.println("  mHeadless=" + mHeadless);
        pw.println("  mOnlyCode=" + mOnlyCore);
        pw.println("  mSafeMode=" + mSafeMode);
        pw.println("  mPendingTraversal=" + mPendingTraversal);
        pw.println("  mAllDisplayBlankStateFromPowerManager=" + mAllDisplayBlankStateFromPowerManager);
        pw.println("  mNextNonDefaultDisplayId=" + mNextNonDefaultDisplayId);
        pw.println("  mDefaultViewport=" + mDefaultViewport);
        pw.println("  mExternalTouchViewport=" + mExternalTouchViewport);
        pw.println("  mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
        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);
        }
    }
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 4 with IndentingPrintWriter

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

the class UsbService method dump.

@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
    pw.println("USB Manager State:");
    if (mDeviceManager != null) {
        mDeviceManager.dump(fd, pw);
    }
    if (mHostManager != null) {
        mHostManager.dump(fd, pw);
    }
    synchronized (mLock) {
        for (int i = 0; i < mSettingsByUser.size(); i++) {
            final int userId = mSettingsByUser.keyAt(i);
            final UsbSettingsManager settings = mSettingsByUser.valueAt(i);
            pw.increaseIndent();
            pw.println("Settings for user " + userId + ":");
            settings.dump(fd, pw);
            pw.decreaseIndent();
        }
    }
    pw.decreaseIndent();
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 5 with IndentingPrintWriter

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

the class NetworkStatsHistory method toString.

@Override
public String toString() {
    final CharArrayWriter writer = new CharArrayWriter();
    dump(new IndentingPrintWriter(writer, "  "), false);
    return writer.toString();
}
Also used : CharArrayWriter(java.io.CharArrayWriter) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Aggregations

IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)136 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)8 Map (java.util.Map)8 PackageParser (android.content.pm.PackageParser)6 UserInfo (android.content.pm.UserInfo)6 ArrayMap (android.util.ArrayMap)6 SparseBooleanArray (android.util.SparseBooleanArray)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 Root (android.provider.DocumentsContract.Root)5