Merge "Rename Sensors 2.0 Default Implementation"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 0900eea..fa711ca 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -69,3 +69,5 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.1.policy)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.configstore@1.1-service)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.configstore@1.1-service.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.cas@1.0*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.cas@1.0*)
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp
index 08354b3..3e3ef43 100644
--- a/camera/common/1.0/default/CameraModule.cpp
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -462,6 +462,17 @@
     return res;
 }
 
+void CameraModule::notifyDeviceStateChange(uint64_t deviceState) {
+   if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 &&
+           mModule->notify_device_state_change != NULL) {
+       ATRACE_BEGIN("camera_module->notify_device_state_change");
+       ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__,
+               deviceState);
+       mModule->notify_device_state_change(deviceState);
+       ATRACE_END();
+   }
+}
+
 status_t CameraModule::filterOpenErrorCode(status_t err) {
     switch(err) {
         case NO_ERROR:
diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/1.0/default/include/CameraModule.h
index ee75e72..32c387f 100644
--- a/camera/common/1.0/default/include/CameraModule.h
+++ b/camera/common/1.0/default/include/CameraModule.h
@@ -67,6 +67,7 @@
     void removeCamera(int cameraId);
     int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo);
     int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams);
+    void notifyDeviceStateChange(uint64_t deviceState);
 
 private:
     // Derive camera characteristics keys defined after HAL device version
diff --git a/camera/device/3.5/types.hal b/camera/device/3.5/types.hal
index 613187d..7cb9727 100644
--- a/camera/device/3.5/types.hal
+++ b/camera/device/3.5/types.hal
@@ -18,6 +18,7 @@
 
 import @3.2::StreamBuffer;
 import @3.4::StreamConfiguration;
+import @3.2::CameraBlobId;
 
 /**
  * StreamConfiguration:
@@ -129,3 +130,35 @@
     uint32_t numBuffersRequested;
 };
 
+/**
+ * CameraBlob:
+ *
+ * Identical to @3.2::CameraBlob, except that it also supports transport of JPEG
+ * APP segments blob, which contains JPEG APP1 to APPn (Application Marker)
+ * segments as specified in JEITA CP-3451.
+ *
+ * To capture a JPEG APP segments blob, a stream is created using the pixel format
+ * HAL_PIXEL_FORMAT_BLOB and dataspace HAL_DATASPACE_JPEG_APP_SEGMENTS. The buffer
+ * size for the stream is calculated by the framework, based on the static
+ * metadata field android.heic.maxAppSegmentsCount.
+ *
+ * Similar to JPEG image, the JPEG APP segment images can be of variable size,
+ * so the HAL needs to include the final size of all APP segments using this
+ * structure inside the output stream buffer. The camera blob ID field must be
+ * set to CameraBlobId::JPEG_APP_SEGMENTS.
+ *
+ * The transport header must be at the end of the JPEG APP segments output stream
+ * buffer. That means the blobId must start at byte[buffer_size -
+ * sizeof(CameraBlob)], where the buffer_size is the size of gralloc
+ * buffer. The JPEG APP segments data itself starts at the beginning of the
+ * buffer and must be blobSize bytes long.
+ */
+enum CameraBlobId : @3.2::CameraBlobId {
+    JPEG_APP_SEGMENTS = 0x100,
+};
+
+struct CameraBlob {
+    CameraBlobId blobId;
+    uint32_t blobSize;
+};
+
diff --git a/camera/metadata/3.4/Android.bp b/camera/metadata/3.4/Android.bp
index 388df68..17a2675 100644
--- a/camera/metadata/3.4/Android.bp
+++ b/camera/metadata/3.4/Android.bp
@@ -15,6 +15,9 @@
     ],
     types: [
         "CameraMetadataEnumAndroidInfoSupportedBufferManagementVersion",
+        "CameraMetadataEnumAndroidScalerAvailableFormats",
+        "CameraMetadataEnumAndroidScalerAvailableRecommendedStreamConfigurations",
+        "CameraMetadataEnumAndroidSensorInfoColorFilterArrangement",
         "CameraMetadataTag",
     ],
     gen_java: true,
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index a79fe53..bb630f1 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -26,7 +26,34 @@
 import android.hardware.camera.metadata@3.2;
 import android.hardware.camera.metadata@3.3;
 
-// No new metadata sections added in this revision
+/**
+ * Top level hierarchy definitions for camera metadata. *_INFO sections are for
+ * the static metadata that can be retrived without opening the camera device.
+ */
+enum CameraMetadataSection : @3.3::CameraMetadataSection {
+    ANDROID_HEIC =
+        android.hardware.camera.metadata@3.3::CameraMetadataSection:ANDROID_SECTION_COUNT,
+
+    ANDROID_HEIC_INFO,
+
+    ANDROID_SECTION_COUNT_3_4,
+
+    VENDOR_SECTION_3_4 = 0x8000,
+
+};
+
+/**
+ * Hierarchy positions in enum space. All vendor extension sections must be
+ * defined with tag >= VENDOR_SECTION_START
+ */
+enum CameraMetadataSectionStart : android.hardware.camera.metadata@3.3::CameraMetadataSectionStart {
+    ANDROID_HEIC_START = CameraMetadataSection:ANDROID_HEIC << 16,
+
+    ANDROID_HEIC_INFO_START = CameraMetadataSection:ANDROID_HEIC_INFO << 16,
+
+    VENDOR_SECTION_START_3_4 = CameraMetadataSection:VENDOR_SECTION_3_4 << 16,
+
+};
 
 /**
  * Main enumeration for defining camera metadata tags added in this revision
@@ -105,6 +132,47 @@
 
     ANDROID_LOGICAL_MULTI_CAMERA_END_3_4,
 
+    /** android.heic.availableHeicStreamConfigurations [static, enum[], ndk_public]
+     *
+     * <p>The available HEIC (ISO/IEC 23008-12) stream
+     * configurations that this camera device supports
+     * (i.e. format, width, height, output/input stream).</p>
+     */
+    ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = CameraMetadataSectionStart:ANDROID_HEIC_START,
+
+    /** android.heic.availableHeicMinFrameDurations [static, int64[], ndk_public]
+     *
+     * <p>This lists the minimum frame duration for each
+     * format/size combination for HEIC output formats.</p>
+     */
+    ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS,
+
+    /** android.heic.availableHeicStallDurations [static, int64[], ndk_public]
+     *
+     * <p>This lists the maximum stall duration for each
+     * output format/size combination for HEIC streams.</p>
+     */
+    ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS,
+
+    ANDROID_HEIC_END_3_4,
+
+    /** android.heic.info.supported [static, enum, system]
+     *
+     * <p>Whether this camera device can support identical set of stream combinations
+     * involving HEIC image format, compared to the
+     * <a href="https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html#createCaptureSession">table of combinations</a>
+     * involving JPEG image format required for the device's hardware level and capabilities.</p>
+     */
+    ANDROID_HEIC_INFO_SUPPORTED = CameraMetadataSectionStart:ANDROID_HEIC_INFO_START,
+
+    /** android.heic.info.maxJpegAppSegmentsCount [static, byte, system]
+     *
+     * <p>The maximum number of Jpeg APP segments supported by the camera HAL device.</p>
+     */
+    ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT,
+
+    ANDROID_HEIC_INFO_END_3_4,
+
 };
 
 /*
@@ -174,3 +242,19 @@
     ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT,
     ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT,
 };
+
+/** android.heic.availableHeicStreamConfigurations enumeration values
+ * @see ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS
+ */
+enum CameraMetadataEnumAndroidHeicAvailableHeicStreamConfigurations : uint32_t {
+    ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT,
+    ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT,
+};
+
+/** android.heic.info.supported enumeration values
+ * @see ANDROID_HEIC_INFO_SUPPORTED
+ */
+enum CameraMetadataEnumAndroidHeicInfoSupported : uint32_t {
+    ANDROID_HEIC_INFO_SUPPORTED_FALSE,
+    ANDROID_HEIC_INFO_SUPPORTED_TRUE,
+};
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 81e5738..9d73934 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -1,46 +1,126 @@
 cc_library_shared {
-    name: "android.hardware.camera.provider@2.4-impl",
+    name: "android.hardware.camera.provider@2.4-legacy",
     defaults: ["hidl_defaults"],
     proprietary: true,
-    relative_install_path: "hw",
-    srcs: ["CameraProvider.cpp",
-           "ExternalCameraProvider.cpp"],
+    srcs: ["LegacyCameraProviderImpl_2_4.cpp"],
     shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libutils",
-        "libcutils",
+        "android.hardware.camera.common@1.0",
         "android.hardware.camera.device@1.0",
         "android.hardware.camera.device@3.2",
         "android.hardware.camera.device@3.3",
         "android.hardware.camera.device@3.4",
         "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
         "camera.device@1.0-impl",
         "camera.device@3.2-impl",
         "camera.device@3.3-impl",
         "camera.device@3.4-impl",
         "camera.device@3.5-impl",
-        "camera.device@3.4-external-impl",
-        "camera.device@3.5-external-impl",
-        "android.hardware.camera.provider@2.4",
-        "android.hardware.camera.common@1.0",
-        "android.hardware.graphics.mapper@2.0",
-        "android.hidl.allocator@1.0",
-        "android.hidl.memory@1.0",
-        "liblog",
-        "libhardware",
         "libcamera_metadata",
-        "libtinyxml2"
-    ],
-    header_libs: [
-        "camera.device@3.4-impl_headers",
-        "camera.device@3.5-impl_headers",
-        "camera.device@3.4-external-impl_headers",
-        "camera.device@3.5-external-impl_headers"
+        "libcutils",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
     ],
     static_libs: [
         "android.hardware.camera.common@1.0-helper",
     ],
