Disable task snapshots on svelte
Test: Boot low ram device, make sure cache stays empty
Bug: 31339431
Change-Id: I0fac1071f17fcd13872ef68f68eee2c793c6753c
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 2b74f84..5041138 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -19,6 +19,7 @@
import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
import android.annotation.Nullable;
+import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
import android.app.ActivityManager.TaskSnapshot;
import android.graphics.GraphicBuffer;
@@ -65,26 +66,22 @@
}
void onTransitionStarting() {
- if (!ENABLE_TASK_SNAPSHOTS) {
- return;
- }
handleClosingApps(mService.mClosingApps);
}
-
/**
* Called when the visibility of an app changes outside of the regular app transition flow.
*/
void notifyAppVisibilityChanged(AppWindowToken appWindowToken, boolean visible) {
- if (!ENABLE_TASK_SNAPSHOTS) {
- return;
- }
if (!visible) {
handleClosingApps(Sets.newArraySet(appWindowToken));
}
}
private void handleClosingApps(ArraySet<AppWindowToken> closingApps) {
+ if (!ENABLE_TASK_SNAPSHOTS || ActivityManager.isLowRamDeviceStatic()) {
+ return;
+ }
// We need to take a snapshot of the task if and only if all activities of the task are
// either closing or hidden.