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