Search in sources :

Example 31 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class BroadcastRecord method dump.

void dump(PrintWriter pw, String prefix, SimpleDateFormat sdf) {
    final long now = SystemClock.uptimeMillis();
    pw.print(prefix);
    pw.print(this);
    pw.print(" to user ");
    pw.println(userId);
    pw.print(prefix);
    pw.println(intent.toInsecureString());
    if (targetComp != null && targetComp != intent.getComponent()) {
        pw.print(prefix);
        pw.print("  targetComp: ");
        pw.println(targetComp.toShortString());
    }
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        pw.print(prefix);
        pw.print("  extras: ");
        pw.println(bundle.toString());
    }
    pw.print(prefix);
    pw.print("caller=");
    pw.print(callerPackage);
    pw.print(" ");
    pw.print(callerApp != null ? callerApp.toShortString() : "null");
    pw.print(" pid=");
    pw.print(callingPid);
    pw.print(" uid=");
    pw.println(callingUid);
    if ((requiredPermissions != null && requiredPermissions.length > 0) || appOp != AppOpsManager.OP_NONE) {
        pw.print(prefix);
        pw.print("requiredPermissions=");
        pw.print(Arrays.toString(requiredPermissions));
        pw.print("  appOp=");
        pw.println(appOp);
    }
    if (options != null) {
        pw.print(prefix);
        pw.print("options=");
        pw.println(options.toBundle());
    }
    pw.print(prefix);
    pw.print("enqueueClockTime=");
    pw.print(sdf.format(new Date(enqueueClockTime)));
    pw.print(" dispatchClockTime=");
    pw.println(sdf.format(new Date(dispatchClockTime)));
    pw.print(prefix);
    pw.print("dispatchTime=");
    TimeUtils.formatDuration(dispatchTime, now, pw);
    pw.print(" (");
    TimeUtils.formatDuration(dispatchClockTime - enqueueClockTime, pw);
    pw.print(" since enq)");
    if (finishTime != 0) {
        pw.print(" finishTime=");
        TimeUtils.formatDuration(finishTime, now, pw);
        pw.print(" (");
        TimeUtils.formatDuration(finishTime - dispatchTime, pw);
        pw.print(" since disp)");
    } else {
        pw.print(" receiverTime=");
        TimeUtils.formatDuration(receiverTime, now, pw);
    }
    pw.println("");
    if (anrCount != 0) {
        pw.print(prefix);
        pw.print("anrCount=");
        pw.println(anrCount);
    }
    if (resultTo != null || resultCode != -1 || resultData != null) {
        pw.print(prefix);
        pw.print("resultTo=");
        pw.print(resultTo);
        pw.print(" resultCode=");
        pw.print(resultCode);
        pw.print(" resultData=");
        pw.println(resultData);
    }
    if (resultExtras != null) {
        pw.print(prefix);
        pw.print("resultExtras=");
        pw.println(resultExtras);
    }
    if (resultAbort || ordered || sticky || initialSticky) {
        pw.print(prefix);
        pw.print("resultAbort=");
        pw.print(resultAbort);
        pw.print(" ordered=");
        pw.print(ordered);
        pw.print(" sticky=");
        pw.print(sticky);
        pw.print(" initialSticky=");
        pw.println(initialSticky);
    }
    if (nextReceiver != 0 || receiver != null) {
        pw.print(prefix);
        pw.print("nextReceiver=");
        pw.print(nextReceiver);
        pw.print(" receiver=");
        pw.println(receiver);
    }
    if (curFilter != null) {
        pw.print(prefix);
        pw.print("curFilter=");
        pw.println(curFilter);
    }
    if (curReceiver != null) {
        pw.print(prefix);
        pw.print("curReceiver=");
        pw.println(curReceiver);
    }
    if (curApp != null) {
        pw.print(prefix);
        pw.print("curApp=");
        pw.println(curApp);
        pw.print(prefix);
        pw.print("curComponent=");
        pw.println((curComponent != null ? curComponent.toShortString() : "--"));
        if (curReceiver != null && curReceiver.applicationInfo != null) {
            pw.print(prefix);
            pw.print("curSourceDir=");
            pw.println(curReceiver.applicationInfo.sourceDir);
        }
    }
    if (state != IDLE) {
        String stateStr = " (?)";
        switch(state) {
            case APP_RECEIVE:
                stateStr = " (APP_RECEIVE)";
                break;
            case CALL_IN_RECEIVE:
                stateStr = " (CALL_IN_RECEIVE)";
                break;
            case CALL_DONE_RECEIVE:
                stateStr = " (CALL_DONE_RECEIVE)";
                break;
            case WAITING_SERVICES:
                stateStr = " (WAITING_SERVICES)";
                break;
        }
        pw.print(prefix);
        pw.print("state=");
        pw.print(state);
        pw.println(stateStr);
    }
    final int N = receivers != null ? receivers.size() : 0;
    String p2 = prefix + "  ";
    PrintWriterPrinter printer = new PrintWriterPrinter(pw);
    for (int i = 0; i < N; i++) {
        Object o = receivers.get(i);
        pw.print(prefix);
        switch(delivery[i]) {
            case DELIVERY_PENDING:
                pw.print("Pending");
                break;
            case DELIVERY_DELIVERED:
                pw.print("Deliver");
                break;
            case DELIVERY_SKIPPED:
                pw.print("Skipped");
                break;
            case DELIVERY_TIMEOUT:
                pw.print("Timeout");
                break;
            default:
                pw.print("???????");
                break;
        }
        pw.print(" #");
        pw.print(i);
        pw.print(": ");
        if (o instanceof BroadcastFilter) {
            pw.println(o);
            ((BroadcastFilter) o).dumpBrief(pw, p2);
        } else if (o instanceof ResolveInfo) {
            pw.println("(manifest)");
            ((ResolveInfo) o).dump(printer, p2, 0);
        } else {
            pw.println(o);
        }
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) ResolveInfo(android.content.pm.ResolveInfo) Bundle(android.os.Bundle) Date(java.util.Date)

