Java Code Examples for com.android.internal.util.IndentingPrintWriter#println()

The following examples show how to use com.android.internal.util.IndentingPrintWriter#println() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageInstaller.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/** {@hide} */
public void dump(IndentingPrintWriter pw) {
    pw.printPair("mode", mode);
    pw.printHexPair("installFlags", installFlags);
    pw.printPair("installLocation", installLocation);
    pw.printPair("sizeBytes", sizeBytes);
    pw.printPair("appPackageName", appPackageName);
    pw.printPair("appIcon", (appIcon != null));
    pw.printPair("appLabel", appLabel);
    pw.printPair("originatingUri", originatingUri);
    pw.printPair("originatingUid", originatingUid);
    pw.printPair("referrerUri", referrerUri);
    pw.printPair("abiOverride", abiOverride);
    pw.printPair("volumeUuid", volumeUuid);
    pw.printPair("grantedRuntimePermissions", grantedRuntimePermissions);
    pw.printPair("installerPackageName", installerPackageName);
    pw.println();
}
 
Example 2
Source File: OffloadController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    if (isOffloadDisabled()) {
        pw.println("Offload disabled");
        return;
    }
    final boolean isStarted = started();
    pw.println("Offload HALs " + (isStarted ? "started" : "not started"));
    LinkProperties lp = mUpstreamLinkProperties;
    String upstream = (lp != null) ? lp.getInterfaceName() : null;
    pw.println("Current upstream: " + upstream);
    pw.println("Exempt prefixes: " + mLastLocalPrefixStrs);
    pw.println("NAT timeout update callbacks received during the "
            + (isStarted ? "current" : "last")
            + " offload session: "
            + mNatUpdateCallbacksReceived);
    pw.println("NAT timeout update netlink errors during the "
            + (isStarted ? "current" : "last")
            + " offload session: "
            + mNatUpdateNetlinkErrors);
}
 
Example 3
Source File: NetworkDiagnostics.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println(TAG + ":" + mDescription);
    final long unfinished = mCountDownLatch.getCount();
    if (unfinished > 0) {
        // This can't happen unless a caller forgets to call waitForMeasurements()
        // or a measurement isn't implemented to correctly honor the timeout.
        pw.println("WARNING: countdown wait incomplete: "
                + unfinished + " unfinished measurements");
    }

    pw.increaseIndent();

    String prefix;
    for (Measurement m : getMeasurements()) {
        prefix = m.checkSucceeded() ? "." : "F";
        pw.println(prefix + "  " + m.toString());
    }

    pw.decreaseIndent();
}
 
Example 4
Source File: HdmiCecLocalDeviceTv.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(final IndentingPrintWriter pw) {
    super.dump(pw);
    pw.println("mArcEstablished: " + mArcEstablished);
    pw.println("mArcFeatureEnabled: " + mArcFeatureEnabled);
    pw.println("mSystemAudioActivated: " + mSystemAudioActivated);
    pw.println("mSystemAudioMute: " + mSystemAudioMute);
    pw.println("mSystemAudioControlFeatureEnabled: " + mSystemAudioControlFeatureEnabled);
    pw.println("mAutoDeviceOff: " + mAutoDeviceOff);
    pw.println("mAutoWakeup: " + mAutoWakeup);
    pw.println("mSkipRoutingControl: " + mSkipRoutingControl);
    pw.println("mPrevPortId: " + mPrevPortId);
    pw.println("CEC devices:");
    pw.increaseIndent();
    for (HdmiDeviceInfo info : mSafeAllDeviceInfos) {
        pw.println(info);
    }
    pw.decreaseIndent();
}
 
