summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard MacGregor <rmacgregor@cyngn.com>2016-03-16 17:20:07 -0700
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-08 10:29:35 -0700
commit25cd7bfe66534ee3dbf1aad7ca646bec3b6c702a (patch)
tree34f0dd79026dbb0b9a5b46dde398a102e8d56421 /src
parenta5eb044a064d9798ecf5a8112b3f5bc543ff414b (diff)
downloadpackages_apps_InCallUI-25cd7bfe66534ee3dbf1aad7ca646bec3b6c702a.tar.gz
packages_apps_InCallUI-25cd7bfe66534ee3dbf1aad7ca646bec3b6c702a.tar.bz2
packages_apps_InCallUI-25cd7bfe66534ee3dbf1aad7ca646bec3b6c702a.zip
Temporarily revert DeepLink
Revert "Resolves a few issues related to call buttons: The DeepLink slot will" This reverts commit ae95d93516b3b7f0d709cddc2cdff6753dba513a. Revert "Resolves a NPE when the UI isn't available at the time of the callback" This reverts commit d740995d19e48aff2b2ae9252248badc52cc65c4. Revert "Tints the DeepLink icons loaded into the callbuttonfragment to keep" This reverts commit 05f12d3cf9383d119ab2ceb228d2e39b3518af23. Revert "DeepLink Refactors for CallButtonPresenter and CallButtonFragment" This reverts commit 1110623527c8f09e604acdc09f9ea31f46938e00. Revert "DeepLink integration phase 1" This reverts commit 824ac83c2076352e459a42f608e1d1fb75d4772f. Change-Id: If0d995e84b79ab76d16ecc5c9e61a89463508b34
Diffstat (limited to 'src')
-rw-r--r--src/com/android/incallui/CallButtonFragment.java47
-rw-r--r--src/com/android/incallui/CallButtonPresenter.java109
2 files changed, 13 insertions, 143 deletions
diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java
index 9abbab65..eabead97 100644
--- a/src/com/android/incallui/CallButtonFragment.java
+++ b/src/com/android/incallui/CallButtonFragment.java
@@ -54,8 +54,6 @@ import android.widget.TextView;
import com.android.incallui.incallapi.InCallPluginInfo;
-import com.cyanogen.ambient.deeplink.DeepLink;
-
import java.lang.Override;
import java.util.ArrayList;
import java.util.List;
@@ -88,17 +86,16 @@ public class CallButtonFragment
public static final int BUTTON_MUTE = 1;
public static final int BUTTON_DIALPAD = 2;
public static final int BUTTON_UPGRADE_TO_VIDEO = 3;
- public static final int BUTTON_TAKE_NOTE = 4;
- public static final int BUTTON_HOLD = 5;
- public static final int BUTTON_SWAP = 6;
- public static final int BUTTON_SWITCH_CAMERA = 7;
- public static final int BUTTON_ADD_CALL = 8;
- public static final int BUTTON_MERGE = 9;
- public static final int BUTTON_PAUSE_VIDEO = 10;
- public static final int BUTTON_MANAGE_VIDEO_CONFERENCE = 11;
- public static final int BUTTON_RECORD_CALL = 12;
- public static final int BUTTON_TRANSFER_CALL = 13;
- public static final int BUTTON_COUNT = 14;
+ public static final int BUTTON_HOLD = 4;
+ public static final int BUTTON_SWAP = 5;
+ public static final int BUTTON_SWITCH_CAMERA = 6;
+ public static final int BUTTON_ADD_CALL = 7;
+ public static final int BUTTON_MERGE = 8;
+ public static final int BUTTON_PAUSE_VIDEO = 9;
+ public static final int BUTTON_MANAGE_VIDEO_CONFERENCE = 10;
+ public static final int BUTTON_RECORD_CALL = 11;
+ public static final int BUTTON_TRANSFER_CALL = 12;
+ public static final int BUTTON_COUNT = 13;
}
private SparseIntArray mButtonVisibilityMap = new SparseIntArray(BUTTON_COUNT);
@@ -118,7 +115,6 @@ public class CallButtonFragment
private ImageButton mManageVideoCallConferenceButton;
private ImageButton mAddParticipantButton;
private ImageButton mTransferCallButton;
- private ImageButton mTakeNoteButton;
private PopupMenu mAudioModePopup;
private boolean mAudioModePopupVisible;
@@ -133,7 +129,6 @@ public class CallButtonFragment
private boolean mIsEnabled;
private MaterialPalette mCurrentThemeColors;
-
@Override
public CallButtonPresenter createPresenter() {
// TODO: find a cleaner way to include audio mode provider than having a singleton instance.
@@ -192,8 +187,6 @@ public class CallButtonFragment
mManageVideoCallConferenceButton = (ImageButton) parent.findViewById(
R.id.manageVideoCallConferenceButton);
mManageVideoCallConferenceButton.setOnClickListener(this);
- mTakeNoteButton = (ImageButton) parent.findViewById(R.id.takeNoteButton);
- mTakeNoteButton.setOnClickListener(CallButtonFragment.this);
return parent;
}
@@ -209,7 +202,6 @@ public class CallButtonFragment
public void onResume() {
if (getPresenter() != null) {
getPresenter().refreshMuteState();
- getPresenter().refreshDeepLinkState();
}
super.onResume();
@@ -217,19 +209,6 @@ public class CallButtonFragment
}
@Override
- public void setDeepLink(DeepLink deepLink) {
- mTakeNoteButton.setImageDrawable(
- configureDeepLinkDrawable(deepLink.getDrawableIcon(getContext())));
- }
-
- public Drawable configureDeepLinkDrawable(Drawable drawable) {
- drawable.mutate();
- drawable.setTintList(getResources().getColorStateList(R.color.selectable_icon_tint));
- drawable.setAutoMirrored(false);
- return drawable;
- }
-
- @Override
public void onClick(View view) {
int id = view.getId();
Log.d(this, "onClick(View " + view + ", id " + id + ")...");
@@ -287,9 +266,6 @@ public class CallButtonFragment
case R.id.transferCall:
getPresenter().transferCallClicked();
break;
- case R.id.takeNoteButton:
- getPresenter().handleNoteClick();
- break;
default:
Log.wtf(this, "onClick: unexpected");
return;
@@ -425,7 +401,6 @@ public class CallButtonFragment
mManageVideoCallConferenceButton.setEnabled(isEnabled);
mAddParticipantButton.setEnabled(isEnabled);
mTransferCallButton.setEnabled(isEnabled);
- mTakeNoteButton.setEnabled(isEnabled);
}
@Override
@@ -469,8 +444,6 @@ public class CallButtonFragment
return mCallRecordButton;
case BUTTON_TRANSFER_CALL:
return mTransferCallButton;
- case BUTTON_TAKE_NOTE:
- return mTakeNoteButton;
default:
Log.w(this, "Invalid button id");
return null;
diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java
index e7228956..cb7b6a03 100644
--- a/src/com/android/incallui/CallButtonPresenter.java
+++ b/src/com/android/incallui/CallButtonPresenter.java
@@ -39,7 +39,6 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.VideoProfile;
import android.text.TextUtils;
-import com.android.dialer.DeepLinkIntegrationManager;
import com.android.incallui.AudioModeProvider.AudioModeListener;
import com.android.incallui.ContactInfoCache;
import com.android.incallui.ContactInfoCache.ContactCacheEntry;
@@ -57,12 +56,6 @@ import com.android.phone.common.ambient.AmbientConnection;
import com.android.phone.common.util.StartInCallCallReceiver;
import com.cyanogen.ambient.common.api.AmbientApiClient;
-import com.cyanogen.ambient.common.api.ResultCallback;
-import com.cyanogen.ambient.deeplink.DeepLink;
-import com.cyanogen.ambient.deeplink.DeepLink.DeepLinkResultList;
-import com.cyanogen.ambient.deeplink.applicationtype.DeepLinkApplicationType;
-import com.cyanogen.ambient.deeplink.linkcontent.CallDeepLinkContent;
-import com.cyanogen.ambient.deeplink.linkcontent.DeepLinkContentType;
import com.cyanogen.ambient.incall.InCallServices;
import com.cyanogen.ambient.incall.extension.OriginCodes;
import com.cyanogen.ambient.incall.extension.StatusCodes;
@@ -84,41 +77,13 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
private static final String KEY_PREVIOUS_MUTE_STATE = "incall_key_previous_mute_state";
private static final String RECORDING_WARNING_PRESENTED = "recording_warning_presented";
private static final boolean DEBUG = false;
+
private Call mCall;
private boolean mAutomaticallyMuted = false;
private boolean mPreviousMuteState = false;
private StartInCallCallReceiver mCallback;
- private DeepLink mDeepLink;
- /**
- * Callback for getPreferredLinks(ResultCallback<DeepLinkResultList> deepLinkCallback).
- *
- * Updates the UI with the deeplink it should be using as an Icon.
- */
- private ResultCallback<DeepLinkResultList> mDeepLinkCallback = new
- ResultCallback<DeepLinkResultList>() {
- @Override
- public void onResult(DeepLinkResultList deepLinkResult) {
- List<DeepLink> links = deepLinkResult.getResults();
- mDeepLink = null;
- if (links != null) {
- for (DeepLink result : links) {
- if (result.getApplicationType() == DeepLinkApplicationType.NOTE) {
- mDeepLink = result;
- if(getUi() != null) {
- getUi().setDeepLink(mDeepLink);
- if(mCall != null) {
- updateButtonsState(mCall);
- }
- }
- break;
- }
- }
- }
- }
- };
-
@Override
public void onReceiveResult(int resultCode, Bundle resultData) {
if (DEBUG) Log.i(TAG, "Got InCallPlugin result callback code = " + resultCode);
@@ -154,6 +119,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
inCallPresenter.getInCallCameraManager().addCameraSelectionListener(this);
inCallPresenter.addInCallPluginUpdateListener(this);
CallList.getInstance().addActiveSubChangeListener(this);
+
// Update the buttons state immediately for the current call
onStateChange(InCallState.NO_CALLS, inCallPresenter.getInCallState(),
CallList.getInstance());
@@ -181,7 +147,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
mCall = callList.getOutgoingCall();
} else if (newState == InCallState.INCALL) {
mCall = callList.getActiveOrBackgroundCall();
- getPreferredLinks(mDeepLinkCallback);
+
// When connected to voice mail, automatically shows the dialpad.
// (On previous releases we showed it when in-call shows up, before waiting for
// OUTGOING. We may want to do that once we start showing "Voice mail" label on
@@ -200,7 +166,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
mCall = callList.getIncomingCall();
} else {
mCall = null;
- mDeepLink = null;
}
updateUi(newState, mCall);
}
@@ -646,7 +611,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
(contactInCallPlugins != null && !contactInCallPlugins.isEmpty())) &&
(callState == Call.State.ACTIVE || callState == Call.State.ONHOLD);
- final boolean showNote = getVisibilityOfNoteButton();
final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE);
final boolean showAddParticipant = call.can(
android.telecom.Call.Details.CAPABILITY_ADD_PARTICIPANT);
@@ -660,7 +624,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
ui.showButton(BUTTON_AUDIO, true);
ui.showButton(BUTTON_SWAP, showSwap);
ui.showButton(BUTTON_HOLD, showHold);
- ui.showButton(BUTTON_TAKE_NOTE,showNote);
ui.setHold(isCallOnHold);
ui.showButton(BUTTON_MUTE, showMute);
ui.showButton(BUTTON_ADD_CALL, showAddCall);
@@ -691,10 +654,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
mAutomaticallyMuted = false;
}
- protected void refreshDeepLinkState() {
- getPreferredLinks(mDeepLinkCallback);
- }
-
private void contactUpdated() {
if (DEBUG) Log.i(this, "contactUpdated");
if (getUi() != null && mCall != null) {
@@ -753,7 +712,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
void modifyChangeToVideoButton();
void displayVideoCallOptions();
void showInviteSnackbar(PendingIntent inviteIntent, String inviteText);
- void setDeepLink(DeepLink deepLink);
/**
* Once showButton() has been called on each of the individual buttons in the UI, call
@@ -777,65 +735,4 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
onStateChange(null, state, CallList.getInstance());
}
-
- /**
- * Take a note triggered by the CallButtonFragment note button.
- */
- public void handleNoteClick() {
- if(mCall != null) {
- if(mDeepLink.getAlreadyHasContent()) {
- getUi().getContext().startActivity(mDeepLink.createViewIntent());
- } else {
- CallDeepLinkContent content = new CallDeepLinkContent(mDeepLink);
- content.setName(getNameForCall());
- content.setNumber(mCall.getNumber());
- content.setUri(DeepLinkIntegrationManager.generateCallUri(mCall.getNumber(),
- mCall.getTelecommCall().getDetails().getCreateTimeMillis()));
- getUi().getContext().startActivity(content.build());
- }
- }
- }
-
- /**
- * Gets the name to display for the call.
- */
- private String getNameForCall() {
- String toRet = getUi().getContext().getResources().getString(R.string
- .call_button_contact_unknown);
- final ContactInfoCache cache = ContactInfoCache.getInstance(getUi().getContext());
- if (cache != null && mCall != null) {
- ContactCacheEntry contactInfo = cache.getInfo(mCall.getId());
- if(contactInfo != null) {
- if (!TextUtils.isEmpty(contactInfo.name)) {
- toRet = contactInfo.name;
- }
- }
- }
- return toRet;
- }
-
- /**
- * Get preferred deeplinks for the current call.
- * @param deepLinkCallback - callback to pass results to.
- */
- public void getPreferredLinks(ResultCallback<DeepLinkResultList> deepLinkCallback) {
- Call localCall = mCall;
- if(localCall == null) {
- localCall = CallList.getInstance().getFirstCall();
- }
- if(localCall != null) {
- DeepLinkIntegrationManager.getInstance().getPreferredLinksFor(deepLinkCallback,
- DeepLinkContentType.CALL,
- DeepLinkIntegrationManager.generateCallUri(localCall.getNumber(),
- localCall.getCreateTimeMillis()));
- }
- }
-
- /**
- * Returns the visibility status for the take note icon
- * @return whether the note button should be shown.
- */
- private boolean getVisibilityOfNoteButton() {
- return mDeepLink != null && mCall != null && mCall.getState() == Call.State.ACTIVE;
- }
}