In Multi-SIM cases use the color of the SIM icon for InCallUI.

Set the color of the InCallUI to be the color of the SIM icon. In the
single SIM case, the background should be the default background.
* Added id to all call button backgrounds for color change
* Initialize color onResume for InCallActivity
* CallCardFragment/CallButtonFragment/DialpadFragment update their colors
* Added InCallUIMaterialColorMapUtils to extract color

Bug: 17971273
Change-Id: Ia247b153b57ffc8a5277d521c433ab0be6696cf6
diff --git a/InCallUI/res/drawable/btn_add.xml b/InCallUI/res/drawable/btn_add.xml
index 515d65b..7d5e90f 100644
--- a/InCallUI/res/drawable/btn_add.xml
+++ b/InCallUI/res/drawable/btn_add.xml
@@ -18,12 +18,13 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_toolbar_add_call"
             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
index 962539e..a26cee3 100644
--- a/InCallUI/res/drawable/btn_change_to_video.xml
+++ b/InCallUI/res/drawable/btn_change_to_video.xml
@@ -18,7 +18,8 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_toolbar_video"
diff --git a/InCallUI/res/drawable/btn_change_to_voice.xml b/InCallUI/res/drawable/btn_change_to_voice.xml
index fdeae07..86a7f21 100644
--- a/InCallUI/res/drawable/btn_change_to_voice.xml
+++ b/InCallUI/res/drawable/btn_change_to_voice.xml
@@ -18,7 +18,8 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_toolbar_audio_phone"
diff --git a/InCallUI/res/drawable/btn_compound_background.xml b/InCallUI/res/drawable/btn_compound_background.xml
index 93e6c31..36aab0d 100644
--- a/InCallUI/res/drawable/btn_compound_background.xml
+++ b/InCallUI/res/drawable/btn_compound_background.xml
@@ -24,7 +24,7 @@
                   android:drawable="@drawable/btn_selected_focused" />
 
             <item android:state_focused="true"
-                  android:drawable="@drawable/btn_unselected_focused" />cd
+                  android:drawable="@drawable/btn_unselected_focused" />
 
             <item android:state_selected="true"
                 android:drawable="@drawable/btn_selected" />
diff --git a/InCallUI/res/drawable/btn_compound_dialpad.xml b/InCallUI/res/drawable/btn_compound_dialpad.xml
index fcd9a3c..1b78ead 100644
--- a/InCallUI/res/drawable/btn_compound_dialpad.xml
+++ b/InCallUI/res/drawable/btn_compound_dialpad.xml
@@ -18,7 +18,8 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:id="@+id/compoundBackgroundItem"
+          android:drawable="@drawable/btn_compound_background" />
 
     <!-- ...and the actual icon on top.  Use an explicit <bitmap> to avoid scaling
          the icon up to the full size of the button. -->
diff --git a/InCallUI/res/drawable/btn_compound_hold.xml b/InCallUI/res/drawable/btn_compound_hold.xml
index dcf9507..7974efa 100644
--- a/InCallUI/res/drawable/btn_compound_hold.xml
+++ b/InCallUI/res/drawable/btn_compound_hold.xml
@@ -18,7 +18,8 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:id="@+id/compoundBackgroundItem"
+          android:drawable="@drawable/btn_compound_background" />
 
     <!-- ...and the actual icon on top.  Use an explicit <bitmap> to avoid scaling
          the icon up to the full size of the button. -->
diff --git a/InCallUI/res/drawable/btn_compound_mute.xml b/InCallUI/res/drawable/btn_compound_mute.xml
index 68a8c9b..86708fb 100644
--- a/InCallUI/res/drawable/btn_compound_mute.xml
+++ b/InCallUI/res/drawable/btn_compound_mute.xml
@@ -18,7 +18,8 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:id="@+id/compoundBackgroundItem"
+          android:drawable="@drawable/btn_compound_background" />
 
     <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full size of the button. -->
     <item>
diff --git a/InCallUI/res/drawable/btn_compound_video_off.xml b/InCallUI/res/drawable/btn_compound_video_off.xml
index 8af4209..b942cd0 100644
--- a/InCallUI/res/drawable/btn_compound_video_off.xml
+++ b/InCallUI/res/drawable/btn_compound_video_off.xml
@@ -19,7 +19,8 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:id="@+id/compoundBackgroundItem"
+          android:drawable="@drawable/btn_compound_background" />
 
     <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full size of the button. -->
     <item>
