use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by AOSPA.
the class ActivityManager method dumpPackageStateStatic.
/**
* @hide
*/
public static void dumpPackageStateStatic(FileDescriptor fd, String packageName) {
FileOutputStream fout = new FileOutputStream(fd);
PrintWriter pw = new FastPrintWriter(fout);
dumpService(pw, fd, "package", new String[] { packageName });
pw.println();
dumpService(pw, fd, Context.ACTIVITY_SERVICE, new String[] { "-a", "package", packageName });
pw.println();
dumpService(pw, fd, "meminfo", new String[] { "--local", "--package", packageName });
pw.println();
dumpService(pw, fd, ProcessStats.SERVICE_NAME, new String[] { packageName });
pw.println();
dumpService(pw, fd, "usagestats", new String[] { "--packages", packageName });
pw.println();
dumpService(pw, fd, BatteryStats.SERVICE_NAME, new String[] { packageName });
pw.flush();
}
use of com.android.internal.util.FastPrintWriter 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;
}
use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by DirtyUnicorns.
the class WindowManagerService method saveANRStateLocked.
/**
* Saves information about the state of the window manager at
* the time an ANR occurred before anything else in the system changes
* in response.
*
* @param appWindowToken The application that ANR'd, may be null.
* @param windowState The window that ANR'd, may be null.
* @param reason The reason for the ANR, may be null.
*/
public void saveANRStateLocked(AppWindowToken appWindowToken, WindowState windowState, String reason) {
StringWriter sw = new StringWriter();
PrintWriter pw = new FastPrintWriter(sw, false, 1024);
pw.println(" ANR time: " + DateFormat.getInstance().format(new Date()));
if (appWindowToken != null) {
pw.println(" Application at fault: " + appWindowToken.stringName);
}
if (windowState != null) {
pw.println(" Window at fault: " + windowState.mAttrs.getTitle());
}
if (reason != null) {
pw.println(" Reason: " + reason);
}
pw.println();
dumpWindowsNoHeaderLocked(pw, true, null);
pw.println();
pw.println("Last ANR continued");
dumpDisplayContentsLocked(pw, true);
pw.close();
mLastANRState = sw.toString();
mH.removeMessages(H.RESET_ANR_MESSAGE);
mH.sendEmptyMessageDelayed(H.RESET_ANR_MESSAGE, LAST_ANR_LIFETIME_DURATION_MSECS);
}
use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by DirtyUnicorns.
the class WindowManagerService method rebuildAppWindowListLocked.
private void rebuildAppWindowListLocked(final DisplayContent displayContent) {
final WindowList windows = displayContent.getWindowList();
int NW = windows.size();
int i;
int lastBelow = -1;
int numRemoved = 0;
if (mRebuildTmp.length < NW) {
mRebuildTmp = new WindowState[NW + 10];
}
// First remove all existing app windows.
i = 0;
while (i < NW) {
WindowState w = windows.get(i);
if (w.mAppToken != null) {
WindowState win = windows.remove(i);
win.mRebuilding = true;
mRebuildTmp[numRemoved] = win;
mWindowsChanged = true;
if (DEBUG_WINDOW_MOVEMENT)
Slog.v(TAG_WM, "Rebuild removing window: " + win);
NW--;
numRemoved++;
continue;
} else if (lastBelow == i - 1) {
if (w.mAttrs.type == TYPE_WALLPAPER) {
lastBelow = i;
}
}
i++;
}
// Keep whatever windows were below the app windows still below,
// by skipping them.
lastBelow++;
i = lastBelow;
// First add all of the exiting app tokens... these are no longer
// in the main app list, but still have windows shown. We put them
// in the back because now that the animation is over we no longer
// will care about them.
final ArrayList<TaskStack> stacks = displayContent.getStacks();
final int numStacks = stacks.size();
for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) {
AppTokenList exitingAppTokens = stacks.get(stackNdx).mExitingAppTokens;
int NT = exitingAppTokens.size();
for (int j = 0; j < NT; j++) {
i = reAddAppWindowsLocked(displayContent, i, exitingAppTokens.get(j));
}
}
// And add in the still active app tokens in Z order.
for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) {
final ArrayList<Task> tasks = stacks.get(stackNdx).getTasks();
final int numTasks = tasks.size();
for (int taskNdx = 0; taskNdx < numTasks; ++taskNdx) {
final AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
final int numTokens = tokens.size();
for (int tokenNdx = 0; tokenNdx < numTokens; ++tokenNdx) {
final AppWindowToken wtoken = tokens.get(tokenNdx);
if (wtoken.mIsExiting && !wtoken.waitingForReplacement()) {
continue;
}
i = reAddAppWindowsLocked(displayContent, i, wtoken);
}
}
}
i -= lastBelow;
if (i != numRemoved) {
displayContent.layoutNeeded = true;
Slog.w(TAG_WM, "On display=" + displayContent.getDisplayId() + " Rebuild removed " + numRemoved + " windows but added " + i + " rebuildAppWindowListLocked() " + " callers=" + Debug.getCallers(10));
for (i = 0; i < numRemoved; i++) {
WindowState ws = mRebuildTmp[i];
if (ws.mRebuilding) {
StringWriter sw = new StringWriter();
PrintWriter pw = new FastPrintWriter(sw, false, 1024);
ws.dump(pw, "", true);
pw.flush();
Slog.w(TAG_WM, "This window was lost: " + ws);
Slog.w(TAG_WM, sw.toString());
ws.mWinAnimator.destroySurfaceLocked();
}
}
Slog.w(TAG_WM, "Current app token list:");
dumpAppTokensLocked();
Slog.w(TAG_WM, "Final window list:");
dumpWindowsLocked();
}
Arrays.fill(mRebuildTmp, null);
}
use of com.android.internal.util.FastPrintWriter 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;
}
Aggregations