Example 5
Source File: PendingTransactionActions.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    // Tell activity manager we have been stopped.
    try {
        if (DEBUG_MEMORY_TRIM) Slog.v(TAG, "Reporting activity stopped: " + mActivity);
        // TODO(lifecycler): Use interface callback instead of AMS.
        ActivityManager.getService().activityStopped(
                mActivity.token, mState, mPersistentState, mDescription);
    } catch (RemoteException ex) {
        // Dump statistics about bundle to help developers debug
        final LogWriter writer = new LogWriter(Log.WARN, TAG);
        final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
        pw.println("Bundle stats:");
        Bundle.dumpStats(pw, mState);
        pw.println("PersistableBundle stats:");
        Bundle.dumpStats(pw, mPersistentState);

        if (ex instanceof TransactionTooLargeException
                && mActivity.packageInfo.getTargetSdkVersion() < Build.VERSION_CODES.N) {
            Log.e(TAG, "App sent too much data in instance state, so it was ignored", ex);
            return;
        }
        throw ex.rethrowFromSystemServer();
    }
}
 
Example 6
Source File: VolumeRecord.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println("VolumeRecord:");
    pw.increaseIndent();
    pw.printPair("type", DebugUtils.valueToString(VolumeInfo.class, "TYPE_", type));
    pw.printPair("fsUuid", fsUuid);
    pw.printPair("partGuid", partGuid);
    pw.println();
    pw.printPair("nickname", nickname);
    pw.printPair("userFlags",
            DebugUtils.flagsToString(VolumeRecord.class, "USER_FLAG_", userFlags));
    pw.println();
    pw.printPair("createdMillis", TimeUtils.formatForLogging(createdMillis));
    pw.printPair("lastTrimMillis", TimeUtils.formatForLogging(lastTrimMillis));
    pw.printPair("lastBenchMillis", TimeUtils.formatForLogging(lastBenchMillis));
    pw.decreaseIndent();
    pw.println();
}
 
Example 7
Source File: VolumeInfo.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    pw.println("VolumeInfo{" + id + "}:");
    pw.increaseIndent();
    pw.printPair("type", DebugUtils.valueToString(getClass(), "TYPE_", type));
    pw.printPair("diskId", getDiskId());
    pw.printPair("partGuid", partGuid);
    pw.printPair("mountFlags", DebugUtils.flagsToString(getClass(), "MOUNT_FLAG_", mountFlags));
    pw.printPair("mountUserId", mountUserId);
    pw.printPair("state", DebugUtils.valueToString(getClass(), "STATE_", state));
    pw.println();
    pw.printPair("fsType", fsType);
    pw.printPair("fsUuid", fsUuid);
    pw.printPair("fsLabel", fsLabel);
    pw.println();
    pw.printPair("path", path);
    pw.printPair("internalPath", internalPath);
    pw.decreaseIndent();
    pw.println();
}
 
Example 8
Source File: DeviceIdleJobsController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void dumpControllerStateLocked(final IndentingPrintWriter pw,
        final Predicate<JobStatus> predicate) {
    pw.println("Idle mode: " + mDeviceIdleMode);
    pw.println();

    mService.getJobStore().forEachJob(predicate, (jobStatus) -> {
        pw.print("#");
        jobStatus.printUniqueId(pw);
        pw.print(" from ");
        UserHandle.formatUid(pw, jobStatus.getSourceUid());
        pw.print(": ");
        pw.print(jobStatus.getSourcePackageName());
        pw.print((jobStatus.satisfiedConstraints
                & JobStatus.CONSTRAINT_DEVICE_NOT_DOZING) != 0
                        ? " RUNNABLE" : " WAITING");
        if (jobStatus.dozeWhitelisted) {
            pw.print(" WHITELISTED");
        }
        if (mAllowInIdleJobs.contains(jobStatus)) {
            pw.print(" ALLOWED_IN_DOZE");
        }
        pw.println();
    });
}
 
Example 9
Source File: ConnectivityController.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@GuardedBy("mLock")
@Override
public void dumpControllerStateLocked(IndentingPrintWriter pw,
        Predicate<JobStatus> predicate) {
    for (int i = 0; i < mTrackedJobs.size(); i++) {
        final JobStatus js = mTrackedJobs.valueAt(i);
        if (predicate.test(js)) {
            pw.print("#");
            js.printUniqueId(pw);
            pw.print(" from ");
            UserHandle.formatUid(pw, js.getSourceUid());
            pw.print(": ");
            pw.print(js.getJob().getRequiredNetwork());
            pw.println();
        }
    }
}
 
