1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.camera.extensions.impl; 18 19 /** 20 * Stub implementation for the extension version check. 21 * 22 * <p>This class should be implemented by OEM and deployed to the target devices. 23 * 24 * @since 1.0 25 */ 26 public class ExtensionVersionImpl { ExtensionVersionImpl()27 public ExtensionVersionImpl() { 28 } 29 30 /** 31 * Provide the current CameraX extension library version to vendor library and vendor would 32 * need to return the supported version for this device. If the returned version is not 33 * supported by CameraX library, the Preview and ImageCapture would not be able to enable the 34 * specific effects provided by the vendor. 35 * 36 * <p>CameraX library provides the Semantic Versioning string in a form of 37 * MAJOR.MINOR.PATCH-description 38 * We will increment the 39 * MAJOR version when make incompatible API changes, 40 * MINOR version when add functionality in a backwards-compatible manner, and 41 * PATCH version when make backwards-compatible bug fixes. And the description can be ignored. 42 * 43 * <p>Vendor library should provide MAJOR.MINOR.PATCH to CameraX. The MAJOR and MINOR 44 * version is used to map to the version of CameraX that it supports, and CameraX extension 45 * would only available when MAJOR version is matched with CameraX current version. The PATCH 46 * version does not indicate compatibility. The patch version should be incremented whenever 47 * the vendor library makes bug fixes or updates to the algorithm. 48 * 49 * @param version the version of CameraX library formatted as MAJOR.MINOR.PATCH-description. 50 * @return the version that vendor supported in this device. The MAJOR.MINOR.PATCH format 51 * should be used. 52 */ checkApiVersion(String version)53 public String checkApiVersion(String version) { 54 throw new RuntimeException("Stub, replace with implementation."); 55 } 56 57 /** 58 * Specify whether or not CameraX should invoke the AdvancedExtenderImpl instead of 59 * PreviewExtenderImpl/ImageCaptureExtenderImpl. 60 * 61 * <p>Starting from version 1.2, a set of alternative interfaces called advanced extender for 62 * implementing extensions are provided to OEMs as another option. OEMs can continue using 63 * previous interfaces (PreviewExtenderImpl/ImageCaptureExtenderImpl, also called basic 64 * extender). 65 * 66 * <p>OEMs should return false here if only basic extender is implemented. When returning true, 67 * CameraX will invoke the AdvancedExtenderImpl implementation in advanced package for all 68 * types of extension modes. 69 * 70 * <p>ExtensionVersionImpl, InitializerImpl will still be called for both basic and advanced 71 * extender implementation paths. 72 * 73 * @return true if AdvancedExtenderImpl is implemented 74 * @since 1.2 75 */ isAdvancedExtenderImplemented()76 public boolean isAdvancedExtenderImplemented() { 77 return false; 78 } 79 } 80