<BUG>public static Camera.Size getBestResolution(Camera camera, ImageSize targetSize) {if (targetSize.areDimensionsDefined()) {</BUG><CONTEXT>import java.util.Collections;import java.util.Comparator;import java.util.List;public class VideoUtil {public static final int ORIENTATION_HYSTERESIS = 5;<extra_id_0>float aspectRatio = (float) targetSize.width / targetSize.height;float bestSizeAspectRatioDiff = Float.POSITIVE_INFINITY;Camera.Size bestSize = null;</CONTEXT>
public static Camera.Size getBestResolution(Camera camera, boolean isRecordingLanscape, ImageSize targetSize) {if (!isRecordingLanscape) {targetSize = new ImageSize(targetSize.height, targetSize.width);}if (targetSize.areDimensionsDefined()) {