Disabled task snapshot for TV
This was causing memory leaks when opening/closing Apps view. Will disable this feature on TV since we are running low on RAM. Bug: 62040693 Test: Compiles Change-Id: Ifc43118dd072f17a047003d1797004bd441669b8
This commit is contained in:
@@ -17,15 +17,13 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
|
||||
import static android.graphics.Bitmap.Config.ARGB_8888;
|
||||
import static android.graphics.Bitmap.Config.HARDWARE;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.StackId;
|
||||
import android.app.ActivityManager.TaskSnapshot;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.GraphicBuffer;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Environment;
|
||||
@@ -38,11 +36,11 @@ import android.view.WindowManager.LayoutParams;
|
||||
import android.view.WindowManagerPolicy.ScreenOffListener;
|
||||
import android.view.WindowManagerPolicy.StartingSurface;
|
||||
|
||||
import com.google.android.collect.Sets;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.server.wm.TaskSnapshotSurface.SystemBarBackgroundPainter;
|
||||
|
||||
import com.google.android.collect.Sets;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
@@ -89,9 +87,16 @@ class TaskSnapshotController {
|
||||
private final ArraySet<Task> mTmpTasks = new ArraySet<>();
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
/**
|
||||
* Flag indicating whether we are running on an Android TV device.
|
||||
*/
|
||||
private final boolean mIsRunningOnTv;
|
||||
|
||||
TaskSnapshotController(WindowManagerService service) {
|
||||
mService = service;
|
||||
mCache = new TaskSnapshotCache(mService, mLoader);
|
||||
mIsRunningOnTv = mService.mContext.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
void systemReady() {
|
||||
@@ -112,7 +117,7 @@ class TaskSnapshotController {
|
||||
}
|
||||
|
||||
private void handleClosingApps(ArraySet<AppWindowToken> closingApps) {
|
||||
if (!ENABLE_TASK_SNAPSHOTS || ActivityManager.isLowRamDeviceStatic()) {
|
||||
if (shouldDisableSnapshots()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,6 +193,10 @@ class TaskSnapshotController {
|
||||
1f /* scale */);
|
||||
}
|
||||
|
||||
private boolean shouldDisableSnapshots() {
|
||||
return !ENABLE_TASK_SNAPSHOTS || ActivityManager.isLowRamDeviceStatic() || mIsRunningOnTv;
|
||||
}
|
||||
|
||||
private Rect minRect(Rect rect1, Rect rect2) {
|
||||
return new Rect(Math.min(rect1.left, rect2.left),
|
||||
Math.min(rect1.top, rect2.top),
|
||||
@@ -301,7 +310,7 @@ class TaskSnapshotController {
|
||||
* Called when screen is being turned off.
|
||||
*/
|
||||
void screenTurningOff(ScreenOffListener listener) {
|
||||
if (!ENABLE_TASK_SNAPSHOTS || ActivityManager.isLowRamDeviceStatic()) {
|
||||
if (shouldDisableSnapshots()) {
|
||||
listener.onScreenOff();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user