Search in sources :

Example 56 with PrintWriterPrinter

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

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 57 with PrintWriterPrinter

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

the class PackageManagerShellCommand method runResolveActivity.

private int runResolveActivity() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        ResolveInfo ri = mInterface.resolveIntent(intent, null, 0, mTargetUser);
        PrintWriter pw = getOutPrintWriter();
        if (ri == null) {
            pw.println("No activity found");
        } else {
            PrintWriterPrinter pr = new PrintWriterPrinter(pw);
            printResolveInfo(pr, "", ri, mBrief, mComponents);
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 58 with PrintWriterPrinter

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

the class PackageManagerShellCommand method runQueryIntentReceivers.

private int runQueryIntentReceivers() {
    Intent intent;
    try {
        intent = parseIntentAndUser();
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    try {
        List<ResolveInfo> result = mInterface.queryIntentReceivers(intent, null, 0, mTargetUser).getList();
        PrintWriter pw = getOutPrintWriter();
        if (result == null || result.size() <= 0) {
            pw.println("No receivers found");
        } else {
            if (!mComponents) {
                pw.print(result.size());
                pw.println(" receivers found:");
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    pw.print("  Receiver #");
                    pw.print(i);
                    pw.println(":");
                    printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
                }
            } else {
                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
                for (int i = 0; i < result.size(); i++) {
                    printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
                }
            }
        }
    } catch (RemoteException e) {
        throw new RuntimeException("Failed calling service", e);
    }
    return 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PrintWriterPrinter(android.util.PrintWriterPrinter) Intent(android.content.Intent) URISyntaxException(java.net.URISyntaxException) RemoteException(android.os.RemoteException) PrintWriter(java.io.PrintWriter)

Example 59 with PrintWriterPrinter

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

the class IntentResolver method dumpMap.

boolean dumpMap(PrintWriter out, String titlePrefix, String title, String prefix, ArrayMap<String, F[]> map, String packageName, boolean printFilter, boolean collapseDuplicates) {
    final String eprefix = prefix + "  ";
    final String fprefix = prefix + "    ";
    final ArrayMap<Object, MutableInt> found = new ArrayMap<>();
    boolean printedSomething = false;
    Printer printer = null;
    for (int mapi = 0; mapi < map.size(); mapi++) {
        F[] a = map.valueAt(mapi);
        final int N = a.length;
        boolean printedHeader = false;
        F filter;
        if (collapseDuplicates && !printFilter) {
            found.clear();
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                Object label = filterToLabel(filter);
                int index = found.indexOfKey(label);
                if (index < 0) {
                    found.put(label, new MutableInt(1));
                } else {
                    found.valueAt(index).value++;
                }
            }
            for (int i = 0; i < found.size(); i++) {
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilterLabel(out, fprefix, found.keyAt(i), found.valueAt(i).value);
            }
        } else {
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilter(out, fprefix, filter);
                if (printFilter) {
                    if (printer == null) {
                        printer = new PrintWriterPrinter(out);
                    }
                    filter.dump(printer, fprefix + "  ");
                }
            }
        }
    }
    return printedSomething;
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) MutableInt(android.util.MutableInt) ArrayMap(android.util.ArrayMap) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer)

Example 60 with PrintWriterPrinter

use of android.util.PrintWriterPrinter in project platform_frameworks_base by android.

the class IntentResolver method dumpMap.

boolean dumpMap(PrintWriter out, String titlePrefix, String title, String prefix, ArrayMap<String, F[]> map, String packageName, boolean printFilter, boolean collapseDuplicates) {
    final String eprefix = prefix + "  ";
    final String fprefix = prefix + "    ";
    final ArrayMap<Object, MutableInt> found = new ArrayMap<>();
    boolean printedSomething = false;
    Printer printer = null;
    for (int mapi = 0; mapi < map.size(); mapi++) {
        F[] a = map.valueAt(mapi);
        final int N = a.length;
        boolean printedHeader = false;
        F filter;
        if (collapseDuplicates && !printFilter) {
            found.clear();
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                Object label = filterToLabel(filter);
                int index = found.indexOfKey(label);
                if (index < 0) {
                    found.put(label, new MutableInt(1));
                } else {
                    found.valueAt(index).value++;
                }
            }
            for (int i = 0; i < found.size(); i++) {
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilterLabel(out, fprefix, found.keyAt(i), found.valueAt(i).value);
            }
        } else {
            for (int i = 0; i < N && (filter = a[i]) != null; i++) {
                if (packageName != null && !isPackageForFilter(packageName, filter)) {
                    continue;
                }
                if (title != null) {
                    out.print(titlePrefix);
                    out.println(title);
                    title = null;
                }
                if (!printedHeader) {
                    out.print(eprefix);
                    out.print(map.keyAt(mapi));
                    out.println(":");
                    printedHeader = true;
                }
                printedSomething = true;
                dumpFilter(out, fprefix, filter);
                if (printFilter) {
                    if (printer == null) {
                        printer = new PrintWriterPrinter(out);
                    }
                    filter.dump(printer, fprefix + "  ");
                }
            }
        }
    }
    return printedSomething;
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) MutableInt(android.util.MutableInt) ArrayMap(android.util.ArrayMap) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer)

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