Merge "Make flushing broadcast loopers optional." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3e7d7d6398
@@ -18894,12 +18894,14 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
|
||||
@Override
|
||||
public void waitForBroadcastIdle() {
|
||||
waitForBroadcastIdle(LOG_WRITER_INFO);
|
||||
waitForBroadcastIdle(LOG_WRITER_INFO, false);
|
||||
}
|
||||
|
||||
public void waitForBroadcastIdle(@NonNull PrintWriter pw) {
|
||||
void waitForBroadcastIdle(@NonNull PrintWriter pw, boolean flushBroadcastLoopers) {
|
||||
enforceCallingPermission(permission.DUMP, "waitForBroadcastIdle()");
|
||||
BroadcastLoopers.waitForIdle(pw);
|
||||
if (flushBroadcastLoopers) {
|
||||
BroadcastLoopers.waitForIdle(pw);
|
||||
}
|
||||
for (BroadcastQueue queue : mBroadcastQueues) {
|
||||
queue.waitForIdle(pw);
|
||||
}
|
||||
@@ -18912,7 +18914,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
waitForBroadcastBarrier(LOG_WRITER_INFO, false, false);
|
||||
}
|
||||
|
||||
public void waitForBroadcastBarrier(@NonNull PrintWriter pw,
|
||||
void waitForBroadcastBarrier(@NonNull PrintWriter pw,
|
||||
boolean flushBroadcastLoopers, boolean flushApplicationThreads) {
|
||||
enforceCallingPermission(permission.DUMP, "waitForBroadcastBarrier()");
|
||||
if (flushBroadcastLoopers) {
|
||||
@@ -18930,7 +18932,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
* Wait for all pending {@link IApplicationThread} events to be processed in
|
||||
* all currently running apps.
|
||||
*/
|
||||
public void waitForApplicationBarrier(@NonNull PrintWriter pw) {
|
||||
void waitForApplicationBarrier(@NonNull PrintWriter pw) {
|
||||
final CountDownLatch finishedLatch = new CountDownLatch(1);
|
||||
final AtomicInteger pingCount = new AtomicInteger(0);
|
||||
final AtomicInteger pongCount = new AtomicInteger(0);
|
||||
|
||||
@@ -3447,7 +3447,17 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
|
||||
int runWaitForBroadcastIdle(PrintWriter pw) throws RemoteException {
|
||||
pw = new PrintWriter(new TeeWriter(LOG_WRITER_INFO, pw));
|
||||
mInternal.waitForBroadcastIdle(pw);
|
||||
boolean flushBroadcastLoopers = false;
|
||||
String opt;
|
||||
while ((opt = getNextOption()) != null) {
|
||||
if (opt.equals("--flush-broadcast-loopers")) {
|
||||
flushBroadcastLoopers = true;
|
||||
} else {
|
||||
getErrPrintWriter().println("Error: Unknown option: " + opt);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
mInternal.waitForBroadcastIdle(pw, flushBroadcastLoopers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user