Merge "Move "manage conference calls" button above photo." into lmp-dev
diff --git a/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 6194506..0000000
--- a/InCallUI/res/drawable-hdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 185c55b..0000000
--- a/InCallUI/res/drawable-ldrtl-hdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 844bed3..0000000
--- a/InCallUI/res/drawable-ldrtl-mdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 38ea395..0000000
--- a/InCallUI/res/drawable-ldrtl-xhdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png
deleted file mode 100644
index fefee32..0000000
--- a/InCallUI/res/drawable-mdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 470ca27..0000000
--- a/InCallUI/res/drawable-xhdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/drawable-xxhdpi/ic_groups_holo_dark.png b/InCallUI/res/drawable-xxhdpi/ic_groups_holo_dark.png
deleted file mode 100644
index 6fdaa5d..0000000
--- a/InCallUI/res/drawable-xxhdpi/ic_groups_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/InCallUI/res/layout-land/call_card_content.xml b/InCallUI/res/layout-land/call_card_content.xml
index f317353..ddcd403 100644
--- a/InCallUI/res/layout-land/call_card_content.xml
+++ b/InCallUI/res/layout-land/call_card_content.xml
@@ -65,6 +65,11 @@
         android:contentDescription="@string/contactPhoto"
         android:src="@drawable/picture_unknown" />
 
+    <include layout="@layout/manage_conference_call_button"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/photo" />
+
     <fragment android:name="com.android.incallui.VideoCallFragment"
         android:layout_alignParentStart="true"
         android:layout_gravity="start|center_vertical"
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 6b7e17a..aa87d0c 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -40,17 +40,6 @@
     android:animateLayoutChanges="true"
     android:visibility="invisible" >
 
-    <!-- Row 1, the "extra button row": A couple of relatively rare
-         buttons used only in certain call states.
-         Most of the time this whole row is GONE.
-         For now, at least, there's only ever one button visible here
-         at a time, so this can be a simple FrameLayout. -->
-    <include android:id="@+id/extraButtonRow"
-        layout="@layout/extra_button_row"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
-
-    <!-- Row 2: The main batch of in-call buttons. -->
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="match_parent"
diff --git a/InCallUI/res/layout/call_card_content.xml b/InCallUI/res/layout/call_card_content.xml
index c45553f..6d0ee88 100644
--- a/InCallUI/res/layout/call_card_content.xml
+++ b/InCallUI/res/layout/call_card_content.xml
@@ -55,6 +55,7 @@
             android:visibility="gone"
             android:padding="@dimen/call_banner_side_padding"
             android:background="@android:color/white" />
+
     </LinearLayout>
 
     <!-- Contact photo for primary call info -->
@@ -98,6 +99,11 @@
     <!-- Secondary "Call info" block, for the background ("on hold") call. -->
     <include layout="@layout/secondary_call_info" />
 
+    <include layout="@layout/manage_conference_call_button"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/photo" />
+
     <!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. -->
     <FrameLayout
         android:id="@+id/dialpadFragmentContainer"
