}
static jboolean
+android_media_AudioSystem_isStreamActiveRemotely(JNIEnv *env, jobject thiz, jint stream,
+ jint inPastMs)
+{
+ bool state = false;
+ AudioSystem::isStreamActiveRemotely((audio_stream_type_t) stream, &state, inPastMs);
+ return state;
+}
+
+static jboolean
android_media_AudioSystem_isSourceActive(JNIEnv *env, jobject thiz, jint source)
{
bool state = false;
{"muteMicrophone", "(Z)I", (void *)android_media_AudioSystem_muteMicrophone},
{"isMicrophoneMuted", "()Z", (void *)android_media_AudioSystem_isMicrophoneMuted},
{"isStreamActive", "(II)Z", (void *)android_media_AudioSystem_isStreamActive},
+ {"isStreamActiveRemotely","(II)Z", (void *)android_media_AudioSystem_isStreamActiveRemotely},
{"isSourceActive", "(I)Z", (void *)android_media_AudioSystem_isSourceActive},
{"setDeviceConnectionState", "(IILjava/lang/String;)I", (void *)android_media_AudioSystem_setDeviceConnectionState},
{"getDeviceConnectionState", "(ILjava/lang/String;)I", (void *)android_media_AudioSystem_getDeviceConnectionState},
/**
* @hide
+ * Checks whether any music or media is actively playing on a remote device (e.g. wireless
+ * display). Note that BT audio sinks are not considered remote devices.
+ * @return true if {@link AudioManager#STREAM_MUSIC} is active on a remote device
+ */
+ public boolean isMusicActiveRemotely() {
+ return AudioSystem.isStreamActiveRemotely(STREAM_MUSIC, 0);
+ }
+
+ /**
+ * @hide
* Checks whether speech recognition is active
* @return true if a recording with source {@link MediaRecorder.AudioSource#VOICE_RECOGNITION}
* is underway.
public static native boolean isStreamActive(int stream, int inPastMs);
/*
+ * Checks whether the specified stream type is active on a remotely connected device. The notion
+ * of what constitutes a remote device is enforced by the audio policy manager of the platform.
+ *
+ * return true if any track playing on this stream is active on a remote device.
+ */
+ public static native boolean isStreamActiveRemotely(int stream, int inPastMs);
+
+ /*
* Checks whether the specified audio source is active.
*
* return true if any recorder using this source is currently recording