Example 10
Source File: MultipathPolicyTracker.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dump(IndentingPrintWriter pw) {
    // Do not use in production. Access to class data is only safe on the handler thrad.
    pw.println("MultipathPolicyTracker:");
    pw.increaseIndent();
    for (MultipathTracker t : mMultipathTrackers.values()) {
        pw.println(String.format("Network %s: quota %d, budget %d. Preference: %s",
                t.network, t.getQuota(), t.getMultipathBudget(),
                DebugUtils.flagsToString(ConnectivityManager.class, "MULTIPATH_PREFERENCE_",
                        t.getMultipathPreference())));
    }
    pw.decreaseIndent();
}
 
Example 11
Source File: PackageInstallerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dump(IndentingPrintWriter pw) {
    synchronized (mSessions) {
        pw.println("Active install sessions:");
        pw.increaseIndent();
        int N = mSessions.size();
        for (int i = 0; i < N; i++) {
            final PackageInstallerSession session = mSessions.valueAt(i);
            session.dump(pw);
            pw.println();
        }
        pw.println();
        pw.decreaseIndent();

        pw.println("Historical install sessions:");
        pw.increaseIndent();
        N = mHistoricalSessions.size();
        for (int i = 0; i < N; i++) {
            pw.print(mHistoricalSessions.get(i));
            pw.println();
        }
        pw.println();
        pw.decreaseIndent();

        pw.println("Legacy install sessions:");
        pw.increaseIndent();
        pw.println(mLegacySessions.toString());
        pw.decreaseIndent();
    }
}
 
Example 12
Source File: NetworkPolicyLogger.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void reverseDump(IndentingPrintWriter pw) {
    final Data[] allData = toArray();
    for (int i = allData.length - 1; i >= 0; --i) {
        if (allData[i] == null) {
            pw.println("NULL");
            continue;
        }
        pw.print(formatDate(allData[i].timeStamp));
        pw.print(" - ");
        pw.println(getContent(allData[i]));
    }
}
 
Example 13
Source File: SyncManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
protected void dump(FileDescriptor fd, PrintWriter pw, boolean dumpAll) {
    final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");

    final SyncAdapterStateFetcher buckets = new SyncAdapterStateFetcher();

    dumpSyncState(ipw, buckets);
    mConstants.dump(pw, "");
    dumpSyncAdapters(ipw);

    if (dumpAll) {
        ipw.println("Detailed Sync History");
        mLogger.dumpAll(pw);
    }
}
 
Example 14
Source File: HdmiCecLocalDevice.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Dump internal status of HdmiCecLocalDevice object.
 */
protected void dump(final IndentingPrintWriter pw) {
    pw.println("mDeviceType: " + mDeviceType);
    pw.println("mAddress: " + mAddress);
    pw.println("mPreferredAddress: " + mPreferredAddress);
    pw.println("mDeviceInfo: " + mDeviceInfo);
    pw.println("mActiveSource: " + mActiveSource);
    pw.println(String.format("mActiveRoutingPath: 0x%04x", mActiveRoutingPath));
}
 
Example 15
Source File: BackgroundJobsController.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void dumpControllerStateLocked(final IndentingPrintWriter pw,
        final Predicate<JobStatus> predicate) {
    mAppStateTracker.dump(pw);
    pw.println();

    mService.getJobStore().forEachJob(predicate, (jobStatus) -> {
        final int uid = jobStatus.getSourceUid();
        final String sourcePkg = jobStatus.getSourcePackageName();
        pw.print("#");
        jobStatus.printUniqueId(pw);
        pw.print(" from ");
        UserHandle.formatUid(pw, uid);
        pw.print(mAppStateTracker.isUidActive(uid) ? " active" : " idle");
        if (mAppStateTracker.isUidPowerSaveWhitelisted(uid) ||
                mAppStateTracker.isUidTempPowerSaveWhitelisted(uid)) {
            pw.print(", whitelisted");
        }
        pw.print(": ");
        pw.print(sourcePkg);

        pw.print(" [RUN_ANY_IN_BACKGROUND ");
        pw.print(mAppStateTracker.isRunAnyInBackgroundAppOpsAllowed(uid, sourcePkg)
                ? "allowed]" : "disallowed]");

        if ((jobStatus.satisfiedConstraints
                & JobStatus.CONSTRAINT_BACKGROUND_NOT_RESTRICTED) != 0) {
            pw.println(" RUNNABLE");
        } else {
            pw.println(" WAITING");
        }
    });
}
 
