Change speaker button for in call UI and bubble.

Bug: 74238896
Test: ButtonControllerTest
PiperOrigin-RevId: 192370117
Change-Id: I265cc9541957c2dd376176ed7a703b4938fe4563
diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java
index 0850e91..fcb6fe0 100644
--- a/java/com/android/incallui/ReturnToCallController.java
+++ b/java/com/android/incallui/ReturnToCallController.java
@@ -303,13 +303,13 @@
         Action.builder()
             .setIconDrawable(context.getDrawable(speakerButtonInfo.icon))
             .setSecondaryIconDrawable(
-                speakerButtonInfo.checkable
+                speakerButtonInfo.nonBluetoothMode
                     ? null
                     : context.getDrawable(R.drawable.quantum_ic_arrow_drop_down_vd_theme_24))
             .setName(context.getText(speakerButtonInfo.label))
-            .setCheckable(speakerButtonInfo.checkable)
+            .setCheckable(speakerButtonInfo.nonBluetoothMode)
             .setChecked(speakerButtonInfo.isChecked)
-            .setIntent(speakerButtonInfo.checkable ? toggleSpeaker : showSpeakerSelect)
+            .setIntent(speakerButtonInfo.nonBluetoothMode ? toggleSpeaker : showSpeakerSelect)
             .build());
     // End call
     actions.add(
diff --git a/java/com/android/incallui/incall/impl/ButtonController.java b/java/com/android/incallui/incall/impl/ButtonController.java
index 9106dab..328ebbe 100644
--- a/java/com/android/incallui/incall/impl/ButtonController.java
+++ b/java/com/android/incallui/incall/impl/ButtonController.java
@@ -312,10 +312,10 @@
 
     @StringRes private int label = R.string.incall_label_speaker;
     @DrawableRes private int icon = R.drawable.quantum_ic_volume_up_vd_theme_24;
-    private boolean checkable;
+    private boolean nonBluetoothMode;
     private CharSequence contentDescription;
-    private CharSequence checkedContentDescription;
-    private CharSequence uncheckedContentDescription;
+    private CharSequence isOnContentDescription;
+    private CharSequence isOffContentDescription;
 
     public SpeakerButtonController(@NonNull InCallButtonUiDelegate delegate) {
       this.delegate = delegate;
@@ -367,31 +367,31 @@
         button.setEnabled(isEnabled && isAllowed);
         button.setVisibility(View.VISIBLE);
         button.setChecked(isChecked);
-        button.setOnClickListener(checkable ? null : this);
-        button.setOnCheckedChangeListener(checkable ? this : null);
+        button.setOnClickListener(nonBluetoothMode ? null : this);
+        button.setOnCheckedChangeListener(nonBluetoothMode ? this : null);
         button.setLabelText(label);
         button.setIconDrawable(icon);
         button.setContentDescription(
-            isChecked ? checkedContentDescription : uncheckedContentDescription);
-        button.setShouldShowMoreIndicator(!checkable);
+            (nonBluetoothMode && !isChecked) ? isOffContentDescription : isOnContentDescription);
+        button.setShouldShowMoreIndicator(!nonBluetoothMode);
       }
     }
 
     public void setAudioState(CallAudioState audioState) {
       SpeakerButtonInfo info = new SpeakerButtonInfo(audioState);
 
-      checkable = info.checkable;
+      nonBluetoothMode = info.nonBluetoothMode;
       isChecked = info.isChecked;
       label = info.label;
       icon = info.icon;
       @StringRes int contentDescriptionResId = info.contentDescription;
 
       contentDescription = delegate.getContext().getText(contentDescriptionResId);
-      checkedContentDescription =
+      isOnContentDescription =
           TextUtils.concat(
               contentDescription,
               delegate.getContext().getText(R.string.incall_talkback_speaker_on));
-      uncheckedContentDescription =
+      isOffContentDescription =
           TextUtils.concat(
               contentDescription,
               delegate.getContext().getText(R.string.incall_talkback_speaker_off));
@@ -406,7 +406,7 @@
     @Override
     public void onCheckedChanged(CheckableLabeledButton checkableLabeledButton, boolean isChecked) {
       checkableLabeledButton.setContentDescription(
-          isChecked ? checkedContentDescription : uncheckedContentDescription);
+          isChecked ? isOnContentDescription : isOffContentDescription);
       delegate.toggleSpeakerphone();
     }
   }
diff --git a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_more.xml b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_more.xml
index 6755f0f..8faa35b 100644
--- a/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_more.xml
+++ b/java/com/android/incallui/incall/impl/res/drawable/incall_button_background_more.xml
@@ -1,4 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2018 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
   <item>
     <selector>
