Merge "Delete auxiliary action button in call button fragment." into lmp-dev
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index 8969cbb..8397ace 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -63,24 +63,18 @@
         android:background="@color/button_background_color"
         android:gravity="bottom|center_horizontal">
 
-        <!-- This row has either 4 or 5 buttons, depending on
-       whether the device supports "Hold" (i.e. 4 buttons on
-       CDMA devices, 5 buttons on GSM devices.)  The buttons
-       are interspersed with 'layout_weight="1"' placeholder
-       views so that they'll be spaced evenly in both cases.
+        <!-- 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.
 
-       But note 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. -->
+             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. -->
 
         <!-- "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. -->
+        <!-- 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. -->
         <ImageButton android:id="@+id/audioButton"
             style="@style/InCallButton"
             android:background="@drawable/btn_compound_audio"
@@ -100,9 +94,9 @@
             android:background="@drawable/btn_compound_dialpad"
             android:contentDescription="@string/onscreenShowDialpadText" />
 
-        <!-- 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. -->
+        <!-- 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"
@@ -117,9 +111,9 @@
             android:contentDescription="@string/onscreenSwapCallsText"
             android:visibility="gone" />
 
-        <!-- 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. -->
+        <!-- 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. -->
+
         <!-- "Add Call" -->
         <ImageButton android:id="@+id/addButton"
             style="@style/InCallButton"
@@ -128,19 +122,15 @@
             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. -->
+        <!-- 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" />
 
-        <ImageButton android:id="@+id/auxiliaryActionButton"
-            style="@style/InCallButton"
-            android:visibility="gone" />
-
     </LinearLayout>
 
 </LinearLayout>
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 20d2aa7..3b06f1a 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -16,7 +16,6 @@
 
 package com.android.incallui;
 
-import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.os.Bundle;
 import android.view.LayoutInflater;
@@ -30,7 +29,6 @@
 import android.widget.PopupMenu;
 import android.widget.PopupMenu.OnDismissListener;
 import android.widget.PopupMenu.OnMenuItemClickListener;
-import android.widget.ToggleButton;
 
 import com.android.services.telephony.common.AudioMode;
 
@@ -49,7 +47,6 @@
     private ImageButton mMergeButton;
     private ImageButton mAddCallButton;
     private ImageButton mSwapButton;
-    private ImageButton mAuxiliaryActionButton;
 
     private PopupMenu mAudioModePopup;
     private boolean mAudioModePopupVisible;
@@ -136,8 +133,6 @@
         mMergeButton.setOnClickListener(this);
         mSwapButton = (ImageButton) parent.findViewById(R.id.swapButton);
         mSwapButton.setOnClickListener(this);
-        mAuxiliaryActionButton = (ImageButton) parent.findViewById(R.id.auxiliaryActionButton);
-        mAuxiliaryActionButton.setOnClickListener(this);
 
         return parent;
     }
@@ -180,9 +175,6 @@
             case R.id.dialpadButton:
                 getPresenter().showDialpadClicked(!mShowDialpadButton.isSelected());
                 break;
-            case R.id.auxiliaryActionButton:
-                getPresenter().auxiliaryActionButtonClicked();
-                break;
             default:
                 Log.wtf(this, "onClick: unexpected");
                 break;
@@ -516,15 +508,6 @@
     }
 
     @Override
-    public void updateAuxiliaryActionButton(boolean show, String description, Drawable drawable) {
-        mAuxiliaryActionButton.setVisibility(show ? View.VISIBLE : View.GONE);
-        if (show) {
-            mAuxiliaryActionButton.setContentDescription(description);
-            mAuxiliaryActionButton.setImageDrawable(drawable);
-        }
-    }
-
-    @Override
     public void showManageConferenceCallButton() {
         mExtraRowButton.setVisibility(View.VISIBLE);
         mManageConferenceButton.setVisibility(View.VISIBLE);
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 84cb8ac..f49637e 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -26,7 +26,6 @@
 import com.android.incallui.InCallPresenter.InCallState;
 import com.android.incallui.InCallPresenter.InCallStateListener;
 import com.android.incallui.InCallPresenter.IncomingCallListener;
-import com.android.incallui.service.AuxiliaryActionService;
 import com.android.incalluibind.ServiceFactory;
 import com.android.services.telephony.common.AudioMode;
 
@@ -37,8 +36,7 @@
  * Logic for call buttons.
  */
 public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButtonUi>
-        implements InCallStateListener, AudioModeListener, IncomingCallListener,
-        AuxiliaryActionService.Client {
+        implements InCallStateListener, AudioModeListener, IncomingCallListener {
 
     private Call mCall;
     private boolean mAutomaticallyMuted = false;
@@ -49,8 +47,6 @@
 
     private InCallState mPreviousState = null;
 
-    private AuxiliaryActionService mAuxiliaryActionService = null;
-
     public CallButtonPresenter() {
     }
 
@@ -65,10 +61,6 @@
         InCallPresenter.getInstance().addIncomingCallListener(this);
 
         Context context = ((Fragment) ui).getActivity();
-        mAuxiliaryActionService = ServiceFactory.newAuxiliaryActionService(context);
-        if (mAuxiliaryActionService != null) {
-            mAuxiliaryActionService.setClient(this);
-        }
     }
 
     @Override
@@ -78,9 +70,6 @@
         InCallPresenter.getInstance().removeListener(this);
         AudioModeProvider.getInstance().removeListener(this);
         InCallPresenter.getInstance().removeIncomingCallListener(this);
-        if (mAuxiliaryActionService != null) {
-            mAuxiliaryActionService.setClient(null);
-        }
     }
 
     @Override
@@ -142,11 +131,6 @@
         }
     }
 
