com.android.internal.util.DumpUtils Java Examples

The following examples show how to use com.android.internal.util.DumpUtils. 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: StatsCompanionService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, writer)) return;

    synchronized (sStatsdLock) {
        writer.println("Number of configuration files deleted: " + mDeletedFiles.size());
        if (mDeletedFiles.size() > 0) {
            writer.println("  timestamp, deleted file name");
        }
        long lastBootMillis =
                SystemClock.currentThreadTimeMillis() - SystemClock.elapsedRealtime();
        for (Long elapsedMillis : mDeletedFiles.keySet()) {
            long deletionMillis = lastBootMillis + elapsedMillis;
            writer.println("  " + deletionMillis + ", " + mDeletedFiles.get(elapsedMillis));
        }
    }
}
 
Example #2
Source File: CountryDetectorService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, fout)) return;
    if (!DEBUG) return;
    try {
        final Printer p = new PrintWriterPrinter(fout);
        p.println("CountryDetectorService state:");
        p.println("  Number of listeners=" + mReceivers.keySet().size());
        if (mCountryDetector == null) {
            p.println("  ComprehensiveCountryDetector not initialized");
        } else {
            p.println("  " + mCountryDetector.toString());
        }
    } catch (Exception e) {
        Slog.e(TAG, "Failed to dump CountryDetectorService: ", e);
    }
}
 
Example #3
Source File: LockSettingsService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args){
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("Current lock settings service state:");
    pw.println(String.format("SP Enabled = %b",
            mLockPatternUtils.isSyntheticPasswordEnabled()));

    List<UserInfo> users = mUserManager.getUsers();
    for (int user = 0; user < users.size(); user++) {
        final int userId = users.get(user).id;
        pw.println("    User " + userId);
        synchronized (mSpManager) {
            pw.println(String.format("        SP Handle = %x",
                    getSyntheticPasswordHandleLocked(userId)));
        }
        try {
            pw.println(String.format("        SID = %x",
                    getGateKeeperService().getSecureUserId(userId)));
        } catch (RemoteException e) {
            // ignore.
        }
    }
}
 
Example #4
Source File: PowerManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override // Binder call
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    final long ident = Binder.clearCallingIdentity();

    boolean isDumpProto = false;
    for (String arg : args) {
        if (arg.equals("--proto")) {
            isDumpProto = true;
        }
    }
    try {
        if (isDumpProto) {
            dumpProto(fd);
        } else {
            dumpInternal(pw);
        }
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example #5
Source File: CommonTimeManagementService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    if (!mDetectedAtStartup) {
        pw.println("Native Common Time service was not detected at startup.  " +
                   "Service is unavailable");
        return;
    }

    synchronized (mLock) {
        pw.println("Current Common Time Management Service Config:");
        pw.println(String.format("  Native service     : %s",
                                 (null == mCTConfig) ? "reconnecting"
                                                     : "alive"));
        pw.println(String.format("  Bound interface    : %s",
                                 (null == mCurIface ? "unbound" : mCurIface)));
        pw.println(String.format("  Allow WiFi         : %s", ALLOW_WIFI ? "yes" : "no"));
        pw.println(String.format("  Allow Auto Disable : %s", AUTO_DISABLE ? "yes" : "no"));
        pw.println(String.format("  Server Priority    : %d", mEffectivePrio));
        pw.println(String.format("  No iface timeout   : %d", NO_INTERFACE_TIMEOUT));
    }
}
 
Example #6
Source File: VibratorService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("Vibrator Service:");
    synchronized (mLock) {
        pw.print("  mCurrentVibration=");
        if (mCurrentVibration != null) {
            pw.println(mCurrentVibration.toInfo().toString());
        } else {
            pw.println("null");
        }
        pw.println("  mLowPowerMode=" + mLowPowerMode);
        pw.println("  mHapticFeedbackIntensity=" + mHapticFeedbackIntensity);
        pw.println("  mNotificationIntensity=" + mNotificationIntensity);
        pw.println("");
        pw.println("  Previous vibrations:");
        for (VibrationInfo info : mPreviousVibrations) {
            pw.print("    ");
            pw.println(info.toString());
        }
    }
}
 
Example #7
Source File: TrustManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, final PrintWriter fout, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, fout)) return;
    if (isSafeMode()) {
        fout.println("disabled because the system is in safe mode.");
        return;
    }
    if (!mTrustAgentsCanRun) {
        fout.println("disabled because the third-party apps can't run yet.");
        return;
    }
    final List<UserInfo> userInfos = mUserManager.getUsers(true /* excludeDying */);
    mHandler.runWithScissors(new Runnable() {
        @Override
        public void run() {
            fout.println("Trust manager state:");
            for (UserInfo user : userInfos) {
                dumpUser(fout, user, user.id == mCurrentUser);
            }
        }
    }, 1500);
}
 
