use of com.android.internal.util.IndentingPrintWriter in project platform_frameworks_base by android.
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();
}
}
}
use of com.android.internal.util.IndentingPrintWriter in project platform_frameworks_base by android.
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();
}
}
use of com.android.internal.util.IndentingPrintWriter in project platform_frameworks_base by android.
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();
}
use of com.android.internal.util.IndentingPrintWriter in project platform_frameworks_base by android.
the class UsageStatsService method dump.
/**
* Called by the Binder stub.
*/
void dump(String[] args, PrintWriter pw) {
synchronized (mLock) {
IndentingPrintWriter idpw = new IndentingPrintWriter(pw, " ");
ArraySet<String> argSet = new ArraySet<>();
argSet.addAll(Arrays.asList(args));
final int userCount = mUserState.size();
for (int i = 0; i < userCount; i++) {
idpw.printPair("user", mUserState.keyAt(i));
idpw.println();
idpw.increaseIndent();
if (argSet.contains("--checkin")) {
mUserState.valueAt(i).checkin(idpw);
} else {
mUserState.valueAt(i).dump(idpw);
idpw.println();
if (args.length > 0) {
if ("history".equals(args[0])) {
mAppIdleHistory.dumpHistory(idpw, mUserState.keyAt(i));
} else if ("flush".equals(args[0])) {
UsageStatsService.this.flushToDiskLocked();
pw.println("Flushed stats to disk");
}
}
}
mAppIdleHistory.dump(idpw, mUserState.keyAt(i));
idpw.decreaseIndent();
}
pw.println();
pw.println("Carrier privileged apps (have=" + mHaveCarrierPrivilegedApps + "): " + mCarrierPrivilegedApps);
pw.println();
pw.println("Settings:");
pw.print(" mAppIdleDurationMillis=");
TimeUtils.formatDuration(mAppIdleScreenThresholdMillis, pw);
pw.println();
pw.print(" mAppIdleWallclockThresholdMillis=");
TimeUtils.formatDuration(mAppIdleWallclockThresholdMillis, pw);
pw.println();
pw.print(" mCheckIdleIntervalMillis=");
TimeUtils.formatDuration(mCheckIdleIntervalMillis, pw);
pw.println();
pw.print(" mAppIdleParoleIntervalMillis=");
TimeUtils.formatDuration(mAppIdleParoleIntervalMillis, pw);
pw.println();
pw.print(" mAppIdleParoleDurationMillis=");
TimeUtils.formatDuration(mAppIdleParoleDurationMillis, pw);
pw.println();
pw.println();
pw.print("mAppIdleEnabled=");
pw.print(mAppIdleEnabled);
pw.print(" mAppIdleTempParoled=");
pw.print(mAppIdleTempParoled);
pw.print(" mCharging=");
pw.print(mCharging);
pw.print(" mLastAppIdleParoledTime=");
TimeUtils.formatDuration(mLastAppIdleParoledTime, pw);
pw.println();
}
}
use of com.android.internal.util.IndentingPrintWriter in project android_frameworks_base by ParanoidAndroid.
the class AccountManagerService method dump.
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
fout.println("Permission Denial: can't dump AccountsManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " without permission " + android.Manifest.permission.DUMP);
return;
}
final boolean isCheckinRequest = scanArgs(args, "--checkin") || scanArgs(args, "-c");
final IndentingPrintWriter ipw = new IndentingPrintWriter(fout, " ");
final List<UserInfo> users = getUserManager().getUsers();
for (UserInfo user : users) {
ipw.println("User " + user + ":");
ipw.increaseIndent();
dumpUser(getUserAccounts(user.id), fd, ipw, args, isCheckinRequest);
ipw.println();
ipw.decreaseIndent();
}
}
Aggregations