Merge "Fix strictmode error logs due to task snapshot hw buffer not being closed" into sc-dev
This commit is contained in:
@@ -62,16 +62,15 @@ public class ThumbnailData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Bitmap makeThumbnail(TaskSnapshot snapshot) {
|
private static Bitmap makeThumbnail(TaskSnapshot snapshot) {
|
||||||
final HardwareBuffer buffer = snapshot.getHardwareBuffer();
|
|
||||||
Bitmap thumbnail = null;
|
Bitmap thumbnail = null;
|
||||||
try {
|
try (final HardwareBuffer buffer = snapshot.getHardwareBuffer()) {
|
||||||
if (buffer != null) {
|
if (buffer != null) {
|
||||||
thumbnail = Bitmap.wrapHardwareBuffer(buffer, snapshot.getColorSpace());
|
thumbnail = Bitmap.wrapHardwareBuffer(buffer, snapshot.getColorSpace());
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// TODO(b/157562905): Workaround for a crash when we get a snapshot without this state
|
// TODO(b/157562905): Workaround for a crash when we get a snapshot without this state
|
||||||
Log.e("ThumbnailData", "Unexpected snapshot without USAGE_GPU_SAMPLED_IMAGE: "
|
Log.e("ThumbnailData", "Unexpected snapshot without USAGE_GPU_SAMPLED_IMAGE: "
|
||||||
+ buffer, ex);
|
+ snapshot.getHardwareBuffer(), ex);
|
||||||
}
|
}
|
||||||
if (thumbnail == null) {
|
if (thumbnail == null) {
|
||||||
Point taskSize = snapshot.getTaskSize();
|
Point taskSize = snapshot.getTaskSize();
|
||||||
|
|||||||
@@ -292,9 +292,10 @@ public class TaskStackChangeListeners {
|
|||||||
}
|
}
|
||||||
case ON_TASK_SNAPSHOT_CHANGED: {
|
case ON_TASK_SNAPSHOT_CHANGED: {
|
||||||
Trace.beginSection("onTaskSnapshotChanged");
|
Trace.beginSection("onTaskSnapshotChanged");
|
||||||
|
final TaskSnapshot snapshot = (TaskSnapshot) msg.obj;
|
||||||
|
final ThumbnailData thumbnail = new ThumbnailData(snapshot);
|
||||||
for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
|
for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
|
||||||
mTaskStackListeners.get(i).onTaskSnapshotChanged(msg.arg1,
|
mTaskStackListeners.get(i).onTaskSnapshotChanged(msg.arg1, thumbnail);
|
||||||
new ThumbnailData((TaskSnapshot) msg.obj));
|
|
||||||
}
|
}
|
||||||
Trace.endSection();
|
Trace.endSection();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user