Example #8
Source File: HardwarePropertiesManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
    pw.println("****** Dump of HardwarePropertiesManagerService ******");

    final String PKG = getCallingPackageName();
    dumpTempValues(PKG, pw, DEVICE_TEMPERATURE_CPU, "CPU ");
    dumpTempValues(PKG, pw, DEVICE_TEMPERATURE_GPU, "GPU ");
    dumpTempValues(PKG, pw, DEVICE_TEMPERATURE_BATTERY, "Battery ");
    dumpTempValues(PKG, pw, DEVICE_TEMPERATURE_SKIN, "Skin ");

    float[] fanSpeeds = getFanSpeeds(PKG);
    pw.println("Fan speed: " + Arrays.toString(fanSpeeds) + "\n");

    CpuUsageInfo[] cpuUsageInfos = getCpuUsages(PKG);
    int core = 0;
    for (int i = 0; i < cpuUsageInfos.length; i++) {
        pw.println("Cpu usage of core: " + i +
                ", active = " + cpuUsageInfos[i].getActive() +
                ", total = " + cpuUsageInfos[i].getTotal());
    }
    pw.println("****** End of HardwarePropertiesManagerService dump ******");
}
 
Example #9
Source File: ProviderMap.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private ArrayList<ContentProviderRecord> getProvidersForName(String name) {
    ArrayList<ContentProviderRecord> allProviders = new ArrayList<ContentProviderRecord>();
    final ArrayList<ContentProviderRecord> ret = new ArrayList<>();

    final Predicate<ContentProviderRecord> filter = DumpUtils.filterRecord(name);

    synchronized (mAm) {
        allProviders.addAll(mSingletonByClass.values());
        for (int i=0; i<mProvidersByClassPerUser.size(); i++) {
            allProviders.addAll(mProvidersByClassPerUser.valueAt(i).values());
        }

        CollectionUtils.addIf(allProviders, ret, filter);
    }
    // Sort by component name.
    ret.sort(Comparator.comparing(WithComponentName::getComponentName));
    return ret;
}
 
Example #10
Source File: MediaSessionService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) return;

    pw.println("MEDIA SESSION SERVICE (dumpsys media_session)");
    pw.println();

    synchronized (mLock) {
        pw.println(mSessionsListeners.size() + " sessions listeners.");
        pw.println("Global priority session is " + mGlobalPrioritySession);
        if (mGlobalPrioritySession != null) {
            mGlobalPrioritySession.dump(pw, "  ");
        }
        pw.println("User Records:");
        int count = mUserRecords.size();
        for (int i = 0; i < count; i++) {
            mUserRecords.valueAt(i).dumpLocked(pw, "");
        }
        mAudioPlayerStateMonitor.dump(getContext(), pw, "");
    }
}
 
Example #11
Source File: MediaRouterService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("MEDIA ROUTER SERVICE (dumpsys media_router)");
    pw.println();
    pw.println("Global state");
    pw.println("  mCurrentUserId=" + mCurrentUserId);

    synchronized (mLock) {
        final int count = mUserRecords.size();
        for (int i = 0; i < count; i++) {
            UserRecord userRecord = mUserRecords.valueAt(i);
            pw.println();
            userRecord.dump(pw, "");
        }
    }
}
 
Example #12
Source File: WifiDisplayAdapter.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public void dumpLocked(PrintWriter pw) {
    super.dumpLocked(pw);

    pw.println("mCurrentStatus=" + getWifiDisplayStatusLocked());
    pw.println("mFeatureState=" + mFeatureState);
    pw.println("mScanState=" + mScanState);
    pw.println("mActiveDisplayState=" + mActiveDisplayState);
    pw.println("mActiveDisplay=" + mActiveDisplay);
    pw.println("mDisplays=" + Arrays.toString(mDisplays));
    pw.println("mAvailableDisplays=" + Arrays.toString(mAvailableDisplays));
    pw.println("mRememberedDisplays=" + Arrays.toString(mRememberedDisplays));
    pw.println("mPendingStatusChangeBroadcast=" + mPendingStatusChangeBroadcast);
    pw.println("mSupportsProtectedBuffers=" + mSupportsProtectedBuffers);

    // Try to dump the controller state.
    if (mDisplayController == null) {
        pw.println("mDisplayController=null");
    } else {
        pw.println("mDisplayController:");
        final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
        ipw.increaseIndent();
        DumpUtils.dumpAsync(getHandler(), mDisplayController, ipw, "", 200);
    }
}
 
