Search in sources :

Example 21 with Printer

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

the class BatteryStatsImpl method dumpLocked.

public void dumpLocked(Context context, PrintWriter pw, int flags, int reqUid, long histStart) {
    if (DEBUG) {
        pw.println("mOnBatteryTimeBase:");
        mOnBatteryTimeBase.dump(pw, "  ");
        pw.println("mOnBatteryScreenOffTimeBase:");
        mOnBatteryScreenOffTimeBase.dump(pw, "  ");
        Printer pr = new PrintWriterPrinter(pw);
        pr.println("*** Screen timer:");
        mScreenOnTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_SCREEN_BRIGHTNESS_BINS; i++) {
            pr.println("*** Screen brightness #" + i + ":");
            mScreenBrightnessTimer[i].logState(pr, "  ");
        }
        pr.println("*** Interactive timer:");
        mInteractiveTimer.logState(pr, "  ");
        pr.println("*** Power save mode timer:");
        mPowerSaveModeEnabledTimer.logState(pr, "  ");
        pr.println("*** Device idle mode light timer:");
        mDeviceIdleModeLightTimer.logState(pr, "  ");
        pr.println("*** Device idle mode full timer:");
        mDeviceIdleModeFullTimer.logState(pr, "  ");
        pr.println("*** Device light idling timer:");
        mDeviceLightIdlingTimer.logState(pr, "  ");
        pr.println("*** Device idling timer:");
        mDeviceIdlingTimer.logState(pr, "  ");
        pr.println("*** Phone timer:");
        mPhoneOnTimer.logState(pr, "  ");
        for (int i = 0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            pr.println("*** Phone signal strength #" + i + ":");
            mPhoneSignalStrengthsTimer[i].logState(pr, "  ");
        }
        pr.println("*** Signal scanning :");
        mPhoneSignalScanningTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; i++) {
            pr.println("*** Data connection type #" + i + ":");
            mPhoneDataConnectionsTimer[i].logState(pr, "  ");
        }
        pr.println("*** mMobileRadioPowerState=" + mMobileRadioPowerState);
        pr.println("*** Mobile network active timer:");
        mMobileRadioActiveTimer.logState(pr, "  ");
        pr.println("*** Mobile network active adjusted timer:");
        mMobileRadioActiveAdjustedTime.logState(pr, "  ");
        pr.println("*** mWifiRadioPowerState=" + mWifiRadioPowerState);
        pr.println("*** Wifi timer:");
        mWifiOnTimer.logState(pr, "  ");
        pr.println("*** WifiRunning timer:");
        mGlobalWifiRunningTimer.logState(pr, "  ");
        for (int i = 0; i < NUM_WIFI_STATES; i++) {
            pr.println("*** Wifi state #" + i + ":");
            mWifiStateTimer[i].logState(pr, "  ");
        }
        for (int i = 0; i < NUM_WIFI_SUPPL_STATES; i++) {
            pr.println("*** Wifi suppl state #" + i + ":");
            mWifiSupplStateTimer[i].logState(pr, "  ");
        }
        for (int i = 0; i < NUM_WIFI_SIGNAL_STRENGTH_BINS; i++) {
            pr.println("*** Wifi signal strength #" + i + ":");
            mWifiSignalStrengthsTimer[i].logState(pr, "  ");
        }
        pr.println("*** Flashlight timer:");
        mFlashlightOnTimer.logState(pr, "  ");
        pr.println("*** Camera timer:");
        mCameraOnTimer.logState(pr, "  ");
    }
    super.dumpLocked(context, pw, flags, reqUid, histStart);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 22 with Printer

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

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 23 with Printer

use of android.util.Printer 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 24 with Printer

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

the class SQLiteConnectionPool method dump.

/**
     * Dumps debugging information about this connection pool.
     *
     * @param printer The printer to receive the dump, not null.
     * @param verbose True to dump more verbose information.
     */
public void dump(Printer printer, boolean verbose) {
    Printer indentedPrinter = PrefixPrinter.create(printer, "    ");
    synchronized (mLock) {
        printer.println("Connection pool for " + mConfiguration.path + ":");
        printer.println("  Open: " + mIsOpen);
        printer.println("  Max connections: " + mMaxConnectionPoolSize);
        printer.println("  Available primary connection:");
        if (mAvailablePrimaryConnection != null) {
            mAvailablePrimaryConnection.dump(indentedPrinter, verbose);
        } else {
            indentedPrinter.println("<none>");
        }
        printer.println("  Available non-primary connections:");
        if (!mAvailableNonPrimaryConnections.isEmpty()) {
            final int count = mAvailableNonPrimaryConnections.size();
            for (int i = 0; i < count; i++) {
                mAvailableNonPrimaryConnections.get(i).dump(indentedPrinter, verbose);
            }
        } else {
            indentedPrinter.println("<none>");
        }
        printer.println("  Acquired connections:");
        if (!mAcquiredConnections.isEmpty()) {
            for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry : mAcquiredConnections.entrySet()) {
                final SQLiteConnection connection = entry.getKey();
                connection.dumpUnsafe(indentedPrinter, verbose);
                indentedPrinter.println("  Status: " + entry.getValue());
            }
        } else {
            indentedPrinter.println("<none>");
        }
        printer.println("  Connection waiters:");
        if (mConnectionWaiterQueue != null) {
            int i = 0;
            final long now = SystemClock.uptimeMillis();
            for (ConnectionWaiter waiter = mConnectionWaiterQueue; waiter != null; waiter = waiter.mNext, i++) {
                indentedPrinter.println(i + ": waited for " + ((now - waiter.mStartTime) * 0.001f) + " ms - thread=" + waiter.mThread + ", priority=" + waiter.mPriority + ", sql='" + waiter.mSql + "'");
            }
        } else {
            indentedPrinter.println("<none>");
        }
    }
}
Also used : PrefixPrinter(android.util.PrefixPrinter) Printer(android.util.Printer) Map(java.util.Map) WeakHashMap(java.util.WeakHashMap)