Example 16
Source File: OverlayManagerSettings.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dump(@NonNull final PrintWriter p) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(p, "  ");
    pw.println("Settings");
    pw.increaseIndent();

    if (mItems.isEmpty()) {
        pw.println("<none>");
        return;
    }

    final int N = mItems.size();
    for (int i = 0; i < N; i++) {
        final SettingsItem item = mItems.get(i);
        pw.println(item.mPackageName + ":" + item.getUserId() + " {");
        pw.increaseIndent();

        pw.print("mPackageName.......: "); pw.println(item.mPackageName);
        pw.print("mUserId............: "); pw.println(item.getUserId());
        pw.print("mTargetPackageName.: "); pw.println(item.getTargetPackageName());
        pw.print("mBaseCodePath......: "); pw.println(item.getBaseCodePath());
        pw.print("mState.............: "); pw.println(OverlayInfo.stateToString(item.getState()));
        pw.print("mIsEnabled.........: "); pw.println(item.isEnabled());
        pw.print("mIsStatic..........: "); pw.println(item.isStatic());
        pw.print("mPriority..........: "); pw.println(item.mPriority);
        pw.print("mCategory..........: "); pw.println(item.mCategory);

        pw.decreaseIndent();
        pw.println("}");
    }
}
 
Example 17
Source File: DeviceStorageMonitorService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void dumpImpl(FileDescriptor fd, PrintWriter _pw, String[] args) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(_pw, "  ");
    if (args == null || args.length == 0 || "-a".equals(args[0])) {
        pw.println("Known volumes:");
        pw.increaseIndent();
        for (int i = 0; i < mStates.size(); i++) {
            final UUID uuid = mStates.keyAt(i);
            final State state = mStates.valueAt(i);
            if (StorageManager.UUID_DEFAULT.equals(uuid)) {
                pw.println("Default:");
            } else {
                pw.println(uuid + ":");
            }
            pw.increaseIndent();
            pw.printPair("level", State.levelToString(state.level));
            pw.printPair("lastUsableBytes", state.lastUsableBytes);
            pw.println();
            pw.decreaseIndent();
        }
        pw.decreaseIndent();
        pw.println();

        pw.printPair("mSeq", mSeq.get());
        pw.printPair("mForceState", State.levelToString(mForceLevel));
        pw.println();
        pw.println();

    } else {
        Shell shell = new Shell();
        shell.exec(mRemoteService, null, fd, null, args, null, new ResultReceiver(null));
    }
}
 
Example 18
Source File: Tethering.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    // Binder.java closes the resource for us.
    @SuppressWarnings("resource")
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("Tethering:");
    pw.increaseIndent();

    pw.println("Configuration:");
    pw.increaseIndent();
    final TetheringConfiguration cfg = mConfig;
    cfg.dump(pw);
    pw.decreaseIndent();

    synchronized (mPublicSync) {
        pw.println("Tether state:");
        pw.increaseIndent();
        for (int i = 0; i < mTetherStates.size(); i++) {
            final String iface = mTetherStates.keyAt(i);
            final TetherState tetherState = mTetherStates.valueAt(i);
            pw.print(iface + " - ");

            switch (tetherState.lastState) {
                case IControlsTethering.STATE_UNAVAILABLE:
                    pw.print("UnavailableState");
                    break;
                case IControlsTethering.STATE_AVAILABLE:
                    pw.print("AvailableState");
                    break;
                case IControlsTethering.STATE_TETHERED:
                    pw.print("TetheredState");
                    break;
                case IControlsTethering.STATE_LOCAL_ONLY:
                    pw.print("LocalHotspotState");
                    break;
                default:
                    pw.print("UnknownState");
                    break;
            }
            pw.println(" - lastError = " + tetherState.lastError);
        }
        pw.println("Upstream wanted: " + upstreamWanted());
        pw.println("Current upstream interface(s): " + mCurrentUpstreamIfaceSet);
        pw.decreaseIndent();
    }

    pw.println("Hardware offload:");
    pw.increaseIndent();
    mOffloadController.dump(pw);
    pw.decreaseIndent();

    pw.println("Log:");
    pw.increaseIndent();
    if (argsContain(args, SHORT_ARG)) {
        pw.println("<log removed for brevity>");
    } else {
        mLog.dump(fd, pw, args);
    }
    pw.decreaseIndent();

    pw.decreaseIndent();
}
 