Example #13
Source File: ContextHubService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("Dumping ContextHub Service");

    pw.println("");
    // dump ContextHubInfo
    pw.println("=================== CONTEXT HUBS ====================");
    for (ContextHubInfo hubInfo : mContextHubIdToInfoMap.values()) {
        pw.println(hubInfo);
    }
    pw.println("");
    pw.println("=================== NANOAPPS ====================");
    // Dump nanoAppHash
    for (NanoAppInstanceInfo info : mNanoAppStateManager.getNanoAppInstanceInfoCollection()) {
        pw.println(info);
    }

    // dump eventLog
}
 
Example #14
Source File: MediaProjectionManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder call
public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
    final long token = Binder.clearCallingIdentity();
    try {
        MediaProjectionManagerService.this.dump(pw);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
 
Example #15
Source File: RMPowerActionService.java    From rebootmenu with GNU General Public License v3.0 5 votes vote down vote up
private boolean enforceDumpPermission(PrintWriter pw) {
    if (Build.VERSION.SDK_INT >= O) return DumpUtils.checkDumpPermission(mContext, TAG, pw);
    else {
        try {
            mContext.enforceCallingOrSelfPermission(Manifest.permission.DUMP, "enforceDumpPermission");
            return true;
        } catch (SecurityException e) {
            pw.println(StringUtils.printStackTraceToString(e));
            Log.e(TAG, "enforceDumpPermission: ", e);
        }
    }
    return false;
}
 
Example #16
Source File: HdmiControlService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, final PrintWriter writer, String[] args) {
    if (!DumpUtils.checkDumpPermission(getContext(), TAG, writer)) return;
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");

    pw.println("mHdmiControlEnabled: " + mHdmiControlEnabled);
    pw.println("mProhibitMode: " + mProhibitMode);
    if (mCecController != null) {
        pw.println("mCecController: ");
        pw.increaseIndent();
        mCecController.dump(pw);
        pw.decreaseIndent();
    }

    pw.println("mMhlController: ");
    pw.increaseIndent();
    mMhlController.dump(pw);
    pw.decreaseIndent();

    pw.println("mPortInfo: ");
    pw.increaseIndent();
    for (HdmiPortInfo hdmiPortInfo : mPortInfo) {
        pw.println("- " + hdmiPortInfo);
    }
    pw.decreaseIndent();
    pw.println("mPowerStatus: " + mPowerStatus);
}
 
Example #17
Source File: InputManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    pw.println("INPUT MANAGER (dumpsys input)\n");
    String dumpStr = nativeDump(mPtr);
    if (dumpStr != null) {
        pw.println(dumpStr);
    }
}
 
Example #18
Source File: DreamManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder call
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
    final long ident = Binder.clearCallingIdentity();
    try {
        dumpInternal(pw);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example #19
Source File: BatteryService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    if (args.length > 0 && "--proto".equals(args[0])) {
        dumpProto(fd);
    } else {
        dumpInternal(fd, pw, args);
    }
}
 
Example #20
Source File: NetworkTimeUpdateService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
    pw.print("PollingIntervalMs: ");
    TimeUtils.formatDuration(mPollingIntervalMs, pw);
    pw.print("\nPollingIntervalShorterMs: ");
    TimeUtils.formatDuration(mPollingIntervalShorterMs, pw);
    pw.println("\nTryAgainTimesMax: " + mTryAgainTimesMax);
    pw.print("TimeErrorThresholdMs: ");
    TimeUtils.formatDuration(mTimeErrorThresholdMs, pw);
    pw.println("\nTryAgainCounter: " + mTryAgainCounter);
    pw.println("NTP cache age: " + mTime.getCacheAge());
    pw.println("NTP cache certainty: " + mTime.getCacheCertainty());
    pw.println();
}
 
Example #21
Source File: SearchManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
    synchronized (mSearchables) {
        for (int i = 0; i < mSearchables.size(); i++) {
            ipw.print("\nUser: "); ipw.println(mSearchables.keyAt(i));
            ipw.increaseIndent();
            mSearchables.valueAt(i).dump(fd, ipw, args);
            ipw.decreaseIndent();
        }
    }
}
 
Example #22
Source File: NsdService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    for (ClientInfo client : mClients.values()) {
        pw.println("Client Info");
        pw.println(client);
    }

    mNsdStateMachine.dump(fd, pw, args);
}
 