diff --git a/InCallUI/res/layout/extra_button_row.xml b/InCallUI/res/layout/extra_button_row.xml
deleted file mode 100644
index 417c4d6..0000000
--- a/InCallUI/res/layout/extra_button_row.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2013 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
-  -->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@color/button_background_color">
-    <!-- The buttons here have a text label floating off to the side
-         (which is necessary because these buttons are used only in
-         a few rare states, and the meaning of the icon might not be
-         obvious.)  The entire row (button + text) is clickable. -->
-
-    <!-- "Manage conference" -->
-    <!-- This button is used only on GSM devices, during a conference call. -->
-    <LinearLayout android:id="@+id/manageConferenceButton"
-        android:orientation="horizontal"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingStart="@dimen/button_cluster_horizontal_padding"
-        android:paddingEnd="@dimen/button_cluster_horizontal_padding"
-        android:background="?android:attr/selectableItemBackground"
-        android:visibility="gone">
-        <!-- The entire LinearLayout here is clickable, so we don't
-             care about clicks on the ImageButton itself. -->
-        <ImageButton android:id="@+id/manageConferenceButtonImage"
-            android:clickable="false"
-            style="@style/InCallExtraRowButton"
-            android:src="@drawable/ic_groups_holo_dark"
-            android:contentDescription="@string/onscreenManageConferenceText" />
-        <TextView android:id="@+id/manageConferenceButtonLabel"
-            style="@style/InCallExtraRowButtonLabel"
-            android:text="@string/onscreenManageConferenceText" />
-    </LinearLayout>
-
-</FrameLayout>
diff --git a/InCallUI/res/layout/manage_conference_call_button.xml b/InCallUI/res/layout/manage_conference_call_button.xml
new file mode 100644
index 0000000..d8ddf21
--- /dev/null
+++ b/InCallUI/res/layout/manage_conference_call_button.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2013 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
+  -->
+
+<!-- This button is used only on GSM devices, during a conference call. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/manage_conference_call_button"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="horizontal"
+    android:paddingStart="@dimen/call_banner_side_padding"
+    android:paddingEnd="@dimen/secondary_call_banner_right_padding"
+    android:paddingTop="@dimen/call_banner_secondary_call_top_bottom_padding"
+    android:paddingBottom="@dimen/call_banner_secondary_call_top_bottom_padding"
+    android:background="@color/incall_banner_secondary_background_color">
+
+    <!-- The entire LinearLayout here is clickable, so we ignore ImageButton clicks. -->
+    <ImageView android:id="@+id/manageConferenceButtonImage"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_group_white_24dp"
+        android:tint="@color/incall_banner_secondary_text_color"
+        android:contentDescription="@string/onscreenManageConferenceText" />
+
+    <TextView android:id="@+id/manageConferenceButtonLabel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingStart="24dp"
+        android:gravity="center_vertical"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="@color/incall_banner_secondary_text_color"
+        android:text="@string/onscreenManageConferenceText" />
+
+</LinearLayout>
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index 6bf80f3..8648c8c 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -50,12 +50,6 @@
     <!-- Height and width of the in-call buttons. -->
     <dimen name="in_call_button_dimension">48dp</dimen>
 
-    <!-- Width of buttons in the extra button row. -->
-    <dimen name="extra_row_button_width">56dp</dimen>
-
-    <!-- Height of buttons in the extra button row. -->
-    <dimen name="extra_row_button_height">@dimen/in_call_button_dimension</dimen>
-
     <dimen name="primary_call_elevation">4dp</dimen>
     <dimen name="secondary_call_elevation">4dp</dimen>
 
diff --git a/InCallUI/res/values/styles.xml b/InCallUI/res/values/styles.xml
index 06aeb87..f49cee9 100644
--- a/InCallUI/res/values/styles.xml
+++ b/InCallUI/res/values/styles.xml
@@ -70,27 +70,6 @@
         <item name="android:textOff">@null</item>
     </style>
 
-    <!-- Buttons in extra button row. -->
-    <style name="InCallExtraRowButton">
-        <item name="android:layout_width">@dimen/extra_row_button_width</item>
-        <item name="android:layout_height">@dimen/extra_row_button_height</item>
-        <item name="android:background">@null</item>
-    </style>
-
-    <!-- Text label drawn alongside buttons in the "extra button row" of
-         the in-call onscreen touch UI. -->
-    <style name="InCallExtraRowButtonLabel">
-        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
-        <item name="android:textColor">@color/incall_call_banner_text_color</item>
-        <item name="android:textAllCaps">true</item>
-        <item name="android:textStyle">bold</item>
-        <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_height">wrap_content</item>
-        <item name="android:layout_gravity">center_vertical</item>
-        <item name="android:layout_marginStart">5dip</item>
-        <item name="android:layout_marginEnd">5dip</item>
-    </style>
-
     <style name="InCallAnimationStyle" parent="@android:style/Animation.Activity">
         <!-- Suppress task-to-task animation happening during the transition from
              OutgoingCallBroadcaster (and SipOptionHandler) to InCallActivity.
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 5744cc5..14d1363 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -58,8 +58,6 @@
     private PopupMenu mAudioModePopup;
     private boolean mAudioModePopupVisible;
     private PopupMenu mOverflowPopup;
-    private View mExtraRowButton;
-    private View mManageConferenceButton;
 
     private int mPrevAudioMode = 0;
 
