Merge "Don't allow core uids to be unfrozen due to deferrable broadcasts." into udc-qpr-dev am: 519a605745
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23879974 Change-Id: Id0a381040edc1a350d8ae6600e1e5dfdb7fd0a22 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1144,9 +1144,6 @@ class BroadcastProcessQueue {
|
|||||||
} else if (mProcessPersistent) {
|
} else if (mProcessPersistent) {
|
||||||
mRunnableAt = runnableAt + constants.DELAY_PERSISTENT_PROC_MILLIS;
|
mRunnableAt = runnableAt + constants.DELAY_PERSISTENT_PROC_MILLIS;
|
||||||
mRunnableAtReason = REASON_PERSISTENT;
|
mRunnableAtReason = REASON_PERSISTENT;
|
||||||
} else if (UserHandle.isCore(uid)) {
|
|
||||||
mRunnableAt = runnableAt;
|
|
||||||
mRunnableAtReason = REASON_CORE_UID;
|
|
||||||
} else if (mCountOrdered > 0) {
|
} else if (mCountOrdered > 0) {
|
||||||
mRunnableAt = runnableAt;
|
mRunnableAt = runnableAt;
|
||||||
mRunnableAtReason = REASON_CONTAINS_ORDERED;
|
mRunnableAtReason = REASON_CONTAINS_ORDERED;
|
||||||
@@ -1193,6 +1190,9 @@ class BroadcastProcessQueue {
|
|||||||
// is already cached, they'll be deferred on the line above
|
// is already cached, they'll be deferred on the line above
|
||||||
mRunnableAt = runnableAt;
|
mRunnableAt = runnableAt;
|
||||||
mRunnableAtReason = REASON_CONTAINS_RESULT_TO;
|
mRunnableAtReason = REASON_CONTAINS_RESULT_TO;
|
||||||
|
} else if (UserHandle.isCore(uid)) {
|
||||||
|
mRunnableAt = runnableAt;
|
||||||
|
mRunnableAtReason = REASON_CORE_UID;
|
||||||
} else {
|
} else {
|
||||||
mRunnableAt = runnableAt + constants.DELAY_NORMAL_MILLIS;
|
mRunnableAt = runnableAt + constants.DELAY_NORMAL_MILLIS;
|
||||||
mRunnableAtReason = REASON_NORMAL;
|
mRunnableAtReason = REASON_NORMAL;
|
||||||
|
|||||||
@@ -620,6 +620,28 @@ public final class BroadcastQueueModernImplTest {
|
|||||||
assertEquals(BroadcastProcessQueue.REASON_CORE_UID, queue.getRunnableAtReason());
|
assertEquals(BroadcastProcessQueue.REASON_CORE_UID, queue.getRunnableAtReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRunnableAt_freezableCoreUid() {
|
||||||
|
final BroadcastProcessQueue queue = new BroadcastProcessQueue(mConstants,
|
||||||
|
"com.android.bluetooth", Process.BLUETOOTH_UID);
|
||||||
|
|
||||||
|
// Mark the process as freezable
|
||||||
|
queue.setProcessAndUidState(mProcess, false, true);
|
||||||
|
final Intent timeTick = new Intent(Intent.ACTION_TIME_TICK);
|
||||||
|
final BroadcastOptions options = BroadcastOptions.makeWithDeferUntilActive(true);
|
||||||
|
final BroadcastRecord timeTickRecord = makeBroadcastRecord(timeTick, options,
|
||||||
|
List.of(makeMockRegisteredReceiver()), false);
|
||||||
|
enqueueOrReplaceBroadcast(queue, timeTickRecord, 0);
|
||||||
|
|
||||||
|
assertEquals(Long.MAX_VALUE, queue.getRunnableAt());
|
||||||
|
assertEquals(BroadcastProcessQueue.REASON_CACHED_INFINITE_DEFER,
|
||||||
|
queue.getRunnableAtReason());
|
||||||
|
|
||||||
|
queue.setProcessAndUidState(mProcess, false, false);
|
||||||
|
assertThat(queue.getRunnableAt()).isEqualTo(timeTickRecord.enqueueTime);
|
||||||
|
assertEquals(BroadcastProcessQueue.REASON_CORE_UID, queue.getRunnableAtReason());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a cached process that would normally be delayed becomes
|
* Verify that a cached process that would normally be delayed becomes
|
||||||
* immediately runnable when the given broadcast is enqueued.
|
* immediately runnable when the given broadcast is enqueued.
|
||||||
|
|||||||
Reference in New Issue
Block a user