Loading services/mediacodec/registrant/CodecServiceRegistrant.cpp +23 −38 Original line number Original line Diff line number Diff line Loading @@ -17,7 +17,7 @@ //#define LOG_NDEBUG 0 //#define LOG_NDEBUG 0 #define LOG_TAG "CodecServiceRegistrant" #define LOG_TAG "CodecServiceRegistrant" #include <android-base/properties.h> #include <android/api-level.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/properties.h> Loading Loading @@ -416,49 +416,34 @@ extern "C" void RegisterCodecServices() { using namespace ::android::hardware::media::c2; using namespace ::android::hardware::media::c2; int platformVersion = int platformVersion = android_get_device_api_level(); android::base::GetIntProperty("ro.build.version.sdk", int32_t(29)); // STOPSHIP: Remove code name checking once platform version bumps up to 30. std::string codeName = android::base::GetProperty("ro.build.version.codename", ""); if (codeName == "S") { platformVersion = 31; } switch (platformVersion) { if (platformVersion >= __ANDROID_API_S__) { case 31: { android::sp<V1_2::IComponentStore> storeV1_2 = android::sp<V1_2::IComponentStore> storeV1_2 = new V1_2::utils::ComponentStore(store); new V1_2::utils::ComponentStore(store); if (storeV1_2->registerAsService("software") != android::OK) { if (storeV1_2->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.2 service."; LOG(ERROR) << "Cannot register software Codec2 v1.2 service."; return; return; } } break; } else if (platformVersion == __ANDROID_API_R__) { } case 30: { android::sp<V1_1::IComponentStore> storeV1_1 = android::sp<V1_1::IComponentStore> storeV1_1 = new V1_1::utils::ComponentStore(store); new V1_1::utils::ComponentStore(store); if (storeV1_1->registerAsService("software") != android::OK) { if (storeV1_1->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.1 service."; LOG(ERROR) << "Cannot register software Codec2 v1.1 service."; return; return; } } break; } else if (platformVersion == __ANDROID_API_Q__) { } case 29: { android::sp<V1_0::IComponentStore> storeV1_0 = android::sp<V1_0::IComponentStore> storeV1_0 = new V1_0::utils::ComponentStore(store); new V1_0::utils::ComponentStore(store); if (storeV1_0->registerAsService("software") != android::OK) { if (storeV1_0->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.0 service."; LOG(ERROR) << "Cannot register software Codec2 v1.0 service."; return; return; } } break; } else { // platformVersion < __ANDROID_API_Q__ } default: { LOG(ERROR) << "The platform version " << platformVersion << LOG(ERROR) << "The platform version " << platformVersion << " is not supported."; " is not supported."; return; return; } } } if (!ionPropertiesDefined()) { if (!ionPropertiesDefined()) { using IComponentStore = using IComponentStore = ::android::hardware::media::c2::V1_0::IComponentStore; ::android::hardware::media::c2::V1_0::IComponentStore; Loading Loading
services/mediacodec/registrant/CodecServiceRegistrant.cpp +23 −38 Original line number Original line Diff line number Diff line Loading @@ -17,7 +17,7 @@ //#define LOG_NDEBUG 0 //#define LOG_NDEBUG 0 #define LOG_TAG "CodecServiceRegistrant" #define LOG_TAG "CodecServiceRegistrant" #include <android-base/properties.h> #include <android/api-level.h> #include <android-base/logging.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/properties.h> Loading Loading @@ -416,49 +416,34 @@ extern "C" void RegisterCodecServices() { using namespace ::android::hardware::media::c2; using namespace ::android::hardware::media::c2; int platformVersion = int platformVersion = android_get_device_api_level(); android::base::GetIntProperty("ro.build.version.sdk", int32_t(29)); // STOPSHIP: Remove code name checking once platform version bumps up to 30. std::string codeName = android::base::GetProperty("ro.build.version.codename", ""); if (codeName == "S") { platformVersion = 31; } switch (platformVersion) { if (platformVersion >= __ANDROID_API_S__) { case 31: { android::sp<V1_2::IComponentStore> storeV1_2 = android::sp<V1_2::IComponentStore> storeV1_2 = new V1_2::utils::ComponentStore(store); new V1_2::utils::ComponentStore(store); if (storeV1_2->registerAsService("software") != android::OK) { if (storeV1_2->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.2 service."; LOG(ERROR) << "Cannot register software Codec2 v1.2 service."; return; return; } } break; } else if (platformVersion == __ANDROID_API_R__) { } case 30: { android::sp<V1_1::IComponentStore> storeV1_1 = android::sp<V1_1::IComponentStore> storeV1_1 = new V1_1::utils::ComponentStore(store); new V1_1::utils::ComponentStore(store); if (storeV1_1->registerAsService("software") != android::OK) { if (storeV1_1->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.1 service."; LOG(ERROR) << "Cannot register software Codec2 v1.1 service."; return; return; } } break; } else if (platformVersion == __ANDROID_API_Q__) { } case 29: { android::sp<V1_0::IComponentStore> storeV1_0 = android::sp<V1_0::IComponentStore> storeV1_0 = new V1_0::utils::ComponentStore(store); new V1_0::utils::ComponentStore(store); if (storeV1_0->registerAsService("software") != android::OK) { if (storeV1_0->registerAsService("software") != android::OK) { LOG(ERROR) << "Cannot register software Codec2 v1.0 service."; LOG(ERROR) << "Cannot register software Codec2 v1.0 service."; return; return; } } break; } else { // platformVersion < __ANDROID_API_Q__ } default: { LOG(ERROR) << "The platform version " << platformVersion << LOG(ERROR) << "The platform version " << platformVersion << " is not supported."; " is not supported."; return; return; } } } if (!ionPropertiesDefined()) { if (!ionPropertiesDefined()) { using IComponentStore = using IComponentStore = ::android::hardware::media::c2::V1_0::IComponentStore; ::android::hardware::media::c2::V1_0::IComponentStore; Loading