Fix for new compactions skipped after cancelling pending compactions
When new compactions are scheduled they are added to the pending compaction process list however, they also maintain a flag that indicates whether a compaction is pending on the record, previously, when cancelling compactions we would remove the process from the list but not clear the flag, leaving the process in an uncompactable state as it would be skipped from being scheduled thinking there was a compaction happening when there wasn't any. Bug: 227502250 Test: Manual. Logging and dumpsys activity Change-Id: Id9d712bd14ba83c4d647d3e9faa88e4ddbd1b697
This commit is contained in:
@@ -1146,13 +1146,26 @@ public final class CachedAppOptimizer {
|
||||
if(wakefulness == PowerManagerInternal.WAKEFULNESS_AWAKE) {
|
||||
// Remove any pending compaction we may have scheduled to happen while screen was off
|
||||
Slog.e(TAG_AM, "Cancel pending or running compactions as system is awake");
|
||||
synchronized(mProcLock) {
|
||||
mPendingCompactionProcesses.clear();
|
||||
}
|
||||
cancelCompaction();
|
||||
cancelAllCompactions();
|
||||
}
|
||||
}
|
||||
|
||||
void cancelAllCompactions() {
|
||||
synchronized (mProcLock) {
|
||||
int size = mPendingCompactionProcesses.size();
|
||||
ProcessRecord record;
|
||||
for (int i=0; i < size; ++i) {
|
||||
record = mPendingCompactionProcesses.get(i);
|
||||
// The process record is kept alive after compactions are cleared,
|
||||
// so make sure to reset the compaction state to avoid skipping any future
|
||||
// compactions due to a stale value here.
|
||||
record.mOptRecord.setHasPendingCompact(false);
|
||||
}
|
||||
mPendingCompactionProcesses.clear();
|
||||
}
|
||||
cancelCompaction();
|
||||
}
|
||||
|
||||
@GuardedBy({"mService", "mProcLock"})
|
||||
void onOomAdjustChanged(int oldAdj, int newAdj, ProcessRecord app) {
|
||||
// Cancel any currently executing compactions
|
||||
|
||||
Reference in New Issue
Block a user