Search in sources :

Example 46 with IndentingPrintWriter

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

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 47 with IndentingPrintWriter

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

the class TvInputHardwareManager method dump.

public void dump(FileDescriptor fd, final 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 TvInputHardwareManager from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    synchronized (mLock) {
        pw.println("TvInputHardwareManager Info:");
        pw.increaseIndent();
        pw.println("mConnections: deviceId -> Connection");
        pw.increaseIndent();
        for (int i = 0; i < mConnections.size(); i++) {
            int deviceId = mConnections.keyAt(i);
            Connection mConnection = mConnections.valueAt(i);
            pw.println(deviceId + ": " + mConnection);
        }
        pw.decreaseIndent();
        pw.println("mHardwareList:");
        pw.increaseIndent();
        for (TvInputHardwareInfo tvInputHardwareInfo : mHardwareList) {
            pw.println(tvInputHardwareInfo);
        }
        pw.decreaseIndent();
        pw.println("mHdmiDeviceList:");
        pw.increaseIndent();
        for (HdmiDeviceInfo hdmiDeviceInfo : mHdmiDeviceList) {
            pw.println(hdmiDeviceInfo);
        }
        pw.decreaseIndent();
        pw.println("mHardwareInputIdMap: deviceId -> inputId");
        pw.increaseIndent();
        for (int i = 0; i < mHardwareInputIdMap.size(); i++) {
            int deviceId = mHardwareInputIdMap.keyAt(i);
            String inputId = mHardwareInputIdMap.valueAt(i);
            pw.println(deviceId + ": " + inputId);
        }
        pw.decreaseIndent();
        pw.println("mHdmiInputIdMap: id -> inputId");
        pw.increaseIndent();
        for (int i = 0; i < mHdmiInputIdMap.size(); i++) {
            int id = mHdmiInputIdMap.keyAt(i);
            String inputId = mHdmiInputIdMap.valueAt(i);
            pw.println(id + ": " + inputId);
        }
        pw.decreaseIndent();
        pw.println("mInputMap: inputId -> inputInfo");
        pw.increaseIndent();
        for (Map.Entry<String, TvInputInfo> entry : mInputMap.entrySet()) {
            pw.println(entry.getKey() + ": " + entry.getValue());
        }
        pw.decreaseIndent();
        pw.decreaseIndent();
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) TvInputHardwareInfo(android.media.tv.TvInputHardwareInfo) TvInputInfo(android.media.tv.TvInputInfo) Map(java.util.Map) ArrayMap(android.util.ArrayMap) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 48 with IndentingPrintWriter

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

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 ArraySet<String> argSet = new ArraySet<String>(args.length);
    for (String arg : args) {
        argSet.add(arg);
    }
    synchronized (mUidRulesFirstLock) {
        synchronized (mNetworkPoliciesSecondLock) {
            if (argSet.contains("--unsnooze")) {
                for (int i = mNetworkPolicy.size() - 1; i >= 0; i--) {
                    mNetworkPolicy.valueAt(i).clearSnooze();
                }
                normalizePoliciesNL();
                updateNetworkEnabledNL();
                updateNetworkRulesNL();
                updateNotificationsNL();
                writePolicyAL();
                fout.println("Cleared snooze timestamps");
                return;
            }
            fout.print("System ready: ");
            fout.println(mSystemReady);
            fout.print("Restrict background: ");
            fout.println(mRestrictBackground);
            fout.print("Restrict power: ");
            fout.println(mRestrictPower);
            fout.print("Device idle: ");
            fout.println(mDeviceIdleMode);
            fout.println("Network policies:");
            fout.increaseIndent();
            for (int i = 0; i < mNetworkPolicy.size(); i++) {
                fout.println(mNetworkPolicy.valueAt(i).toString());
            }
            fout.decreaseIndent();
            fout.print("Metered ifaces: ");
            fout.println(String.valueOf(mMeteredIfaces));
            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=");
                fout.print(DebugUtils.flagsToString(NetworkPolicyManager.class, "POLICY_", policy));
                fout.println();
            }
            fout.decreaseIndent();
            size = mPowerSaveWhitelistExceptIdleAppIds.size();
            if (size > 0) {
                fout.println("Power save whitelist (except idle) app ids:");
                fout.increaseIndent();
                for (int i = 0; i < size; i++) {
                    fout.print("UID=");
                    fout.print(mPowerSaveWhitelistExceptIdleAppIds.keyAt(i));
                    fout.print(": ");
                    fout.print(mPowerSaveWhitelistExceptIdleAppIds.valueAt(i));
                    fout.println();
                }
                fout.decreaseIndent();
            }
            size = mPowerSaveWhitelistAppIds.size();
            if (size > 0) {
                fout.println("Power save whitelist app ids:");
                fout.increaseIndent();
                for (int i = 0; i < size; i++) {
                    fout.print("UID=");
                    fout.print(mPowerSaveWhitelistAppIds.keyAt(i));
                    fout.print(": ");
                    fout.print(mPowerSaveWhitelistAppIds.valueAt(i));
                    fout.println();
                }
                fout.decreaseIndent();
            }
            size = mRestrictBackgroundWhitelistUids.size();
            if (size > 0) {
                fout.println("Restrict background whitelist uids:");
                fout.increaseIndent();
                for (int i = 0; i < size; i++) {
                    fout.print("UID=");
                    fout.print(mRestrictBackgroundWhitelistUids.keyAt(i));
                    fout.println();
                }
                fout.decreaseIndent();
            }
            size = mDefaultRestrictBackgroundWhitelistUids.size();
            if (size > 0) {
                fout.println("Default restrict background whitelist uids:");
                fout.increaseIndent();
                for (int i = 0; i < size; i++) {
                    fout.print("UID=");
                    fout.print(mDefaultRestrictBackgroundWhitelistUids.keyAt(i));
                    fout.println();
                }
                fout.decreaseIndent();
            }
            size = mRestrictBackgroundWhitelistRevokedUids.size();
            if (size > 0) {
                fout.println("Default restrict background whitelist uids revoked by users:");
                fout.increaseIndent();
                for (int i = 0; i < size; i++) {
                    fout.print("UID=");
                    fout.print(mRestrictBackgroundWhitelistRevokedUids.keyAt(i));
                    fout.println();
                }
                fout.decreaseIndent();
            }
            final SparseBooleanArray knownUids = new SparseBooleanArray();
            collectKeys(mUidState, knownUids);
            collectKeys(mUidRules, knownUids);
            fout.println("Status for all 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);
                final int state = mUidState.get(uid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
                fout.print(" state=");
                fout.print(state);
                if (state <= ActivityManager.PROCESS_STATE_TOP) {
                    fout.print(" (fg)");
                } else {
                    fout.print(state <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE ? " (fg svc)" : " (bg)");
                }
                final int uidRules = mUidRules.get(uid, RULE_NONE);
                fout.print(" rules=");
                fout.print(uidRulesToString(uidRules));
                fout.println();
            }
            fout.decreaseIndent();
            fout.println("Status for just UIDs with rules:");
            fout.increaseIndent();
            size = mUidRules.size();
            for (int i = 0; i < size; i++) {
                final int uid = mUidRules.keyAt(i);
                fout.print("UID=");
                fout.print(uid);
                final int uidRules = mUidRules.get(uid, RULE_NONE);
                fout.print(" rules=");
                fout.print(uidRulesToString(uidRules));
                fout.println();
            }
            fout.decreaseIndent();
        }
    }
}
Also used : ArraySet(android.util.ArraySet) NetworkPolicyManager(android.net.NetworkPolicyManager) INetworkPolicyManager(android.net.INetworkPolicyManager) SparseBooleanArray(android.util.SparseBooleanArray) NetworkPolicyManager.uidRulesToString(android.net.NetworkPolicyManager.uidRulesToString) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 49 with IndentingPrintWriter

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

the class NetdEventListenerService method dump.

public synchronized void dump(PrintWriter writer) {
    IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
    pw.println(TAG + ":");
    pw.increaseIndent();
    for (DnsEventBatch batch : mEventBatches.values()) {
        pw.println(batch.toString());
    }
    // TODO: also dump ConnectStats
    pw.decreaseIndent();
}
Also used : IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 50 with IndentingPrintWriter

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

the class MidiService 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("MIDI Manager State:");
    pw.increaseIndent();
    pw.println("Devices:");
    pw.increaseIndent();
    synchronized (mDevicesByInfo) {
        for (Device device : mDevicesByInfo.values()) {
            pw.println(device.toString());
        }
    }
    pw.decreaseIndent();
    pw.println("Clients:");
    pw.increaseIndent();
    synchronized (mClients) {
        for (Client client : mClients.values()) {
            pw.println(client.toString());
        }
    }
    pw.decreaseIndent();
}
Also used : BluetoothDevice(android.bluetooth.BluetoothDevice) 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