Example 32 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class ReceiverList method dump.

void dump(PrintWriter pw, String prefix) {
    Printer pr = new PrintWriterPrinter(pw);
    dumpLocal(pw, prefix);
    String p2 = prefix + "  ";
    final int N = size();
    for (int i = 0; i < N; i++) {
        BroadcastFilter bf = get(i);
        pw.print(prefix);
        pw.print("Filter #");
        pw.print(i);
        pw.print(": BroadcastFilter{");
        pw.print(Integer.toHexString(System.identityHashCode(bf)));
        pw.println('}');
        bf.dumpInReceiverList(pw, pr, p2);
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 33 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class MockProvider method dump.

public void dump(PrintWriter pw, String prefix) {
    pw.println(prefix + mName);
    pw.println(prefix + "mHasLocation=" + mHasLocation);
    pw.println(prefix + "mLocation:");
    mLocation.dump(new PrintWriterPrinter(pw), prefix + "  ");
    pw.println(prefix + "mHasStatus=" + mHasStatus);
    pw.println(prefix + "mStatus=" + mStatus);
    pw.println(prefix + "mStatusUpdateTime=" + mStatusUpdateTime);
    pw.println(prefix + "mExtras=" + mExtras);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter)

Example 34 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by DirtyUnicorns.

the class PowerManagerService method dumpInternal.

private void dumpInternal(PrintWriter pw) {
    pw.println("POWER MANAGER (dumpsys power)\n");
    final WirelessChargerDetector wcd;
    synchronized (mLock) {
        pw.println("Power Manager State:");
        pw.println("  mDirty=0x" + Integer.toHexString(mDirty));
        pw.println("  mWakefulness=" + PowerManagerInternal.wakefulnessToString(mWakefulness));
        pw.println("  mWakefulnessChanging=" + mWakefulnessChanging);
        pw.println("  mIsPowered=" + mIsPowered);
        pw.println("  mPlugType=" + mPlugType);
        pw.println("  mBatteryLevel=" + mBatteryLevel);
        pw.println("  mBatteryLevelWhenDreamStarted=" + mBatteryLevelWhenDreamStarted);
        pw.println("  mDockState=" + mDockState);
        pw.println("  mStayOn=" + mStayOn);
        pw.println("  mProximityPositive=" + mProximityPositive);
        pw.println("  mBootCompleted=" + mBootCompleted);
        pw.println("  mSystemReady=" + mSystemReady);
        pw.println("  mHalAutoSuspendModeEnabled=" + mHalAutoSuspendModeEnabled);
        pw.println("  mHalInteractiveModeEnabled=" + mHalInteractiveModeEnabled);
        pw.println("  mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary));
        pw.print("  mNotifyLongScheduled=");
        if (mNotifyLongScheduled == 0) {
            pw.print("(none)");
        } else {
            TimeUtils.formatDuration(mNotifyLongScheduled, SystemClock.uptimeMillis(), pw);
        }
        pw.println();
        pw.print("  mNotifyLongDispatched=");
        if (mNotifyLongDispatched == 0) {
            pw.print("(none)");
        } else {
            TimeUtils.formatDuration(mNotifyLongDispatched, SystemClock.uptimeMillis(), pw);
        }
        pw.println();
        pw.print("  mNotifyLongNextCheck=");
        if (mNotifyLongNextCheck == 0) {
            pw.print("(none)");
        } else {
            TimeUtils.formatDuration(mNotifyLongNextCheck, SystemClock.uptimeMillis(), pw);
        }
        pw.println();
        pw.println("  mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary));
        pw.println("  mRequestWaitForNegativeProximity=" + mRequestWaitForNegativeProximity);
        pw.println("  mSandmanScheduled=" + mSandmanScheduled);
        pw.println("  mSandmanSummoned=" + mSandmanSummoned);
        pw.println("  mLowPowerModeEnabled=" + mLowPowerModeEnabled);
        pw.println("  mBatteryLevelLow=" + mBatteryLevelLow);
        pw.println("  mLightDeviceIdleMode=" + mLightDeviceIdleMode);
        pw.println("  mDeviceIdleMode=" + mDeviceIdleMode);
        pw.println("  mDeviceIdleWhitelist=" + Arrays.toString(mDeviceIdleWhitelist));
        pw.println("  mDeviceIdleTempWhitelist=" + Arrays.toString(mDeviceIdleTempWhitelist));
        pw.println("  mLastWakeTime=" + TimeUtils.formatUptime(mLastWakeTime));
        pw.println("  mLastSleepTime=" + TimeUtils.formatUptime(mLastSleepTime));
        pw.println("  mLastUserActivityTime=" + TimeUtils.formatUptime(mLastUserActivityTime));
        pw.println("  mLastUserActivityTimeNoChangeLights=" + TimeUtils.formatUptime(mLastUserActivityTimeNoChangeLights));
        pw.println("  mLastInteractivePowerHintTime=" + TimeUtils.formatUptime(mLastInteractivePowerHintTime));
        pw.println("  mLastScreenBrightnessBoostTime=" + TimeUtils.formatUptime(mLastScreenBrightnessBoostTime));
        pw.println("  mScreenBrightnessBoostInProgress=" + mScreenBrightnessBoostInProgress);
        pw.println("  mDisplayReady=" + mDisplayReady);
        pw.println("  mHoldingWakeLockSuspendBlocker=" + mHoldingWakeLockSuspendBlocker);
        pw.println("  mHoldingDisplaySuspendBlocker=" + mHoldingDisplaySuspendBlocker);
        pw.println();
        pw.println("Settings and Configuration:");
        pw.println("  mDecoupleHalAutoSuspendModeFromDisplayConfig=" + mDecoupleHalAutoSuspendModeFromDisplayConfig);
        pw.println("  mDecoupleHalInteractiveModeFromDisplayConfig=" + mDecoupleHalInteractiveModeFromDisplayConfig);
        pw.println("  mWakeUpWhenPluggedOrUnpluggedConfig=" + mWakeUpWhenPluggedOrUnpluggedConfig);
        pw.println("  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=" + mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig);
        pw.println("  mTheaterModeEnabled=" + mTheaterModeEnabled);
        pw.println("  mSuspendWhenScreenOffDueToProximityConfig=" + mSuspendWhenScreenOffDueToProximityConfig);
        pw.println("  mDreamsSupportedConfig=" + mDreamsSupportedConfig);
        pw.println("  mDreamsEnabledByDefaultConfig=" + mDreamsEnabledByDefaultConfig);
        pw.println("  mDreamsActivatedOnSleepByDefaultConfig=" + mDreamsActivatedOnSleepByDefaultConfig);
        pw.println("  mDreamsActivatedOnDockByDefaultConfig=" + mDreamsActivatedOnDockByDefaultConfig);
        pw.println("  mDreamsEnabledOnBatteryConfig=" + mDreamsEnabledOnBatteryConfig);
        pw.println("  mDreamsBatteryLevelMinimumWhenPoweredConfig=" + mDreamsBatteryLevelMinimumWhenPoweredConfig);
        pw.println("  mDreamsBatteryLevelMinimumWhenNotPoweredConfig=" + mDreamsBatteryLevelMinimumWhenNotPoweredConfig);
        pw.println("  mDreamsBatteryLevelDrainCutoffConfig=" + mDreamsBatteryLevelDrainCutoffConfig);
        pw.println("  mDreamsEnabledSetting=" + mDreamsEnabledSetting);
        pw.println("  mDreamsActivateOnSleepSetting=" + mDreamsActivateOnSleepSetting);
        pw.println("  mDreamsActivateOnDockSetting=" + mDreamsActivateOnDockSetting);
        pw.println("  mDozeAfterScreenOffConfig=" + mDozeAfterScreenOffConfig);
        pw.println("  mLowPowerModeSetting=" + mLowPowerModeSetting);
        pw.println("  mAutoLowPowerModeConfigured=" + mAutoLowPowerModeConfigured);
        pw.println("  mAutoLowPowerModeSnoozing=" + mAutoLowPowerModeSnoozing);
        pw.println("  mMinimumScreenOffTimeoutConfig=" + mMinimumScreenOffTimeoutConfig);
        pw.println("  mMaximumScreenDimDurationConfig=" + mMaximumScreenDimDurationConfig);
        pw.println("  mMaximumScreenDimRatioConfig=" + mMaximumScreenDimRatioConfig);
        pw.println("  mScreenOffTimeoutSetting=" + mScreenOffTimeoutSetting);
        pw.println("  mSleepTimeoutSetting=" + mSleepTimeoutSetting);
        pw.println("  mMaximumScreenOffTimeoutFromDeviceAdmin=" + mMaximumScreenOffTimeoutFromDeviceAdmin + " (enforced=" + isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked() + ")");
        pw.println("  mStayOnWhilePluggedInSetting=" + mStayOnWhilePluggedInSetting);
        pw.println("  mScreenBrightnessSetting=" + mScreenBrightnessSetting);
        pw.println("  mScreenAutoBrightnessAdjustmentSetting=" + mScreenAutoBrightnessAdjustmentSetting);
        pw.println("  mScreenBrightnessModeSetting=" + mScreenBrightnessModeSetting);
        pw.println("  mScreenBrightnessOverrideFromWindowManager=" + mScreenBrightnessOverrideFromWindowManager);
        pw.println("  mUserActivityTimeoutOverrideFromWindowManager=" + mUserActivityTimeoutOverrideFromWindowManager);
        pw.println("  mUserInactiveOverrideFromWindowManager=" + mUserInactiveOverrideFromWindowManager);
        pw.println("  mTemporaryScreenBrightnessSettingOverride=" + mTemporaryScreenBrightnessSettingOverride);
        pw.println("  mTemporaryScreenAutoBrightnessAdjustmentSettingOverride=" + mTemporaryScreenAutoBrightnessAdjustmentSettingOverride);
        pw.println("  mDozeScreenStateOverrideFromDreamManager=" + mDozeScreenStateOverrideFromDreamManager);
        pw.println("  mDozeScreenBrightnessOverrideFromDreamManager=" + mDozeScreenBrightnessOverrideFromDreamManager);
        pw.println("  mScreenBrightnessSettingMinimum=" + mScreenBrightnessSettingMinimum);
        pw.println("  mScreenBrightnessSettingMaximum=" + mScreenBrightnessSettingMaximum);
        pw.println("  mScreenBrightnessSettingDefault=" + mScreenBrightnessSettingDefault);
        pw.println("  mScreenBrightnessForVrSettingDefault=" + mScreenBrightnessForVrSettingDefault);
        pw.println("  mScreenBrightnessForVrSetting=" + mScreenBrightnessForVrSetting);
        pw.println("  mDoubleTapWakeEnabled=" + mDoubleTapWakeEnabled);
        pw.println("  mIsVrModeEnabled=" + mIsVrModeEnabled);
        final int sleepTimeout = getSleepTimeoutLocked();
        final int screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);
        final int screenDimDuration = getScreenDimDurationLocked(screenOffTimeout);
        pw.println();
        pw.println("Sleep timeout: " + sleepTimeout + " ms");
        pw.println("Screen off timeout: " + screenOffTimeout + " ms");
        pw.println("Screen dim duration: " + screenDimDuration + " ms");
        pw.println();
        pw.println("UID states:");
        for (int i = 0; i < mUidState.size(); i++) {
            pw.print("  UID ");
            UserHandle.formatUid(pw, mUidState.keyAt(i));
            pw.print(": ");
            pw.println(mUidState.valueAt(i));
        }
        pw.println();
        pw.println("Looper state:");
        mHandler.getLooper().dump(new PrintWriterPrinter(pw), "  ");
        pw.println();
        pw.println("Wake Locks: size=" + mWakeLocks.size());
        for (WakeLock wl : mWakeLocks) {
            pw.println("  " + wl);
        }
        pw.println();
        pw.println("Suspend Blockers: size=" + mSuspendBlockers.size());
        for (SuspendBlocker sb : mSuspendBlockers) {
            pw.println("  " + sb);
        }
        pw.println();
        pw.println("Display Power: " + mDisplayPowerCallbacks);
        wcd = mWirelessChargerDetector;
    }
    if (wcd != null) {
        wcd.dump(pw);
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter)

Example 35 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project android_frameworks_base by AOSPA.

the class InputMethodManagerService method dump.

@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 InputMethodManager from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    IInputMethod method;
    ClientState client;
    ClientState focusedWindowClient;
    final Printer p = new PrintWriterPrinter(pw);
    synchronized (mMethodMap) {
        p.println("Current Input Method Manager state:");
        int N = mMethodList.size();
        p.println("  Input Methods:");
        for (int i = 0; i < N; i++) {
            InputMethodInfo info = mMethodList.get(i);
            p.println("  InputMethod #" + i + ":");
            info.dump(p, "    ");
        }
        p.println("  Clients:");
        for (ClientState ci : mClients.values()) {
            p.println("  Client " + ci + ":");
            p.println("    client=" + ci.client);
            p.println("    inputContext=" + ci.inputContext);
            p.println("    sessionRequested=" + ci.sessionRequested);
            p.println("    curSession=" + ci.curSession);
        }
        p.println("  mCurMethodId=" + mCurMethodId);
        client = mCurClient;
        p.println("  mCurClient=" + client + " mCurSeq=" + mCurSeq);
        p.println("  mCurFocusedWindow=" + mCurFocusedWindow);
        focusedWindowClient = mCurFocusedWindowClient;
        p.println("  mCurFocusedWindowClient=" + focusedWindowClient);
        p.println("  mCurId=" + mCurId + " mHaveConnect=" + mHaveConnection + " mBoundToMethod=" + mBoundToMethod);
        p.println("  mCurToken=" + mCurToken);
        p.println("  mCurIntent=" + mCurIntent);
        method = mCurMethod;
        p.println("  mCurMethod=" + mCurMethod);
        p.println("  mEnabledSession=" + mEnabledSession);
        p.println("  mImeWindowVis=" + imeWindowStatusToString(mImeWindowVis));
        p.println("  mShowRequested=" + mShowRequested + " mShowExplicitlyRequested=" + mShowExplicitlyRequested + " mShowForced=" + mShowForced + " mInputShown=" + mInputShown);
        p.println("  mCurUserActionNotificationSequenceNumber=" + mCurUserActionNotificationSequenceNumber);
        p.println("  mSystemReady=" + mSystemReady + " mInteractive=" + mIsInteractive);
        p.println("  mSettingsObserver=" + mSettingsObserver);
        p.println("  mSwitchingController:");
        mSwitchingController.dump(p);
        p.println("  mSettings:");
        mSettings.dumpLocked(p, "    ");
    }
    p.println(" ");
    if (client != null) {
        pw.flush();
        try {
            client.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client dead: " + e);
        }
    } else {
        p.println("No input method client.");
    }
    if (focusedWindowClient != null && client != focusedWindowClient) {
        p.println(" ");
        p.println("Warning: Current input method client doesn't match the last focused. " + "window.");
        p.println("Dumping input method client in the last focused window just in case.");
        p.println(" ");
        pw.flush();
        try {
            focusedWindowClient.client.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method client in focused window dead: " + e);
        }
    }
    p.println(" ");
    if (method != null) {
        pw.flush();
        try {
            method.asBinder().dump(fd, args);
        } catch (RemoteException e) {
            p.println("Input method service dead: " + e);
        }
    } else {
        p.println("No input method service.");
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) IInputMethod(com.android.internal.view.IInputMethod) Printer(android.util.Printer) PrintWriterPrinter(android.util.PrintWriterPrinter) RemoteException(android.os.RemoteException) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Aggregations

PrintWriterPrinter (android.util.PrintWriterPrinter)109 Printer (android.util.Printer)47 RemoteException (android.os.RemoteException)28 ResolveInfo (android.content.pm.ResolveInfo)22 Intent (android.content.Intent)20 PrintWriter (java.io.PrintWriter)16 URISyntaxException (java.net.URISyntaxException)16 Bundle (android.os.Bundle)10 ArrayMap (android.util.ArrayMap)7 LogPrinter (android.util.LogPrinter)7 HashMap (java.util.HashMap)7 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 IInputMethod (com.android.internal.view.IInputMethod)6 Date (java.util.Date)6 Map (java.util.Map)6 MutableInt (android.util.MutableInt)5 ArrayList (java.util.ArrayList)5 PendingIntent (android.app.PendingIntent)4 Iterator (java.util.Iterator)4 Point (android.graphics.Point)2