-    @Override
-    public void onAuxiliaryActionStateChanged() {
-        updateAuxiliaryActionButton();
-    }
-
     public int getAudioMode() {
         return AudioModeProvider.getInstance().getAudioMode();
     }
@@ -234,10 +218,6 @@
         updateExtraButtonRow();
     }
 
-    public void auxiliaryActionButtonClicked() {
-        mAuxiliaryActionService.performAction();
-    }
-
     private void updateUi(InCallState state, Call call) {
         final CallButtonUi ui = getUi();
         if (ui == null) {
@@ -324,7 +304,6 @@
             mShowManageConference = (call.isConferenceCall() && !isGenericConference);
 
             updateExtraButtonRow();
-            updateAuxiliaryActionButton();
         }
     }
 
@@ -346,22 +325,6 @@
         }
     }
 
-    private void updateAuxiliaryActionButton() {
-        if (mAuxiliaryActionService == null) {
-            return;
-        }
-        final CallButtonUi ui = getUi();
-        if (ui == null) {
-            return;
-        }
-        if (mCall != null) {
-            mAuxiliaryActionService.setRemotePhoneNumber(mCall.getNumber());
-        }
-        ui.updateAuxiliaryActionButton(mAuxiliaryActionService.isActionEnabled(),
-                mAuxiliaryActionService.getActionDescription(),
-                mAuxiliaryActionService.getActionDrawable());
-    }
-
     public void refreshMuteState() {
         // Restore the previous mute state
         if (mAutomaticallyMuted &&
@@ -393,6 +356,5 @@
         void showGenericMergeButton();
         void hideExtraRow();
         void displayManageConferencePanel(boolean on);
-        void updateAuxiliaryActionButton(boolean show, String description, Drawable drawable);
     }
 }
diff --git a/InCallUI/src/com/android/incallui/service/AuxiliaryActionService.java b/InCallUI/src/com/android/incallui/service/AuxiliaryActionService.java
deleted file mode 100644
index b0970fa..0000000
--- a/InCallUI/src/com/android/incallui/service/AuxiliaryActionService.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
- */
-
-package com.android.incallui.service;
-
-import android.graphics.drawable.Drawable;
-
-/**
- * Generic service that allows the user to perform an action from within the in call UI.
- * If the service is implemented then a button is added to the InCallUI. The button is visible if
- * AuxiliaryActionService.isActionEnabled() returns true and hidden otherwise. If this service
- * is not implemented then the button is always hidden.
- */
-public interface AuxiliaryActionService {
-    /**
-     * Client of the service.
-     */
-    public interface Client {
-        /**
-         * Called when the action's enabled state may have changed.
-         */
-        public void onAuxiliaryActionStateChanged();
-    }
-
-    /**
-     * Sets the client.
-     */
-    public void setClient(Client client);
-
-    /**
-     * Sets the remote phone number.
-     */
-    public void setRemotePhoneNumber(String remotePhoneNumber);
-
-    /**
-     * Gets the action's description.
-     *
-     * @return the description.
-     */
-    public String getActionDescription();
-
-    /**
-     * Gets the action's drawable.
-     *
-     * @return the drawable.
-     */
-    public Drawable getActionDrawable();
-
-    /**
-     * Checks if the auxiliary action is enabled.
-     *
-     * @return true if the action is enabled, otherwise false.
-     */
-    public boolean isActionEnabled();
-
-    /**
-     * Triggers the action for the auxiliary service.
-     */
-    public void performAction();
-}
diff --git a/InCallUI/src/com/android/incalluibind/ServiceFactory.java b/InCallUI/src/com/android/incalluibind/ServiceFactory.java
index fcbc0ca..7191f14 100644
--- a/InCallUI/src/com/android/incalluibind/ServiceFactory.java
+++ b/InCallUI/src/com/android/incalluibind/ServiceFactory.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 
-import com.android.incallui.service.AuxiliaryActionService;
 import com.android.incallui.service.PhoneNumberService;
 
 /**
@@ -30,9 +29,4 @@
         // no phone number service.
         return null;
     }
-
-    public static AuxiliaryActionService newAuxiliaryActionService(Context context) {
-        // no auxiliary action service.
-        return null;
-    }
 }