Search in sources :

Example 11 with Printer

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

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)

Example 12 with Printer

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

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

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

the class InputMethodManager method doDump.

void doDump(FileDescriptor fd, PrintWriter fout, String[] args) {
    final Printer p = new PrintWriterPrinter(fout);
    p.println("Input method client state for " + this + ":");
    p.println("  mService=" + mService);
    p.println("  mMainLooper=" + mMainLooper);
    p.println("  mIInputContext=" + mIInputContext);
    p.println("  mActive=" + mActive + " mHasBeenInactive=" + mHasBeenInactive + " mBindSequence=" + mBindSequence + " mCurId=" + mCurId);
    p.println("  mCurMethod=" + mCurMethod);
    p.println("  mCurRootView=" + mCurRootView);
    p.println("  mServedView=" + mServedView);
    p.println("  mNextServedView=" + mNextServedView);
    p.println("  mServedConnecting=" + mServedConnecting);
    if (mCurrentTextBoxAttribute != null) {
        p.println("  mCurrentTextBoxAttribute:");
        mCurrentTextBoxAttribute.dump(p, "    ");
    } else {
        p.println("  mCurrentTextBoxAttribute: null");
    }
    p.println("  mServedInputConnectionWrapper=" + mServedInputConnectionWrapper);
    p.println("  mCompletions=" + Arrays.toString(mCompletions));
    p.println("  mCursorRect=" + mCursorRect);
    p.println("  mCursorSelStart=" + mCursorSelStart + " mCursorSelEnd=" + mCursorSelEnd + " mCursorCandStart=" + mCursorCandStart + " mCursorCandEnd=" + mCursorCandEnd);
    p.println("  mNextUserActionNotificationSequenceNumber=" + mNextUserActionNotificationSequenceNumber + " mLastSentUserActionNotificationSequenceNumber=" + mLastSentUserActionNotificationSequenceNumber);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 14 with Printer

use of android.util.Printer in project XobotOS by xamarin.

the class InputMethodService method dump.

/**
     * Performs a dump of the InputMethodService's internal state.  Override
     * to add your own information to the dump.
     */
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    final Printer p = new PrintWriterPrinter(fout);
    p.println("Input method service state for " + this + ":");
    p.println("  mWindowCreated=" + mWindowCreated + " mWindowAdded=" + mWindowAdded);
    p.println("  mWindowVisible=" + mWindowVisible + " mWindowWasVisible=" + mWindowWasVisible + " mInShowWindow=" + mInShowWindow);
    p.println("  Configuration=" + getResources().getConfiguration());
    p.println("  mToken=" + mToken);
    p.println("  mInputBinding=" + mInputBinding);
    p.println("  mInputConnection=" + mInputConnection);
    p.println("  mStartedInputConnection=" + mStartedInputConnection);
    p.println("  mInputStarted=" + mInputStarted + " mInputViewStarted=" + mInputViewStarted + " mCandidatesViewStarted=" + mCandidatesViewStarted);
    if (mInputEditorInfo != null) {
        p.println("  mInputEditorInfo:");
        mInputEditorInfo.dump(p, "    ");
    } else {
        p.println("  mInputEditorInfo: null");
    }
    p.println("  mShowInputRequested=" + mShowInputRequested + " mLastShowInputRequested=" + mLastShowInputRequested + " mShowInputForced=" + mShowInputForced + " mShowInputFlags=0x" + Integer.toHexString(mShowInputFlags));
    p.println("  mCandidatesVisibility=" + mCandidatesVisibility + " mFullscreenApplied=" + mFullscreenApplied + " mIsFullscreen=" + mIsFullscreen + " mExtractViewHidden=" + mExtractViewHidden);
    if (mExtractedText != null) {
        p.println("  mExtractedText:");
        p.println("    text=" + mExtractedText.text.length() + " chars" + " startOffset=" + mExtractedText.startOffset);
        p.println("    selectionStart=" + mExtractedText.selectionStart + " selectionEnd=" + mExtractedText.selectionEnd + " flags=0x" + Integer.toHexString(mExtractedText.flags));
    } else {
        p.println("  mExtractedText: null");
    }
    p.println("  mExtractedToken=" + mExtractedToken);
    p.println("  mIsInputViewShown=" + mIsInputViewShown + " mStatusIcon=" + mStatusIcon);
    p.println("Last computed insets:");
    p.println("  contentTopInsets=" + mTmpInsets.contentTopInsets + " visibleTopInsets=" + mTmpInsets.visibleTopInsets + " touchableInsets=" + mTmpInsets.touchableInsets + " touchableRegion=" + mTmpInsets.touchableRegion);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 15 with Printer

use of android.util.Printer in project XobotOS by xamarin.

the class BatteryStatsImpl method dumpLocked.

public void dumpLocked(PrintWriter pw) {
    if (DEBUG) {
        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("*** Input event counter:");
        mInputEventCounter.logState(pr, "  ");
        pr.println("*** Phone timer:");
        mPhoneOnTimer.logState(pr, "  ");
        for (int i = 0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            pr.println("*** 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("*** Wifi timer:");
        mWifiOnTimer.logState(pr, "  ");
        pr.println("*** WifiRunning timer:");
        mGlobalWifiRunningTimer.logState(pr, "  ");
        pr.println("*** Bluetooth timer:");
        mBluetoothOnTimer.logState(pr, "  ");
        pr.println("*** Mobile ifaces:");
        pr.println(mMobileIfaces.toString());
    }
    super.dumpLocked(pw);
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

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