Example 25 with Printer

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

the class IntentResolver method buildResolveList.

private void buildResolveList(Intent intent, FastImmutableArraySet<String> categories, boolean debug, boolean defaultOnly, String resolvedType, String scheme, F[] src, List<R> dest, int userId) {
    final String action = intent.getAction();
    final Uri data = intent.getData();
    final String packageName = intent.getPackage();
    final boolean excludingStopped = intent.isExcludingStopped();
    final Printer logPrinter;
    final PrintWriter logPrintWriter;
    if (debug) {
        logPrinter = new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM);
        logPrintWriter = new FastPrintWriter(logPrinter);
    } else {
        logPrinter = null;
        logPrintWriter = null;
    }
    final int N = src != null ? src.length : 0;
    boolean hasNonDefaults = false;
    int i;
    F filter;
    for (i = 0; i < N && (filter = src[i]) != null; i++) {
        int match;
        if (debug)
            Slog.v(TAG, "Matching against filter " + filter);
        if (excludingStopped && isFilterStopped(filter, userId)) {
            if (debug) {
                Slog.v(TAG, "  Filter's target is stopped; skipping");
            }
            continue;
        }
        // Is delivery being limited to filters owned by a particular package?
        if (packageName != null && !isPackageForFilter(packageName, filter)) {
            if (debug) {
                Slog.v(TAG, "  Filter is not from package " + packageName + "; skipping");
            }
            continue;
        }
        // Are we verified ?
        if (filter.getAutoVerify()) {
            if (localVerificationLOGV || debug) {
                Slog.v(TAG, "  Filter verified: " + isFilterVerified(filter));
                int authorities = filter.countDataAuthorities();
                for (int z = 0; z < authorities; z++) {
                    Slog.v(TAG, "   " + filter.getDataAuthority(z).getHost());
                }
            }
        }
        // Do we already have this one?
        if (!allowFilterResult(filter, dest)) {
            if (debug) {
                Slog.v(TAG, "  Filter's target already added");
            }
            continue;
        }
        match = filter.match(action, resolvedType, scheme, data, categories, TAG);
        if (match >= 0) {
            if (debug)
                Slog.v(TAG, "  Filter matched!  match=0x" + Integer.toHexString(match) + " hasDefault=" + filter.hasCategory(Intent.CATEGORY_DEFAULT));
            if (!defaultOnly || filter.hasCategory(Intent.CATEGORY_DEFAULT)) {
                final R oneResult = newResult(filter, match, userId);
                if (oneResult != null) {
                    dest.add(oneResult);
                    if (debug) {
                        dumpFilter(logPrintWriter, "    ", filter);
                        logPrintWriter.flush();
                        filter.dump(logPrinter, "    ");
                    }
                }
            } else {
                hasNonDefaults = true;
            }
        } else {
            if (debug) {
                String reason;
                switch(match) {
                    case IntentFilter.NO_MATCH_ACTION:
                        reason = "action";
                        break;
                    case IntentFilter.NO_MATCH_CATEGORY:
                        reason = "category";
                        break;
                    case IntentFilter.NO_MATCH_DATA:
                        reason = "data";
                        break;
                    case IntentFilter.NO_MATCH_TYPE:
                        reason = "type";
                        break;
                    default:
                        reason = "unknown reason";
                        break;
                }
                Slog.v(TAG, "  Filter did not match: " + reason);
            }
        }
    }
    if (debug && hasNonDefaults) {
        if (dest.size() == 0) {
            Slog.v(TAG, "resolveIntent failed: found match, but none with CATEGORY_DEFAULT");
        } else if (dest.size() > 1) {
            Slog.v(TAG, "resolveIntent: multiple matches, only some with CATEGORY_DEFAULT");
        }
    }
}
Also used : FastPrintWriter(com.android.internal.util.FastPrintWriter) PrintWriterPrinter(android.util.PrintWriterPrinter) LogPrinter(android.util.LogPrinter) Printer(android.util.Printer) Uri(android.net.Uri) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) LogPrinter(android.util.LogPrinter)

Aggregations

Printer (android.util.Printer)72 PrintWriterPrinter (android.util.PrintWriterPrinter)52 RemoteException (android.os.RemoteException)18 LogPrinter (android.util.LogPrinter)12 InputMethodInfo (android.view.inputmethod.InputMethodInfo)12 PrefixPrinter (android.util.PrefixPrinter)8 Map (java.util.Map)8 Uri (android.net.Uri)6 PrintStreamPrinter (android.util.PrintStreamPrinter)6 IInputMethod (com.android.internal.view.IInputMethod)6 PrintWriter (java.io.PrintWriter)6 WeakHashMap (java.util.WeakHashMap)6 ArrayMap (android.util.ArrayMap)5 MutableInt (android.util.MutableInt)5 FastPrintWriter (com.android.internal.util.FastPrintWriter)5 StringBuilderPrinter (android.util.StringBuilderPrinter)2 HashMap (java.util.HashMap)2 Resources (android.content.res.Resources)1 ViewGroup (android.view.ViewGroup)1 EditorInfo (android.view.inputmethod.EditorInfo)1