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

Commit 0530be14 authored by Hui Yu's avatar Hui Yu Committed by Automerger Merge Worker
Browse files

Merge "Deferred BOOT_COMPLETED broadcast does not mean queue is not idle."...

Merge "Deferred BOOT_COMPLETED broadcast does not mean queue is not idle." into tm-dev am: 525fad6c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17779272



Change-Id: Ic9b44fa45064f4ff11bf458c63a12262f33ca9c9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0f481b70 525fad6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15093,7 +15093,7 @@ public class ActivityManagerService extends IActivityManager.Stub
    @GuardedBy("this")
    final boolean canGcNowLocked() {
        for (BroadcastQueue q : mBroadcastQueues) {
            if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isEmpty()) {
            if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isIdle()) {
                return false;
            }
        }
+15 −3
Original line number Diff line number Diff line
@@ -511,13 +511,25 @@ public class BroadcastDispatcher {
     * Standard contents-are-empty check
     */
    public boolean isEmpty() {
        synchronized (mLock) {
            return isIdle()
                    && getBootCompletedBroadcastsUidsSize(Intent.ACTION_LOCKED_BOOT_COMPLETED) == 0
                    && getBootCompletedBroadcastsUidsSize(Intent.ACTION_BOOT_COMPLETED) == 0;
        }
    }

    /**
     * Have less check than {@link #isEmpty()}.
     * The dispatcher is considered as idle even with deferred LOCKED_BOOT_COMPLETED/BOOT_COMPLETED
     * broadcasts because those can be deferred until the first time the uid's process is started.
     * @return
     */
    public boolean isIdle() {
        synchronized (mLock) {
            return mCurrentBroadcast == null
                    && mOrderedBroadcasts.isEmpty()
                    && isDeferralsListEmpty(mDeferredBroadcasts)
                    && isDeferralsListEmpty(mAlarmBroadcasts)
                    && getBootCompletedBroadcastsUidsSize(Intent.ACTION_LOCKED_BOOT_COMPLETED) == 0
                    && getBootCompletedBroadcastsUidsSize(Intent.ACTION_BOOT_COMPLETED) == 0;
                    && isDeferralsListEmpty(mAlarmBroadcasts);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -2218,7 +2218,7 @@ public final class BroadcastQueue {
    }

    boolean isIdle() {
        return mParallelBroadcasts.isEmpty() && mDispatcher.isEmpty()
        return mParallelBroadcasts.isEmpty() && mDispatcher.isIdle()
                && (mPendingBroadcast == null);
    }