ResolutionFilter


public interface ResolutionFilter


Applications can filter out unsuitable sizes and sort the resolution list in the preferred order by implementing the resolution filter interface. The preferred order is the order in which the resolutions should be tried first.

Applications can create a ResolutionSelector with a proper ResolutionFilter to choose the preferred resolution.

Summary

Public methods

abstract @NonNull List<Size>
filter(@NonNull List<Size> supportedSizes, int rotationDegrees)

Removes unsuitable sizes and sorts the resolution list in the preferred order.

Public methods

filter

Added in 1.3.0
abstract @NonNull List<Sizefilter(@NonNull List<Size> supportedSizes, int rotationDegrees)

Removes unsuitable sizes and sorts the resolution list in the preferred order.

OEMs might make the width or height of the supported output sizes be mod 16 aligned for performance reasons. This means that the device might support 1920x1088 instead of 1920x1080, even though a 16:9 aspect ratio size is 1920x1080. Therefore, the input supported sizes list also contains these aspect ratio sizes when applications specify an AspectRatioStrategy with RATIO_16_9 and then also specify a ResolutionFilter to apply their own selection logic.

Parameters
@NonNull List<Size> supportedSizes

the supported output sizes which have been filtered and sorted according to the other resolution selector settings.

int rotationDegrees

the rotation degrees to rotate the image to the desired orientation, matching the UseCase’s target rotation setting View size at the front of the returned list. The value is one of the following: 0, 90, 180, or 270. For example, the target rotation set via setTargetRotation or setTargetRotation. After rotating the sizes by the rotation degrees, applications can obtain the source image size in the specified target orientation. Then, applications can put the size that best fits to the Preview's Android View size at the front of the returned list.

Returns
@NonNull List<Size>

the desired ordered sizes list for resolution selection. The returned list should only include sizes in the provided input supported sizes list.