Loading services/core/java/com/android/server/am/CachedAppOptimizer.java +19 −3 Original line number Diff line number Diff line Loading @@ -110,6 +110,8 @@ public final class CachedAppOptimizer { private static final String ATRACE_COMPACTION_TRACK = "Compaction"; @VisibleForTesting static final boolean ENABLE_FILE_COMPACT = false; // Defaults for phenotype flags. @VisibleForTesting static final Boolean DEFAULT_USE_COMPACTION = false; @VisibleForTesting static final Boolean DEFAULT_USE_FREEZER = true; Loading Loading @@ -515,10 +517,12 @@ public final class CachedAppOptimizer { @GuardedBy("mProcLock") void compactAppSome(ProcessRecord app, boolean force) { if (ENABLE_FILE_COMPACT) { app.mOptRecord.setReqCompactAction(COMPACT_PROCESS_SOME); ++mSomeCompactRequest; compactApp(app, force, "some"); } } // 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 Loading Loading @@ -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; } Loading Loading @@ -1545,6 +1558,9 @@ public final class CachedAppOptimizer { } int resolvedAction = resolveCompactionAction(requestedAction); if (resolvedAction == COMPACT_ACTION_NONE) { return; } action = compactActionIntToString(resolvedAction); try { Loading services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -1079,6 +1079,7 @@ public final class CachedAppOptimizerTest { mCachedAppOptimizerUnderTest.mLastCompactionStats.clear(); if (CachedAppOptimizer.ENABLE_FILE_COMPACT) { // We force a some compaction mCachedAppOptimizerUnderTest.compactAppSome(processRecord, true); waitForHandler(); Loading @@ -1088,6 +1089,7 @@ public final class CachedAppOptimizerTest { assertThat(executedCompactAction) .isEqualTo(mCachedAppOptimizerUnderTest.mCompactActionSome); } } private void setFlag(String key, String value, boolean defaultValue) throws Exception { mCountDown = new CountDownLatch(1); Loading Loading
services/core/java/com/android/server/am/CachedAppOptimizer.java +19 −3 Original line number Diff line number Diff line Loading @@ -110,6 +110,8 @@ public final class CachedAppOptimizer { private static final String ATRACE_COMPACTION_TRACK = "Compaction"; @VisibleForTesting static final boolean ENABLE_FILE_COMPACT = false; // Defaults for phenotype flags. @VisibleForTesting static final Boolean DEFAULT_USE_COMPACTION = false; @VisibleForTesting static final Boolean DEFAULT_USE_FREEZER = true; Loading Loading @@ -515,10 +517,12 @@ public final class CachedAppOptimizer { @GuardedBy("mProcLock") void compactAppSome(ProcessRecord app, boolean force) { if (ENABLE_FILE_COMPACT) { app.mOptRecord.setReqCompactAction(COMPACT_PROCESS_SOME); ++mSomeCompactRequest; compactApp(app, force, "some"); } } // 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 Loading Loading @@ -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; } Loading Loading @@ -1545,6 +1558,9 @@ public final class CachedAppOptimizer { } int resolvedAction = resolveCompactionAction(requestedAction); if (resolvedAction == COMPACT_ACTION_NONE) { return; } action = compactActionIntToString(resolvedAction); try { Loading
services/tests/mockingservicestests/src/com/android/server/am/CachedAppOptimizerTest.java +8 −6 Original line number Diff line number Diff line Loading @@ -1079,6 +1079,7 @@ public final class CachedAppOptimizerTest { mCachedAppOptimizerUnderTest.mLastCompactionStats.clear(); if (CachedAppOptimizer.ENABLE_FILE_COMPACT) { // We force a some compaction mCachedAppOptimizerUnderTest.compactAppSome(processRecord, true); waitForHandler(); Loading @@ -1088,6 +1089,7 @@ public final class CachedAppOptimizerTest { assertThat(executedCompactAction) .isEqualTo(mCachedAppOptimizerUnderTest.mCompactActionSome); } } private void setFlag(String key, String value, boolean defaultValue) throws Exception { mCountDown = new CountDownLatch(1); Loading