Merge changes Ib66706ca,Ibd7c7f97
* changes:
Create new list of BT devices when querying
Integrate the BT multi-hfp apis with Telecom
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 9e7677b..a06bbf1 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -964,10 +964,7 @@
if (isRttSettingOn() ||
extras.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, false)) {
Log.i(this, "Incoming call requesting RTT, rtt setting is %b", isRttSettingOn());
- if (phoneAccount != null &&
- phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) {
- call.createRttStreams();
- }
+ call.createRttStreams();
// Even if the phone account doesn't support RTT yet, the connection manager might
// change that. Set this to check it later.
call.setRequestedToStartWithRtt();
diff --git a/testapps/res/layout/self_managed_call_list_item.xml b/testapps/res/layout/self_managed_call_list_item.xml
index 66b5b21..6a31a50 100644
--- a/testapps/res/layout/self_managed_call_list_item.xml
+++ b/testapps/res/layout/self_managed_call_list_item.xml
@@ -65,13 +65,18 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Speaker"
+ android:text="🔊"
android:id="@+id/speakerButton" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Earpiece"
+ android:text="👂"
android:id="@+id/earpieceButton" />
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="🎧"
+ android:id="@+id/bluetoothButton" />
<CheckBox
android:id="@+id/holdable"
android:layout_width="wrap_content"
diff --git a/testapps/src/com/android/server/telecom/testapps/SelfManagedCallListAdapter.java b/testapps/src/com/android/server/telecom/testapps/SelfManagedCallListAdapter.java
index 8eaa282..75ceb62 100644
--- a/testapps/src/com/android/server/telecom/testapps/SelfManagedCallListAdapter.java
+++ b/testapps/src/com/android/server/telecom/testapps/SelfManagedCallListAdapter.java
@@ -104,6 +104,16 @@
}
};
+ private View.OnClickListener mBluetoothListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ View parent = (View) v.getParent().getParent();
+ SelfManagedConnection connection = (SelfManagedConnection) parent.getTag();
+ connection.setAudioRoute(CallAudioState.ROUTE_BLUETOOTH);
+ notifyDataSetChanged();
+ }
+ };
+
private View.OnClickListener mHoldableListener = new View.OnClickListener() {
@Override
public void onClick (View v) {
@@ -221,6 +231,8 @@
speakerButton.setOnClickListener(mSpeakerListener);
View earpieceButton = view.findViewById(R.id.earpieceButton);
earpieceButton.setOnClickListener(mEarpieceListener);
+ View bluetoothButton = view.findViewById(R.id.bluetoothButton);
+ bluetoothButton.setOnClickListener(mBluetoothListener);
View missedButton = view.findViewById(R.id.missedButton);
missedButton.setOnClickListener(mMissedListener);
missedButton.setVisibility(isRinging ? View.VISIBLE : View.GONE);
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index 52dcadb..5ae4815 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -16,11 +16,16 @@
package com.android.server.telecom.testapps;
+import static android.media.AudioAttributes.CONTENT_TYPE_SPEECH;
+import static android.media.AudioAttributes.USAGE_VOICE_COMMUNICATION;
+
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.media.AudioAttributes;
+import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
@@ -582,8 +587,16 @@
}
private MediaPlayer createMediaPlayer() {
+ AudioAttributes attributes = new AudioAttributes.Builder()
+ .setUsage(USAGE_VOICE_COMMUNICATION)
+ .setContentType(CONTENT_TYPE_SPEECH)
+ .build();
+
+ final int audioSessionId = ((AudioManager) getSystemService(
+ Context.AUDIO_SERVICE)).generateAudioSessionId();
// Prepare the media player to play a tone when there is a call.
- MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.beep_boop);
+ MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.beep_boop, attributes,
+ audioSessionId);
mediaPlayer.setLooping(true);
return mediaPlayer;
}