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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations