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
|
@Override
|
||||||
public void waitForBroadcastIdle() {
|
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()");
|
enforceCallingPermission(permission.DUMP, "waitForBroadcastIdle()");
|
||||||
|
if (flushBroadcastLoopers) {
|
||||||
BroadcastLoopers.waitForIdle(pw);
|
BroadcastLoopers.waitForIdle(pw);
|
||||||
|
}
|
||||||
for (BroadcastQueue queue : mBroadcastQueues) {
|
for (BroadcastQueue queue : mBroadcastQueues) {
|
||||||
queue.waitForIdle(pw);
|
queue.waitForIdle(pw);
|
||||||
}
|
}
|
||||||
@@ -18912,7 +18914,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
waitForBroadcastBarrier(LOG_WRITER_INFO, false, false);
|
waitForBroadcastBarrier(LOG_WRITER_INFO, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForBroadcastBarrier(@NonNull PrintWriter pw,
|
void waitForBroadcastBarrier(@NonNull PrintWriter pw,
|
||||||
boolean flushBroadcastLoopers, boolean flushApplicationThreads) {
|
boolean flushBroadcastLoopers, boolean flushApplicationThreads) {
|
||||||
enforceCallingPermission(permission.DUMP, "waitForBroadcastBarrier()");
|
enforceCallingPermission(permission.DUMP, "waitForBroadcastBarrier()");
|
||||||
if (flushBroadcastLoopers) {
|
if (flushBroadcastLoopers) {
|
||||||
@@ -18930,7 +18932,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
* Wait for all pending {@link IApplicationThread} events to be processed in
|
* Wait for all pending {@link IApplicationThread} events to be processed in
|
||||||
* all currently running apps.
|
* all currently running apps.
|
||||||
*/
|
*/
|
||||||
public void waitForApplicationBarrier(@NonNull PrintWriter pw) {
|
void waitForApplicationBarrier(@NonNull PrintWriter pw) {
|
||||||
final CountDownLatch finishedLatch = new CountDownLatch(1);
|
final CountDownLatch finishedLatch = new CountDownLatch(1);
|
||||||
final AtomicInteger pingCount = new AtomicInteger(0);
|
final AtomicInteger pingCount = new AtomicInteger(0);
|
||||||
final AtomicInteger pongCount = new AtomicInteger(0);
|
final AtomicInteger pongCount = new AtomicInteger(0);
|
||||||
|
|||||||
@@ -3447,7 +3447,17 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
|||||||
|
|
||||||
int runWaitForBroadcastIdle(PrintWriter pw) throws RemoteException {
|
int runWaitForBroadcastIdle(PrintWriter pw) throws RemoteException {
|
||||||
pw = new PrintWriter(new TeeWriter(LOG_WRITER_INFO, pw));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user