@Test public void buildCaptureRequestWithNullCameraDevice() throws CameraAccessException { CameraDevice cameraDevice = null; CaptureConfig captureConfig = new CaptureConfig.Builder().build(); CaptureRequest captureRequest = Camera2CaptureRequestBuilder.build(captureConfig, cameraDevice, new HashMap<DeferrableSurface, Surface>()); assertThat(captureRequest).isNull(); }
@Nullable public static CaptureRequest build(@NonNull CaptureConfig captureConfig, @Nullable CameraDevice device, @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap) throws CameraAccessException { if (device == null) { return null; } List<Surface> surfaceList = getConfiguredSurfaces(captureConfig.getSurfaces(), configuredSurfaceMap); if (surfaceList.isEmpty()) { return null; } CaptureRequest.Builder builder = device.createCaptureRequest( captureConfig.getTemplateType()); applyImplementationOptionToCaptureBuilder(builder, captureConfig.getImplementationOptions()); for (Surface surface : surfaceList) { builder.addTarget(surface); } builder.setTag(captureConfig.getTag()); return builder.build(); }
Camera2CaptureRequestBuilder { @Nullable public static CaptureRequest build(@NonNull CaptureConfig captureConfig, @Nullable CameraDevice device, @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap) throws CameraAccessException { if (device == null) { return null; } List<Surface> surfaceList = getConfiguredSurfaces(captureConfig.getSurfaces(), configuredSurfaceMap); if (surfaceList.isEmpty()) { return null; } CaptureRequest.Builder builder = device.createCaptureRequest( captureConfig.getTemplateType()); applyImplementationOptionToCaptureBuilder(builder, captureConfig.getImplementationOptions()); for (Surface surface : surfaceList) { builder.addTarget(surface); } builder.setTag(captureConfig.getTag()); return builder.build(); } }
Camera2CaptureRequestBuilder { @Nullable public static CaptureRequest build(@NonNull CaptureConfig captureConfig, @Nullable CameraDevice device, @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap) throws CameraAccessException { if (device == null) { return null; } List<Surface> surfaceList = getConfiguredSurfaces(captureConfig.getSurfaces(), configuredSurfaceMap); if (surfaceList.isEmpty()) { return null; } CaptureRequest.Builder builder = device.createCaptureRequest( captureConfig.getTemplateType()); applyImplementationOptionToCaptureBuilder(builder, captureConfig.getImplementationOptions()); for (Surface surface : surfaceList) { builder.addTarget(surface); } builder.setTag(captureConfig.getTag()); return builder.build(); }  }
Camera2CaptureRequestBuilder { @Nullable public static CaptureRequest build(@NonNull CaptureConfig captureConfig, @Nullable CameraDevice device, @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap) throws CameraAccessException { if (device == null) { return null; } List<Surface> surfaceList = getConfiguredSurfaces(captureConfig.getSurfaces(), configuredSurfaceMap); if (surfaceList.isEmpty()) { return null; } CaptureRequest.Builder builder = device.createCaptureRequest( captureConfig.getTemplateType()); applyImplementationOptionToCaptureBuilder(builder, captureConfig.getImplementationOptions()); for (Surface surface : surfaceList) { builder.addTarget(surface); } builder.setTag(captureConfig.getTag()); return builder.build(); }  @Nullable static CaptureRequest build(@NonNull CaptureConfig captureConfig,
            @Nullable CameraDevice device,
            @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap); @Nullable static CaptureRequest buildWithoutTarget(@NonNull CaptureConfig captureConfig,
            @Nullable CameraDevice device); }
Camera2CaptureRequestBuilder { @Nullable public static CaptureRequest build(@NonNull CaptureConfig captureConfig, @Nullable CameraDevice device, @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap) throws CameraAccessException { if (device == null) { return null; } List<Surface> surfaceList = getConfiguredSurfaces(captureConfig.getSurfaces(), configuredSurfaceMap); if (surfaceList.isEmpty()) { return null; } CaptureRequest.Builder builder = device.createCaptureRequest( captureConfig.getTemplateType()); applyImplementationOptionToCaptureBuilder(builder, captureConfig.getImplementationOptions()); for (Surface surface : surfaceList) { builder.addTarget(surface); } builder.setTag(captureConfig.getTag()); return builder.build(); }  @Nullable static CaptureRequest build(@NonNull CaptureConfig captureConfig,
            @Nullable CameraDevice device,
            @NonNull Map<DeferrableSurface, Surface> configuredSurfaceMap); @Nullable static CaptureRequest buildWithoutTarget(@NonNull CaptureConfig captureConfig,
            @Nullable CameraDevice device);  }