Merge "RESTRICT AUTOMERGE: Disable file compaction by default" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fc6f91498c
@@ -110,6 +110,8 @@ public final class CachedAppOptimizer {
|
|||||||
|
|
||||||
private static final String ATRACE_COMPACTION_TRACK = "Compaction";
|
private static final String ATRACE_COMPACTION_TRACK = "Compaction";
|
||||||
|
|
||||||
|
@VisibleForTesting static final boolean ENABLE_FILE_COMPACT = false;
|
||||||
|
|
||||||
// Defaults for phenotype flags.
|
// Defaults for phenotype flags.
|
||||||
@VisibleForTesting static final Boolean DEFAULT_USE_COMPACTION = false;
|
@VisibleForTesting static final Boolean DEFAULT_USE_COMPACTION = false;
|
||||||
@VisibleForTesting static final Boolean DEFAULT_USE_FREEZER = true;
|
@VisibleForTesting static final Boolean DEFAULT_USE_FREEZER = true;
|
||||||
@@ -515,10 +517,12 @@ public final class CachedAppOptimizer {
|
|||||||
|
|
||||||
@GuardedBy("mProcLock")
|
@GuardedBy("mProcLock")
|
||||||
void compactAppSome(ProcessRecord app, boolean force) {
|
void compactAppSome(ProcessRecord app, boolean force) {
|
||||||
|
if (ENABLE_FILE_COMPACT) {
|
||||||
app.mOptRecord.setReqCompactAction(COMPACT_PROCESS_SOME);
|
app.mOptRecord.setReqCompactAction(COMPACT_PROCESS_SOME);
|
||||||
++mSomeCompactRequest;
|
++mSomeCompactRequest;
|
||||||
compactApp(app, force, "some");
|
compactApp(app, force, "some");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This method returns true only if requirements are met. Note, that requirements are different
|
// This method returns true only if requirements are met. Note, that requirements are different
|
||||||
// from throttles applied at the time a compaction is trying to be executed in the sense that
|
// from throttles applied at the time a compaction is trying to be executed in the sense that
|
||||||
@@ -1278,6 +1282,15 @@ public final class CachedAppOptimizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ENABLE_FILE_COMPACT) {
|
||||||
|
// Turn off file compaction
|
||||||
|
if (resolvedAction == COMPACT_ACTION_FULL) {
|
||||||
|
resolvedAction = COMPACT_ACTION_ANON;
|
||||||
|
} else if (resolvedAction == COMPACT_ACTION_FILE) {
|
||||||
|
resolvedAction = COMPACT_ACTION_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return resolvedAction;
|
return resolvedAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1545,6 +1558,9 @@ public final class CachedAppOptimizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int resolvedAction = resolveCompactionAction(requestedAction);
|
int resolvedAction = resolveCompactionAction(requestedAction);
|
||||||
|
if (resolvedAction == COMPACT_ACTION_NONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
action = compactActionIntToString(resolvedAction);
|
action = compactActionIntToString(resolvedAction);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1079,6 +1079,7 @@ public final class CachedAppOptimizerTest {
|
|||||||
|
|
||||||
mCachedAppOptimizerUnderTest.mLastCompactionStats.clear();
|
mCachedAppOptimizerUnderTest.mLastCompactionStats.clear();
|
||||||
|
|
||||||
|
if (CachedAppOptimizer.ENABLE_FILE_COMPACT) {
|
||||||
// We force a some compaction
|
// We force a some compaction
|
||||||
mCachedAppOptimizerUnderTest.compactAppSome(processRecord, true);
|
mCachedAppOptimizerUnderTest.compactAppSome(processRecord, true);
|
||||||
waitForHandler();
|
waitForHandler();
|
||||||
@@ -1088,6 +1089,7 @@ public final class CachedAppOptimizerTest {
|
|||||||
assertThat(executedCompactAction)
|
assertThat(executedCompactAction)
|
||||||
.isEqualTo(mCachedAppOptimizerUnderTest.mCompactActionSome);
|
.isEqualTo(mCachedAppOptimizerUnderTest.mCompactActionSome);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setFlag(String key, String value, boolean defaultValue) throws Exception {
|
private void setFlag(String key, String value, boolean defaultValue) throws Exception {
|
||||||
mCountDown = new CountDownLatch(1);
|
mCountDown = new CountDownLatch(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user