diff options
author | Nivedita Sarkar <nsarkar@codeaurora.org> | 2014-10-27 23:52:55 -0700 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2014-12-13 01:45:38 +0100 |
commit | 6fc6844f80cb3b957045784161409e3daffabcf9 (patch) | |
tree | 26f14f421637a7cb7cb474986dca4db0bdd51d14 | |
parent | cb36b695ebba82753264923967ddc7d4ea41e00f (diff) | |
download | packages_apps_InCallUI-6fc6844f80cb3b957045784161409e3daffabcf9.tar.gz packages_apps_InCallUI-6fc6844f80cb3b957045784161409e3daffabcf9.tar.bz2 packages_apps_InCallUI-6fc6844f80cb3b957045784161409e3daffabcf9.zip |
Propagate call substate message and display a notification on the UI
Change-Id: I7d96ddc3be73f6f73ff35f15f80e621441c55f59
CRs-Fixed: 749824
-rw-r--r-- | res/values/strings.xml | 8 | ||||
-rw-r--r-- | src/com/android/incallui/Call.java | 7 | ||||
-rw-r--r-- | src/com/android/incallui/VideoCallFragment.java | 41 | ||||
-rw-r--r-- | src/com/android/incallui/VideoCallPresenter.java | 20 |
4 files changed, 75 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 80620086..94530611 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -576,4 +576,12 @@ <string name="sub_1">SUB 1</string> <!-- Set Subscription screen: label sub 2 --> <string name="sub_2">SUB 2</string> + <!-- Call substate label for call resumed --> + <string name="call_substate_call_resumed">Call Resumed</string> + <!-- Call substate label for call connected suspended (audio) --> + <string name="call_substate_connected_suspended_audio">Call Connected Suspended (Audio)</string> + <!-- Call substate label for call connected suspended (video) --> + <string name="call_substate_connected_suspended_video">Call Connected Suspended (Video)</string> + <!-- Call substate label for avp retry --> + <string name="call_substate_avp_retry">Avp Retry</string> </resources> diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java index 22ec1bea..d9fbcac0 100644 --- a/src/com/android/incallui/Call.java +++ b/src/com/android/incallui/Call.java @@ -450,6 +450,10 @@ public final class Call { return mTelecommCall.getDetails().getVideoState(); } + public int getCallSubstate() { + return mTelecommCall.getDetails().getCallSubstate(); + } + public boolean isVideoCall(Context context) { return CallUtil.isVideoEnabled(context) && VideoProfile.VideoState.isVideo(getVideoState()); @@ -494,6 +498,7 @@ public final class Call { PhoneCapabilities.toString(mTelecommCall.getDetails().getCallCapabilities()), mChildCallIds, getParentId(), - mTelecommCall.getDetails().getVideoState(), mIsActiveSub); + mTelecommCall.getDetails().getVideoState(), mIsActiveSub, + mTelecommCall.getDetails().getCallSubstate()); } } diff --git a/src/com/android/incallui/VideoCallFragment.java b/src/com/android/incallui/VideoCallFragment.java index 54da8ae7..39868bd0 100644 --- a/src/com/android/incallui/VideoCallFragment.java +++ b/src/com/android/incallui/VideoCallFragment.java @@ -17,6 +17,7 @@ package com.android.incallui; import android.content.Context; +import android.content.res.Resources; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.SurfaceTexture; @@ -34,6 +35,7 @@ import android.widget.Toast; import com.google.common.base.Objects; import android.widget.Toast; import android.telecom.VideoProfile; +import android.telecom.Connection; /** * Fragment containing video calling surfaces. @@ -578,6 +580,45 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, } /** + * Displays a message on the UI that the call substate has changed. + * + */ + @Override + public void showCallSubstateChanged(int callSubstate) { + Log.d(this, "showCallSubstateChanged - call substate changed to " + callSubstate); + + final Context context = getActivity(); + if (context == null) { + Log.e(this, "showCallSubstateChanged - Activity is null. Return"); + return; + } + + final Resources resources = context.getResources(); + String callSubstateChangedText = ""; + + switch (callSubstate) { + case Connection.CALL_SUBSTATE_NONE: + callSubstateChangedText += + resources.getString(R.string.call_substate_call_resumed); + break; + case Connection.CALL_SUBSTATE_AUDIO_CONNECTED_SUSPENDED: + callSubstateChangedText += + resources.getString(R.string.call_substate_connected_suspended_audio); + break; + case Connection.CALL_SUBSTATE_VIDEO_CONNECTED_SUSPENDED: + callSubstateChangedText += + resources.getString(R.string.call_substate_connected_suspended_video); + break; + case Connection.CALL_SUBSTATE_AVP_RETRY: + callSubstateChangedText += resources.getString(R.string.call_substate_avp_retry); + break; + default: + break; + } + Toast.makeText(context, callSubstateChangedText, Toast.LENGTH_SHORT).show(); + } + + /** * Cleans up the video telephony surfaces. Used when the presenter indicates a change to an * audio-only state. Since the surfaces are static, it is important to ensure they are cleaned * up promptly. diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java index 31635550..68e5a354 100644 --- a/src/com/android/incallui/VideoCallPresenter.java +++ b/src/com/android/incallui/VideoCallPresenter.java @@ -148,6 +148,11 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi */ private int mPreVideoAudioMode = AudioModeProvider.AUDIO_MODE_INVALID; + /** + * Stores the current call substate. + */ + private int mCurrentCallSubstate; + /** Handler which resets request state to NO_REQUEST after an interval. */ private Handler mSessionModificationResetHandler; private static final long SESSION_MODIFICATION_RESET_DELAY_MS = 3000; @@ -403,6 +408,19 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi } } + private void checkForCallSubstateChange() { + if (mCurrentCallSubstate != mPrimaryCall.getCallSubstate()) { + VideoCallUi ui = getUi(); + if (ui == null) { + Log.e(this, "Error VideoCallUi is null. Return."); + return; + } + mCurrentCallSubstate = mPrimaryCall.getCallSubstate(); + // Display a call substate changed message on UI. + ui.showCallSubstateChanged(mCurrentCallSubstate); + } + } + private void cleanupSurfaces() { final VideoCallUi ui = getUi(); if (ui == null) { @@ -431,6 +449,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi } checkForVideoStateChange(); + checkForCallSubstateChange(); } /** @@ -822,5 +841,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi Point getScreenSize(); void cleanupSurfaces(); boolean isActivityRestart(); + void showCallSubstateChanged(int callSubstate); } } |