Loading services/core/java/com/android/server/broadcastradio/Tuner.java +3 −2 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ 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); Loading Loading @@ -148,8 +150,7 @@ class Tuner extends ITuner.Stub { if (mIsMuted == mute) return; mIsMuted = mute; // TODO(b/62713378): notifify audio policy manager of media activity on radio audio // device. This task is pulled directly from previous implementation of native service. nativeSetMuted(mNativeContext, mute); } } Loading services/core/jni/BroadcastRadio/Tuner.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ struct TunerContext { bool mIsClosed = false; HalRevision mHalRev; bool mWithAudio; bool mIsAudioConnected = false; Band mBand; wp<V1_0::IBroadcastRadio> mHalModule; wp<V1_1::IBroadcastRadio> mHalModule11; Loading Loading @@ -142,6 +143,8 @@ void HalDeathRecipient::serviceDied(uint64_t cookie __unused, // 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(); Loading Loading @@ -265,6 +268,14 @@ 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__); Loading Loading @@ -497,6 +508,7 @@ 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 }, Loading Loading
services/core/java/com/android/server/broadcastradio/Tuner.java +3 −2 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ 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); Loading Loading @@ -148,8 +150,7 @@ class Tuner extends ITuner.Stub { if (mIsMuted == mute) return; mIsMuted = mute; // TODO(b/62713378): notifify audio policy manager of media activity on radio audio // device. This task is pulled directly from previous implementation of native service. nativeSetMuted(mNativeContext, mute); } } Loading
services/core/jni/BroadcastRadio/Tuner.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ struct TunerContext { bool mIsClosed = false; HalRevision mHalRev; bool mWithAudio; bool mIsAudioConnected = false; Band mBand; wp<V1_0::IBroadcastRadio> mHalModule; wp<V1_1::IBroadcastRadio> mHalModule11; Loading Loading @@ -142,6 +143,8 @@ void HalDeathRecipient::serviceDied(uint64_t cookie __unused, // 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(); Loading Loading @@ -265,6 +268,14 @@ 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__); Loading Loading @@ -497,6 +508,7 @@ 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 }, Loading