@@ -90,11 +88,6 @@
             Bundle savedInstanceState) {
         final View parent = inflater.inflate(R.layout.call_button_fragment, container, false);
 
-        mExtraRowButton = parent.findViewById(R.id.extraButtonRow);
-
-        mManageConferenceButton = parent.findViewById(R.id.manageConferenceButton);
-        mManageConferenceButton.setOnClickListener(this);
-
         mAudioButton = (ImageButton) parent.findViewById(R.id.audioButton);
         mAudioButton.setOnClickListener(this);
         mChangeToVoiceButton = (ImageButton) parent.findViewById(R.id.changeToVoiceButton);
@@ -191,9 +184,6 @@
             case R.id.overflowButton:
                 mOverflowPopup.show();
                 break;
-            case R.id.manageConferenceButton:
-                getPresenter().manageConferenceButtonClicked();
-                break;
             default:
                 Log.wtf(this, "onClick: unexpected");
                 break;
@@ -660,28 +650,10 @@
     }
 
     @Override
-    public void displayManageConferencePanel(boolean value) {
-        if (getActivity() != null && getActivity() instanceof InCallActivity) {
-            ((InCallActivity) getActivity()).displayManageConferencePanel(value);
-        }
-    }
-
-    @Override
     public Context getContext() {
         return getActivity();
     }
 
-    @Override
-    public void showManageConferenceCallButton() {
-        mExtraRowButton.setVisibility(View.VISIBLE);
-        mManageConferenceButton.setVisibility(View.VISIBLE);
-    }
-
-    @Override
-    public void hideExtraRow() {
-       mExtraRowButton.setVisibility(View.GONE);
-    }
-
     private void maybeSendAccessibilityEvent(View view, int stringId) {
         final Context context = getActivity();
         AccessibilityManager manager =
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 393c0f6..8a5170c 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -165,10 +165,6 @@
         setAudioMode(newMode);
     }
 
-    public void manageConferenceButtonClicked() {
-        getUi().displayManageConferencePanel(true);
-    }
-
     public void muteClicked(boolean checked) {
         Log.d(this, "turning on mute: " + checked);
         TelecommAdapter.getInstance().mute(checked);
@@ -219,7 +215,6 @@
     public void showDialpadClicked(boolean checked) {
         Log.v(this, "Show dialpad " + String.valueOf(checked));
         getUi().displayDialpad(checked /* show */, true /* animate */);
-        updateExtraButtonRow(checked);
     }
 
     public void changeToVideoClicked() {
@@ -409,25 +404,6 @@
             ui.enableHold(enableHoldOption);
             ui.showSwapButton(showSwapOption);
         }
-
-        // Only show the conference call button if we are not in a generic conference.
-        // On CDMA devices, instead of a conference call button we show "add" and "merge" buttons.
-        mShowManageConference = (call.isConferenceCall() && !isGenericConference);
-        updateExtraButtonRow(ui.isDialpadVisible());
-    }
-
-    private void updateExtraButtonRow(boolean isDialpadVisible) {
-        final boolean showExtraButtonRow = mShowManageConference && !isDialpadVisible;
-
-        Log.d(this, "mShowManageConference : " + mShowManageConference);
-        Log.d(this, "isDialpadVisible: " + isDialpadVisible);
-        if (showExtraButtonRow) {
-            if (mShowManageConference) {
-                getUi().showManageConferenceCallButton();
-            }
-        } else {
-            getUi().hideExtraRow();
-        }
     }
 
     public void refreshMuteState() {
@@ -468,9 +444,6 @@
         void setSupportedAudio(int mask);
         void configureOverflowMenu(boolean showMergeMenuOption, boolean showAddMenuOption,
                 boolean showHoldMenuOption, boolean showSwapMenuOption);
-        void showManageConferenceCallButton();
-        void hideExtraRow();
-        void displayManageConferencePanel(boolean on);
         Context getContext();
     }
 }
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index bd32684..600689c 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -90,6 +90,8 @@
     private ImageView mSecondaryCallProviderIcon;
     private View mProgressSpinner;
 
+    private View mManageConferenceCallButton;
+
     // Dark number info bar
     private TextView mInCallMessageLabel;
 