+    header_libs: [
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-impl_headers",
+    ],
+    export_include_dirs: ["."],
+}
+
+cc_library_shared {
+    name: "android.hardware.camera.provider@2.4-external",
+    proprietary: true,
+    srcs: ["ExternalCameraProviderImpl_2_4.cpp"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "camera.device@3.3-impl",
+        "camera.device@3.4-external-impl",
+        "camera.device@3.4-impl",
+        "camera.device@3.5-external-impl",
+        "camera.device@3.5-impl",
+        "libcamera_metadata",
+        "libcutils",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libtinyxml2",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.5-external-impl_headers"
+    ],
+    export_include_dirs: ["."],
+}
+
+cc_library_shared {
+    name: "android.hardware.camera.provider@2.4-impl",
+    defaults: ["hidl_defaults"],
+    proprietary: true,
+    relative_install_path: "hw",
+    srcs: ["CameraProvider_2_4.cpp"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.4-external",
+        "android.hardware.camera.provider@2.4-legacy",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "camera.device@1.0-impl",
+        "camera.device@3.2-impl",
+        "camera.device@3.3-impl",
+        "camera.device@3.4-external-impl",
+        "camera.device@3.4-impl",
+        "camera.device@3.5-external-impl",
+        "camera.device@3.5-impl",
+        "libcamera_metadata",
+        "libcutils",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libtinyxml2",
+        "libutils",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-external-impl_headers",
+        "camera.device@3.5-impl_headers",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    export_include_dirs: ["."],
 }
 
 cc_defaults {
@@ -50,18 +130,32 @@
     relative_install_path: "hw",
     srcs: ["service.cpp"],
     shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libbinder",
-        "liblog",
-        "libutils",
+        "android.hardware.camera.common@1.0",
         "android.hardware.camera.device@1.0",
         "android.hardware.camera.device@3.2",
         "android.hardware.camera.device@3.3",
         "android.hardware.camera.device@3.4",
         "android.hardware.camera.device@3.5",
         "android.hardware.camera.provider@2.4",
-        "android.hardware.camera.common@1.0",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "libbinder",
+        "libcamera_metadata",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-external-impl_headers",
+        "camera.device@3.5-impl_headers",
     ],
 }
 
@@ -106,17 +200,24 @@
     compile_multilib: "32",
     init_rc: ["android.hardware.camera.provider@2.4-external-service.rc"],
     shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libbinder",
-        "liblog",
-        "libutils",
+        "android.hardware.camera.common@1.0",
         "android.hardware.camera.device@1.0",
         "android.hardware.camera.device@3.2",
         "android.hardware.camera.device@3.3",
         "android.hardware.camera.device@3.4",
         "android.hardware.camera.device@3.5",
         "android.hardware.camera.provider@2.4",
-        "android.hardware.camera.common@1.0",
+        "libbinder",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libtinyxml2",
+        "libutils",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-external-impl_headers",
+        "camera.device@3.5-impl_headers",
     ],
 }
diff --git a/camera/provider/2.4/default/CameraProvider_2_4.cpp b/camera/provider/2.4/default/CameraProvider_2_4.cpp
new file mode 100644
index 0000000..15fc702
--- /dev/null
+++ b/camera/provider/2.4/default/CameraProvider_2_4.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "CameraProvider_2_4.h"
+#include "LegacyCameraProviderImpl_2_4.h"
+#include "ExternalCameraProviderImpl_2_4.h"
+
+const char *kLegacyProviderName = "legacy/0";
+const char *kExternalProviderName = "external/0";
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_4 {
+namespace implementation {
+
+using android::hardware::camera::provider::V2_4::ICameraProvider;
+
+extern "C" ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name);
+
+template<typename IMPL>
+CameraProvider<IMPL>* getProviderImpl() {
+    CameraProvider<IMPL> *provider = new CameraProvider<IMPL>();
+    if (provider == nullptr) {
+        ALOGE("%s: cannot allocate camera provider!", __FUNCTION__);
+        return nullptr;
+    }
+    if (provider->isInitFailed()) {
+        ALOGE("%s: camera provider init failed!", __FUNCTION__);
+        delete provider;
+        return nullptr;
+    }
+    return provider;
+}
+
+ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name) {
+    using namespace android::hardware::camera::provider::V2_4::implementation;
+    ICameraProvider* provider = nullptr;
+    if (strcmp(name, kLegacyProviderName) == 0) {
+        provider = getProviderImpl<LegacyCameraProviderImpl_2_4>();
+    } else if (strcmp(name, kExternalProviderName) == 0) {
+        provider = getProviderImpl<ExternalCameraProviderImpl_2_4>();
+    } else {
+        ALOGE("%s: unknown instance name: %s", __FUNCTION__, name);
+    }
+
+    return provider;
+}
+
+}  // namespace implementation
+}  // namespace V2_4
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/provider/2.4/default/CameraProvider_2_4.h b/camera/provider/2.4/default/CameraProvider_2_4.h
new file mode 100644
index 0000000..d2e5b94
--- /dev/null
+++ b/camera/provider/2.4/default/CameraProvider_2_4.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_4 {
+namespace implementation {
+
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::provider::V2_4::ICameraProvider;
+using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
+using ::android::hardware::Return;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+template<typename IMPL>
+struct CameraProvider : public ICameraProvider {
+    CameraProvider() : impl() {}
+    ~CameraProvider() {}
+
+    // Caller must use this method to check if CameraProvider ctor failed
+    bool isInitFailed() { return impl.isInitFailed(); }
+
+    // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
+    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override {
+        return impl.setCallback(callback);
+    }
+
+    Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override {
+        return impl.getVendorTags(_hidl_cb);
+    }
+
+    Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override {
+        return impl.getCameraIdList(_hidl_cb);
+    }
+
+    Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override {
+        return impl.isSetTorchModeSupported(_hidl_cb);
+    }
+
+    Return<void> getCameraDeviceInterface_V1_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V1_x_cb _hidl_cb) override {
+        return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb);
+    }
+
+    Return<void> getCameraDeviceInterface_V3_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V3_x_cb _hidl_cb) override {
+        return impl.getCameraDeviceInterface_V3_x(cameraDeviceName, _hidl_cb);
+    }
+
+private:
+    IMPL impl;
+};
+
+}  // namespace implementation
+}  // namespace V2_4
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
diff --git a/camera/provider/2.4/default/ExternalCameraProvider.cpp b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp
similarity index 87%
rename from camera/provider/2.4/default/ExternalCameraProvider.cpp
rename to camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp
index 604df5c..a6fd288 100644
--- a/camera/provider/2.4/default/ExternalCameraProvider.cpp
+++ b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "CamPvdr@2.4-external"
+#define LOG_TAG "CamPrvdr@2.4-external"
 //#define LOG_NDEBUG 0
 #include <log/log.h>
 
@@ -22,10 +22,10 @@
 #include <sys/inotify.h>
 #include <errno.h>
 #include <linux/videodev2.h>
-#include "ExternalCameraProvider.h"
+#include <cutils/properties.h>
+#include "ExternalCameraProviderImpl_2_4.h"
 #include "ExternalCameraDevice_3_4.h"
 #include "ExternalCameraDevice_3_5.h"
