Merge "Moving check for empty snapshots earlier." into oc-dr1-dev
This commit is contained in:
@@ -400,8 +400,8 @@ public class RecentsTransitionHelper {
|
||||
view.draw(c);
|
||||
}
|
||||
node.end(c);
|
||||
return ThreadedRenderer.createHardwareBitmap(node, bufferWidth, bufferHeight)
|
||||
.createGraphicBufferHandle();
|
||||
Bitmap hwBitmap = ThreadedRenderer.createHardwareBitmap(node, bufferWidth, bufferHeight);
|
||||
return hwBitmap.createGraphicBufferHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,9 @@ package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;
|
||||
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.StackId;
|
||||
@@ -29,6 +32,7 @@ import android.graphics.Rect;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
import android.view.DisplayListCanvas;
|
||||
import android.view.RenderNode;
|
||||
import android.view.ThreadedRenderer;
|
||||
@@ -57,6 +61,7 @@ import java.io.PrintWriter;
|
||||
* To access this class, acquire the global window manager lock.
|
||||
*/
|
||||
class TaskSnapshotController {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskSnapshotController" : TAG_WM;
|
||||
|
||||
/**
|
||||
* Return value for {@link #getSnapshotMode}: We are allowed to take a real screenshot to be
|
||||
@@ -147,10 +152,17 @@ class TaskSnapshotController {
|
||||
break;
|
||||
}
|
||||
if (snapshot != null) {
|
||||
mCache.putSnapshot(task, snapshot);
|
||||
mPersister.persistSnapshot(task.mTaskId, task.mUserId, snapshot);
|
||||
if (task.getController() != null) {
|
||||
task.getController().reportSnapshotChanged(snapshot);
|
||||
final GraphicBuffer buffer = snapshot.getSnapshot();
|
||||
if (buffer.getWidth() == 0 || buffer.getHeight() == 0) {
|
||||
buffer.destroy();
|
||||
Slog.e(TAG, "Invalid task snapshot dimensions " + buffer.getWidth() + "x"
|
||||
+ buffer.getHeight());
|
||||
} else {
|
||||
mCache.putSnapshot(task, snapshot);
|
||||
mPersister.persistSnapshot(task.mTaskId, task.mUserId, snapshot);
|
||||
if (task.getController() != null) {
|
||||
task.getController().reportSnapshotChanged(snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,6 @@ class TaskSnapshotPersister {
|
||||
failed = true;
|
||||
}
|
||||
if (!writeBuffer()) {
|
||||
writeBuffer();
|
||||
failed = true;
|
||||
}
|
||||
if (failed) {
|
||||
@@ -327,11 +326,7 @@ class TaskSnapshotPersister {
|
||||
final File reducedFile = getReducedResolutionBitmapFile(mTaskId, mUserId);
|
||||
final Bitmap bitmap = Bitmap.createHardwareBitmap(mSnapshot.getSnapshot());
|
||||
if (bitmap == null) {
|
||||
Slog.e(TAG, "Invalid task snapshot");
|
||||
return false;
|
||||
} else if (bitmap.getWidth() == 0 || bitmap.getHeight() == 0) {
|
||||
Slog.e(TAG, "Invalid task snapshot dimensions " + bitmap.getWidth() + "x"
|
||||
+ bitmap.getHeight());
|
||||
Slog.e(TAG, "Invalid task snapshot hw bitmap");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user