Example 19
Source File: ResourcesManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * @hide
 */
public void dump(String prefix, PrintWriter printWriter) {
    synchronized (this) {
        IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, "  ");
        for (int i = 0; i < prefix.length() / 2; i++) {
            pw.increaseIndent();
        }

        pw.println("ResourcesManager:");
        pw.increaseIndent();
        if (mLoadedApkAssets != null) {
            pw.print("cached apks: total=");
            pw.print(mLoadedApkAssets.size());
            pw.print(" created=");
            pw.print(mLoadedApkAssets.createCount());
            pw.print(" evicted=");
            pw.print(mLoadedApkAssets.evictionCount());
            pw.print(" hit=");
            pw.print(mLoadedApkAssets.hitCount());
            pw.print(" miss=");
            pw.print(mLoadedApkAssets.missCount());
            pw.print(" max=");
            pw.print(mLoadedApkAssets.maxSize());
        } else {
            pw.print("cached apks: 0 [cache disabled]");
        }
        pw.println();

        pw.print("total apks: ");
        pw.println(countLiveReferences(mCachedApkAssets.values()));

        pw.print("resources: ");

        int references = countLiveReferences(mResourceReferences);
        for (ActivityResources activityResources : mActivityResourceReferences.values()) {
            references += countLiveReferences(activityResources.activityResources);
        }
        pw.println(references);

        pw.print("resource impls: ");
        pw.println(countLiveReferences(mResourceImpls.values()));
    }
}
 
Example 20
Source File: TelephonyRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");

    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    synchronized (mRecords) {
        final int recordCount = mRecords.size();
        pw.println("last known state:");
        pw.increaseIndent();
        for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
            pw.println("Phone Id=" + i);
            pw.increaseIndent();
            pw.println("mCallState=" + mCallState[i]);
            pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]);
            pw.println("mServiceState=" + mServiceState[i]);
            pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
            pw.println("mDataActivationState= " + mDataActivationState[i]);
            pw.println("mUserMobileDataState= " + mUserMobileDataState[i]);
            pw.println("mSignalStrength=" + mSignalStrength[i]);
            pw.println("mMessageWaiting=" + mMessageWaiting[i]);
            pw.println("mCallForwarding=" + mCallForwarding[i]);
            pw.println("mDataActivity=" + mDataActivity[i]);
            pw.println("mDataConnectionState=" + mDataConnectionState[i]);
            pw.println("mCellLocation=" + mCellLocation[i]);
            pw.println("mCellInfo=" + mCellInfo.get(i));
            pw.decreaseIndent();
        }
        pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState);
        pw.println("mPreciseCallState=" + mPreciseCallState);
        pw.println("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState);
        pw.println("mRingingCallState=" + mRingingCallState);
        pw.println("mForegroundCallState=" + mForegroundCallState);
        pw.println("mBackgroundCallState=" + mBackgroundCallState);
        pw.println("mVoLteServiceState=" + mVoLteServiceState);

        pw.decreaseIndent();

        pw.println("local logs:");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
        pw.decreaseIndent();
        pw.println("registrations: count=" + recordCount);
        pw.increaseIndent();
        for (Record r : mRecords) {
            pw.println(r);
        }
        pw.decreaseIndent();
    }
}