camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/compat/workaround/ResolutionCorrector.java
/**
     * Returns a new list of resolution with the selected resolution inserted or prioritized.
     *
     * <p> If the list contains the selected resolution, move it to be the first element; if it
     * does not contain the selected resolution, insert it as the first element; if there is no
     * device quirk, return the original list.
     *
     * @param configType           the config type based on which the supported resolution is
     *                             calculated.
     * @param supportedResolutions a ordered list of resolutions calculated by CameraX.
     */
Returns a new list of resolution with the selected resolution inserted or prioritized.
 If the list contains the selected resolution, move it to be the first element; if it
does not contain the selected resolution, insert it as the first element; if there is no
device quirk, return the original list.

@param configType           the config type based on which the supported resolution is
calculated.
@param supportedResolutions a ordered list of resolutions calculated by CameraX.
Returns a new list of resolution with the selected resolution inserted or prioritized . If the list contains the selected resolution move it to be the first element ; if it does not contain the selected resolution insert it as the first element ; if there is no device quirk return the original list . @param configType the config type based on which the supported resolution is calculated . @param supportedResolutions a ordered list of resolutions calculated by CameraX .
@NonNull
    public List<Size> insertOrPrioritize(
            @NonNull SurfaceConfig.ConfigType configType,
            @NonNull List<Size> supportedResolutions) {
        if (mExtraCroppingQuirk == null) {
            return supportedResolutions;
        }
        Size selectResolution = mExtraCroppingQuirk.getVerifiedResolution(configType);
        if (selectResolution == null) {
            return supportedResolutions;
        }
        List<Size> newResolutions = new ArrayList<>();
        newResolutions.add(selectResolution);
        for (Size size : supportedResolutions) {
            if (!size.equals(selectResolution)) {
                newResolutions.add(size);
            }
        }
        return newResolutions;
    }
@ NonNull public List < Size > insertOrPrioritize ( @ NonNull SurfaceConfig . ConfigType configType , @ NonNull List < Size > supportedResolutions ) { if ( mExtraCroppingQuirk == null ) { return supportedResolutions ; } Size selectResolution = mExtraCroppingQuirk . getVerifiedResolution ( configType ) ; if ( selectResolution == null ) { return supportedResolutions ; } List < Size > newResolutions = new ArrayList < > ( ) ; newResolutions . add ( selectResolution ) ; for ( Size size : supportedResolutions ) { if ( ! size . equals ( selectResolution ) ) { newResolutions . add ( size ) ; } } return newResolutions ; }
Returns a new list of resolution with the selected resolution inserted or prioritized.
Returns a new list of resolution with the selected resolution inserted or prioritized .