Refactor webrtc audio management

Attempts to:

1) Successfully play ringtone through speaker instead of earpiece
   when possible.

2) Manage bluetooth headset connectivity as well as possible

3) Eliminate notification sounds while in-call when possible

4) Make sure audio is correctly setup when receiving calls

Fixes #6271
Fixes #6248
Fixes #6238
Fixes #6184
Fixes #6169

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-03-04 15:48:10 -08:00
parent 3904c76261
commit cd28cd172f
20 changed files with 841 additions and 534 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/compoundBackgroundItem" android:drawable="@drawable/webrtc_control_background"/>
<item android:id="@+id/moreIndicatorItem"
android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp">
<bitmap android:src="@drawable/redphone_ic_more_indicator_holo_dark"
android:gravity="bottom|right" />
</item>
<item android:id="@+id/bluetoothItem"
android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp">
<bitmap android:src="@drawable/ic_phone_bluetooth_speaker_white_24dp"
android:gravity="center" />
</item>
<!-- Handset earpiece is active -->
<item android:id="@+id/handsetItem" android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp">
<bitmap android:src="@drawable/ic_phone_in_talk_white_24dp"
android:gravity="center" />
</item>
<!-- Speakerphone icon showing 'speaker on' state -->
<item android:id="@+id/speakerphoneOnItem" android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp">
<bitmap android:src="@drawable/ic_volume_up_white_24dp"
android:gravity="center" />
</item>
<!--&lt;!&ndash; Speakerphone icon showing 'speaker off' state &ndash;&gt;-->
<!--<item android:id="@+id/speakerphoneOffItem">-->
<!--<bitmap android:src="@drawable/ic_volume_mute_white_24dp"-->
<!--android:gravity="center" />-->
<!--</item>-->
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/webrtc_control_background"/>
<item android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp"
android:drawable="@drawable/ic_bluetooth_white_24dp"/>
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/webrtc_control_background"/>
<item android:top="5dp"
android:left="5dp"
android:right="5dp"
android:bottom="5dp"
android:drawable="@drawable/ic_volume_up_white_24dp"/>
</layer-list>

View File

@@ -7,12 +7,18 @@
android:orientation="horizontal"
tools:background="@color/textsecure_primary">
<ToggleButton android:id="@+id/audioButton"
<ToggleButton android:id="@+id/speakerButton"
style="@style/WebRtcCallCompoundButton"
android:background="@drawable/webrtc_audio_button"
android:background="@drawable/webrtc_speaker_button"
tools:checked="true"
android:layout_marginRight="15dp"/>
<ToggleButton android:id="@+id/bluetoothButton"
style="@style/WebRtcCallCompoundButton"
android:background="@drawable/webrtc_bluetooth_button"
tools:checked="true"
android:layout_marginRight="15dp"
android:visibility="gone"/>
<ToggleButton android:id="@+id/muteButton"
style="@style/WebRtcCallCompoundButton"

View File

@@ -176,7 +176,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/textsecure_primary"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="16dp"