Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java +20 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,7 @@ public class Task { public Task(Task other) { this(other.key, other.colorPrimary, other.colorBackground, other.isDockable, other.isLocked, other.taskDescription, other.topActivity); lastSnapshotData.set(other.lastSnapshotData); } /** Loading Loading @@ -281,6 +282,25 @@ public class Task { : key.baseIntent.getComponent(); } public void setLastSnapshotData(ActivityManager.RecentTaskInfo rawTask) { lastSnapshotData.set(rawTask.lastSnapshotData); } /** * Returns the visible width to height ratio. Returns 0f if snapshot data is not available. */ public float getVisibleThumbnailRatio() { if (lastSnapshotData.taskSize == null || lastSnapshotData.contentInsets == null) { return 0f; } float availableWidth = lastSnapshotData.taskSize.x - (lastSnapshotData.contentInsets.left + lastSnapshotData.contentInsets.right); float availableHeight = lastSnapshotData.taskSize.y - (lastSnapshotData.contentInsets.top + lastSnapshotData.contentInsets.bottom); return availableWidth / availableHeight; } @Override public boolean equals(Object o) { // Check that the id matches Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/model/Task.java +20 −0 Original line number Diff line number Diff line Loading @@ -254,6 +254,7 @@ public class Task { public Task(Task other) { this(other.key, other.colorPrimary, other.colorBackground, other.isDockable, other.isLocked, other.taskDescription, other.topActivity); lastSnapshotData.set(other.lastSnapshotData); } /** Loading Loading @@ -281,6 +282,25 @@ public class Task { : key.baseIntent.getComponent(); } public void setLastSnapshotData(ActivityManager.RecentTaskInfo rawTask) { lastSnapshotData.set(rawTask.lastSnapshotData); } /** * Returns the visible width to height ratio. Returns 0f if snapshot data is not available. */ public float getVisibleThumbnailRatio() { if (lastSnapshotData.taskSize == null || lastSnapshotData.contentInsets == null) { return 0f; } float availableWidth = lastSnapshotData.taskSize.x - (lastSnapshotData.contentInsets.left + lastSnapshotData.contentInsets.right); float availableHeight = lastSnapshotData.taskSize.y - (lastSnapshotData.contentInsets.top + lastSnapshotData.contentInsets.bottom); return availableWidth / availableHeight; } @Override public boolean equals(Object o) { // Check that the id matches Loading