diff --git a/InCallUI/res/drawable/btn_compound_video_switch.xml b/InCallUI/res/drawable/btn_compound_video_switch.xml
index ef171ab..f811186 100644
--- a/InCallUI/res/drawable/btn_compound_video_switch.xml
+++ b/InCallUI/res/drawable/btn_compound_video_switch.xml
@@ -19,7 +19,8 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <!-- The standard "compound button" background. -->
-    <item android:drawable="@drawable/btn_compound_background" />
+    <item android:id="@+id/compoundBackgroundItem"
+          android:drawable="@drawable/btn_compound_background" />
 
     <!-- Use an explicit <bitmap> to avoid scaling the icon up to the full size of the button. -->
     <item>
diff --git a/InCallUI/res/drawable/btn_merge.xml b/InCallUI/res/drawable/btn_merge.xml
index 78e1974..2b4818a 100644
--- a/InCallUI/res/drawable/btn_merge.xml
+++ b/InCallUI/res/drawable/btn_merge.xml
@@ -18,7 +18,8 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_toolbar_merge"
diff --git a/InCallUI/res/drawable/btn_overflow.xml b/InCallUI/res/drawable/btn_overflow.xml
index e851ece..2eb26cc 100644
--- a/InCallUI/res/drawable/btn_overflow.xml
+++ b/InCallUI/res/drawable/btn_overflow.xml
@@ -18,7 +18,8 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_overflow_menu"
diff --git a/InCallUI/res/drawable/btn_swap.xml b/InCallUI/res/drawable/btn_swap.xml
index 7a82411..5d6c8ec 100644
--- a/InCallUI/res/drawable/btn_swap.xml
+++ b/InCallUI/res/drawable/btn_swap.xml
@@ -18,7 +18,8 @@
 
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:drawable="@drawable/btn_background" />
+    <item android:id="@+id/backgroundItem"
+          android:drawable="@drawable/btn_background" />
 
     <item>
         <bitmap android:src="@drawable/ic_toolbar_swap"
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index aa87d0c..56d65b0 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -35,6 +35,7 @@
     android:layout_width="match_parent"
     android:layout_margin="0dp"
     android:padding="0dp"
+    android:background="@color/button_background_color"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:animateLayoutChanges="true"
@@ -46,7 +47,6 @@
         android:layout_height="wrap_content"
         android:paddingStart="@dimen/button_cluster_horizontal_padding"
         android:paddingEnd="@dimen/button_cluster_horizontal_padding"
-        android:background="@color/button_background_color"
         android:gravity="bottom|center_horizontal">
 
         <!-- This row only ever shows either 4 or 5 buttons. This may depend on whether the device
diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml
index f691fe2..05c2cf1 100644
--- a/InCallUI/res/values/colors.xml
+++ b/InCallUI/res/values/colors.xml
@@ -76,4 +76,31 @@
 
     <!-- 20% opacity, theme color. -->
     <color name="incall_dialpad_touch_tint">#330288d1</color>
+
+    <!-- Background colors for InCallUI. This set of colors is a subset of
+        https://spec.googleplex.com/quantumpalette#extended which pass WCAG AA and all have a
+        contrast ratio over 5:1.
+
+        These colors are also used by InCallUIMaterialColorMapUtils to generate primary
+        activity colors.
+    -->
+    <array name="background_colors">
+        <item>#00796B</item>
+        <item>#3367D6</item>
+        <item>#303F9F</item>
+        <item>#7B1FA2</item>
+        <item>#C2185B</item>
+        <item>#C53929</item>
+    </array>
+
+    <!-- Darker versions of background_colors, two shades darker. These colors are used for the
+         status bar. -->
+    <array name="background_colors_dark">
+        <item>#004D40</item>
+        <item>#1C3AA9</item>
+        <item>#1A237E</item>
+        <item>#4A148C</item>
+        <item>#880E4F</item>
+        <item>#A52714</item>
+    </array>
 </resources>