am 034bca58: am 7e3752e6: am 24a306c5: am 3052e6ed: am cb2775a7: Merge "Add new activity dumpsys command to persist all data." into lmp-dev

* commit '034bca58065a9aba92d7d34f76912bdb2aa221ba':
  Add new activity dumpsys command to persist all data.
This commit is contained in:
Dianne Hackborn
2014-09-19 23:30:22 +00:00
committed by Android Git Automerger
2 changed files with 23 additions and 1 deletions

View File

@@ -12230,6 +12230,7 @@ public final class ActivityManagerService extends ActivityManagerNative
pw.println(" package [PACKAGE_NAME]: all state related to given package");
pw.println(" all: dump all activities");
pw.println(" top: dump the top activity");
pw.println(" write: write all pending state to storage");
pw.println(" cmd may also be a COMP_SPEC to dump activities.");
pw.println(" COMP_SPEC may be a component name (com.foo/.myApp),");
pw.println(" a partial substring in a component name, a");
@@ -12364,6 +12365,10 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (this) {
mServices.dumpServicesLocked(fd, pw, args, opti, true, dumpClient, null);
}
} else if ("write".equals(cmd)) {
mTaskPersister.flush();
pw.println("All tasks persisted.");
return;
} else {
// Dumping a single activity?
if (!dumpActivity(fd, pw, cmd, args, opti, dumpAll)) {

View File

@@ -187,6 +187,19 @@ public class TaskPersister {
yieldIfQueueTooDeep();
}
void flush() {
synchronized (this) {
mNextWriteTime = FLUSH_QUEUE;
notifyAll();
do {
try {
wait();
} catch (InterruptedException e) {
}
} while (mNextWriteTime == FLUSH_QUEUE);
}
}
void saveImage(Bitmap image, String filename) {
synchronized (this) {
int queueNdx;
@@ -483,8 +496,12 @@ public class TaskPersister {
INTER_WRITE_DELAY_MS + " msec. (" + mNextWriteTime + ")");
}
while (mWriteQueue.isEmpty()) {
mNextWriteTime = 0; // idle.
if (mNextWriteTime != 0) {
mNextWriteTime = 0; // idle.
TaskPersister.this.notifyAll(); // wake up flush() if needed.
}
try {
if (DEBUG) Slog.d(TAG, "LazyTaskWriter: waiting indefinitely.");
TaskPersister.this.wait();