diff options
3 files changed, 2 insertions, 55 deletions
diff --git a/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java b/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java index ff1e29b4027c..f2e44ee132ed 100644 --- a/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java +++ b/services/core/java/com/android/server/broadcastradio/hal1/Tuner.java @@ -80,8 +80,6 @@ class Tuner extends ITuner.Stub { @NonNull RadioManager.BandConfig config); private native RadioManager.BandConfig nativeGetConfiguration(long nativeContext, int region); - private native void nativeSetMuted(long nativeContext, boolean mute); - private native void nativeStep(long nativeContext, boolean directionDown, boolean skipSubChannel); private native void nativeScan(long nativeContext, boolean directionDown, boolean skipSubChannel); private native void nativeTune(long nativeContext, @NonNull ProgramSelector selector); @@ -155,8 +153,7 @@ class Tuner extends ITuner.Stub { checkNotClosedLocked(); if (mIsMuted == mute) return; mIsMuted = mute; - - nativeSetMuted(mNativeContext, mute); + Slog.w(TAG, "Mute via RadioService is not implemented - please handle it via app"); } } diff --git a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java index 8f3f099c9601..9833507f8fce 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java @@ -25,7 +25,6 @@ import android.hardware.radio.ITuner; import android.hardware.radio.ProgramList; import android.hardware.radio.ProgramSelector; import android.hardware.radio.RadioManager; -import android.media.AudioSystem; import android.os.RemoteException; import android.util.MutableBoolean; import android.util.MutableInt; @@ -45,7 +44,6 @@ class TunerSession extends ITuner.Stub { private final ITunerSession mHwSession; private final TunerCallback mCallback; private boolean mIsClosed = false; - private boolean mIsAudioConnected = false; private boolean mIsMuted = false; // necessary only for older APIs compatibility @@ -56,7 +54,6 @@ class TunerSession extends ITuner.Stub { mModule = Objects.requireNonNull(module); mHwSession = Objects.requireNonNull(hwSession); mCallback = Objects.requireNonNull(callback); - notifyAudioServiceLocked(true); } @Override @@ -64,7 +61,6 @@ class TunerSession extends ITuner.Stub { synchronized (mLock) { if (mIsClosed) return; mIsClosed = true; - notifyAudioServiceLocked(false); } } @@ -79,22 +75,6 @@ class TunerSession extends ITuner.Stub { } } - private void notifyAudioServiceLocked(boolean connected) { - if (mIsAudioConnected == connected) return; - - Slog.d(TAG, "Notifying AudioService about new state: " + connected); - int ret = AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_FM_TUNER, - connected ? AudioSystem.DEVICE_STATE_AVAILABLE : AudioSystem.DEVICE_STATE_UNAVAILABLE, - null, kAudioDeviceName); - - if (ret == AudioSystem.AUDIO_STATUS_OK) { - mIsAudioConnected = connected; - } else { - Slog.e(TAG, "Failed to notify AudioService about new state: " - + connected + ", response was: " + ret); - } - } - @Override public void setConfiguration(RadioManager.BandConfig config) { synchronized (mLock) { @@ -119,7 +99,7 @@ class TunerSession extends ITuner.Stub { checkNotClosedLocked(); if (mIsMuted == mute) return; mIsMuted = mute; - notifyAudioServiceLocked(!mute); + Slog.w(TAG, "Mute via RadioService is not implemented - please handle it via app"); } } diff --git a/services/core/jni/BroadcastRadio/Tuner.cpp b/services/core/jni/BroadcastRadio/Tuner.cpp index a04697fa4cd9..9c2e1e59dd32 100644 --- a/services/core/jni/BroadcastRadio/Tuner.cpp +++ b/services/core/jni/BroadcastRadio/Tuner.cpp @@ -26,7 +26,6 @@ #include <binder/IPCThreadState.h> #include <broadcastradio-utils-1x/Utils.h> #include <core_jni_helpers.h> -#include <media/AudioSystem.h> #include <nativehelper/JNIHelp.h> #include <utils/Log.h> @@ -70,8 +69,6 @@ static struct { } Tuner; } gjni; -static const char* const kAudioDeviceName = "Radio tuner source"; - class HalDeathRecipient : public hidl_death_recipient { wp<V1_1::ITunerCallback> mTunerCallback; @@ -154,20 +151,6 @@ sp<V1_1::IBroadcastRadio> TunerContext::getHalModule11() const { return V1_1::IBroadcastRadio::castFrom(halModule).withDefault(nullptr); } -// TODO(b/62713378): implement support for multiple tuners open at the same time -static void notifyAudioService(TunerContext& ctx, bool connected) { - if (!ctx.mWithAudio) return; - if (ctx.mIsAudioConnected == connected) return; - ctx.mIsAudioConnected = connected; - - ALOGD("Notifying AudioService about new state: %d", connected); - auto token = IPCThreadState::self()->clearCallingIdentity(); - AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_IN_FM_TUNER, - connected ? AUDIO_POLICY_DEVICE_STATE_AVAILABLE : AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, - nullptr, kAudioDeviceName); - IPCThreadState::self()->restoreCallingIdentity(token); -} - void assignHalInterfaces(JNIEnv *env, JavaRef<jobject> const &jTuner, sp<V1_0::IBroadcastRadio> halModule, sp<V1_0::ITuner> halTuner) { ALOGV("%s(%p)", __func__, halTuner.get()); @@ -193,8 +176,6 @@ void assignHalInterfaces(JNIEnv *env, JavaRef<jobject> const &jTuner, ctx.mHalDeathRecipient = new HalDeathRecipient(getNativeCallback(env, jTuner)); halTuner->linkToDeath(ctx.mHalDeathRecipient, 0); - - notifyAudioService(ctx, true); } static sp<V1_0::ITuner> getHalTuner(const TunerContext& ctx) { @@ -236,8 +217,6 @@ static void nativeClose(JNIEnv *env, jobject obj, jlong nativeContext) { ALOGI("Closing tuner %p", ctx.mHalTuner.get()); - notifyAudioService(ctx, false); - ctx.mHalTuner->unlinkToDeath(ctx.mHalDeathRecipient); ctx.mHalDeathRecipient = nullptr; @@ -280,14 +259,6 @@ static jobject nativeGetConfiguration(JNIEnv *env, jobject obj, jlong nativeCont return convert::BandConfigFromHal(env, halConfig, region).release(); } -static void nativeSetMuted(JNIEnv *env, jobject obj, jlong nativeContext, bool mute) { - ALOGV("%s(%d)", __func__, mute); - lock_guard<mutex> lk(gContextMutex); - auto& ctx = getNativeContext(nativeContext); - - notifyAudioService(ctx, !mute); -} - static void nativeStep(JNIEnv *env, jobject obj, jlong nativeContext, bool directionDown, bool skipSubChannel) { ALOGV("%s", __func__); @@ -467,7 +438,6 @@ static const JNINativeMethod gTunerMethods[] = { (void*)nativeSetConfiguration }, { "nativeGetConfiguration", "(JI)Landroid/hardware/radio/RadioManager$BandConfig;", (void*)nativeGetConfiguration }, - { "nativeSetMuted", "(JZ)V", (void*)nativeSetMuted }, { "nativeStep", "(JZZ)V", (void*)nativeStep }, { "nativeScan", "(JZZ)V", (void*)nativeScan }, { "nativeTune", "(JLandroid/hardware/radio/ProgramSelector;)V", (void*)nativeTune }, |