@@ -25,6 +39,7 @@
   <item>
     <bitmap
       android:gravity="end"
+      android:tint="@color/incall_button_icon"
       android:src="@drawable/quantum_ic_arrow_drop_down_white_18"/>
   </item>
 </layer-list>
diff --git a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
index deee8ee..e9f9d04 100644
--- a/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
+++ b/java/com/android/incallui/rtt/impl/RttOverflowMenu.java
@@ -87,7 +87,7 @@
 
   void setAudioState(CallAudioState audioState) {
     SpeakerButtonInfo info = new SpeakerButtonInfo(audioState);
-    if (info.checkable) {
+    if (info.nonBluetoothMode) {
       speakerButton.setChecked(info.isChecked);
       speakerButton.setOnClickListener(null);
       speakerButton.setOnCheckedChangeListener(this);
diff --git a/java/com/android/incallui/speakerbuttonlogic/SpeakerButtonInfo.java b/java/com/android/incallui/speakerbuttonlogic/SpeakerButtonInfo.java
index 58fd40f..0c873b2 100644
--- a/java/com/android/incallui/speakerbuttonlogic/SpeakerButtonInfo.java
+++ b/java/com/android/incallui/speakerbuttonlogic/SpeakerButtonInfo.java
@@ -39,34 +39,37 @@
   @DrawableRes public final int icon;
   @StringRes public final int contentDescription;
   @StringRes public final int label;
-  public final boolean checkable;
+  public final boolean nonBluetoothMode;
   public final boolean isChecked;
 
   public SpeakerButtonInfo(CallAudioState audioState) {
     if ((audioState.getSupportedRouteMask() & CallAudioState.ROUTE_BLUETOOTH)
         == CallAudioState.ROUTE_BLUETOOTH) {
-      checkable = false;
-      isChecked = false;
+      nonBluetoothMode = false;
       label = R.string.incall_label_audio;
 
       if ((audioState.getRoute() & CallAudioState.ROUTE_BLUETOOTH)
           == CallAudioState.ROUTE_BLUETOOTH) {
-        icon = R.drawable.quantum_ic_bluetooth_audio_vd_theme_24;
+        icon = R.drawable.volume_bluetooth;
         contentDescription = R.string.incall_content_description_bluetooth;
+        isChecked = true;
       } else if ((audioState.getRoute() & CallAudioState.ROUTE_SPEAKER)
           == CallAudioState.ROUTE_SPEAKER) {
         icon = R.drawable.quantum_ic_volume_up_vd_theme_24;
         contentDescription = R.string.incall_content_description_speaker;
+        isChecked = true;
       } else if ((audioState.getRoute() & CallAudioState.ROUTE_WIRED_HEADSET)
           == CallAudioState.ROUTE_WIRED_HEADSET) {
         icon = R.drawable.quantum_ic_headset_vd_theme_24;
         contentDescription = R.string.incall_content_description_headset;
+        isChecked = true;
       } else {
         icon = R.drawable.quantum_ic_phone_in_talk_vd_theme_24;
         contentDescription = R.string.incall_content_description_earpiece;
+        isChecked = false;
       }
     } else {
-      checkable = true;
+      nonBluetoothMode = true;
       isChecked = audioState.getRoute() == CallAudioState.ROUTE_SPEAKER;
       label = R.string.incall_label_speaker;
       icon = R.drawable.quantum_ic_volume_up_vd_theme_24;
diff --git a/java/com/android/incallui/speakerbuttonlogic/res/drawable/volume_bluetooth.xml b/java/com/android/incallui/speakerbuttonlogic/res/drawable/volume_bluetooth.xml
new file mode 100644
index 0000000..59dfdf3
--- /dev/null
+++ b/java/com/android/incallui/speakerbuttonlogic/res/drawable/volume_bluetooth.xml
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (C) 2018 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:width="24dp"
+    android:height="24dp">
+  <path
+      android:fillColor="@android:color/white"
+      android:pathData="M3 9l0 6 4 0 5 5 0 -16 -5 5 -4 0zm11.71 6.5l2.29 -2.29 0 3.79 0.5 0 2.85 -2.85L18.12 12 20.36 9.85 17.5 7l-0.5 0 0 3.79L14.71 8.5 14 9.21 16.79 12 14 14.79 14.71 15.5ZM18 8.91l0.94 0.94 -0.94 0.94 0 -1.88zm0 4.3l0.94 0.94 -0.94 0.94 0 -1.88z"/>
+</vector>
\ No newline at end of file