Merge "Add new buttons for video calls." into lmp-dev
diff --git a/InCallUI/res/drawable/btn_change_to_audio.xml b/InCallUI/res/drawable/btn_change_to_audio.xml
new file mode 100644
index 0000000..974dd4a
--- /dev/null
+++ b/InCallUI/res/drawable/btn_change_to_audio.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  ~ Copyright (C) 2014 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 android:drawable="@drawable/btn_background" />
+
+    <item>
+        <bitmap android:src="@drawable/ic_toolbar_audio_phone"
+            android:gravity="center"
+            android:tint="@color/selectable_icon_tint" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/InCallUI/res/drawable/btn_change_to_video.xml b/InCallUI/res/drawable/btn_change_to_video.xml
new file mode 100644
index 0000000..255b9b6
--- /dev/null
+++ b/InCallUI/res/drawable/btn_change_to_video.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  ~ Copyright (C) 2014 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 android:drawable="@drawable/btn_background" />
+
+    <item>
+        <bitmap android:src="@drawable/ic_toolbar_video"
+            android:gravity="center"
+            android:tint="@color/selectable_icon_tint" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/InCallUI/res/drawable/btn_compound_video_off.xml b/InCallUI/res/drawable/btn_compound_video_off.xml
new file mode 100644
index 0000000..776df50
--- /dev/null
+++ b/InCallUI/res/drawable/btn_compound_video_off.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 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
+  -->
+
+<!-- Layers used to render the in-call "Mute" compound button. -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!-- The standard "compound button" background. -->
+    <item android:drawable="@drawable/btn_compound_background" />
+
+    <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full size of the button. -->
+    <item>
+        <bitmap android:src="@drawable/ic_toolbar_video_off"
+            android:gravity="center"
+            android:tint="@color/selectable_icon_tint" />
+    </item>
+
+</layer-list>
diff --git a/InCallUI/res/drawable/btn_compound_video_switch.xml b/InCallUI/res/drawable/btn_compound_video_switch.xml
new file mode 100644
index 0000000..aa14593
--- /dev/null
+++ b/InCallUI/res/drawable/btn_compound_video_switch.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2014 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
+  -->
+
+<!-- Layers used to render the in-call "Mute" compound button. -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <!-- The standard "compound button" background. -->
+    <item android:drawable="@drawable/btn_compound_background" />
+
+    <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full size of the button. -->
+    <item>
+        <bitmap android:src="@drawable/ic_toolbar_video_switch"
+            android:gravity="center"
+            android:tint="@color/selectable_icon_tint" />
+    </item>
+
+</layer-list>
diff --git a/InCallUI/res/drawable/btn_overflow.xml b/InCallUI/res/drawable/btn_overflow.xml
new file mode 100644
index 0000000..e851ece
--- /dev/null
+++ b/InCallUI/res/drawable/btn_overflow.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  ~ Copyright (C) 2014 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 android:drawable="@drawable/btn_background" />
+
+    <item>
+        <bitmap android:src="@drawable/ic_overflow_menu"
+            android:gravity="center"
+            android:tint="@color/selectable_icon_tint" />
+    </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 8397ace..a35cc5e 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -50,10 +50,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
-    <!-- Row 2: The main batch of in-call buttons:
-         Dialpad / Audio mode / Mute / Hold / Add call
-         Visible in all states except while an incoming call is
-         ringing. -->
+    <!-- Row 2: The main batch of in-call buttons. -->
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
@@ -63,44 +60,59 @@
         android:background="@color/button_background_color"
         android:gravity="bottom|center_horizontal">
 
-        <!-- This row has either 4 or 5 buttons. This may depend on whether the device supports
-             "Hold" (i.e. 4 buttons on CDMA devices, 5 buttons on GSM devices.) or whether it is in
-             a video call.
+        <!-- This row only ever shows either 4 or 5 buttons. This may depend on whether the device
+             supports "Hold" (i.e. 4 buttons on CDMA devices, 5 buttons on GSM devices.) or whether
+             it is in a video call.
 
              There are a couple of *pairs* of buttons that share a single "slot", namely Hold/Swap
              and Add/Merge.  For these, the code in InCallTouchUi is responsible for making sure
-             that at any point exactly one of the pair is VISIBLE and the other is GONE. -->
+             that at any point exactly one of the pair is VISIBLE and the other is GONE.
 
-        <!-- "Audio mode" -->
-        <!-- This is a multi-mode button that can behave either like a simple "compound button" with
-             two states *or* like an action button that brings up a popup menu; see
-             btn_compound_audio.xml and InCallTouchUi.updateAudioButton() for the full details. -->
+             If there are more than 5 buttons eligible to be shown, the presenter is responsible for
+             collapsing those options into an overflow menu, which appears as one of the buttons
+             in the row instead. -->
+
+        <!-- FAR LEFT SLOT ===================================================================== -->
+
+        <!-- "Audio mode". this is a multi-mode button that can behave either like a simple
+             "compound button" with two states *or* like an action button that brings up a popup
+             menu; see btn_compound_audio.xml and CallButtonFragment.updateAudioButtons(). -->
         <ImageButton android:id="@+id/audioButton"
