diff options
| author | Danny Baumann <dannybaumann@web.de> | 2014-11-13 14:41:14 +0100 |
|---|---|---|
| committer | Danny Baumann <dannybaumann@web.de> | 2015-12-11 13:14:09 +0100 |
| commit | 86c696a1cd6796ea0717bf63d081022f39aaf8e0 (patch) | |
| tree | 8a8d530b36bb697da753da4a10ba1cb2e7b4dfef | |
| parent | 5da3b19908d7ea5c9aeb3781a1b2c864a6bfbfbb (diff) | |
| download | android_packages_apps_InCallUI-86c696a1cd6796ea0717bf63d081022f39aaf8e0.tar.gz android_packages_apps_InCallUI-86c696a1cd6796ea0717bf63d081022f39aaf8e0.tar.bz2 android_packages_apps_InCallUI-86c696a1cd6796ea0717bf63d081022f39aaf8e0.zip | |
Proper supplementary service notification handling (5/5).
Map some pieces of information provided by SSN into the UI.
Change-Id: I6650102a9c464b6c1eb8bfc5a30a12fe68a1cfef
| -rw-r--r-- | res/values/cm_strings.xml | 38 | ||||
| -rw-r--r-- | src/com/android/incallui/Call.java | 29 | ||||
| -rw-r--r-- | src/com/android/incallui/CallCardFragment.java | 40 | ||||
| -rw-r--r-- | src/com/android/incallui/CallCardPresenter.java | 24 | ||||
| -rw-r--r-- | src/com/android/incallui/InCallActivity.java | 18 | ||||
| -rw-r--r-- | src/com/android/incallui/InCallPresenter.java | 2 |
6 files changed, 125 insertions, 26 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml new file mode 100644 index 00000000..6d036f45 --- /dev/null +++ b/res/values/cm_strings.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2013-2014 The CyanogenMod Project + Copyright (c) 2013, The Linux Foundation. All rights reserved. + + 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. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- In-call screen: call failure reason (call denied because call barring is ON on MT side ) --> + <string name="callFailed_incoming_cb_enabled">Party has barred all incoming calls.</string> + <!-- In-call screen: status label for an incoming call that is not answered and forwarded --> + <string name="callUnanswered_forwarded">Call unanswered and forwarded</string> + + <!-- In-call screen: "call type" indication for a forwarded call [CHAR LIMIT=30] --> + <string name="incall_call_type_label_forwarded">Forwarded call</string> + + <!-- In-call screen: status label for a call in the "dialing" state that's waiting for the busy remote side --> + <string name="card_title_dialing_waiting">Dialing (waiting\u2026)</string> + <!-- In-call screen: status label for an outgoing call that's routed via a specific + provider (e.g. MSIM) and is waiting for the busy remote side --> + <string name="calling_via_waiting_template">Calling via <xliff:g id="provider_name">%s</xliff:g> (Waiting\u2026)</string> + <!-- In-call screen: status label template for an active call that's routed via a specific + provider (e.g. MSIM) --> + <string name="card_title_active_via_template"><xliff:g id="status" example="Call on hold">%1$s</xliff:g> (via <xliff:g id="provider_name">%2$s</xliff:g>)</string> + + <!-- In-call screen: status label for a call that is held remotely --> + <string name="card_title_waiting_call">Waiting call</string> +</resources> diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index 8b87dbf7..f769f398 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -587,8 +587,33 @@ public class Call { } public boolean isConferenceCall() { - return mTelecommCall.getDetails().hasProperty( - android.telecom.Call.Details.PROPERTY_CONFERENCE); + return hasProperty(android.telecom.Call.Details.PROPERTY_CONFERENCE); + } + + public boolean isForwarded() { + return hasProperty(android.telecom.Call.Details.PROPERTY_WAS_FORWARDED); + } + + public boolean isWaitingForRemoteSide() { + if (mState == State.ACTIVE + && hasProperty(android.telecom.Call.Details.PROPERTY_HELD_REMOTELY)) { + return true; + } + if (mState == State.DIALING + && hasProperty(android.telecom.Call.Details.PROPERTY_DIALING_IS_WAITING)) { + return true; + } + return false; + } + + public boolean wasUnansweredForwarded() { + return getDisconnectCause().getCode() == DisconnectCause.MISSED + && hasProperty(android.telecom.Call.Details.PROPERTY_ADDITIONAL_CALL_FORWARDED); + } + + public boolean missedBecauseIncomingCallsBarredRemotely() { + return getDisconnectCause().getCode() == DisconnectCause.RESTRICTED + && hasProperty(android.telecom.Call.Details.PROPERTY_REMOTE_INCOMING_CALLS_BARRED); } public GatewayInfo getGatewayInfo() { diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java index 0b6fefda..57372f72 100644 --- a/src/com/android/incallui/CallCardFragment.java +++ b/src/com/android/incallui/CallCardFragment.java @@ -509,7 +509,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr */ @Override public void setPrimary(String number, String name, boolean nameIsNumber, String label, - Drawable photo, boolean isSipCall, boolean isContactPhotoShown) { + Drawable photo, boolean isSipCall, boolean isForwarded, boolean isContactPhotoShown) { Log.d(this, "Setting primary call"); // set the name field. setPrimaryName(name, nameIsNumber); @@ -527,7 +527,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr // Set the label (Mobile, Work, etc) setPrimaryLabel(label); - showInternetCallLabel(isSipCall); + showCallTypeLabel(isSipCall, isForwarded); setDrawableToImageView(mPhoto, photo, isContactPhotoShown); } @@ -652,11 +652,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr Drawable callStateIcon, String gatewayNumber, boolean isWifi, - boolean isConference) { + boolean isConference, + boolean isWaitingForRemoteSide) { boolean isGatewayCall = !TextUtils.isEmpty(gatewayNumber); CallStateLabel callStateLabel = getCallStateLabelFromState(state, videoState, sessionModificationState, disconnectCause, connectionLabel, isGatewayCall, isWifi, - isConference); + isConference, isWaitingForRemoteSide); Log.v(this, "setCallState " + callStateLabel.getCallStateLabel()); Log.v(this, "AutoDismiss " + callStateLabel.isAutoDismissing()); @@ -824,12 +825,13 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr return mIsAnimating; } - private void showInternetCallLabel(boolean show) { - if (show) { - final String label = getView().getContext().getString( - R.string.incall_call_type_label_sip); + private void showCallTypeLabel(boolean isSipCall, boolean isForwarded) { + if (isSipCall) { + mCallTypeLabel.setVisibility(View.VISIBLE); + mCallTypeLabel.setText(R.string.incall_call_type_label_sip); + } else if (isForwarded) { mCallTypeLabel.setVisibility(View.VISIBLE); - mCallTypeLabel.setText(label); + mCallTypeLabel.setText(R.string.incall_call_type_label_forwarded); } else { mCallTypeLabel.setVisibility(View.GONE); } @@ -894,7 +896,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr */ private CallStateLabel getCallStateLabelFromState(int state, int videoState, int sessionModificationState, DisconnectCause disconnectCause, String label, - boolean isGatewayCall, boolean isWifi, boolean isConference) { + boolean isGatewayCall, boolean isWifi, boolean isConference, + boolean isWaitingForRemoteSide) { final Context context = getView().getContext(); CharSequence callStateLabel = null; // Label to display as part of the call banner @@ -925,11 +928,17 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr callStateLabel = context.getString(R.string.card_title_video_call_requesting); } else if (CallUtils.isVideoCall(videoState)) { callStateLabel = context.getString(R.string.card_title_video_call); + } else if (isWaitingForRemoteSide) { + callStateLabel = context.getString(R.string.card_title_waiting_call); } if ((isAccount || isWifi || isConference) && hasSuggestedLabel) { - label += (callStateLabel != null) ? (" " + callStateLabel) : ""; - callStateLabel = label; + if (callStateLabel != null) { + callStateLabel = context.getString(R.string.card_title_active_via_template, + callStateLabel, label); + } else { + callStateLabel = label; + } } break; case Call.State.ONHOLD: @@ -938,7 +947,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr case Call.State.CONNECTING: case Call.State.DIALING: if (hasSuggestedLabel && !isWifi) { - callStateLabel = context.getString(R.string.calling_via_template, label); + int resId = isWaitingForRemoteSide + ? R.string.calling_via_waiting_template + : R.string.calling_via_template; + callStateLabel = context.getString(resId, label); + } else if (isWaitingForRemoteSide) { + callStateLabel = context.getString(R.string.card_title_dialing_waiting); } else { callStateLabel = context.getString(R.string.card_title_dialing); } diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index a6907dff..10056bef 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -215,6 +215,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> final boolean primaryChanged = !(Call.areSame(mPrimary, primary) && Call.areSameNumber(mPrimary, primary)); + final boolean primaryForwardedChanged = isForwarded(mPrimary) != isForwarded(primary); final boolean secondaryChanged = !(Call.areSame(mSecondary, secondary) && Call.areSameNumber(mSecondary, secondary)); final boolean shouldShowCallSubject = shouldShowCallSubject(mPrimary); @@ -247,6 +248,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> updatePrimaryDisplayInfo(); maybeStartSearch(mPrimary, true); mPrimary.setSessionModificationState(Call.SessionModificationState.NO_REQUEST); + } else if (primaryForwardedChanged && mPrimary != null) { + updatePrimaryDisplayInfo(); } if (previousPrimary != null && mPrimary == null) { @@ -297,7 +300,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> null, null, false /* isWifi */, - false /* isConference */); + false /* isConference */, + false /* isWaitingForRemoteSide */); getUi().showHdAudioIndicator(false); } @@ -398,7 +402,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> getCallStateIcon(), getGatewayNumber(), mPrimary.hasProperty(Details.PROPERTY_WIFI), - mPrimary.isConferenceCall()); + mPrimary.isConferenceCall(), + mPrimary.isWaitingForRemoteSide()); maybeShowHdAudioIcon(); setCallbackNumber(); @@ -568,6 +573,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } } + private static boolean isForwarded(Call call) { + return call != null && call.isForwarded(); + } + private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary) { if (isPrimary) { mPrimaryContactInfo = entry; @@ -630,7 +639,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> if (mPrimary == null) { // Clear the primary display info. - ui.setPrimary(null, null, false, null, null, false, false); + ui.setPrimary(null, null, false, null, null, false, false, false); return; } @@ -649,6 +658,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> null /* label */, getConferencePhoto(mPrimary), false /* isSipCall */, + false /* isForwarded */, showContactPhoto); } else if (mPrimaryContactInfo != null) { Log.d(TAG, "Update primary display info for " + mPrimaryContactInfo); @@ -681,6 +691,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> maybeShowHdAudioIcon(); boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number); + final boolean isForwarded = isForwarded(mPrimary); ui.setPrimary( number, name, @@ -688,10 +699,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label, mPrimaryContactInfo.photo, mPrimaryContactInfo.isSipCall, + isForwarded, showContactPhoto); } else { // Clear the primary display info. - ui.setPrimary(null, null, false, null, null, false, false); + ui.setPrimary(null, null, false, null, null, false, false, false); } if (mEmergencyCallListener != null) { @@ -992,7 +1004,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> void setVisible(boolean on); void setCallCardVisible(boolean visible); void setPrimary(String number, String name, boolean nameIsNumber, String label, - Drawable photo, boolean isSipCall, boolean isContactPhotoShown); + Drawable photo, boolean isSipCall, boolean isForwarded, boolean isContactPhotoShown); void setSecondary(boolean show, String name, boolean nameIsNumber, String label, String providerLabel, boolean isConference, boolean isVideoCall, boolean isFullscreen); @@ -1000,7 +1012,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> void setCallState(int state, int videoState, int sessionModificationState, DisconnectCause disconnectCause, String connectionLabel, Drawable connectionIcon, String gatewayNumber, boolean isWifi, - boolean isConference); + boolean isConference, boolean isWaitingForRemoteSide); void setPrimaryCallElapsedTime(boolean show, long duration); void setPrimaryName(String name, boolean nameIsNumber); void setPrimaryImage(Drawable image, boolean isVisible); diff --git a/src/com/android/incallui/InCallActivity.java b/src/com/android/incallui/InCallActivity.java index 58392fd9..a9e31b58 100644 --- a/src/com/android/incallui/InCallActivity.java +++ b/src/com/android/incallui/InCallActivity.java @@ -812,12 +812,22 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { return super.dispatchPopulateAccessibilityEvent(event); } - public void maybeShowErrorDialogOnDisconnect(DisconnectCause disconnectCause) { + public void maybeShowErrorDialogOnDisconnect(Call call) { Log.d(this, "maybeShowErrorDialogOnDisconnect"); - if (!isFinishing() && !TextUtils.isEmpty(disconnectCause.getDescription()) - && (disconnectCause.getCode() == DisconnectCause.ERROR || - disconnectCause.getCode() == DisconnectCause.RESTRICTED)) { + if (isFinishing()) { + return; + } + + DisconnectCause disconnectCause = call.getDisconnectCause(); + int code = disconnectCause.getCode(); + + if (call.wasUnansweredForwarded()) { + showErrorDialog(getString(R.string.callUnanswered_forwarded)); + } else if (call.missedBecauseIncomingCallsBarredRemotely()) { + showErrorDialog(getString(R.string.callFailed_incoming_cb_enabled)); + } else if (!TextUtils.isEmpty(disconnectCause.getDescription()) + && (code == DisconnectCause.ERROR || code == DisconnectCause.RESTRICTED)) { showErrorDialog(disconnectCause.getDescription()); } } diff --git a/src/com/android/incallui/InCallPresenter.java b/src/com/android/incallui/InCallPresenter.java index 0b9d447a..07da827b 100644 --- a/src/com/android/incallui/InCallPresenter.java +++ b/src/com/android/incallui/InCallPresenter.java @@ -1107,7 +1107,7 @@ public class InCallPresenter implements CallList.Listener, if (call.getAccountHandle() == null && !call.isConferenceCall()) { setDisconnectCauseForMissingAccounts(call); } - mInCallActivity.maybeShowErrorDialogOnDisconnect(call.getDisconnectCause()); + mInCallActivity.maybeShowErrorDialogOnDisconnect(call); } } |
