@Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) { pw.println( "Permission Denial: can't dump UserManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid() + " without permission " + android.Manifest.permission.DUMP); return; } long now = System.currentTimeMillis(); StringBuilder sb = new StringBuilder(); synchronized (mPackagesLock) { pw.println("Users:"); for (int i = 0; i < mUsers.size(); i++) { UserInfo user = mUsers.valueAt(i); if (user == null) continue; pw.print(" "); pw.print(user); pw.print(" serialNo="); pw.print(user.serialNumber); if (mRemovingUserIds.get(mUsers.keyAt(i))) pw.print(" <removing> "); if (user.partial) pw.print(" <partial>"); pw.println(); pw.print(" Created: "); if (user.creationTime == 0) { pw.println("<unknown>"); } else { sb.setLength(0); TimeUtils.formatDuration(now - user.creationTime, sb); sb.append(" ago"); pw.println(sb); } pw.print(" Last logged in: "); if (user.lastLoggedInTime == 0) { pw.println("<unknown>"); } else { sb.setLength(0); TimeUtils.formatDuration(now - user.lastLoggedInTime, sb); sb.append(" ago"); pw.println(sb); } } } }
public String toString() { StringBuilder s = new StringBuilder(); s.append("Request[").append(qualityToString(this.mQuality)); if (this.mProvider != null) { s.append(' ').append(this.mProvider); } if (this.mQuality != POWER_NONE) { s.append(" requested="); TimeUtils.formatDuration(this.mInterval, s); } s.append(" fastest="); TimeUtils.formatDuration(this.mFastestInterval, s); if (this.mExpireAt != TtmlUtils.INVALID_TIMESTAMP) { long expireIn = this.mExpireAt - SystemClock.elapsedRealtime(); s.append(" expireIn="); TimeUtils.formatDuration(expireIn, s); } if (this.mNumUpdates != RILConstants.MAX_INT) { s.append(" num=").append(this.mNumUpdates); } s.append(']'); return s.toString(); }
@Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) { pw.println( "Permission Denial: can't dump " + SERVICE + " from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()); return; } pw.println("Current DeviceStorageMonitor state:"); pw.print(" mFreeMem="); pw.print(Formatter.formatFileSize(mContext, mFreeMem)); pw.print(" mTotalMemory="); pw.println(Formatter.formatFileSize(mContext, mTotalMemory)); pw.print(" mFreeMemAfterLastCacheClear="); pw.println(Formatter.formatFileSize(mContext, mFreeMemAfterLastCacheClear)); pw.print(" mLastReportedFreeMem="); pw.print(Formatter.formatFileSize(mContext, mLastReportedFreeMem)); pw.print(" mLastReportedFreeMemTime="); TimeUtils.formatDuration(mLastReportedFreeMemTime, SystemClock.elapsedRealtime(), pw); pw.println(); pw.print(" mLowMemFlag="); pw.print(mLowMemFlag); pw.print(" mMemFullFlag="); pw.println(mMemFullFlag); pw.print(" mClearSucceeded="); pw.print(mClearSucceeded); pw.print(" mClearingCache="); pw.println(mClearingCache); pw.print(" mMemLowThreshold="); pw.print(Formatter.formatFileSize(mContext, mMemLowThreshold)); pw.print(" mMemFullThreshold="); pw.println(Formatter.formatFileSize(mContext, mMemFullThreshold)); pw.print(" mMemCacheStartTrimThreshold="); pw.print(Formatter.formatFileSize(mContext, mMemCacheStartTrimThreshold)); pw.print(" mMemCacheTrimToThreshold="); pw.println(Formatter.formatFileSize(mContext, mMemCacheTrimToThreshold)); }
boolean dumpLocked(FileDescriptor fd, PrintWriter pw, boolean needSep, String dumpPackage) { if (!mProcessCrashTimes.getMap().isEmpty()) { boolean printed = false; final long now = SystemClock.uptimeMillis(); final ArrayMap<String, SparseArray<Long>> pmap = mProcessCrashTimes.getMap(); final int processCount = pmap.size(); for (int ip = 0; ip < processCount; ip++) { final String pname = pmap.keyAt(ip); final SparseArray<Long> uids = pmap.valueAt(ip); final int uidCount = uids.size(); for (int i = 0; i < uidCount; i++) { final int puid = uids.keyAt(i); final ProcessRecord r = mService.mProcessNames.get(pname, puid); if (dumpPackage != null && (r == null || !r.pkgList.containsKey(dumpPackage))) { continue; } if (!printed) { if (needSep) pw.println(); needSep = true; pw.println(" Time since processes crashed:"); printed = true; } pw.print(" Process "); pw.print(pname); pw.print(" uid "); pw.print(puid); pw.print(": last crashed "); TimeUtils.formatDuration(now - uids.valueAt(i), pw); pw.println(" ago"); } } } if (!mBadProcesses.getMap().isEmpty()) { boolean printed = false; final ArrayMap<String, SparseArray<BadProcessInfo>> pmap = mBadProcesses.getMap(); final int processCount = pmap.size(); for (int ip = 0; ip < processCount; ip++) { final String pname = pmap.keyAt(ip); final SparseArray<BadProcessInfo> uids = pmap.valueAt(ip); final int uidCount = uids.size(); for (int i = 0; i < uidCount; i++) { final int puid = uids.keyAt(i); final ProcessRecord r = mService.mProcessNames.get(pname, puid); if (dumpPackage != null && (r == null || !r.pkgList.containsKey(dumpPackage))) { continue; } if (!printed) { if (needSep) pw.println(); needSep = true; pw.println(" Bad processes:"); printed = true; } final BadProcessInfo info = uids.valueAt(i); pw.print(" Bad process "); pw.print(pname); pw.print(" uid "); pw.print(puid); pw.print(": crashed at time "); pw.println(info.time); if (info.shortMsg != null) { pw.print(" Short msg: "); pw.println(info.shortMsg); } if (info.longMsg != null) { pw.print(" Long msg: "); pw.println(info.longMsg); } if (info.stack != null) { pw.println(" Stack:"); int lastPos = 0; for (int pos = 0; pos < info.stack.length(); pos++) { if (info.stack.charAt(pos) == '\n') { pw.print(" "); pw.write(info.stack, lastPos, pos - lastPos); pw.println(); lastPos = pos + 1; } } if (lastPos < info.stack.length()) { pw.print(" "); pw.write(info.stack, lastPos, info.stack.length() - lastPos); pw.println(); } } } } } return needSep; }
// Dumpsys infrastructure public void dump(PrintWriter pw, String prefix, boolean full) { pw.print(prefix); UserHandle.formatUid(pw, callingUid); pw.print(" tag="); pw.println(tag); pw.print(prefix); pw.print("Source: uid="); UserHandle.formatUid(pw, getSourceUid()); pw.print(" user="******" pkg="); pw.println(getSourcePackageName()); if (full) { pw.print(prefix); pw.println("JobInfo:"); pw.print(prefix); pw.print(" Service: "); pw.println(job.getService().flattenToShortString()); if (job.isPeriodic()) { pw.print(prefix); pw.print(" PERIODIC: interval="); TimeUtils.formatDuration(job.getIntervalMillis(), pw); pw.print(" flex="); TimeUtils.formatDuration(job.getFlexMillis(), pw); pw.println(); } if (job.isPersisted()) { pw.print(prefix); pw.println(" PERSISTED"); } if (job.getPriority() != 0) { pw.print(prefix); pw.print(" Priority: "); pw.println(job.getPriority()); } if (job.getFlags() != 0) { pw.print(prefix); pw.print(" Flags: "); pw.println(Integer.toHexString(job.getFlags())); } pw.print(prefix); pw.print(" Requires: charging="); pw.print(job.isRequireCharging()); pw.print(" deviceIdle="); pw.println(job.isRequireDeviceIdle()); if (job.getTriggerContentUris() != null) { pw.print(prefix); pw.println(" Trigger content URIs:"); for (int i = 0; i < job.getTriggerContentUris().length; i++) { JobInfo.TriggerContentUri trig = job.getTriggerContentUris()[i]; pw.print(prefix); pw.print(" "); pw.print(Integer.toHexString(trig.getFlags())); pw.print(' '); pw.println(trig.getUri()); } if (job.getTriggerContentUpdateDelay() >= 0) { pw.print(prefix); pw.print(" Trigger update delay: "); TimeUtils.formatDuration(job.getTriggerContentUpdateDelay(), pw); pw.println(); } if (job.getTriggerContentMaxDelay() >= 0) { pw.print(prefix); pw.print(" Trigger max delay: "); TimeUtils.formatDuration(job.getTriggerContentMaxDelay(), pw); pw.println(); } } if (job.getNetworkType() != JobInfo.NETWORK_TYPE_NONE) { pw.print(prefix); pw.print(" Network type: "); pw.println(job.getNetworkType()); } if (job.getMinLatencyMillis() != 0) { pw.print(prefix); pw.print(" Minimum latency: "); TimeUtils.formatDuration(job.getMinLatencyMillis(), pw); pw.println(); } if (job.getMaxExecutionDelayMillis() != 0) { pw.print(prefix); pw.print(" Max execution delay: "); TimeUtils.formatDuration(job.getMaxExecutionDelayMillis(), pw); pw.println(); } pw.print(prefix); pw.print(" Backoff: policy="); pw.print(job.getBackoffPolicy()); pw.print(" initial="); TimeUtils.formatDuration(job.getInitialBackoffMillis(), pw); pw.println(); if (job.hasEarlyConstraint()) { pw.print(prefix); pw.println(" Has early constraint"); } if (job.hasLateConstraint()) { pw.print(prefix); pw.println(" Has late constraint"); } } pw.print(prefix); pw.print("Required constraints:"); dumpConstraints(pw, requiredConstraints); pw.println(); if (full) { pw.print(prefix); pw.print("Satisfied constraints:"); dumpConstraints(pw, satisfiedConstraints); pw.println(); pw.print(prefix); pw.print("Unsatisfied constraints:"); dumpConstraints(pw, (requiredConstraints & ~satisfiedConstraints)); pw.println(); if (dozeWhitelisted) { pw.print(prefix); pw.println("Doze whitelisted: true"); } } if (changedAuthorities != null) { pw.print(prefix); pw.println("Changed authorities:"); for (int i = 0; i < changedAuthorities.size(); i++) { pw.print(prefix); pw.print(" "); pw.println(changedAuthorities.valueAt(i)); } if (changedUris != null) { pw.print(prefix); pw.println("Changed URIs:"); for (int i = 0; i < changedUris.size(); i++) { pw.print(prefix); pw.print(" "); pw.println(changedUris.valueAt(i)); } } } pw.print(prefix); pw.print("Earliest run time: "); pw.println(formatRunTime(earliestRunTimeElapsedMillis, NO_EARLIEST_RUNTIME)); pw.print(prefix); pw.print("Latest run time: "); pw.println(formatRunTime(latestRunTimeElapsedMillis, NO_LATEST_RUNTIME)); if (numFailures != 0) { pw.print(prefix); pw.print("Num failures: "); pw.println(numFailures); } }