Example #23
Source File: StatusBarManagerService.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, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    synchronized (mLock) {
        pw.println("  mDisabled1=0x" + Integer.toHexString(mDisabled1));
        pw.println("  mDisabled2=0x" + Integer.toHexString(mDisabled2));
        final int N = mDisableRecords.size();
        pw.println("  mDisableRecords.size=" + N);
        for (int i=0; i<N; i++) {
            DisableRecord tok = mDisableRecords.get(i);
            pw.println("    [" + i + "] " + tok);
        }
        pw.println("  mCurrentUserId=" + mCurrentUserId);
        pw.println("  mIcons=");
        for (String slot : mIcons.keySet()) {
            pw.println("    ");
            pw.print(slot);
            pw.print(" -> ");
            final StatusBarIcon icon = mIcons.get(slot);
            pw.print(icon);
            if (!TextUtils.isEmpty(icon.contentDescription)) {
                pw.print(" \"");
                pw.print(icon.contentDescription);
                pw.print("\"");
            }
            pw.println();
        }
    }
}
 
Example #24
Source File: NetworkScoreService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void dump(final FileDescriptor fd, final PrintWriter writer, final String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, writer)) return;
    final long token = Binder.clearCallingIdentity();
    try {
        NetworkScorerAppData currentScorer = mNetworkScorerAppManager.getActiveScorer();
        if (currentScorer == null) {
            writer.println("Scoring is disabled.");
            return;
        }
        writer.println("Current scorer: " + currentScorer);

        sendCacheUpdateCallback(new BiConsumer<INetworkScoreCache, Object>() {
            @Override
            public void accept(INetworkScoreCache networkScoreCache, Object cookie) {
                try {
                    TransferPipe.dumpAsync(networkScoreCache.asBinder(), fd, args);
                } catch (IOException | RemoteException e) {
                    writer.println("Failed to dump score cache: " + e);
                }
            }
        }, getScoreCacheLists());

        synchronized (mServiceConnectionLock) {
            if (mServiceConnection != null) {
                mServiceConnection.dump(fd, writer, args);
            } else {
                writer.println("ScoringServiceConnection: null");
            }
        }
        writer.flush();
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
 
Example #25
Source File: FingerprintService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder call
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    final long ident = Binder.clearCallingIdentity();
    try {
        if (args.length > 0 && "--proto".equals(args[0])) {
            dumpProto(fd);
        } else {
            dumpInternal(pw);
        }
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example #26
Source File: DockObserver.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) return;
    final long ident = Binder.clearCallingIdentity();
    try {
        synchronized (mLock) {
            if (args == null || args.length == 0 || "-a".equals(args[0])) {
                pw.println("Current Dock Observer Service state:");
                if (mUpdatesStopped) {
                    pw.println("  (UPDATES STOPPED -- use 'reset' to restart)");
                }
                pw.println("  reported state: " + mReportedDockState);
                pw.println("  previous state: " + mPreviousDockState);
                pw.println("  actual state: " + mActualDockState);
            } else if (args.length == 3 && "set".equals(args[0])) {
                String key = args[1];
                String value = args[2];
                try {
                    if ("state".equals(key)) {
                        mUpdatesStopped = true;
                        setDockStateLocked(Integer.parseInt(value));
                    } else {
                        pw.println("Unknown set option: " + key);
                    }
                } catch (NumberFormatException ex) {
                    pw.println("Bad value: " + value);
                }
            } else if (args.length == 1 && "reset".equals(args[0])) {
                mUpdatesStopped = false;
                setDockStateLocked(mActualDockState);
            } else {
                pw.println("Dump current dock state, or:");
                pw.println("  set state <value>");
                pw.println("  reset");
            }
        }
    } finally {
        Binder.restoreCallingIdentity(ident);
    }
}
 
Example #27
Source File: DisplayManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override // Binder call
public void dump(FileDescriptor fd, final PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;

    final long token = Binder.clearCallingIdentity();
    try {
        dumpInternal(pw);
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
 
Example #28
Source File: OverlayDisplayAdapter.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void dumpLocked(PrintWriter pw) {
    pw.println("  " + mName + ":");
    pw.println("    mModes=" + Arrays.toString(mModes.toArray()));
    pw.println("    mActiveMode=" + mActiveMode);
    pw.println("    mGravity=" + mGravity);
    pw.println("    mSecure=" + mSecure);
    pw.println("    mNumber=" + mNumber);

    // Try to dump the window state.
    if (mWindow != null) {
        final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
        ipw.increaseIndent();
        DumpUtils.dumpAsync(mUiHandler, mWindow, ipw, "", 200);
    }
}
 
Example #29
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();
    }
}
 
Example #30
Source File: DeviceStorageMonitorService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) return;
    dumpImpl(fd, pw, args);
}