diff options
author | Andrew Lee <anwlee@google.com> | 2015-04-15 14:13:32 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-04-16 14:50:41 -0700 |
commit | b73b8ba04f32faeeb8c11e28ab4fc19b81daf653 (patch) | |
tree | d209d60d9b84bc008470828e289b2fe729266745 /InCallUI | |
parent | b74a5ebcc0fcc8a70a7e1af855f93ae6f158f0bb (diff) |
Rename CallListener to CallCallback.
To match API changes.
Bug: 20160491
Change-Id: I664cb0c3db7e0affc42179d467828246887069e8
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/Call.java | 32 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 29 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallVideoCallCallback.java (renamed from InCallUI/src/com/android/incallui/InCallVideoCallListener.java) | 28 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java (renamed from InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java) | 11 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoCallPresenter.java | 18 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoPauseController.java | 6 |
6 files changed, 75 insertions, 49 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 4ed7a49cf..d637c8a60 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -172,11 +172,11 @@ public class Call { private static final String ID_PREFIX = Call.class.getSimpleName() + "_"; private static int sIdCounter = 0; - private android.telecom.Call.Listener mTelecommCallListener = - new android.telecom.Call.Listener() { + private android.telecom.Call.Callback mTelecomCallCallback = + new android.telecom.Call.Callback() { @Override public void onStateChanged(android.telecom.Call call, int newState) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + " newState=" + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " newState=" + newState); update(); } @@ -184,7 +184,7 @@ public class Call { @Override public void onParentChanged(android.telecom.Call call, android.telecom.Call newParent) { - Log.d(this, "TelecommCallListener onParentChanged call=" + call + " newParent=" + Log.d(this, "TelecommCallCallback onParentChanged call=" + call + " newParent=" + newParent); update(); } @@ -198,7 +198,7 @@ public class Call { @Override public void onDetailsChanged(android.telecom.Call call, android.telecom.Call.Details details) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + " details=" + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " details=" + details); update(); } @@ -206,7 +206,7 @@ public class Call { @Override public void onCannedTextResponsesLoaded(android.telecom.Call call, List<String> cannedTextResponses) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " cannedTextResponses=" + cannedTextResponses); update(); } @@ -214,7 +214,7 @@ public class Call { @Override public void onPostDialWait(android.telecom.Call call, String remainingPostDialSequence) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " remainingPostDialSequence=" + remainingPostDialSequence); update(); } @@ -222,15 +222,15 @@ public class Call { @Override public void onVideoCallChanged(android.telecom.Call call, VideoCall videoCall) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + " videoCall=" + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " videoCall=" + videoCall); update(); } @Override public void onCallDestroyed(android.telecom.Call call) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call); - call.removeListener(mTelecommCallListener); + Log.d(this, "TelecommCallCallback onStateChanged call=" + call); + call.unregisterCallback(mTelecomCallCallback); } @Override @@ -252,7 +252,7 @@ public class Call { */ private int mModifyToVideoState = VideoProfile.VideoState.AUDIO_ONLY; - private InCallVideoCallListener mVideoCallListener; + private InCallVideoCallCallback mVideoCallCallback; /** * Used only to create mock calls for testing @@ -268,7 +268,7 @@ public class Call { mTelecommCall = telecommCall; mId = ID_PREFIX + Integer.toString(sIdCounter++); updateFromTelecommCall(); - mTelecommCall.addListener(mTelecommCallListener); + mTelecommCall.registerCallback(mTelecomCallCallback); } public android.telecom.Call getTelecommCall() { @@ -301,10 +301,10 @@ public class Call { setDisconnectCause(mTelecommCall.getDetails().getDisconnectCause()); if (mTelecommCall.getVideoCall() != null) { - if (mVideoCallListener == null) { - mVideoCallListener = new InCallVideoCallListener(this); + if (mVideoCallCallback == null) { + mVideoCallCallback = new InCallVideoCallCallback(this); } - mTelecommCall.getVideoCall().setVideoCallListener(mVideoCallListener); + mTelecommCall.getVideoCall().registerCallback(mVideoCallCallback); } mChildCallIds.clear(); @@ -562,7 +562,7 @@ public class Call { getParentId(), this.mTelecommCall.getConferenceableCalls(), mTelecommCall.getDetails().getVideoState(), - mTelecommCall.getDetails().getCallSubstate(), + mTelecommCall.getDetails().getCallSubstate(), mSessionModificationState, getVideoSettings()); } diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 9c0fca305..0880607fc 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -110,8 +110,33 @@ public class InCallPresenter implements CallList.Listener, */ private PhoneAccountHandle mPendingPhoneAccountHandle; - private final android.telecom.Call.Listener mCallListener = - new android.telecom.Call.Listener() { + private final Phone.Listener mPhoneListener = new Phone.Listener() { + @Override + public void onBringToForeground(Phone phone, boolean showDialpad) { + Log.i(this, "Bringing UI to foreground."); + bringToForeground(showDialpad); + } + @Override + public void onCallAdded(Phone phone, android.telecom.Call call) { + // Since a call has been added we are no longer waiting for Telecom to send us a + // call. + setBoundAndWaitingForOutgoingCall(false, null); + call.registerCallback(mCallCallback); + } + @Override + public void onCallRemoved(Phone phone, android.telecom.Call call) { + call.unregisterCallback(mCallCallback); + } + @Override + public void onCanAddCallChanged(Phone phone, boolean canAddCall) { + for (CanAddCallListener listener : mCanAddCallListeners) { + listener.onCanAddCallChanged(canAddCall); + } + } + }; + + private final android.telecom.Call.Callback mCallCallback = + new android.telecom.Call.Callback() { @Override public void onPostDialWait(android.telecom.Call call, String remainingPostDialSequence) { onPostDialCharWait(mCallList.getCallByTelecommCall(call).getId(), diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java index 741b8d614..f868b3baf 100644 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java +++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java @@ -23,9 +23,9 @@ import android.telecom.InCallService.VideoCall; import android.telecom.VideoProfile; /** - * Implements the InCallUI Video Call Listener. + * Implements the InCallUI VideoCall Callback. */ -public class InCallVideoCallListener extends VideoCall.Listener { +public class InCallVideoCallCallback extends VideoCall.Callback { /** * The call associated with this {@link InCallVideoClient}. @@ -37,7 +37,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { * * @param call The call. */ - public InCallVideoCallListener(Call call) { + public InCallVideoCallCallback(Call call) { mCall = call; } @@ -57,9 +57,9 @@ public class InCallVideoCallListener extends VideoCall.Listener { // Check for upgrades to video and downgrades to audio. if (wasVideoCall && !isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall); + InCallVideoCallCallbackNotifier.getInstance().downgradeToAudio(mCall); } else if (previousVideoState != newVideoState) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoRequest(mCall, + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoRequest(mCall, newVideoState); } } @@ -80,17 +80,17 @@ public class InCallVideoCallListener extends VideoCall.Listener { Log.d(this, "onSessionModifyResponseReceived status=" + status + " requestedProfile=" + requestedProfile + " responseProfile=" + responseProfile); if (status != VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(status, mCall); + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoFail(status, mCall); } else if (requestedProfile != null && responseProfile != null) { boolean modifySucceeded = requestedProfile.getVideoState() == responseProfile.getVideoState(); boolean isVideoCall = VideoProfile.VideoState.isVideo(responseProfile.getVideoState()); if (modifySucceeded && isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoSuccess(mCall); + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoSuccess(mCall); } else if (!modifySucceeded && isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(status, mCall); + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoFail(status, mCall); } else if (modifySucceeded && !isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall); + InCallVideoCallCallbackNotifier.getInstance().downgradeToAudio(mCall); } } else { Log.d(this, "onSessionModifyResponseReceived request and response Profiles are null"); @@ -104,7 +104,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { */ @Override public void onCallSessionEvent(int event) { - InCallVideoCallListenerNotifier.getInstance().callSessionEvent(event); + InCallVideoCallCallbackNotifier.getInstance().callSessionEvent(event); } /** @@ -115,7 +115,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { */ @Override public void onPeerDimensionsChanged(int width, int height) { - InCallVideoCallListenerNotifier.getInstance().peerDimensionsChanged(mCall, width, height); + InCallVideoCallCallbackNotifier.getInstance().peerDimensionsChanged(mCall, width, height); } /** @@ -125,7 +125,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { */ @Override public void onVideoQualityChanged(int videoQuality) { - InCallVideoCallListenerNotifier.getInstance().videoQualityChanged(mCall, videoQuality); + InCallVideoCallCallbackNotifier.getInstance().videoQualityChanged(mCall, videoQuality); } /** @@ -137,7 +137,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { @Override public void onCallDataUsageChanged(long dataUsage) { Log.d(this, "onCallDataUsageChanged: dataUsage = " + dataUsage); - InCallVideoCallListenerNotifier.getInstance().callDataUsageChanged(dataUsage); + InCallVideoCallCallbackNotifier.getInstance().callDataUsageChanged(dataUsage); } /** @@ -149,7 +149,7 @@ public class InCallVideoCallListener extends VideoCall.Listener { @Override public void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities) { if (cameraCapabilities != null) { - InCallVideoCallListenerNotifier.getInstance().cameraDimensionsChanged( + InCallVideoCallCallbackNotifier.getInstance().cameraDimensionsChanged( mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight()); } } diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java index 818ed032a..dfb645bfc 100644 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java +++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java @@ -23,14 +23,15 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; /** - * Class used by {@link InCallService.VideoCallListener} to notify interested parties of incoming + * Class used by {@link InCallService.VideoCallCallback} to notify interested parties of incoming * events. */ -public class InCallVideoCallListenerNotifier { +public class InCallVideoCallCallbackNotifier { /** * Singleton instance of this class. */ - private static InCallVideoCallListenerNotifier sInstance = new InCallVideoCallListenerNotifier(); + private static InCallVideoCallCallbackNotifier sInstance = + new InCallVideoCallCallbackNotifier(); /** * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is @@ -48,14 +49,14 @@ public class InCallVideoCallListenerNotifier { /** * Static singleton accessor method. */ - public static InCallVideoCallListenerNotifier getInstance() { + public static InCallVideoCallCallbackNotifier getInstance() { return sInstance; } /** * Private constructor. Instance should only be acquired through getInstance(). */ - private InCallVideoCallListenerNotifier() { + private InCallVideoCallCallbackNotifier() { } /** diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 9bc0822bf..b9aeacfd7 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -33,8 +33,8 @@ import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallOrientationListener; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; -import com.android.incallui.InCallVideoCallListenerNotifier.SurfaceChangeListener; -import com.android.incallui.InCallVideoCallListenerNotifier.VideoEventListener; +import com.android.incallui.InCallVideoCallCallbackNotifier.SurfaceChangeListener; +import com.android.incallui.InCallVideoCallCallbackNotifier.VideoEventListener; import com.google.common.base.Preconditions; import java.util.Objects; @@ -64,7 +64,7 @@ import java.util.Objects; public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi> implements IncomingCallListener, InCallOrientationListener, InCallStateListener, InCallDetailsListener, SurfaceChangeListener, VideoEventListener, - InCallVideoCallListenerNotifier.SessionModificationListener { + InCallVideoCallCallbackNotifier.SessionModificationListener { public static final String TAG = "VideoCallPresenter"; public static final boolean DEBUG = false; @@ -198,9 +198,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallPresenter.getInstance().addDetailsListener(this); // Register for surface and video events from {@link InCallVideoCallListener}s. - InCallVideoCallListenerNotifier.getInstance().addSurfaceChangeListener(this); - InCallVideoCallListenerNotifier.getInstance().addVideoEventListener(this); - InCallVideoCallListenerNotifier.getInstance().addSessionModificationListener(this); + InCallVideoCallCallbackNotifier.getInstance().addSurfaceChangeListener(this); + InCallVideoCallCallbackNotifier.getInstance().addVideoEventListener(this); + InCallVideoCallCallbackNotifier.getInstance().addSessionModificationListener(this); mCurrentVideoState = VideoProfile.VideoState.AUDIO_ONLY; mCurrentCallState = Call.State.INVALID; } @@ -220,9 +220,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallPresenter.getInstance().removeIncomingCallListener(this); InCallPresenter.getInstance().removeOrientationListener(this); - InCallVideoCallListenerNotifier.getInstance().removeSurfaceChangeListener(this); - InCallVideoCallListenerNotifier.getInstance().removeVideoEventListener(this); - InCallVideoCallListenerNotifier.getInstance().removeSessionModificationListener(this); + InCallVideoCallCallbackNotifier.getInstance().removeSurfaceChangeListener(this); + InCallVideoCallCallbackNotifier.getInstance().removeVideoEventListener(this); + InCallVideoCallCallbackNotifier.getInstance().removeSessionModificationListener(this); } /** diff --git a/InCallUI/src/com/android/incallui/VideoPauseController.java b/InCallUI/src/com/android/incallui/VideoPauseController.java index dd47c7f4a..41d06a3a2 100644 --- a/InCallUI/src/com/android/incallui/VideoPauseController.java +++ b/InCallUI/src/com/android/incallui/VideoPauseController.java @@ -34,7 +34,7 @@ import com.android.incallui.Call.State; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; -import com.android.incallui.InCallVideoCallListenerNotifier.SessionModificationListener; +import com.android.incallui.InCallVideoCallCallbackNotifier.SessionModificationListener; import com.google.common.base.Preconditions; /** @@ -119,7 +119,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener, mInCallPresenter = Preconditions.checkNotNull(inCallPresenter); mInCallPresenter.addListener(this); mInCallPresenter.addIncomingCallListener(this); - InCallVideoCallListenerNotifier.getInstance().addSessionModificationListener(this); + InCallVideoCallCallbackNotifier.getInstance().addSessionModificationListener(this); } /** @@ -128,7 +128,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener, */ public void tearDown() { log("tearDown..."); - InCallVideoCallListenerNotifier.getInstance().removeSessionModificationListener(this); + InCallVideoCallCallbackNotifier.getInstance().removeSessionModificationListener(this); mInCallPresenter.removeListener(this); mInCallPresenter.removeIncomingCallListener(this); clear(); |