Search in sources :

Example 6 with LogWriter

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

the class BatteryStatsImpl method getNextOldHistoryLocked.

@Override
public boolean getNextOldHistoryLocked(HistoryItem out) {
    boolean end = mHistoryBuffer.dataPosition() >= mHistoryBuffer.dataSize();
    if (!end) {
        mHistoryReadTmp.readDelta(mHistoryBuffer);
        mReadOverflow |= mHistoryReadTmp.cmd == HistoryItem.CMD_OVERFLOW;
    }
    HistoryItem cur = mHistoryIterator;
    if (cur == null) {
        if (!mReadOverflow && !end) {
            Slog.w(TAG, "Old history ends before new history!");
        }
        return false;
    }
    out.setTo(cur);
    mHistoryIterator = cur.next;
    if (!mReadOverflow) {
        if (end) {
            Slog.w(TAG, "New history ends before old history!");
        } else if (!out.same(mHistoryReadTmp)) {
            long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();
            PrintWriter pw = new PrintWriter(new LogWriter(android.util.Log.WARN, TAG));
            pw.println("Histories differ!");
            pw.println("Old history:");
            (new HistoryPrinter()).printNextItem(pw, out, now);
            pw.println("New history:");
            (new HistoryPrinter()).printNextItem(pw, mHistoryReadTmp, now);
        }
    }
    return true;
}
Also used : LogWriter(android.util.LogWriter) PrintWriter(java.io.PrintWriter)

Example 7 with LogWriter

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

the class FragmentManagerImpl method throwException.

private void throwException(RuntimeException ex) {
    Log.e(TAG, ex.getMessage());
    LogWriter logw = new LogWriter(Log.ERROR, TAG);
    PrintWriter pw = new FastPrintWriter(logw, false, 1024);
    if (mHost != null) {
        Log.e(TAG, "Activity state:");
        try {
            mHost.onDump("  ", null, pw, new String[] {});
        } catch (Exception e) {
            pw.flush();
            Log.e(TAG, "Failed dumping state", e);
        }
    } else {
        Log.e(TAG, "Fragment manager state:");
        try {
            dump("  ", null, pw, new String[] {});
        } catch (Exception e) {
            pw.flush();
            Log.e(TAG, "Failed dumping state", e);
        }
    }
    pw.flush();
    throw ex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) SuperNotCalledException(android.util.SuperNotCalledException) NotFoundException(android.content.res.Resources.NotFoundException) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 8 with LogWriter

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

the class BackStackRecord method commitInternal.

int commitInternal(boolean allowStateLoss) {
    if (mCommitted) {
        throw new IllegalStateException("commit already called");
    }
    if (FragmentManagerImpl.DEBUG) {
        Log.v(TAG, "Commit: " + this);
        LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
        PrintWriter pw = new FastPrintWriter(logw, false, 1024);
        dump("  ", null, pw, null);
        pw.flush();
    }
    mCommitted = true;
    if (mAddToBackStack) {
        mIndex = mManager.allocBackStackIndex(this);
    } else {
        mIndex = -1;
    }
    mManager.enqueueAction(this, allowStateLoss);
    return mIndex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 9 with LogWriter

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

the class BackStackRecord method commitInternal.

int commitInternal(boolean allowStateLoss) {
    if (mCommitted) {
        throw new IllegalStateException("commit already called");
    }
    if (FragmentManagerImpl.DEBUG) {
        Log.v(TAG, "Commit: " + this);
        LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
        PrintWriter pw = new FastPrintWriter(logw, false, 1024);
        dump("  ", null, pw, null);
        pw.flush();
    }
    mCommitted = true;
    if (mAddToBackStack) {
        mIndex = mManager.allocBackStackIndex(this);
    } else {
        mIndex = -1;
    }
    mManager.enqueueAction(this, allowStateLoss);
    return mIndex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 10 with LogWriter

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

the class FragmentManagerImpl method throwException.

private void throwException(RuntimeException ex) {
    Log.e(TAG, ex.getMessage());
    LogWriter logw = new LogWriter(Log.ERROR, TAG);
    PrintWriter pw = new FastPrintWriter(logw, false, 1024);
    if (mHost != null) {
        Log.e(TAG, "Activity state:");
        try {
            mHost.onDump("  ", null, pw, new String[] {});
        } catch (Exception e) {
            pw.flush();
            Log.e(TAG, "Failed dumping state", e);
        }
    } else {
        Log.e(TAG, "Fragment manager state:");
        try {
            dump("  ", null, pw, new String[] {});
        } catch (Exception e) {
            pw.flush();
            Log.e(TAG, "Failed dumping state", e);
        }
    }
    pw.flush();
    throw ex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) SuperNotCalledException(android.util.SuperNotCalledException) NotFoundException(android.content.res.Resources.NotFoundException) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Aggregations

LogWriter (android.util.LogWriter)31 PrintWriter (java.io.PrintWriter)31 FastPrintWriter (com.android.internal.util.FastPrintWriter)24 NotFoundException (android.content.res.Resources.NotFoundException)5 SuperNotCalledException (android.util.SuperNotCalledException)5 Bundle (android.os.Bundle)1