use of android.util.LogWriter in project android_frameworks_base by AOSPA.
the class BatteryStatsImpl method getNextOldHistoryLocked.
@Override
public boolean getNextOldHistoryLocked(HistoryItem out) {
boolean end = mHistoryBuffer.dataPosition() >= mHistoryBuffer.dataSize();
if (!end) {
readHistoryDelta(mHistoryBuffer, mHistoryReadTmp);
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)) {
PrintWriter pw = new FastPrintWriter(new LogWriter(android.util.Log.WARN, TAG));
pw.println("Histories differ!");
pw.println("Old history:");
(new HistoryPrinter()).printNextItem(pw, out, 0, false, true);
pw.println("New history:");
(new HistoryPrinter()).printNextItem(pw, mHistoryReadTmp, 0, false, true);
pw.flush();
}
}
return true;
}
use of android.util.LogWriter in project android_frameworks_base by ResurrectionRemix.
the class BackStackRecord method popFromBackStack.
public TransitionState popFromBackStack(boolean doStateMove, TransitionState state, SparseArray<Fragment> firstOutFragments, SparseArray<Fragment> lastInFragments) {
if (FragmentManagerImpl.DEBUG) {
Log.v(TAG, "popFromBackStack: " + this);
LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
PrintWriter pw = new FastPrintWriter(logw, false, 1024);
dump(" ", null, pw, null);
pw.flush();
}
if (mManager.mCurState >= Fragment.CREATED) {
if (state == null) {
if (firstOutFragments.size() != 0 || lastInFragments.size() != 0) {
state = beginTransition(firstOutFragments, lastInFragments, true);
}
} else if (!doStateMove) {
setNameOverrides(state, mSharedElementTargetNames, mSharedElementSourceNames);
}
}
bumpBackStackNesting(-1);
Op op = mTail;
while (op != null) {
switch(op.cmd) {
case OP_ADD:
{
Fragment f = op.fragment;
f.mNextAnim = op.popExitAnim;
mManager.removeFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
break;
case OP_REPLACE:
{
Fragment f = op.fragment;
if (f != null) {
f.mNextAnim = op.popExitAnim;
mManager.removeFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
if (op.removed != null) {
for (int i = 0; i < op.removed.size(); i++) {
Fragment old = op.removed.get(i);
old.mNextAnim = op.popEnterAnim;
mManager.addFragment(old, false);
}
}
}
break;
case OP_REMOVE:
{
Fragment f = op.fragment;
f.mNextAnim = op.popEnterAnim;
mManager.addFragment(f, false);
}
break;
case OP_HIDE:
{
Fragment f = op.fragment;
f.mNextAnim = op.popEnterAnim;
mManager.showFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
break;
case OP_SHOW:
{
Fragment f = op.fragment;
f.mNextAnim = op.popExitAnim;
mManager.hideFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
break;
case OP_DETACH:
{
Fragment f = op.fragment;
f.mNextAnim = op.popEnterAnim;
mManager.attachFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
break;
case OP_ATTACH:
{
Fragment f = op.fragment;
f.mNextAnim = op.popExitAnim;
mManager.detachFragment(f, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle);
}
break;
default:
{
throw new IllegalArgumentException("Unknown cmd: " + op.cmd);
}
}
op = op.prev;
}
if (doStateMove) {
mManager.moveToState(mManager.mCurState, FragmentManagerImpl.reverseTransit(mTransition), mTransitionStyle, true);
state = null;
}
if (mIndex >= 0) {
mManager.freeBackStackIndex(mIndex);
mIndex = -1;
}
return state;
}
use of android.util.LogWriter in project android_frameworks_base by ResurrectionRemix.
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 ResurrectionRemix.
the class BatteryStatsImpl method getNextOldHistoryLocked.
@Override
public boolean getNextOldHistoryLocked(HistoryItem out) {
boolean end = mHistoryBuffer.dataPosition() >= mHistoryBuffer.dataSize();
if (!end) {
readHistoryDelta(mHistoryBuffer, mHistoryReadTmp);
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)) {
PrintWriter pw = new FastPrintWriter(new LogWriter(android.util.Log.WARN, TAG));
pw.println("Histories differ!");
pw.println("Old history:");
(new HistoryPrinter()).printNextItem(pw, out, 0, false, true);
pw.println("New history:");
(new HistoryPrinter()).printNextItem(pw, mHistoryReadTmp, 0, false, true);
pw.flush();
}
}
return true;
}
use of android.util.LogWriter in project android_frameworks_base by DirtyUnicorns.
the class BatteryStatsImpl method getNextOldHistoryLocked.
@Override
public boolean getNextOldHistoryLocked(HistoryItem out) {
boolean end = mHistoryBuffer.dataPosition() >= mHistoryBuffer.dataSize();
if (!end) {
readHistoryDelta(mHistoryBuffer, mHistoryReadTmp);
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)) {
PrintWriter pw = new FastPrintWriter(new LogWriter(android.util.Log.WARN, TAG));
pw.println("Histories differ!");
pw.println("Old history:");
(new HistoryPrinter()).printNextItem(pw, out, 0, false, true);
pw.println("New history:");
(new HistoryPrinter()).printNextItem(pw, mHistoryReadTmp, 0, false, true);
pw.flush();
}
}
return true;
}
Aggregations