Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -15093,7 +15093,7 @@ public class ActivityManagerService extends IActivityManager.Stub @GuardedBy("this") @GuardedBy("this") final boolean canGcNowLocked() { final boolean canGcNowLocked() { for (BroadcastQueue q : mBroadcastQueues) { for (BroadcastQueue q : mBroadcastQueues) { if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isEmpty()) { if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isIdle()) { return false; return false; } } } } services/core/java/com/android/server/am/BroadcastDispatcher.java +15 −3 Original line number Original line Diff line number Diff line Loading @@ -511,13 +511,25 @@ public class BroadcastDispatcher { * Standard contents-are-empty check * Standard contents-are-empty check */ */ public boolean isEmpty() { 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) { synchronized (mLock) { return mCurrentBroadcast == null return mCurrentBroadcast == null && mOrderedBroadcasts.isEmpty() && mOrderedBroadcasts.isEmpty() && isDeferralsListEmpty(mDeferredBroadcasts) && isDeferralsListEmpty(mDeferredBroadcasts) && isDeferralsListEmpty(mAlarmBroadcasts) && isDeferralsListEmpty(mAlarmBroadcasts); && getBootCompletedBroadcastsUidsSize(Intent.ACTION_LOCKED_BOOT_COMPLETED) == 0 && getBootCompletedBroadcastsUidsSize(Intent.ACTION_BOOT_COMPLETED) == 0; } } } } Loading services/core/java/com/android/server/am/BroadcastQueue.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2218,7 +2218,7 @@ public final class BroadcastQueue { } } boolean isIdle() { boolean isIdle() { return mParallelBroadcasts.isEmpty() && mDispatcher.isEmpty() return mParallelBroadcasts.isEmpty() && mDispatcher.isIdle() && (mPendingBroadcast == null); && (mPendingBroadcast == null); } } Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -15093,7 +15093,7 @@ public class ActivityManagerService extends IActivityManager.Stub @GuardedBy("this") @GuardedBy("this") final boolean canGcNowLocked() { final boolean canGcNowLocked() { for (BroadcastQueue q : mBroadcastQueues) { for (BroadcastQueue q : mBroadcastQueues) { if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isEmpty()) { if (!q.mParallelBroadcasts.isEmpty() || !q.mDispatcher.isIdle()) { return false; return false; } } } }
services/core/java/com/android/server/am/BroadcastDispatcher.java +15 −3 Original line number Original line Diff line number Diff line Loading @@ -511,13 +511,25 @@ public class BroadcastDispatcher { * Standard contents-are-empty check * Standard contents-are-empty check */ */ public boolean isEmpty() { 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) { synchronized (mLock) { return mCurrentBroadcast == null return mCurrentBroadcast == null && mOrderedBroadcasts.isEmpty() && mOrderedBroadcasts.isEmpty() && isDeferralsListEmpty(mDeferredBroadcasts) && isDeferralsListEmpty(mDeferredBroadcasts) && isDeferralsListEmpty(mAlarmBroadcasts) && isDeferralsListEmpty(mAlarmBroadcasts); && getBootCompletedBroadcastsUidsSize(Intent.ACTION_LOCKED_BOOT_COMPLETED) == 0 && getBootCompletedBroadcastsUidsSize(Intent.ACTION_BOOT_COMPLETED) == 0; } } } } Loading
services/core/java/com/android/server/am/BroadcastQueue.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2218,7 +2218,7 @@ public final class BroadcastQueue { } } boolean isIdle() { boolean isIdle() { return mParallelBroadcasts.isEmpty() && mDispatcher.isEmpty() return mParallelBroadcasts.isEmpty() && mDispatcher.isIdle() && (mPendingBroadcast == null); && (mPendingBroadcast == null); } } Loading