Remove broadcastradio HAL 1.2 support from the framework.
Bug: 62945293 Test: it boots Change-Id: I7f434ed7ef07d0cf9afa93c17e78f2bf80f43b36
This commit is contained in:
@@ -98,10 +98,6 @@ class Tuner extends ITuner.Stub {
|
||||
private native boolean nativeIsAnalogForced(long nativeContext);
|
||||
private native void nativeSetAnalogForced(long nativeContext, boolean isForced);
|
||||
|
||||
private native Map<String, String> nativeSetParameters(long nativeContext,
|
||||
Map<String, String> parameters);
|
||||
private native Map<String, String> nativeGetParameters(long nativeContext, List<String> keys);
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
synchronized (mLock) {
|
||||
@@ -291,26 +287,11 @@ class Tuner extends ITuner.Stub {
|
||||
|
||||
@Override
|
||||
public Map setParameters(Map parameters) {
|
||||
Map<String, String> results;
|
||||
synchronized (mLock) {
|
||||
checkNotClosedLocked();
|
||||
results = nativeSetParameters(mNativeContext, Objects.requireNonNull(parameters));
|
||||
}
|
||||
if (results == null) return Collections.emptyMap();
|
||||
return results;
|
||||
throw new UnsupportedOperationException("Not supported by HAL 1.x");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getParameters(List<String> keys) {
|
||||
if (keys == null) {
|
||||
throw new IllegalArgumentException("The argument must not be a null pointer");
|
||||
}
|
||||
Map<String, String> results;
|
||||
synchronized (mLock) {
|
||||
checkNotClosedLocked();
|
||||
results = nativeGetParameters(mNativeContext, keys);
|
||||
}
|
||||
if (results == null) return Collections.emptyMap();
|
||||
return results;
|
||||
throw new UnsupportedOperationException("Not supported by HAL 1.x");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class TunerCallback implements ITunerCallback {
|
||||
|
||||
@Override
|
||||
public void onParametersUpdated(Map parameters) {
|
||||
dispatch(() -> mClientCallback.onParametersUpdated(parameters));
|
||||
Slog.e(TAG, "Not applicable for HAL 1.x");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -110,7 +110,6 @@ cc_defaults {
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.broadcastradio@1.0",
|
||||
"android.hardware.broadcastradio@1.1",
|
||||
"android.hardware.broadcastradio@1.2",
|
||||
"android.hardware.contexthub@1.0",
|
||||
"android.hardware.gnss@1.0",
|
||||
"android.hardware.gnss@1.1",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "convert.h"
|
||||
|
||||
#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
|
||||
#include <android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h>
|
||||
#include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h>
|
||||
#include <android/hidl/manager/1.0/IServiceManager.h>
|
||||
#include <broadcastradio-utils-1x/Utils.h>
|
||||
#include <core_jni_helpers.h>
|
||||
@@ -45,7 +45,6 @@ using hardware::hidl_vec;
|
||||
|
||||
namespace V1_0 = hardware::broadcastradio::V1_0;
|
||||
namespace V1_1 = hardware::broadcastradio::V1_1;
|
||||
namespace V1_2 = hardware::broadcastradio::V1_2;
|
||||
namespace utils = hardware::broadcastradio::utils;
|
||||
|
||||
using V1_0::BandConfig;
|
||||
@@ -149,11 +148,7 @@ static jobject nativeLoadModules(JNIEnv *env, jobject obj, jlong nativeContext)
|
||||
|
||||
auto halRev = HalRevision::V1_0;
|
||||
auto halMinor = 0;
|
||||
if (V1_2::IBroadcastRadioFactory::castFrom(factory).withDefault(nullptr) != nullptr) {
|
||||
halRev = HalRevision::V1_2;
|
||||
halMinor = 2;
|
||||
} else if (V1_1::IBroadcastRadioFactory::castFrom(factory).withDefault(nullptr)
|
||||
!= nullptr) {
|
||||
if (V1_1::IBroadcastRadioFactory::castFrom(factory).withDefault(nullptr) != nullptr) {
|
||||
halRev = HalRevision::V1_1;
|
||||
halMinor = 1;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "convert.h"
|
||||
#include "TunerCallback.h"
|
||||
|
||||
#include <android/hardware/broadcastradio/1.2/IBroadcastRadioFactory.h>
|
||||
#include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h>
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <broadcastradio-utils-1x/Utils.h>
|
||||
#include <core_jni_helpers.h>
|
||||
@@ -44,16 +44,15 @@ using hardware::hidl_vec;
|
||||
|
||||
namespace V1_0 = hardware::broadcastradio::V1_0;
|
||||
namespace V1_1 = hardware::broadcastradio::V1_1;
|
||||
namespace V1_2 = hardware::broadcastradio::V1_2;
|
||||
namespace utils = hardware::broadcastradio::utils;
|
||||
|
||||
using V1_0::Band;
|
||||
using V1_0::BandConfig;
|
||||
using V1_0::MetaData;
|
||||
using V1_0::Result;
|
||||
using V1_1::ITunerCallback;
|
||||
using V1_1::ProgramListResult;
|
||||
using V1_1::VendorKeyValue;
|
||||
using V1_2::ITunerCallback;
|
||||
using utils::HalRevision;
|
||||
|
||||
static mutex gContextMutex;
|
||||
@@ -94,7 +93,6 @@ struct TunerContext {
|
||||
wp<V1_1::IBroadcastRadio> mHalModule11;
|
||||
sp<V1_0::ITuner> mHalTuner;
|
||||
sp<V1_1::ITuner> mHalTuner11;
|
||||
sp<V1_2::ITuner> mHalTuner12;
|
||||
sp<HalDeathRecipient> mHalDeathRecipient;
|
||||
|
||||
private:
|
||||
@@ -181,11 +179,8 @@ void assignHalInterfaces(JNIEnv *env, JavaRef<jobject> const &jTuner,
|
||||
|
||||
ctx.mHalTuner = halTuner;
|
||||
ctx.mHalTuner11 = V1_1::ITuner::castFrom(halTuner).withDefault(nullptr);
|
||||
ctx.mHalTuner12 = V1_2::ITuner::castFrom(halTuner).withDefault(nullptr);
|
||||
ALOGW_IF(ctx.mHalRev >= HalRevision::V1_1 && ctx.mHalTuner11 == nullptr,
|
||||
"Provided tuner does not implement 1.1 HAL");
|
||||
ALOGW_IF(ctx.mHalRev >= HalRevision::V1_2 && ctx.mHalTuner12 == nullptr,
|
||||
"Provided tuner does not implement 1.2 HAL");
|
||||
|
||||
ctx.mHalDeathRecipient = new HalDeathRecipient(getNativeCallback(env, jTuner));
|
||||
halTuner->linkToDeath(ctx.mHalDeathRecipient, 0);
|
||||
@@ -209,11 +204,6 @@ static sp<V1_1::ITuner> getHalTuner11(jlong nativeContext) {
|
||||
return getNativeContext(nativeContext).mHalTuner11;
|
||||
}
|
||||
|
||||
static sp<V1_2::ITuner> getHalTuner12(jlong nativeContext) {
|
||||
lock_guard<mutex> lk(gContextMutex);
|
||||
return getNativeContext(nativeContext).mHalTuner12;
|
||||
}
|
||||
|
||||
sp<ITunerCallback> getNativeCallback(JNIEnv *env, JavaRef<jobject> const &tuner) {
|
||||
return TunerCallback::getNativeCallback(env,
|
||||
env->GetObjectField(tuner.get(), gjni.Tuner.tunerCallback));
|
||||
@@ -243,7 +233,6 @@ static void nativeClose(JNIEnv *env, jobject obj, jlong nativeContext) {
|
||||
ctx.mHalDeathRecipient = nullptr;
|
||||
|
||||
ctx.mHalTuner11 = nullptr;
|
||||
ctx.mHalTuner12 = nullptr;
|
||||
ctx.mHalTuner = nullptr;
|
||||
}
|
||||
|
||||
@@ -466,48 +455,6 @@ static void nativeSetAnalogForced(JNIEnv *env, jobject obj, jlong nativeContext,
|
||||
convert::ThrowIfFailed(env, halResult);
|
||||
}
|
||||
|
||||
static jobject nativeSetParameters(JNIEnv *env, jobject obj, jlong nativeContext, jobject jParameters) {
|
||||
ALOGV("%s", __func__);
|
||||
|
||||
auto halTuner = getHalTuner12(nativeContext);
|
||||
if (halTuner == nullptr) {
|
||||
ALOGI("Parameters are not supported with HAL < 1.2");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JavaRef<jobject> jResults = nullptr;
|
||||
auto parameters = convert::VendorInfoToHal(env, jParameters);
|
||||
auto hidlResult = halTuner->setParameters(parameters,
|
||||
[&](const hidl_vec<VendorKeyValue> results) {
|
||||
jResults = convert::VendorInfoFromHal(env, results);
|
||||
});
|
||||
|
||||
if (convert::ThrowIfFailed(env, hidlResult)) return nullptr;
|
||||
|
||||
return jResults.release();
|
||||
}
|
||||
|
||||
static jobject nativeGetParameters(JNIEnv *env, jobject obj, jlong nativeContext, jobject jKeys) {
|
||||
ALOGV("%s", __func__);
|
||||
|
||||
auto halTuner = getHalTuner12(nativeContext);
|
||||
if (halTuner == nullptr) {
|
||||
ALOGI("Parameters are not supported with HAL < 1.2");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JavaRef<jobject> jResults = nullptr;
|
||||
auto keys = convert::StringListToHal(env, jKeys);
|
||||
auto hidlResult = halTuner->getParameters(keys,
|
||||
[&](const hidl_vec<VendorKeyValue> parameters) {
|
||||
jResults = convert::VendorInfoFromHal(env, parameters);
|
||||
});
|
||||
|
||||
if (convert::ThrowIfFailed(env, hidlResult)) return nullptr;
|
||||
|
||||
return jResults.release();
|
||||
}
|
||||
|
||||
static const JNINativeMethod gTunerMethods[] = {
|
||||
{ "nativeInit", "(IZI)J", (void*)nativeInit },
|
||||
{ "nativeFinalize", "(J)V", (void*)nativeFinalize },
|
||||
@@ -528,8 +475,6 @@ static const JNINativeMethod gTunerMethods[] = {
|
||||
{ "nativeGetImage", "(JI)[B", (void*)nativeGetImage},
|
||||
{ "nativeIsAnalogForced", "(J)Z", (void*)nativeIsAnalogForced },
|
||||
{ "nativeSetAnalogForced", "(JZ)V", (void*)nativeSetAnalogForced },
|
||||
{ "nativeSetParameters", "(JLjava/util/Map;)Ljava/util/Map;", (void*)nativeSetParameters },
|
||||
{ "nativeGetParameters", "(JLjava/util/List;)Ljava/util/Map;", (void*)nativeGetParameters },
|
||||
};
|
||||
|
||||
} // namespace Tuner
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include "JavaRef.h"
|
||||
|
||||
#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
|
||||
#include <android/hardware/broadcastradio/1.2/ITuner.h>
|
||||
#include <android/hardware/broadcastradio/1.2/ITunerCallback.h>
|
||||
#include <android/hardware/broadcastradio/1.1/ITuner.h>
|
||||
#include <android/hardware/broadcastradio/1.1/ITunerCallback.h>
|
||||
#include <jni.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
|
||||
@@ -39,7 +39,7 @@ void assignHalInterfaces(JNIEnv *env, JavaRef<jobject> const &jTuner,
|
||||
sp<hardware::broadcastradio::V1_0::IBroadcastRadio> halModule,
|
||||
sp<hardware::broadcastradio::V1_0::ITuner> halTuner);
|
||||
|
||||
sp<hardware::broadcastradio::V1_2::ITunerCallback>
|
||||
sp<hardware::broadcastradio::V1_1::ITunerCallback>
|
||||
getNativeCallback(JNIEnv *env, JavaRef<jobject> const &tuner);
|
||||
|
||||
Region getRegion(JNIEnv *env, jobject obj);
|
||||
|
||||
@@ -40,18 +40,17 @@ using hardware::hidl_vec;
|
||||
|
||||
namespace V1_0 = hardware::broadcastradio::V1_0;
|
||||
namespace V1_1 = hardware::broadcastradio::V1_1;
|
||||
namespace V1_2 = hardware::broadcastradio::V1_2;
|
||||
namespace utils = hardware::broadcastradio::utils;
|
||||
|
||||
using V1_0::Band;
|
||||
using V1_0::BandConfig;
|
||||
using V1_0::MetaData;
|
||||
using V1_0::Result;
|
||||
using V1_1::ITunerCallback;
|
||||
using V1_1::ProgramInfo;
|
||||
using V1_1::ProgramListResult;
|
||||
using V1_1::ProgramSelector;
|
||||
using V1_1::VendorKeyValue;
|
||||
using V1_2::ITunerCallback;
|
||||
using utils::HalRevision;
|
||||
|
||||
static JavaVM *gvm = nullptr;
|
||||
@@ -70,7 +69,6 @@ static struct {
|
||||
jmethodID onBackgroundScanAvailabilityChange;
|
||||
jmethodID onBackgroundScanComplete;
|
||||
jmethodID onProgramListChanged;
|
||||
jmethodID onParametersUpdated;
|
||||
} TunerCallback;
|
||||
} gjni;
|
||||
|
||||
@@ -122,7 +120,6 @@ public:
|
||||
virtual Return<void> backgroundScanComplete(ProgramListResult result);
|
||||
virtual Return<void> programListChanged();
|
||||
virtual Return<void> currentProgramInfoChanged(const ProgramInfo& info);
|
||||
virtual Return<void> parametersUpdated(const hidl_vec<VendorKeyValue>& parameters);
|
||||
};
|
||||
|
||||
struct TunerCallbackContext {
|
||||
@@ -344,17 +341,6 @@ Return<void> NativeCallback::currentProgramInfoChanged(const ProgramInfo& info)
|
||||
return Return<void>();
|
||||
}
|
||||
|
||||
Return<void> NativeCallback::parametersUpdated(const hidl_vec<VendorKeyValue>& parameters) {
|
||||
ALOGV("%s", __func__);
|
||||
|
||||
mCallbackThread.enqueue([this, parameters](JNIEnv *env) {
|
||||
auto jParameters = convert::VendorInfoFromHal(env, parameters);
|
||||
env->CallVoidMethod(mJCallback, gjni.TunerCallback.onParametersUpdated, jParameters.get());
|
||||
});
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
static TunerCallbackContext& getNativeContext(jlong nativeContextHandle) {
|
||||
auto nativeContext = reinterpret_cast<TunerCallbackContext*>(nativeContextHandle);
|
||||
LOG_ALWAYS_FATAL_IF(nativeContext == nullptr, "Native context not initialized");
|
||||
@@ -441,8 +427,6 @@ void register_android_server_broadcastradio_TunerCallback(JavaVM *vm, JNIEnv *en
|
||||
"onBackgroundScanComplete", "()V");
|
||||
gjni.TunerCallback.onProgramListChanged = GetMethodIDOrDie(env, tunerCbClass,
|
||||
"onProgramListChanged", "()V");
|
||||
gjni.TunerCallback.onParametersUpdated = GetMethodIDOrDie(env, tunerCbClass,
|
||||
"onParametersUpdated", "(Ljava/util/Map;)V");
|
||||
|
||||
auto res = jniRegisterNativeMethods(env, "com/android/server/broadcastradio/hal1/TunerCallback",
|
||||
gTunerCallbackMethods, NELEM(gTunerCallbackMethods));
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "NativeCallbackThread.h"
|
||||
#include "types.h"
|
||||
|
||||
#include <android/hardware/broadcastradio/1.2/ITunerCallback.h>
|
||||
#include <android/hardware/broadcastradio/1.1/ITunerCallback.h>
|
||||
#include <jni.h>
|
||||
|
||||
namespace android {
|
||||
@@ -32,7 +32,7 @@ namespace server {
|
||||
namespace BroadcastRadio {
|
||||
namespace TunerCallback {
|
||||
|
||||
sp<hardware::broadcastradio::V1_2::ITunerCallback>
|
||||
sp<hardware::broadcastradio::V1_1::ITunerCallback>
|
||||
getNativeCallback(JNIEnv *env, jobject jTunerCallback);
|
||||
|
||||
} // namespace TunerCallback
|
||||
|
||||
Reference in New Issue
Block a user