@@ -165,10 +167,9 @@
         mPhoneNumber = (TextView) view.findViewById(R.id.phoneNumber);
         mPrimaryName = (TextView) view.findViewById(R.id.name);
         mNumberLabel = (TextView) view.findViewById(R.id.label);
-        mSecondaryCallInfo = (View) view.findViewById(R.id.secondary_call_info);
-        mSecondaryCallProviderInfo = (View) view.findViewById(R.id.secondary_call_provider_info);
+        mSecondaryCallInfo = view.findViewById(R.id.secondary_call_info);
+        mSecondaryCallProviderInfo = view.findViewById(R.id.secondary_call_provider_info);
         mPhoto = (ImageView) view.findViewById(R.id.photo);
-        mCallStateButton = view.findViewById(R.id.callStateButton);
         mCallStateIcon = (ImageView) view.findViewById(R.id.callStateIcon);
         mCallStateVideoCallIcon = (ImageView) view.findViewById(R.id.videoCallIcon);
         mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
@@ -215,15 +216,25 @@
             }
         });
 
-        mPrimaryName.setElegantTextHeight(false);
-        mCallStateLabel.setElegantTextHeight(false);
-
+        mCallStateButton = view.findViewById(R.id.callStateButton);
         mCallStateButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 getPresenter().phoneAccountClicked();
             }
         });
+
+        mManageConferenceCallButton = view.findViewById(R.id.manage_conference_call_button);
+        mManageConferenceCallButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                InCallActivity activity = (InCallActivity) getActivity();
+                activity.showConferenceCallManager();
+            }
+        });
+
+        mPrimaryName.setElegantTextHeight(false);
+        mCallStateLabel.setElegantTextHeight(false);
     }
 
     @Override
@@ -840,6 +851,16 @@
         mPhoto.setVisibility(isVisible ? View.VISIBLE : View.GONE);
     }
 
+    /**
+     * Changes the visibility of the "manage conference call" button.
+     *
+     * @param visible Whether to set the button to be visible or not.
+     */
+    @Override
+    public void showManageConferenceCallButton(boolean visible) {
+        mManageConferenceCallButton.setVisibility(visible ? View.VISIBLE : View.GONE);
+    }
+
     private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) {
         if (view == null) return;
         final List<CharSequence> eventText = event.getText();
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 5f98aa9..b746267 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -249,6 +249,8 @@
                     callState != Call.State.ONHOLD));
         }
 
+        maybeShowManageConferenceCallButton();
+
         final boolean enableEndCallButton = Call.State.isConnectingOrConnected(callState) &&
                 callState != Call.State.INCOMING && mPrimary != null;
         // Hide the end call button instantly if we're receiving an incoming call.
@@ -291,6 +293,16 @@
         }
     }
 
+    /**
+     * Only show the conference call button if we are not in a generic conference.
+     * On CDMA devices, instead of a manage conference call button, we show "add" and "merge"
+     * buttons in the {@link CallButtonFragment}.
+     */
+    private void maybeShowManageConferenceCallButton() {
+        final boolean isGenericConference = mPrimary.can(PhoneCapabilities.GENERIC_CONFERENCE);
+        getUi().showManageConferenceCallButton(mPrimary.isConferenceCall() && !isGenericConference);
+    }
+
     private void setCallbackNumber() {
         String callbackNumber = null;
 
@@ -658,6 +670,7 @@
         void setCallbackNumber(String number, boolean isEmergencyCalls);
         void setPhotoVisible(boolean isVisible);
         void setProgressSpinnerVisible(boolean visible);
+        void showManageConferenceCallButton(boolean visible);
     }
 
     private TelecommManager getTelecommManager() {
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 02635dc..f092033 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -586,10 +586,8 @@
         return mDialpadFragment != null && mDialpadFragment.isVisible();
     }
 
-    public void displayManageConferencePanel(boolean showPanel) {
-        if (showPanel) {
-            mConferenceManagerFragment.setVisible(true);
-        }
+    public void showConferenceCallManager() {
+        mConferenceManagerFragment.setVisible(true);
     }
 
     public void showPostCharWaitDialog(String callId, String chars) {