Java Code Examples for android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL
The following examples show how to use
android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraInfo.java From MobileInfo with Apache License 2.0 | 6 votes |
private static String getLevel(Integer level) { if (level == null) { return UNKNOWN; } switch (level) { case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY: return "LEGACY"; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3: return "LEVEL_3"; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL: return "EXTERNAL"; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL: return "FULL"; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED: return "LIMITED"; default: return UNKNOWN + "-" + level; } }
Example 2
Source File: OneCameraCharacteristicsImpl.java From Camera2 with Apache License 2.0 | 6 votes |
@Override public SupportedHardwareLevel getSupportedHardwareLevel() { Integer supportedHardwareLevel = mCameraCharacteristics .get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL); // If this fails, it is a framework bug, per API documentation. checkNotNull(supportedHardwareLevel, "INFO_SUPPORTED_HARDWARE_LEVEL not found"); switch (supportedHardwareLevel) { case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL: return SupportedHardwareLevel.FULL; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED: return SupportedHardwareLevel.LIMITED; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY: return SupportedHardwareLevel.LEGACY; default: if (supportedHardwareLevel > CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL) { Log.i(TAG, "Unknown higher hardware level mapped to FULL: " + supportedHardwareLevel); return SupportedHardwareLevel.FULL; } throw new IllegalStateException("Invalid value for INFO_SUPPORTED_HARDWARE_LEVEL"); } }
Example 3
Source File: ScanQRActivity.java From ScreenCapture with MIT License | 5 votes |
private boolean isHardwareLevelSupported(int requiredLevel) { boolean res = false; if (mCameraId == null) return res; try { CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE); CameraCharacteristics cameraCharacteristics = manager.getCameraCharacteristics(mCameraId); int deviceLevel = cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL); switch (deviceLevel) { case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3: Log.d(TAG, "Camera support level: INFO_SUPPORTED_HARDWARE_LEVEL_3"); break; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL: Log.d(TAG, "Camera support level: INFO_SUPPORTED_HARDWARE_LEVEL_FULL"); break; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY: Log.d(TAG, "Camera support level: INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY"); break; case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED: Log.d(TAG, "Camera support level: INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED"); break; default: Log.d(TAG, "Unknown INFO_SUPPORTED_HARDWARE_LEVEL: " + deviceLevel); break; } if (deviceLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) { res = requiredLevel == deviceLevel; } else { // deviceLevel is not LEGACY, can use numerical sort res = requiredLevel <= deviceLevel; } } catch (Exception e) { Log.e(TAG, "isHardwareLevelSupported Error", e); } return res; }
Example 4
Source File: CameraH264Activity.java From AndroidDemo with MIT License | 5 votes |
CameraConfig(String cameraId, CameraCharacteristics characteristics, @NonNull CameraDevice.StateCallback deviceStateCallback, @NonNull Handler handler) { this.cameraId = cameraId; Integer orientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); this.orientation = orientation == null ? 0 : orientation; Integer level = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL); fullSupport = level != null && level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL; this.deviceStateCallback = deviceStateCallback; this.handler = handler; }
Example 5
Source File: LollipopCamera.java From LiveMultimedia with Apache License 2.0 | 5 votes |
private String determineCameraApiSupport(int level) { String support; if (level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) { support = LEGACY; } else if (level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED) { support = LIMITED; } else if (level == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL) { support = FULL; } else { support = LEGACY; } return support; }
Example 6
Source File: OneCameraFeatureConfigCreator.java From Camera2 with Apache License 2.0 | 4 votes |
private static Function<CameraCharacteristics, CaptureSupportLevel> buildCaptureModuleDetector( final ContentResolver contentResolver) { return new Function<CameraCharacteristics, CaptureSupportLevel>() { @Override public CaptureSupportLevel apply(CameraCharacteristics characteristics) { // If a capture support level override exists, use it. Otherwise // dynamically check the capabilities of the current device. Optional<CaptureSupportLevel> override = getCaptureSupportLevelOverride(characteristics, contentResolver); if (override.isPresent()) { Log.i(TAG, "Camera support level override: " + override.get().name()); return override.get(); } Integer supportedLevel = characteristics .get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL); // A hardware level should always be supported, so we should // never have to return here. If no hardware level is supported // on a LEGACY device, the LIMITED_JPEG fallback will not work. if (supportedLevel == null) { Log.e(TAG, "Device does not report supported hardware level."); return CaptureSupportLevel.LIMITED_JPEG; } // LEGACY_JPEG is the ONLY mode that is supported on LEGACY // devices. if (supportedLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) { return CaptureSupportLevel.LEGACY_JPEG; } // No matter if L or L MR1, the N5 does not currently support // ZSL due to HAL bugs. The latest one causes random preview // freezes even on MR1, see b/19565931. if (ApiHelper.IS_NEXUS_5) { return CaptureSupportLevel.LIMITED_JPEG; } if (ApiHelper.IS_NEXUS_6) { if (ApiHelper.isLMr1OrHigher()) { // Although front-facing cameras on the N6 (and N5) are not advertised as // FULL, they can do ZSL. We might want to change the check for ZSL // according to b/19625916. return CaptureSupportLevel.ZSL; } else { // On a non-LEGACY N6 (or N5) prior to Lollipop MR1 we fall back to // LIMITED_JPEG due to HAL bugs. return CaptureSupportLevel.LIMITED_JPEG; } } // On FULL devices starting with L-MR1 we can run ZSL if private reprocessing // or YUV reprocessing is supported. if (supportedLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL || supportedLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3) { if (supportsReprocessing(characteristics)) { return CaptureSupportLevel.ZSL; } else { return CaptureSupportLevel.LIMITED_YUV; } } // On LIMITED devices starting with L-MR1 we run a simple YUV // capture mode. if (supportedLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED) { return CaptureSupportLevel.LIMITED_YUV; } // We should never get here. If we do, let's fall back to a mode // that should work on all non-LEGACY devices. Log.e(TAG, "Unknown support level: " + supportedLevel); return CaptureSupportLevel.LIMITED_JPEG; } }; }
Example 7
Source File: CameraUtils.java From SimpleSmsRemote with MIT License | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public static MyCameraInfo CreateFromCameraCharacteristics(String cameraId, CameraCharacteristics characteristics) { StreamConfigurationMap configMap = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); Size[] outputSizes = configMap.getOutputSizes(ImageFormat.JPEG); List<int[]> outputResolutions = new ArrayList<>(); for (Size outputSize : outputSizes) { outputResolutions.add(new int[]{outputSize.getWidth(), outputSize.getHeight()}); } MyCameraInfo cameraInfo = new MyCameraInfo(cameraId, outputResolutions); // supported functionality depends on the supported hardware level switch (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)) { case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_3: case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL: case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED: cameraInfo.setAutofocusSupport(true); case CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY: // only supports camera 1 api features break; } int[] ints = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES); if (characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE)) cameraInfo.setFlashlightSupport(true); Integer lensFacing = characteristics.get(CameraCharacteristics.LENS_FACING); if (lensFacing != null) { if (lensFacing == CameraCharacteristics.LENS_FACING_BACK) cameraInfo.setLensFacing(LensFacing.BACK); else if (lensFacing == CameraCharacteristics.LENS_FACING_FRONT) cameraInfo.setLensFacing(LensFacing.FRONT); else if (lensFacing == CameraCharacteristics.LENS_FACING_EXTERNAL) cameraInfo.setLensFacing(LensFacing.EXTERNAL); } /* jpeg is always supported boolean isSupported = configMap.isOutputSupportedFor(0x100); */ //TODO add more info return cameraInfo; }