-            style="@style/InCallButton"
+            style="@style/InCallCompoundButton"
             android:background="@drawable/btn_compound_audio"
             android:contentDescription="@string/onscreenAudioText" />
 
-        <!-- "Mute" -->
-        <!-- This is a "compound button": it has checked and unchecked states. -->
-        <ImageButton android:id="@+id/muteButton"
+        <!-- "Change to audio call" for video calls. -->
+        <ImageButton android:id="@+id/changeToAudioButton"
             style="@style/InCallButton"
+            android:background="@drawable/btn_change_to_audio"
+            android:contentDescription="@string/onscreenChangeToAudioText"
+            android:visibility="gone" />
+
+        <!-- MIDDLE LEFT SLOT ================================================================== -->
+
+        <!-- "Mute" -->
+        <ImageButton android:id="@+id/muteButton"
+            style="@style/InCallCompoundButton"
             android:background="@drawable/btn_compound_mute"
             android:contentDescription="@string/onscreenMuteText" />
 
+        <!-- CENTER SLOT ======================================================================= -->
+
         <!-- "Dialpad" -->
-        <!-- This is a "compound button": it has checked and unchecked states. -->
         <ImageButton android:id="@+id/dialpadButton"
             style="@style/InCallCompoundButton"
             android:background="@drawable/btn_compound_dialpad"
             android:contentDescription="@string/onscreenShowDialpadText" />
 
+        <!-- MIDDLE RIGHT SLOT ================================================================= -->
+
         <!-- This slot is either "Hold" or "Swap", depending on the state of the call. One or the
              other of these must always be set to GONE. -->
 
         <!-- "Hold" -->
-        <!-- This is a "compound button": it has checked and unchecked states. -->
         <ImageButton android:id="@+id/holdButton"
-            style="@style/InCallButton"
+            style="@style/InCallCompoundButton"
             android:background="@drawable/btn_compound_hold"
             android:contentDescription="@string/onscreenHoldText" />
 
@@ -111,6 +123,22 @@
             android:contentDescription="@string/onscreenSwapCallsText"
             android:visibility="gone" />
 
+        <!-- "Change to video call" -->
+        <ImageButton android:id="@+id/changeToVideoButton"
+            style="@style/InCallButton"
+            android:background="@drawable/btn_change_to_video"
+            android:contentDescription="@string/onscreenVideoCallText"
+            android:visibility="gone" />
+
+        <!-- "Switch camera" for video calls. -->
+        <ImageButton android:id="@+id/switchCameraButton"
+            style="@style/InCallCompoundButton"
+            android:background="@drawable/btn_compound_video_switch"
+            android:contentDescription="@string/onscreenSwitchCameraText"
+            android:visibility="gone" />
+
+        <!-- FAR RIGHT SLOT ==================================================================== -->
+
         <!-- This slot is either "Add" or "Merge", depending on the state of the call.  One or the
              other of these must always be set to GONE. -->
 
@@ -121,16 +149,29 @@
             android:contentDescription="@string/onscreenAddCallText"
             android:visibility="gone" />
 
-        <!-- "Merge calls" -->
-        <!-- This button is used only on GSM devices, where we know that "Add" and "Merge" are never
-             available at the same time. The "Merge" button for CDMA devices is "cdmaMergeButton"
-             above. -->
+        <!-- "Merge calls". This button is used only on GSM devices, where we know that "Add" and
+             "Merge" are never available at the same time. The "Merge" button for CDMA devices is
+             "cdmaMergeButton" above. -->
         <ImageButton android:id="@+id/mergeButton"
             style="@style/InCallButton"
             android:background="@drawable/btn_merge"
             android:contentDescription="@string/onscreenMergeCallsText"
             android:visibility="gone" />
 
+        <!-- "Switch camera" for video calls. -->
+        <ImageButton android:id="@+id/pauseVideoButton"
+            style="@style/InCallCompoundButton"
+            android:background="@drawable/btn_compound_video_off"
+            android:contentDescription="@string/onscreenPauseVideoText"
+            android:visibility="gone" />
+
+        <!-- "Overflow" -->
+        <ImageButton android:id="@+id/overflowButton"
+            style="@style/InCallButton"
+            android:background="@drawable/btn_overflow"
+            android:contentDescription="@string/onscreenOverflowText"
+            android:visibility="gone" />
+
     </LinearLayout>
 
 </LinearLayout>
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index d0f300d..3795aa5 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -311,6 +311,8 @@
     <string name="onscreenSwitchCameraText">Switch camera</string>
     <!-- Text for the onscreen "Pause video" button. -->
     <string name="onscreenPauseVideoText">Pause video</string>
+    <!-- Text for the onscreen overflow button, to see additional actions which can be done. -->
+    <string name="onscreenOverflowText">More options</string>
 
     <!-- For incoming calls, this is a string we can get from a CDMA network instead of
          the actual phone number, to indicate there's no number present.  DO NOT TRANSLATE. -->