Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f950269 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 7e3752e6: am 24a306c5: am 3052e6ed: am cb2775a7: Merge "Add new activity...

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

* commit '7e3752e6f54955de8084dc9f320483f79fbc88a4':
  Add new activity dumpsys command to persist all data.
parents 52dc6256 1aab9db1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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)) {
+18 −1
Original line number Diff line number Diff line
@@ -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()) {
                        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();