Loading android/app/jni/com_android_bluetooth_le_audio.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -542,6 +542,19 @@ static void setInCallNative(JNIEnv* env, jobject object, jboolean inCall) { sLeAudioClientInterface->SetInCall(inCall); } static void sendAudioProfilePreferencesNative( JNIEnv* env, jint groupId, jboolean isOutputPreferenceLeAudio, jboolean isDuplexPreferenceLeAudio) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sLeAudioClientInterface) { LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface"; return; } sLeAudioClientInterface->SendAudioProfilePreferences( groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void*)classInitNative}, {"initNative", "([Landroid/bluetooth/BluetoothLeAudioCodecConfig;)V", Loading @@ -558,6 +571,8 @@ static JNINativeMethod sMethods[] = { (void*)setCodecConfigPreferenceNative}, {"setCcidInformationNative", "(II)V", (void*)setCcidInformationNative}, {"setInCallNative", "(Z)V", (void*)setInCallNative}, {"sendAudioProfilePreferencesNative", "(IZZ)V", (void*)sendAudioProfilePreferencesNative}, }; /* Le Audio Broadcaster */ Loading android/app/src/com/android/bluetooth/Utils.java +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public final class Utils { private static final String ENABLE_DUAL_MODE_AUDIO = "persist.bluetooth.enable_dual_mode_audio"; private static boolean sDualModeEnabled = SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false);; SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false); private static final String KEY_TEMP_ALLOW_LIST_DURATION_MS = "temp_allow_list_duration_ms"; private static final long DEFAULT_TEMP_ALLOW_LIST_DURATION_MS = 20_000; Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +15 −0 Original line number Diff line number Diff line Loading @@ -4833,6 +4833,21 @@ public class AdapterService extends Service { return dbResult; } int outputOnlyPreference = strippedPreferences.getInt( BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY); if (outputOnlyPreference == 0) { outputOnlyPreference = previousPreferences.getInt( BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY); } int duplexPreference = strippedPreferences.getInt(BluetoothAdapter.AUDIO_MODE_DUPLEX); if (duplexPreference == 0) { duplexPreference = previousPreferences.getInt(BluetoothAdapter.AUDIO_MODE_DUPLEX); } mLeAudioService.sendAudioProfilePreferencesToNative(groupId, outputOnlyPreference == BluetoothProfile.LE_AUDIO, duplexPreference == BluetoothProfile.LE_AUDIO); /* Populates the HashMap to hold requests on the groupId. We will update numRequestsToAudioFramework after we make requests to the audio framework */ PendingAudioProfilePreferenceRequest holdRequest = Loading android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +21 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,24 @@ public class LeAudioNativeInterface { setInCallNative(inCall); } /** * Sends the audio preferences for the groupId to the native stack. * * @param groupId is the groupId corresponding to the preferences * @param isOutputPreferenceLeAudio whether LEA is preferred for OUTPUT_ONLY * @param isDuplexPreferenceLeAudio whether LEA is preferred for DUPLEX */ public void sendAudioProfilePreferences(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio) { if (DBG) { Log.d(TAG, "sendAudioProfilePreferences groupId=" + groupId + ", isOutputPreferenceLeAudio=" + isOutputPreferenceLeAudio + ", isDuplexPreferenceLeAudio=" + isDuplexPreferenceLeAudio); } sendAudioProfilePreferencesNative(groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } // Native methods that call into the JNI interface private static native void classInitNative(); private native void initNative(BluetoothLeAudioCodecConfig[] codecConfigOffloading); Loading @@ -330,4 +348,7 @@ public class LeAudioNativeInterface { BluetoothLeAudioCodecConfig outputCodecConfig); private native void setCcidInformationNative(int ccid, int contextType); private native void setInCallNative(boolean inCall); /*package*/ private native void sendAudioProfilePreferencesNative(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio); } android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2347,6 +2347,27 @@ public class LeAudioService extends ProfileService { mLeAudioNativeInterface.setInCall(inCall); } /** * Sends the preferred audio profiles for a dual mode audio device to the native stack. * * @param groupId is the group id of the device which had a preference change * @param isOutputPreferenceLeAudio {@code true} if {@link BluetoothProfile#LE_AUDIO} is * preferred for {@link BluetoothAdapter#AUDIO_MODE_OUTPUT_ONLY}, {@code false} if it is * {@link BluetoothProfile#A2DP} * @param isDuplexPreferenceLeAudio {@code true} if {@link BluetoothProfile#LE_AUDIO} is * preferred for {@link BluetoothAdapter#AUDIO_MODE_DUPLEX}, {@code false} if it is * {@link BluetoothProfile#HEADSET} */ public void sendAudioProfilePreferencesToNative(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio) { if (!mLeAudioNativeIsInitialized) { Log.e(TAG, "Le Audio not initialized properly."); return; } mLeAudioNativeInterface.sendAudioProfilePreferences(groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } /** * Set Inactive by HFP during handover */ Loading Loading
android/app/jni/com_android_bluetooth_le_audio.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -542,6 +542,19 @@ static void setInCallNative(JNIEnv* env, jobject object, jboolean inCall) { sLeAudioClientInterface->SetInCall(inCall); } static void sendAudioProfilePreferencesNative( JNIEnv* env, jint groupId, jboolean isOutputPreferenceLeAudio, jboolean isDuplexPreferenceLeAudio) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sLeAudioClientInterface) { LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface"; return; } sLeAudioClientInterface->SendAudioProfilePreferences( groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } static JNINativeMethod sMethods[] = { {"classInitNative", "()V", (void*)classInitNative}, {"initNative", "([Landroid/bluetooth/BluetoothLeAudioCodecConfig;)V", Loading @@ -558,6 +571,8 @@ static JNINativeMethod sMethods[] = { (void*)setCodecConfigPreferenceNative}, {"setCcidInformationNative", "(II)V", (void*)setCcidInformationNative}, {"setInCallNative", "(Z)V", (void*)setInCallNative}, {"sendAudioProfilePreferencesNative", "(IZZ)V", (void*)sendAudioProfilePreferencesNative}, }; /* Le Audio Broadcaster */ Loading
android/app/src/com/android/bluetooth/Utils.java +1 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public final class Utils { private static final String ENABLE_DUAL_MODE_AUDIO = "persist.bluetooth.enable_dual_mode_audio"; private static boolean sDualModeEnabled = SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false);; SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false); private static final String KEY_TEMP_ALLOW_LIST_DURATION_MS = "temp_allow_list_duration_ms"; private static final long DEFAULT_TEMP_ALLOW_LIST_DURATION_MS = 20_000; Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +15 −0 Original line number Diff line number Diff line Loading @@ -4833,6 +4833,21 @@ public class AdapterService extends Service { return dbResult; } int outputOnlyPreference = strippedPreferences.getInt( BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY); if (outputOnlyPreference == 0) { outputOnlyPreference = previousPreferences.getInt( BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY); } int duplexPreference = strippedPreferences.getInt(BluetoothAdapter.AUDIO_MODE_DUPLEX); if (duplexPreference == 0) { duplexPreference = previousPreferences.getInt(BluetoothAdapter.AUDIO_MODE_DUPLEX); } mLeAudioService.sendAudioProfilePreferencesToNative(groupId, outputOnlyPreference == BluetoothProfile.LE_AUDIO, duplexPreference == BluetoothProfile.LE_AUDIO); /* Populates the HashMap to hold requests on the groupId. We will update numRequestsToAudioFramework after we make requests to the audio framework */ PendingAudioProfilePreferenceRequest holdRequest = Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +21 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,24 @@ public class LeAudioNativeInterface { setInCallNative(inCall); } /** * Sends the audio preferences for the groupId to the native stack. * * @param groupId is the groupId corresponding to the preferences * @param isOutputPreferenceLeAudio whether LEA is preferred for OUTPUT_ONLY * @param isDuplexPreferenceLeAudio whether LEA is preferred for DUPLEX */ public void sendAudioProfilePreferences(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio) { if (DBG) { Log.d(TAG, "sendAudioProfilePreferences groupId=" + groupId + ", isOutputPreferenceLeAudio=" + isOutputPreferenceLeAudio + ", isDuplexPreferenceLeAudio=" + isDuplexPreferenceLeAudio); } sendAudioProfilePreferencesNative(groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } // Native methods that call into the JNI interface private static native void classInitNative(); private native void initNative(BluetoothLeAudioCodecConfig[] codecConfigOffloading); Loading @@ -330,4 +348,7 @@ public class LeAudioNativeInterface { BluetoothLeAudioCodecConfig outputCodecConfig); private native void setCcidInformationNative(int ccid, int contextType); private native void setInCallNative(boolean inCall); /*package*/ private native void sendAudioProfilePreferencesNative(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio); }
android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +21 −0 Original line number Diff line number Diff line Loading @@ -2347,6 +2347,27 @@ public class LeAudioService extends ProfileService { mLeAudioNativeInterface.setInCall(inCall); } /** * Sends the preferred audio profiles for a dual mode audio device to the native stack. * * @param groupId is the group id of the device which had a preference change * @param isOutputPreferenceLeAudio {@code true} if {@link BluetoothProfile#LE_AUDIO} is * preferred for {@link BluetoothAdapter#AUDIO_MODE_OUTPUT_ONLY}, {@code false} if it is * {@link BluetoothProfile#A2DP} * @param isDuplexPreferenceLeAudio {@code true} if {@link BluetoothProfile#LE_AUDIO} is * preferred for {@link BluetoothAdapter#AUDIO_MODE_DUPLEX}, {@code false} if it is * {@link BluetoothProfile#HEADSET} */ public void sendAudioProfilePreferencesToNative(int groupId, boolean isOutputPreferenceLeAudio, boolean isDuplexPreferenceLeAudio) { if (!mLeAudioNativeIsInitialized) { Log.e(TAG, "Le Audio not initialized properly."); return; } mLeAudioNativeInterface.sendAudioProfilePreferences(groupId, isOutputPreferenceLeAudio, isDuplexPreferenceLeAudio); } /** * Set Inactive by HFP during handover */ Loading