-#include <cutils/properties.h>
 
 namespace android {
 namespace hardware {
@@ -34,6 +34,8 @@
 namespace V2_4 {
 namespace implementation {
 
+template struct CameraProvider<ExternalCameraProviderImpl_2_4>;
+
 namespace {
 // "device@<version>/external/<id>"
 const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/external/(.+)");
@@ -60,7 +62,7 @@
 
 } // anonymous namespace
 
-ExternalCameraProvider::ExternalCameraProvider() :
+ExternalCameraProviderImpl_2_4::ExternalCameraProviderImpl_2_4() :
         mCfg(ExternalCameraConfig::loadFromCfg()),
         mHotPlugThread(this) {
     mHotPlugThread.run("ExtCamHotPlug", PRIORITY_BACKGROUND);
@@ -81,12 +83,12 @@
     }
 }
 
-ExternalCameraProvider::~ExternalCameraProvider() {
+ExternalCameraProviderImpl_2_4::~ExternalCameraProviderImpl_2_4() {
     mHotPlugThread.requestExit();
 }
 
 
-Return<Status> ExternalCameraProvider::setCallback(
+Return<Status> ExternalCameraProviderImpl_2_4::setCallback(
         const sp<ICameraProviderCallback>& callback) {
     {
         Mutex::Autolock _l(mLock);
@@ -105,14 +107,16 @@
     return Status::OK;
 }
 
-Return<void> ExternalCameraProvider::getVendorTags(getVendorTags_cb _hidl_cb) {
+Return<void> ExternalCameraProviderImpl_2_4::getVendorTags(
+        ICameraProvider::getVendorTags_cb _hidl_cb) {
     // No vendor tag support for USB camera
     hidl_vec<VendorTagSection> zeroSections;
     _hidl_cb(Status::OK, zeroSections);
     return Void();
 }
 
-Return<void> ExternalCameraProvider::getCameraIdList(getCameraIdList_cb _hidl_cb) {
+Return<void> ExternalCameraProviderImpl_2_4::getCameraIdList(
+        ICameraProvider::getCameraIdList_cb _hidl_cb) {
     // External camera HAL always report 0 camera, and extra cameras
     // are just reported via cameraDeviceStatusChange callbacks
     hidl_vec<hidl_string> hidlDeviceNameList;
@@ -120,25 +124,25 @@
     return Void();
 }
 
-Return<void> ExternalCameraProvider::isSetTorchModeSupported(
-        isSetTorchModeSupported_cb _hidl_cb) {
+Return<void> ExternalCameraProviderImpl_2_4::isSetTorchModeSupported(
+        ICameraProvider::isSetTorchModeSupported_cb _hidl_cb) {
     // setTorchMode API is supported, though right now no external camera device
     // has a flash unit.
     _hidl_cb (Status::OK, true);
     return Void();
 }
 
-Return<void> ExternalCameraProvider::getCameraDeviceInterface_V1_x(
+Return<void> ExternalCameraProviderImpl_2_4::getCameraDeviceInterface_V1_x(
         const hidl_string&,
-        getCameraDeviceInterface_V1_x_cb _hidl_cb) {
+        ICameraProvider::getCameraDeviceInterface_V1_x_cb _hidl_cb) {
     // External Camera HAL does not support HAL1
     _hidl_cb(Status::OPERATION_NOT_SUPPORTED, nullptr);
     return Void();
 }
 
-Return<void> ExternalCameraProvider::getCameraDeviceInterface_V3_x(
+Return<void> ExternalCameraProviderImpl_2_4::getCameraDeviceInterface_V3_x(
         const hidl_string& cameraDeviceName,
-        getCameraDeviceInterface_V3_x_cb _hidl_cb) {
+        ICameraProvider::getCameraDeviceInterface_V3_x_cb _hidl_cb) {
 
     std::string cameraId, deviceVersion;
     bool match = matchDeviceName(cameraDeviceName, &deviceVersion, &cameraId);
@@ -194,7 +198,7 @@
     return Void();
 }
 
-void ExternalCameraProvider::addExternalCamera(const char* devName) {
+void ExternalCameraProviderImpl_2_4::addExternalCamera(const char* devName) {
     ALOGI("ExtCam: adding %s to External Camera HAL!", devName);
     Mutex::Autolock _l(mLock);
     std::string deviceName;
@@ -209,7 +213,7 @@
     }
 }
 
-void ExternalCameraProvider::deviceAdded(const char* devName) {
+void ExternalCameraProviderImpl_2_4::deviceAdded(const char* devName) {
     {
         base::unique_fd fd(::open(devName, O_RDWR));
         if (fd.get() < 0) {
@@ -242,7 +246,7 @@
     return;
 }
 
-void ExternalCameraProvider::deviceRemoved(const char* devName) {
+void ExternalCameraProviderImpl_2_4::deviceRemoved(const char* devName) {
     Mutex::Autolock _l(mLock);
     std::string deviceName;
     if (mPreferredHal3MinorVersion == 5) {
@@ -260,14 +264,15 @@
     }
 }
 
-ExternalCameraProvider::HotplugThread::HotplugThread(ExternalCameraProvider* parent) :
+ExternalCameraProviderImpl_2_4::HotplugThread::HotplugThread(
+        ExternalCameraProviderImpl_2_4* parent) :
         Thread(/*canCallJava*/false),
         mParent(parent),
         mInternalDevices(parent->mCfg.mInternalDevices) {}
 
-ExternalCameraProvider::HotplugThread::~HotplugThread() {}
+ExternalCameraProviderImpl_2_4::HotplugThread::~HotplugThread() {}
 
-bool ExternalCameraProvider::HotplugThread::threadLoop() {
+bool ExternalCameraProviderImpl_2_4::HotplugThread::threadLoop() {
     // Find existing /dev/video* devices
     DIR* devdir = opendir(kDevicePath);
     if(devdir == 0) {
diff --git a/camera/provider/2.4/default/ExternalCameraProvider.h b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h
similarity index 72%
rename from camera/provider/2.4/default/ExternalCameraProvider.h
rename to camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h
index a69cf8b..8c79f68 100644
--- a/camera/provider/2.4/default/ExternalCameraProvider.h
+++ b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h
@@ -20,13 +20,14 @@
 #include <string>
 #include <unordered_map>
 #include <unordered_set>
-#include "utils/Mutex.h"
-#include "utils/Thread.h"
-#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <utils/Mutex.h>
+#include <utils/Thread.h>
 #include <hidl/Status.h>
 #include <hidl/MQDescriptor.h>
 #include "ExternalCameraUtils.h"
 
+#include "CameraProvider_2_4.h"
+
 namespace android {
 namespace hardware {
 namespace camera {
@@ -47,25 +48,32 @@
 using ::android::sp;
 using ::android::Mutex;
 
-struct ExternalCameraProvider : public ICameraProvider {
-    ExternalCameraProvider();
-    ~ExternalCameraProvider();
+/**
+ * The implementation of external webcam CameraProvider 2.4, separated
+ * from the HIDL interface layer to allow for implementation reuse by later
+ * provider versions.
+ *
+ * This camera provider supports standard UVC webcameras via the Linux V4L2
+ * UVC driver.
+ */
+struct ExternalCameraProviderImpl_2_4 {
+    ExternalCameraProviderImpl_2_4();
+    ~ExternalCameraProviderImpl_2_4();
+
+    // Caller must use this method to check if CameraProvider ctor failed
+    bool isInitFailed() { return false;}
 
     // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
-    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override;
-
-    Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override;
-
-    Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override;
-
-    Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override;
-
+    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback);
+    Return<void> getVendorTags(ICameraProvider::getVendorTags_cb _hidl_cb);
+    Return<void> getCameraIdList(ICameraProvider::getCameraIdList_cb _hidl_cb);
+    Return<void> isSetTorchModeSupported(ICameraProvider::isSetTorchModeSupported_cb _hidl_cb);
     Return<void> getCameraDeviceInterface_V1_x(
             const hidl_string&,
-            getCameraDeviceInterface_V1_x_cb) override;
+            ICameraProvider::getCameraDeviceInterface_V1_x_cb);
     Return<void> getCameraDeviceInterface_V3_x(
             const hidl_string&,
-            getCameraDeviceInterface_V3_x_cb) override;
+            ICameraProvider::getCameraDeviceInterface_V3_x_cb);
 
 private:
 
@@ -77,13 +85,13 @@
 
     class HotplugThread : public android::Thread {
     public:
-        HotplugThread(ExternalCameraProvider* parent);
+        HotplugThread(ExternalCameraProviderImpl_2_4* parent);
         ~HotplugThread();
 
         virtual bool threadLoop() override;
 
     private:
-        ExternalCameraProvider* mParent = nullptr;
+        ExternalCameraProviderImpl_2_4* mParent = nullptr;
         const std::unordered_set<std::string> mInternalDevices;
 
         int mINotifyFD = -1;
diff --git a/camera/provider/2.4/default/CameraProvider.cpp b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
similarity index 89%
rename from camera/provider/2.4/default/CameraProvider.cpp
rename to camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
index e02cc7e..4cff1b7 100644
--- a/camera/provider/2.4/default/CameraProvider.cpp
+++ b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
@@ -14,21 +14,21 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "CamProvider@2.4-impl"
+#define LOG_TAG "CamPrvdr@2.4-legacy"
 //#define LOG_NDEBUG 0
 #include <android/log.h>
 
-#include "CameraProvider.h"
-#include "ExternalCameraProvider.h"
+#include "LegacyCameraProviderImpl_2_4.h"
 #include "CameraDevice_1_0.h"
 #include "CameraDevice_3_3.h"
 #include "CameraDevice_3_4.h"
 #include "CameraDevice_3_5.h"
+#include "CameraProvider_2_4.h"
 #include <cutils/properties.h>
+#include <regex>
 #include <string.h>
 #include <utils/Trace.h>
 
-
 namespace android {
 namespace hardware {
 namespace camera {
@@ -36,9 +36,9 @@
 namespace V2_4 {
 namespace implementation {
 
+template struct CameraProvider<LegacyCameraProviderImpl_2_4>;
+
 namespace {
-const char *kLegacyProviderName = "legacy/0";
-const char *kExternalProviderName = "external/0";
 // "device@<version>/legacy/<id>"
 const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/legacy/(.+)");
 const char *kHAL3_4 = "3.4";
@@ -67,7 +67,7 @@
 using ::android::hardware::camera::common::V1_0::CameraMetadataType;
 using ::android::hardware::camera::common::V1_0::Status;
 
-void CameraProvider::addDeviceNames(int camera_id, CameraDeviceStatus status, bool cam_new)
+void LegacyCameraProviderImpl_2_4::addDeviceNames(int camera_id, CameraDeviceStatus status, bool cam_new)
 {
     char cameraId[kMaxCameraIdLen];
     snprintf(cameraId, sizeof(cameraId), "%d", camera_id);
@@ -107,7 +107,7 @@
     }
 }
 
-void CameraProvider::removeDeviceNames(int camera_id)
+void LegacyCameraProviderImpl_2_4::removeDeviceNames(int camera_id)
 {
     std::string cameraIdStr = std::to_string(camera_id);
 
@@ -134,13 +134,12 @@
 /**
  * static callback forwarding methods from HAL to instance
  */
-void CameraProvider::sCameraDeviceStatusChange(
+void LegacyCameraProviderImpl_2_4::sCameraDeviceStatusChange(
         const struct camera_module_callbacks* callbacks,
         int camera_id,
         int new_status) {
-    CameraProvider* cp = const_cast<CameraProvider*>(
-            static_cast<const CameraProvider*>(callbacks));
-
+    LegacyCameraProviderImpl_2_4* cp = const_cast<LegacyCameraProviderImpl_2_4*>(
+            static_cast<const LegacyCameraProviderImpl_2_4*>(callbacks));
     if (cp == nullptr) {
         ALOGE("%s: callback ops is null", __FUNCTION__);
         return;
@@ -181,12 +180,12 @@
     }
 }
 
-void CameraProvider::sTorchModeStatusChange(
+void LegacyCameraProviderImpl_2_4::sTorchModeStatusChange(
         const struct camera_module_callbacks* callbacks,
         const char* camera_id,
         int new_status) {
-    CameraProvider* cp = const_cast<CameraProvider*>(
-            static_cast<const CameraProvider*>(callbacks));
+    LegacyCameraProviderImpl_2_4* cp = const_cast<LegacyCameraProviderImpl_2_4*>(
+            static_cast<const LegacyCameraProviderImpl_2_4*>(callbacks));
 
     if (cp == nullptr) {
         ALOGE("%s: callback ops is null", __FUNCTION__);
@@ -206,7 +205,7 @@
     }
 }
 
-Status CameraProvider::getHidlStatus(int status) {
+Status LegacyCameraProviderImpl_2_4::getHidlStatus(int status) {
     switch (status) {
         case 0: return Status::OK;
         case -ENODEV: return Status::INTERNAL_ERROR;
@@ -217,13 +216,13 @@
     }
 }
 
-std::string CameraProvider::getLegacyCameraId(const hidl_string& deviceName) {
+std::string LegacyCameraProviderImpl_2_4::getLegacyCameraId(const hidl_string& deviceName) {
     std::string cameraId;
     matchDeviceName(deviceName, nullptr, &cameraId);
     return cameraId;
 }
 
-std::string CameraProvider::getHidlDeviceName(
+std::string LegacyCameraProviderImpl_2_4::getHidlDeviceName(
         std::string cameraId, int deviceVersion) {
     // Maybe consider create a version check method and SortedVec to speed up?
     if (deviceVersion != CAMERA_DEVICE_API_VERSION_1_0 &&
@@ -258,15 +257,15 @@
     return deviceName;
 }
 
-CameraProvider::CameraProvider() :
+LegacyCameraProviderImpl_2_4::LegacyCameraProviderImpl_2_4() :
         camera_module_callbacks_t({sCameraDeviceStatusChange,
                                    sTorchModeStatusChange}) {
     mInitFailed = initialize();
 }
 
-CameraProvider::~CameraProvider() {}
+LegacyCameraProviderImpl_2_4::~LegacyCameraProviderImpl_2_4() {}
 
-bool CameraProvider::initialize() {
+bool LegacyCameraProviderImpl_2_4::initialize() {
     camera_module_t *rawModule;
     int err = hw_get_module(CAMERA_HARDWARE_MODULE_ID,
             (const hw_module_t **)&rawModule);
@@ -343,7 +342,7 @@
 /**
  * Check that the device HAL version is still in supported.
  */
-int CameraProvider::checkCameraVersion(int id, camera_info info) {
+int LegacyCameraProviderImpl_2_4::checkCameraVersion(int id, camera_info info) {
     if (mModule == nullptr) {
         return NO_INIT;
     }
@@ -390,7 +389,7 @@
     return OK;
 }
 
-bool CameraProvider::setUpVendorTags() {
+bool LegacyCameraProviderImpl_2_4::setUpVendorTags() {
     ATRACE_CALL();
     vendor_tag_ops_t vOps = vendor_tag_ops_t();
 
@@ -447,11 +446,8 @@
 }
 
 // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
-Return<Status> CameraProvider::setCallback(const sp<ICameraProviderCallback>& callback)  {
-    if (callback == nullptr) {
-        return Status::ILLEGAL_ARGUMENT;
-    }
-
+Return<Status> LegacyCameraProviderImpl_2_4::setCallback(
+        const sp<ICameraProviderCallback>& callback) {
     Mutex::Autolock _l(mCbLock);
     mCallbacks = callback;
 
@@ -467,12 +463,14 @@
     return Status::OK;
 }
 
-Return<void> CameraProvider::getVendorTags(getVendorTags_cb _hidl_cb)  {
+Return<void> LegacyCameraProviderImpl_2_4::getVendorTags(
+        ICameraProvider::getVendorTags_cb _hidl_cb) {
     _hidl_cb(Status::OK, mVendorTagSections);
     return Void();
 }
 
-Return<void> CameraProvider::getCameraIdList(getCameraIdList_cb _hidl_cb)  {
+Return<void> LegacyCameraProviderImpl_2_4::getCameraIdList(
+        ICameraProvider::getCameraIdList_cb _hidl_cb) {
     std::vector<hidl_string> deviceNameList;
     for (auto const& deviceNamePair : mCameraDeviceNames) {
         if (std::stoi(deviceNamePair.first) >= mNumberOfLegacyCameras) {
@@ -489,14 +487,16 @@
     return Void();
 }
 
-Return<void> CameraProvider::isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) {
+Return<void> LegacyCameraProviderImpl_2_4::isSetTorchModeSupported(
+        ICameraProvider::isSetTorchModeSupported_cb _hidl_cb) {
     bool support = mModule->isSetTorchModeSupported();
     _hidl_cb (Status::OK, support);
     return Void();
 }
 
-Return<void> CameraProvider::getCameraDeviceInterface_V1_x(
-        const hidl_string& cameraDeviceName, getCameraDeviceInterface_V1_x_cb _hidl_cb)  {
+Return<void> LegacyCameraProviderImpl_2_4::getCameraDeviceInterface_V1_x(
+        const hidl_string& cameraDeviceName,
+        ICameraProvider::getCameraDeviceInterface_V1_x_cb _hidl_cb)  {
     std::string cameraId, deviceVersion;
     bool match = matchDeviceName(cameraDeviceName, &deviceVersion, &cameraId);
     if (!match) {
@@ -548,8 +548,9 @@
     return Void();
 }
 
-Return<void> CameraProvider::getCameraDeviceInterface_V3_x(
-        const hidl_string& cameraDeviceName, getCameraDeviceInterface_V3_x_cb _hidl_cb)  {
+Return<void> LegacyCameraProviderImpl_2_4::getCameraDeviceInterface_V3_x(
+        const hidl_string& cameraDeviceName,
+        ICameraProvider::getCameraDeviceInterface_V3_x_cb _hidl_cb)  {
     std::string cameraId, deviceVersion;
     bool match = matchDeviceName(cameraDeviceName, &deviceVersion, &cameraId);
     if (!match) {
@@ -647,27 +648,6 @@
     return Void();
 }
 
-ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name) {
-    if (strcmp(name, kLegacyProviderName) == 0) {
-        CameraProvider* provider = new CameraProvider();
-        if (provider == nullptr) {
-            ALOGE("%s: cannot allocate camera provider!", __FUNCTION__);
-            return nullptr;
-        }
-        if (provider->isInitFailed()) {
-            ALOGE("%s: camera provider init failed!", __FUNCTION__);
-            delete provider;
-            return nullptr;
-        }
-        return provider;
-    } else if (strcmp(name, kExternalProviderName) == 0) {
-        ExternalCameraProvider* provider = new ExternalCameraProvider();
-        return provider;
-    }
-    ALOGE("%s: unknown instance name: %s", __FUNCTION__, name);
-    return nullptr;
-}
-
 } // namespace implementation
 }  // namespace V2_4
 }  // namespace provider
diff --git a/camera/provider/2.4/default/CameraProvider.h b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.h
similarity index 79%
rename from camera/provider/2.4/default/CameraProvider.h
rename to camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.h
index 10e9b0d..b4914b3 100644
--- a/camera/provider/2.4/default/CameraProvider.h
+++ b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.h
@@ -14,16 +14,14 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
-#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_LEGACYCAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_LEGACYCAMERAPROVIDER_H
 
-#include <regex>
+#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
 #include "hardware/camera_common.h"
 #include "utils/Mutex.h"
 #include "utils/SortedVector.h"
-#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <hidl/Status.h>
-#include <hidl/MQDescriptor.h>
+
 #include "CameraModule.h"
 #include "VendorTagDescriptor.h"
 
@@ -50,26 +48,34 @@
 using ::android::sp;
 using ::android::Mutex;
 
-struct CameraProvider : public ICameraProvider, public camera_module_callbacks_t {
-    CameraProvider();
-    ~CameraProvider();
+/**
+ * The implementation of legacy wrapper CameraProvider 2.4, separated
+ * from the HIDL interface layer to allow for implementation reuse by later
+ * provider versions.
+ *
+ * This implementation supports cameras implemented via the legacy libhardware
+ * camera HAL definitions.
+ */
+struct LegacyCameraProviderImpl_2_4 : public camera_module_callbacks_t {
+    LegacyCameraProviderImpl_2_4();
+    ~LegacyCameraProviderImpl_2_4();
 
     // Caller must use this method to check if CameraProvider ctor failed
     bool isInitFailed() { return mInitFailed; }
 
     // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
-    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override;
-    Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override;
-    Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override;
-    Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override;
+    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback);
+    Return<void> getVendorTags(ICameraProvider::getVendorTags_cb _hidl_cb);
+    Return<void> getCameraIdList(ICameraProvider::getCameraIdList_cb _hidl_cb);
+    Return<void> isSetTorchModeSupported(ICameraProvider::isSetTorchModeSupported_cb _hidl_cb);
     Return<void> getCameraDeviceInterface_V1_x(
             const hidl_string& cameraDeviceName,
-            getCameraDeviceInterface_V1_x_cb _hidl_cb) override;
+            ICameraProvider::getCameraDeviceInterface_V1_x_cb _hidl_cb);
     Return<void> getCameraDeviceInterface_V3_x(
             const hidl_string& cameraDeviceName,
-            getCameraDeviceInterface_V3_x_cb _hidl_cb) override;
+            ICameraProvider::getCameraDeviceInterface_V3_x_cb _hidl_cb);
 
-private:
+protected:
     Mutex mCbLock;
     sp<ICameraProviderCallback> mCallbacks = nullptr;
 
@@ -115,9 +121,8 @@
     void addDeviceNames(int camera_id, CameraDeviceStatus status = CameraDeviceStatus::PRESENT,
                         bool cam_new = false);
     void removeDeviceNames(int camera_id);
-};
 
-extern "C" ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name);
+};
 
 }  // namespace implementation
 }  // namespace V2_4
@@ -126,4 +131,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_LEGACYCAMERAPROVIDER_H
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 15d0ea6..4475f7d 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -21,9 +21,8 @@
 #endif
 
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <hidl/LegacySupport.h>
-
 #include <binder/ProcessState.h>
+#include <hidl/LegacySupport.h>
 
 using android::status_t;
 using android::hardware::defaultLazyPassthroughServiceImplementation;
@@ -38,7 +37,7 @@
 
 int main()
 {
-    ALOGI("Camera provider Service is starting.");
+    ALOGI("CameraProvider@2.4 legacy service is starting.");
     // The camera HAL may communicate to other vendor components via
     // /dev/vndbinder
     android::ProcessState::initWithDriver("/dev/vndbinder");
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index f8f058e..5fb1fd8 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -40,6 +40,7 @@
         "android.hardware.camera.device@3.5",
 	"android.hardware.camera.metadata@3.4",
         "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.5",
         "android.hardware.graphics.allocator@2.0",
         "android.hardware.graphics.common@1.0",
         "android.hardware.graphics.mapper@2.0",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 211240a..fb78483 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -35,6 +35,7 @@
 #include <android/hardware/camera/device/3.4/ICameraDeviceCallback.h>
 #include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
 #include <android/hardware/camera/metadata/3.4/types.h>
 #include <android/hidl/manager/1.0/IServiceManager.h>
 #include <binder/MemoryHeapBase.h>
@@ -65,6 +66,7 @@
 using namespace ::android::hardware::camera::device;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
+using ::android::hardware::hidl_bitfield;
 using ::android::hardware::hidl_handle;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -543,6 +545,9 @@
 
      uint32_t id;
      ASSERT_TRUE(parseProviderName(service_name, &mProviderType, &id));
+
+     castProvider(mProvider, &mProvider2_5);
+     notifyDeviceState(provider::V2_5::DeviceState::NORMAL);
  }
  virtual void TearDown() override {}
 
@@ -680,6 +685,8 @@
         CameraHidlTest *mParent;               // Parent object
     };
 
+    void notifyDeviceState(::android::hardware::camera::provider::V2_5::DeviceState newState);
+
     void openCameraDevice(const std::string &name, sp<ICameraProvider> provider,
             sp<::android::hardware::camera::device::V1_0::ICameraDevice> *device /*out*/);
     void setupPreviewWindow(
@@ -709,6 +716,8 @@
             sp<ICameraDeviceSession> *session /*out*/,
             camera_metadata_t **staticMeta /*out*/,
             ::android::sp<ICameraDevice> *device = nullptr/*out*/);
+    void castProvider(const sp<provider::V2_4::ICameraProvider> &provider,
+            sp<provider::V2_5::ICameraProvider> *provider2_5 /*out*/);
     void castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
             sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
             sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
@@ -898,6 +907,8 @@
 
     // Camera provider service
     sp<ICameraProvider> mProvider;
+    sp<::android::hardware::camera::provider::V2_5::ICameraProvider> mProvider2_5;
+
     // Camera provider type.
     std::string mProviderType;
 };
@@ -4681,6 +4692,13 @@
     }
 }
 
+// Test camera provider@2.5 notify method
+TEST_F(CameraHidlTest, providerDeviceStateNotification) {
+
+    notifyDeviceState(provider::V2_5::DeviceState::BACK_COVERED);
+    notifyDeviceState(provider::V2_5::DeviceState::NORMAL);
+}
+
 // Retrieve all valid output stream resolutions from the camera
 // static characteristics.
 Status CameraHidlTest::getAvailableOutputStreams(camera_metadata_t *staticMeta,
@@ -5362,6 +5380,16 @@
     }
 }
 
+//Cast camera provider to corresponding version if available
+void CameraHidlTest::castProvider(const sp<ICameraProvider> &provider,
+        sp<provider::V2_5::ICameraProvider> *provider2_5 /*out*/) {
+    ASSERT_NE(nullptr, provider2_5);
+    auto castResult = provider::V2_5::ICameraProvider::castFrom(provider);
+    if (castResult.isOk()) {
+        *provider2_5 = castResult;
+    }
+}
+
 //Cast camera device session to corresponding version
 void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
         sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
@@ -5539,6 +5567,41 @@
         ADD_FAILURE() << "ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS"
             << " per API contract should never be set by Hal!";
     }
+
+    retcode = find_camera_metadata_ro_entry(metadata,
+            ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS, &entry);
+    if (0 == retcode || entry.count > 0) {
+        ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS "
+            << " per API contract should never be set by Hal!";
+    }
+
+    retcode = find_camera_metadata_ro_entry(metadata,
+            ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS, &entry);
+    if (0 == retcode || entry.count > 0) {
+        ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS "
+            << " per API contract should never be set by Hal!";
+    }
+
+    retcode = find_camera_metadata_ro_entry(metadata,
+            ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS, &entry);
+    if (0 == retcode || entry.count > 0) {
+        ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS "
+            << " per API contract should never be set by Hal!";
+    }
+
+    retcode = find_camera_metadata_ro_entry(metadata,
+            ANDROID_HEIC_INFO_SUPPORTED, &entry);
+    if (0 == retcode && entry.count > 0) {
+        retcode = find_camera_metadata_ro_entry(metadata,
+            ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT, &entry);
+        if (0 == retcode && entry.count > 0) {
+            uint8_t maxJpegAppSegmentsCount = entry.data.u8[0];
+            ASSERT_TRUE(maxJpegAppSegmentsCount >= 1 &&
+                    maxJpegAppSegmentsCount <= 16);
+        } else {
+            ADD_FAILURE() << "Get Heic maxJpegAppSegmentsCount failed!";
+        }
+    }
 }
 
 void CameraHidlTest::verifyMonochromeCharacteristics(const CameraMetadata& chars,
@@ -5774,6 +5837,13 @@
     ASSERT_TRUE(ret.isOk());
 }
 
+void CameraHidlTest::notifyDeviceState(provider::V2_5::DeviceState newState) {
+    if (mProvider2_5.get() == nullptr) return;
+
+    mProvider2_5->notifyDeviceStateChange(
+            static_cast<hidl_bitfield<provider::V2_5::DeviceState>>(newState));
+}
+
 // Open a particular camera device.
 void CameraHidlTest::openCameraDevice(const std::string &name,
         sp<ICameraProvider> provider,
diff --git a/camera/provider/2.5/Android.bp b/camera/provider/2.5/Android.bp
new file mode 100644
index 0000000..3de010a
--- /dev/null
+++ b/camera/provider/2.5/Android.bp
@@ -0,0 +1,25 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+    name: "android.hardware.camera.provider@2.5",
+    root: "android.hardware",
+    vndk: {
+        enabled: true,
+    },
+    srcs: [
+        "types.hal",
+        "ICameraProvider.hal",
+    ],
+    interfaces: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.provider@2.4",
+        "android.hidl.base@1.0",
+    ],
+    types: [
+        "DeviceState",
+    ],
+    gen_java: false,
+}
+
diff --git a/camera/provider/2.5/ICameraProvider.hal b/camera/provider/2.5/ICameraProvider.hal
new file mode 100644
index 0000000..b4cda6a
--- /dev/null
+++ b/camera/provider/2.5/ICameraProvider.hal
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.camera.provider@2.5;
+
+import android.hardware.camera.common@1.0::Status;
+import android.hardware.camera.provider@2.4::ICameraProvider;
+
+/**
+ * Camera provider HAL
+ *
+ * Version 2.5 adds support for the notifyDeviceStateChange method
+ */
+interface ICameraProvider extends @2.4::ICameraProvider {
+
+    /**
+     * notifyDeviceStateChange:
+     *
+     * Notify the HAL provider that the state of the overall device has
+     * changed in some way that the HAL may want to know about.
+     *
+     * For example, a physical shutter may have been uncovered or covered,
+     * or a camera may have been covered or uncovered by an add-on keyboard
+     * or other accessory.
+     *
+     * The state is a bitfield of potential states, and some physical configurations
+     * could plausibly correspond to multiple different combinations of state bits.
+     * The HAL must ignore any state bits it is not actively using to determine
+     * the appropriate camera configuration.
+     *
+     * For example, on some devices the FOLDED state could mean that
+     * backward-facing cameras are covered by the fold, so FOLDED by itself implies
+     * BACK_COVERED. But other devices may support folding but not cover any cameras
+     * when folded, so for those FOLDED would not imply any of the other flags.
+     * Since these relationships are very device-specific, it is difficult to specify
+     * a comprehensive policy.  But as a recommendation, it is suggested that if a flag
+     * necessarily implies other flags are set as well, then those flags should be set.
+     * So even though FOLDED would be enough to infer BACK_COVERED on some devices, the
+     * BACK_COVERED flag should also be set for clarity.
+     *
+     * This method may be invoked by the HAL client at any time. It must not
+     * cause any active camera device sessions to be closed, but may dynamically
+     * change which physical camera a logical multi-camera is using for its
+     * active and future output.
+     *
+     * The method must be invoked by the HAL client at least once before the
+     * client calls ICameraDevice::open on any camera device interfaces listed
+     * by this provider, to establish the initial device state.
+     *
+     * @param newState
+     *    The new state of the device.
+     */
+    notifyDeviceStateChange(bitfield<DeviceState> newState);
+
+};
diff --git a/camera/provider/2.5/default/Android.bp b/camera/provider/2.5/default/Android.bp
new file mode 100644
index 0000000..cd1caeb
--- /dev/null
+++ b/camera/provider/2.5/default/Android.bp
@@ -0,0 +1,187 @@
+cc_library_shared {
+    name: "android.hardware.camera.provider@2.5-legacy",
+    proprietary: true,
+    srcs: ["LegacyCameraProviderImpl_2_5.cpp"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.4-legacy",
+        "android.hardware.camera.provider@2.5",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "camera.device@1.0-impl",
+        "camera.device@3.2-impl",
+        "camera.device@3.3-impl",
+        "camera.device@3.4-impl",
+        "camera.device@3.5-impl",
+        "libcamera_metadata",
+        "libcutils",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-impl_headers",
+    ],
+    export_include_dirs: ["."],
+}
+
+cc_library_shared {
+    name: "android.hardware.camera.provider@2.5-external",
+    proprietary: true,
+    srcs: ["ExternalCameraProviderImpl_2_5.cpp"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.4-external",
+        "android.hardware.camera.provider@2.5",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "camera.device@3.3-impl",
+        "camera.device@3.4-external-impl",
+        "camera.device@3.4-impl",
+        "camera.device@3.5-external-impl",
+        "camera.device@3.5-impl",
+        "libcamera_metadata",
+        "libcutils",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libtinyxml2",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.5-external-impl_headers"
+    ],
+    export_include_dirs: ["."],
+}
+
+cc_defaults {
+    name: "camera_service_2_5_defaults",
+    defaults: ["hidl_defaults"],
+    proprietary: true,
+    relative_install_path: "hw",
+    srcs: ["service.cpp"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.4-legacy",
+        "android.hardware.camera.provider@2.5",
+        "android.hardware.camera.provider@2.5-legacy",
+        "android.hardware.graphics.mapper@2.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "libbinder",
+        "libcamera_metadata",
+        "libhardware",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-impl_headers"
+    ],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.5-service",
+    defaults: ["camera_service_2_5_defaults"],
+    compile_multilib: "32",
+    init_rc: ["android.hardware.camera.provider@2.5-service.rc"],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.5-service_64",
+    defaults: ["camera_service_2_5_defaults"],
+    compile_multilib: "64",
+    init_rc: ["android.hardware.camera.provider@2.5-service_64.rc"],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.5-service-lazy",
+    overrides: ["android.hardware.camera.provider@2.5-service"],
+    defaults: ["camera_service_2_5_defaults"],
+    compile_multilib: "32",
+    init_rc: ["android.hardware.camera.provider@2.5-service-lazy.rc"],
+    cflags: ["-DLAZY_SERVICE"],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.5-service-lazy_64",
+    overrides: ["android.hardware.camera.provider@2.5-service_64"],
+    defaults: ["camera_service_2_5_defaults"],
+    compile_multilib: "64",
+    init_rc: ["android.hardware.camera.provider@2.5-service-lazy_64.rc"],
+    cflags: ["-DLAZY_SERVICE"],
+}
+
+cc_binary {
+    name: "android.hardware.camera.provider@2.5-external-service",
+    defaults: ["hidl_defaults"],
+    proprietary: true,
+    relative_install_path: "hw",
+    srcs: ["external-service.cpp"],
+    compile_multilib: "32",
+    init_rc: ["android.hardware.camera.provider@2.5-external-service.rc"],
+    shared_libs: [
+        "android.hardware.camera.common@1.0",
+        "android.hardware.camera.device@1.0",
+        "android.hardware.camera.device@3.2",
+        "android.hardware.camera.device@3.3",
+        "android.hardware.camera.device@3.4",
+        "android.hardware.camera.device@3.5",
+        "android.hardware.camera.provider@2.4",
+        "android.hardware.camera.provider@2.4-external",
+        "android.hardware.camera.provider@2.5",
+        "android.hardware.camera.provider@2.5-external",
+        "android.hardware.graphics.mapper@2.0",
+        "libbinder",
+        "libhidlbase",
+        "libhidltransport",
+        "liblog",
+        "libtinyxml2",
+        "libutils",
+    ],
+    static_libs: [
+        "android.hardware.camera.common@1.0-helper",
+    ],
+    header_libs: [
+        "camera.device@3.4-external-impl_headers",
+        "camera.device@3.4-impl_headers",
+        "camera.device@3.5-external-impl_headers",
+        "camera.device@3.5-impl_headers",
+    ],
+}
diff --git a/camera/provider/2.5/default/CameraProvider_2_5.h b/camera/provider/2.5/default/CameraProvider_2_5.h
new file mode 100644
index 0000000..d0f1dda
--- /dev/null
+++ b/camera/provider/2.5/default/CameraProvider_2_5.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
+
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_5 {
+namespace implementation {
+
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::provider::V2_5::ICameraProvider;
+using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
+using ::android::hardware::Return;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+// Default recommended RPC thread count for camera provider implementations
+const int HWBINDER_THREAD_COUNT = 6;
+
+template<typename IMPL>
+struct CameraProvider : public ICameraProvider {
+    CameraProvider() : impl() {}
+    ~CameraProvider() {}
+
+    // Caller must use this method to check if CameraProvider ctor failed
+    bool isInitFailed() { return impl.isInitFailed(); }
+
+    // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
+    Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override {
+        return impl.setCallback(callback);
+    }
+
+    Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override {
+        return impl.getVendorTags(_hidl_cb);
+    }
+
+    Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override {
+        return impl.getCameraIdList(_hidl_cb);
+    }
+
+    Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override {
+        return impl.isSetTorchModeSupported(_hidl_cb);
+    }
+
+    Return<void> getCameraDeviceInterface_V1_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V1_x_cb _hidl_cb) override {
+        return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb);
+    }
+
+    Return<void> getCameraDeviceInterface_V3_x(
+            const hidl_string& cameraDeviceName,
+            getCameraDeviceInterface_V3_x_cb _hidl_cb) override {
+        return impl.getCameraDeviceInterface_V3_x(cameraDeviceName, _hidl_cb);
+    }
+
+    // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow.
+    Return<void> notifyDeviceStateChange(hardware::hidl_bitfield<DeviceState> newState) override {
+        return impl.notifyDeviceStateChange(newState);
+    }
+
+private:
+    IMPL impl;
+};
+
+}  // namespace implementation
+}  // namespace V2_5
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
diff --git a/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp
new file mode 100644
index 0000000..87851cd
--- /dev/null
+++ b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "CamPrvdr@2.5-external"
+//#define LOG_NDEBUG 0
+#include <log/log.h>
+
+#include "ExternalCameraProviderImpl_2_5.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_5 {
+namespace implementation {
+
+ExternalCameraProviderImpl_2_5::ExternalCameraProviderImpl_2_5() :
+        ExternalCameraProviderImpl_2_4() {
+}
+
+ExternalCameraProviderImpl_2_5::~ExternalCameraProviderImpl_2_5() {
+}
+
+Return<void> ExternalCameraProviderImpl_2_5::notifyDeviceStateChange(
+        hidl_bitfield<DeviceState> /*newState*/) {
+    return Void();
+}
+
+}  // namespace implementation
+}  // namespace V2_5
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h
new file mode 100644
index 0000000..eeaa7cc
--- /dev/null
+++ b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H
+
+#include <ExternalCameraProviderImpl_2_4.h>
+
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_5 {
+namespace implementation {
+
+using namespace ::android::hardware::camera::provider;
+
+using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::common::V1_0::VendorTagSection;
+using ::android::hardware::camera::external::common::ExternalCameraConfig;
+using ::android::hardware::camera::provider::V2_5::ICameraProvider;
+using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_bitfield;
+
+struct ExternalCameraProviderImpl_2_5 :
+        public V2_4::implementation::ExternalCameraProviderImpl_2_4 {
+    ExternalCameraProviderImpl_2_5();
+    ~ExternalCameraProviderImpl_2_5();
+
+    // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow.
+    Return<void> notifyDeviceStateChange(hidl_bitfield<DeviceState> newState);
+private:
+};
+
+}  // namespace implementation
+}  // namespace V2_5
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H
diff --git a/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp
new file mode 100644
index 0000000..5233397
--- /dev/null
+++ b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "CamPrvdr@2.5-legacy"
+//#define LOG_NDEBUG 0
+#include <android/log.h>
+#include <inttypes.h>
+
+#include "LegacyCameraProviderImpl_2_5.h"
+#include "CameraProvider_2_5.h"
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_5 {
+namespace implementation {
+
+template struct CameraProvider<LegacyCameraProviderImpl_2_5>;
+
+LegacyCameraProviderImpl_2_5::LegacyCameraProviderImpl_2_5() :
+        LegacyCameraProviderImpl_2_4() {
+}
+
+LegacyCameraProviderImpl_2_5::~LegacyCameraProviderImpl_2_5() {}
+
+Return<void> LegacyCameraProviderImpl_2_5::notifyDeviceStateChange(
+        hidl_bitfield<DeviceState> newState) {
+    ALOGD("%s: New device state: 0x%" PRIx64, __FUNCTION__, newState);
+    uint64_t state = static_cast<uint64_t>(newState);
+    mModule->notifyDeviceStateChange(state);
+    return Void();
+}
+
+}  // namespace implementation
+}  // namespace V2_5
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
diff --git a/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h
new file mode 100644
index 0000000..62dd97f
--- /dev/null
+++ b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_LEGACYCAMERAPROVIDER_H
+#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_LEGACYCAMERAPROVIDER_H
+
+#include <LegacyCameraProviderImpl_2_4.h>
+
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace provider {
+namespace V2_5 {
+namespace implementation {
+
+using namespace ::android::hardware::camera::provider;
+
+using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
+using ::android::hardware::camera::common::V1_0::Status;
+using ::android::hardware::camera::common::V1_0::TorchModeStatus;
+using ::android::hardware::camera::common::V1_0::VendorTag;
+using ::android::hardware::camera::common::V1_0::VendorTagSection;
+using ::android::hardware::camera::common::V1_0::helper::CameraModule;
+using ::android::hardware::camera::common::V1_0::helper::VendorTagDescriptor;
+using ::android::hardware::camera::provider::V2_5::DeviceState;
+using ::android::hardware::hidl_bitfield;
+using ::android::hardware::Return;
+
+struct LegacyCameraProviderImpl_2_5 : public V2_4::implementation::LegacyCameraProviderImpl_2_4 {
+    LegacyCameraProviderImpl_2_5();
+    ~LegacyCameraProviderImpl_2_5();
+
+    // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow.
+    Return<void> notifyDeviceStateChange(hidl_bitfield<DeviceState> newState);
+private:
+};
+
+}  // namespace implementation
+}  // namespace V2_5
+}  // namespace provider
+}  // namespace camera
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
diff --git a/camera/provider/2.5/default/OWNERS b/camera/provider/2.5/default/OWNERS
new file mode 100644
index 0000000..369b204
--- /dev/null
+++ b/camera/provider/2.5/default/OWNERS
@@ -0,0 +1,7 @@
+cychen@google.com
+epeev@google.com
+etalvala@google.com
+jchowdhary@google.com
+shuzhenwang@google.com
+yinchiayeh@google.com
+zhijunhe@google.com
diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc
new file mode 100644
index 0000000..107097e
--- /dev/null
+++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc
@@ -0,0 +1,9 @@
+service vendor.camera-provider-2-5-ext /vendor/bin/hw/android.hardware.camera.provider@2.5-external-service
+    interface android.hardware.camera.provider@2.5::ICameraProvider external/0
+    interface android.hardware.camera.provider@2.4::ICameraProvider external/0
+    class hal
+    user cameraserver
+    group audio camera input drmrpc usb
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc
new file mode 100644
index 0000000..b45158a
--- /dev/null
+++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc
@@ -0,0 +1,11 @@
+service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service-lazy
+    interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+    oneshot
+    disabled
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc
new file mode 100644
index 0000000..aa070d9
--- /dev/null
+++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc
@@ -0,0 +1,11 @@
+service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service-lazy_64
+    interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0
+    interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0
+    oneshot
+    disabled
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc
new file mode 100644
index 0000000..c065815
--- /dev/null
+++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc
@@ -0,0 +1,9 @@
+service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service
+    interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc
new file mode 100644
index 0000000..63dd11d
--- /dev/null
+++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc
@@ -0,0 +1,9 @@
+service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service_64
+    interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0
+    interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+    class hal
+    user cameraserver
+    group audio camera input drmrpc
+    ioprio rt 4
+    capabilities SYS_NICE
+    writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.5/default/external-service.cpp b/camera/provider/2.5/default/external-service.cpp
new file mode 100644
index 0000000..8788916
--- /dev/null
+++ b/camera/provider/2.5/default/external-service.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.camera.provider@2.5-external-service"
+
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
+#include <binder/ProcessState.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "CameraProvider_2_5.h"
+#include "ExternalCameraProviderImpl_2_5.h"
+
+using android::status_t;
+using android::hardware::camera::provider::V2_5::ICameraProvider;
+
+int main()
+{
+    using namespace android::hardware::camera::provider::V2_5::implementation;
+
+    ALOGI("CameraProvider@2.5 external webcam service is starting.");
+
+    ::android::hardware::configureRpcThreadpool(/*threads*/ HWBINDER_THREAD_COUNT, /*willJoin*/ true);
+
+    ::android::sp<ICameraProvider> provider = new CameraProvider<ExternalCameraProviderImpl_2_5>();
+
+    status_t status = provider->registerAsService("external/0");
+    LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering provider service: %d",
+            status);
+
+    ::android::hardware::joinRpcThreadpool();
+
+    return 0;
+}
diff --git a/camera/provider/2.5/default/service.cpp b/camera/provider/2.5/default/service.cpp
new file mode 100644
index 0000000..604215d
--- /dev/null
+++ b/camera/provider/2.5/default/service.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.camera.provider@2.5-service-lazy"
+#else
+#define LOG_TAG "android.hardware.camera.provider@2.5-service"
+#endif
+
+#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
+#include <binder/ProcessState.h>
+#include <hidl/HidlLazyUtils.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "CameraProvider_2_5.h"
+#include "LegacyCameraProviderImpl_2_5.h"
+
+using android::status_t;
+using android::hardware::camera::provider::V2_5::ICameraProvider;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
+
+int main()
+{
+    using namespace android::hardware::camera::provider::V2_5::implementation;
+
+    ALOGI("CameraProvider@2.5 legacy service is starting.");
+
+    ::android::hardware::configureRpcThreadpool(/*threads*/ HWBINDER_THREAD_COUNT, /*willJoin*/ true);
+
+    ::android::sp<ICameraProvider> provider = new CameraProvider<LegacyCameraProviderImpl_2_5>();
+
+    status_t status;
+    if (kLazyService) {
+        auto serviceRegistrar = std::make_shared<::android::hardware::LazyServiceRegistrar>();
+        status = serviceRegistrar->registerService(provider, "legacy/0");
+    } else {
+        status = provider->registerAsService("legacy/0");
+    }
+    LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering provider service: %d",
+            status);
+
+    ::android::hardware::joinRpcThreadpool();
+
+    return 0;
+}
diff --git a/camera/provider/2.5/types.hal b/camera/provider/2.5/types.hal
new file mode 100644
index 0000000..6a8ae83
--- /dev/null
+++ b/camera/provider/2.5/types.hal
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.camera.provider@2.5;
+
+/**
+ * DeviceState:
+ *
+ * Possible physical states of the overall device, for use with
+ * ICameraProvider::notifyDeviceStateChange.
+ *
+ */
+enum DeviceState : uint64_t {
+    /**
+     * The device is in its normal physical configuration. This is the default if the
+     * device does not support multiple different states.
+     */
+    NORMAL = 0,
+
+    /**
+     * Camera device(s) facing backward are covered.
+     */
+    BACK_COVERED = 1 << 0,
+
+    /**
+     * Camera device(s) facing foward are covered.
+     */
+    FRONT_COVERED = 1 << 1,
+
+    /**
+     * The device is folded.  If not set, the device is unfolded or does not
+     * support folding.
+     *
+     * The exact point when this status change happens during the folding
+     * operation is device-specific.
+     */
+    FOLDED = 1 << 2,
+
+};
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 0540ef1..1d3f254 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -113,7 +113,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.camera.provider</name>
-        <version>2.4</version>
+        <version>2.5</version>
         <interface>
             <name>ICameraProvider</name>
             <regex-instance>[^/]+/[0-9]+</regex-instance>
diff --git a/graphics/common/1.2/types.hal b/graphics/common/1.2/types.hal
index 3da6176..ebea1dc 100644
--- a/graphics/common/1.2/types.hal
+++ b/graphics/common/1.2/types.hal
@@ -49,6 +49,32 @@
      * Embedded depth metadata following the dynamic depth specification.
      */
     DYNAMIC_DEPTH = 0x1002,
+
+    /**
+     * JPEG APP segments format as specified by JEIDA spec
+     *
+     * The buffer must only contain APP1 (Application Marker) segment followed
+     * by zero or more APPn segments, as is specified by JEITA CP-3451C section 4.5.4.
+     * The APP1 segment optionally contains a thumbnail. The buffer will not
+     * contain main compressed image.
+     *
+     * This value is valid with formats:
+     *    HAL_PIXEL_FORMAT_BLOB: JPEG APP segments optionally containing thumbnail image
+     * in APP1. BLOB buffer with this dataspace is output by HAL, and used by
+     * camera framework to encode into a HEIC image.
+     */
+    JPEG_APP_SEGMENTS = 0x1003,
+
+    /**
+     * ISO/IEC 23008-12
+     *
+     * High Efficiency Image File Format (HEIF)
+     *
+     * This value is valid with formats:
+     *    HAL_PIXEL_FORMAT_BLOB: A HEIC image encoded by HEIC or HEVC encoder
+     * according to ISO/IEC 23008-12.
+     */
+    HEIF = 0x1004,
 };
 
 enum ColorMode : @1.1::ColorMode {
@@ -70,6 +96,18 @@
 };
 
 /**
+ * Buffer usage definitions.
+ */
+enum BufferUsage : @1.1::BufferUsage {
+    /**
+     * Buffer is used as input for HEIC encoder.
+     */
+    HW_IMAGE_ENCODER = 1ULL << 27,
+
+    /* bits 28 and 32-47 must be zero and are reserved for future versions */
+};
+
+/**
  * HIDL counterpart of `AHardwareBuffer_Desc`.
  *
  * An `AHardwareBuffer_Desc` object can be converted to and from a
diff --git a/input/classifier/1.0/default/Android.bp b/input/classifier/1.0/default/Android.bp
index ddd883c..ceb2aca 100644
--- a/input/classifier/1.0/default/Android.bp
+++ b/input/classifier/1.0/default/Android.bp
@@ -1,6 +1,6 @@
 cc_binary {
-    name: "android.hardware.input.classifier@1.0-service-example",
-    init_rc: ["android.hardware.input.classifier@1.0-service-example.rc"],
+    name: "android.hardware.input.classifier@1.0-service.default",
+    init_rc: ["android.hardware.input.classifier@1.0-service.default.rc"],
     relative_install_path: "hw",
     vendor: true,
     vintf_fragments: ["manifest_input.classifier.xml"],
diff --git a/input/classifier/1.0/default/InputClassifier.cpp b/input/classifier/1.0/default/InputClassifier.cpp
index a78bbc5..cce9190 100644
--- a/input/classifier/1.0/default/InputClassifier.cpp
+++ b/input/classifier/1.0/default/InputClassifier.cpp
@@ -31,41 +31,24 @@
 namespace implementation {
 
 // Methods from ::android::hardware::input::classifier::V1_0::IInputClassifier follow.
-Return<Classification> InputClassifier::classify(const MotionEvent& event) {
+Return<Classification> InputClassifier::classify(const MotionEvent& /*event*/) {
     /**
-     * In this example implementation, we will see how many "pixels" inside the video frame
-     * exceed the value of 250. If more than 6 such pixels are present, then treat the event
-     * as a "DEEP_PRESS".
+     * The touchscreen data is highly device-dependent.
+     * As a result, the implementation of this method will likely be hardware-specific.
+     * Here we just report gesture as not having any classification, which means that the
+     * default action will be taken in the framework.
+     * This is equivalent to not having the InputClassifier HAL at all.
      */
-    if (event.frames.size() == 0) {
-        return Classification::NONE;
-    }
-    ALOGI("Frame(O) timestamp = %" PRIu64 ", received %zu frame(s)", event.frames[0].timestamp,
-          event.frames.size());
-    for (const VideoFrame& frame : event.frames) {
-        size_t count = 0;
-        for (size_t i = 0; i < frame.data.size(); i++) {
-            if (frame.data[i] > 250) {
-                count++;
-            }
-        }
-        if (count > 6) {
-            return Classification::DEEP_PRESS;
-        }
-    }
-
     return Classification::NONE;
 }
 
 Return<void> InputClassifier::reset() {
-    // We don't have any internal state in this example implementation,
-    // so no work needed here.
+    // We don't have any internal state, so no work needed here.
     return Void();
 }
 
 Return<void> InputClassifier::resetDevice(int32_t /*deviceId*/) {
-    // We don't have any internal per-device state in this example implementation,
-    // so no work needed here.
+    // We don't have any internal per-device state, so no work needed here.
     return Void();
 }
 
diff --git a/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc b/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service.default.rc
similarity index 90%
rename from input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc
rename to input/classifier/1.0/default/android.hardware.input.classifier@1.0-service.default.rc
index f799bf4..e7d16ae 100644
--- a/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service-example.rc
+++ b/input/classifier/1.0/default/android.hardware.input.classifier@1.0-service.default.rc
@@ -1,4 +1,4 @@
-service vendor.input.classifier-1-0 /vendor/bin/hw/android.hardware.input.classifier@1.0-service-example
+service vendor.input.classifier-1-0 /vendor/bin/hw/android.hardware.input.classifier@1.0-service.default
     # Must be specified if "disabled" is set. This HAL will only start if requested via getService
     interface android.hardware.input.classifier@1.0::IInputClassifier default
     class hal
diff --git a/radio/1.4/IRadioIndication.hal b/radio/1.4/IRadioIndication.hal
index 3c61f96..f4d3ba9 100644
--- a/radio/1.4/IRadioIndication.hal
+++ b/radio/1.4/IRadioIndication.hal
@@ -53,7 +53,7 @@
             vec<EmergencyNumber> emergencyNumberList);
 
     /**
-     * Request all of the current cell information known to the radio.
+     * Report all of the current cell information known to the radio.
      *
      * @param type Type of radio indication
      * @param records Current cell information