Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab26e7a8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "codecServiceRegistrant_fuzzer: Bug Fix" into main am: f84f2fa7 am: 606ece61

parents 23ad201c 606ece61
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "fuzzer/FuzzedDataProvider.h"
#include <C2Config.h>
#include <C2Param.h>
#include <android/api-level.h>

using namespace std;

@@ -59,11 +60,31 @@ void CodecServiceRegistrantFuzzer::initH2C2ComponentStore() {
  if (!store) {
    return;
  }

  int32_t platformVersion = android_get_device_api_level();
  if (platformVersion >= __ANDROID_API_S__) {
    android::sp<V1_2::IComponentStore> storeV1_2 =
      new V1_2::utils::ComponentStore(store);
    if (storeV1_2->registerAsService(string(kServiceName)) != android::OK) {
      return;
    }
  } else if (platformVersion == __ANDROID_API_R__) {
    android::sp<V1_1::IComponentStore> storeV1_1 =
      new V1_1::utils::ComponentStore(store);
    if (storeV1_1->registerAsService(string(kServiceName)) != android::OK) {
      return;
    }
  } else if (platformVersion == __ANDROID_API_Q__) {
    android::sp<V1_0::IComponentStore> storeV1_0 =
      new V1_0::utils::ComponentStore(store);
    if (storeV1_0->registerAsService(string(kServiceName)) != android::OK) {
      return;
    }
  }
  else {
    return;
  }

  string const preferredStoreName = string(kServiceName);
  sp<IComponentStore> preferredStore =
      IComponentStore::getService(preferredStoreName.c_str());