Search in sources :

Example 41 with Printer

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

the class CountryDetectorService method dump.

@SuppressWarnings("unused")
@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
    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);
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer) RemoteException(android.os.RemoteException)

Example 42 with Printer

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

the class DevicePolicyManagerService 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 DevicePolicyManagerService from from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    final Printer p = new PrintWriterPrinter(pw);
    synchronized (this) {
        p.println("Current Device Policy Manager state:");
        int userCount = mUserData.size();
        for (int u = 0; u < userCount; u++) {
            DevicePolicyData policy = getUserData(mUserData.keyAt(u));
            p.println("  Enabled Device Admins (User " + policy.mUserHandle + "):");
            final int N = policy.mAdminList.size();
            for (int i = 0; i < N; i++) {
                ActiveAdmin ap = policy.mAdminList.get(i);
                if (ap != null) {
                    pw.print("  ");
                    pw.print(ap.info.getComponent().flattenToShortString());
                    pw.println(":");
                    ap.dump("    ", pw);
                }
            }
            pw.println(" ");
            pw.print("  mPasswordOwner=");
            pw.println(policy.mPasswordOwner);
        }
    }
}
Also used : PrintWriterPrinter(android.util.PrintWriterPrinter) PrintWriterPrinter(android.util.PrintWriterPrinter) Printer(android.util.Printer)

Example 43 with Printer

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

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

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

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

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

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)

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