From 0f83642786a67dcb4bb96bcbb473fd6008511bc3 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Thu, 16 Apr 2015 11:32:36 -0700 Subject: DO NOT MERGE Show video call button only for video calls or upgrade to video Bug: 20297465 Change-Id: Ied98faeece5079a6c000726b82244057b0422c92 --- InCallUI/src/com/android/incallui/CallButtonPresenter.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index bce86042a..b89afbe06 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -374,10 +374,12 @@ public class CallButtonPresenter extends Presenter Date: Thu, 16 Apr 2015 12:29:07 -0700 Subject: DO NOT MERGE Remove connection substate Bug:20300433 Change-Id: Iec4a56229ee30f3183c9f4cf37bed3f028eed155 --- InCallUI/res/values/strings.xml | 11 ----- InCallUI/src/com/android/incallui/Call.java | 7 +-- .../com/android/incallui/VideoCallFragment.java | 52 ---------------------- .../com/android/incallui/VideoCallPresenter.java | 22 --------- 4 files changed, 1 insertion(+), 91 deletions(-) diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index cfe3d41ab..b8a84c70c 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -447,17 +447,6 @@ Emergency number - - - Call substate - \u000a - - Resumed \u000a - - Connected Suspended (Audio) \u000a - - Connected Suspended (Video) \u000a - - Avp Retry \u000a Video quality changed to \u0020 diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 3d6f2032e..a3fcd4db7 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -441,10 +441,6 @@ 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()); @@ -522,7 +518,7 @@ public final class Call { @Override public String toString() { return String.format(Locale.US, "[%s, %s, %s, children:%s, parent:%s, conferenceable:%s, " + - "videoState:%d, callSubState:%d, mSessionModificationState:%d, VideoSettings:%s]", + "videoState:%d, mSessionModificationState:%d, VideoSettings:%s]", mId, State.toString(getState()), android.telecom.Call.Details @@ -531,7 +527,6 @@ public final class Call { getParentId(), this.mTelecommCall.getConferenceableCalls(), mTelecommCall.getDetails().getVideoState(), - mTelecommCall.getDetails().getCallSubstate(), mSessionModificationState, getVideoSettings()); } diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java index 1d711a882..2ce7b8910 100644 --- a/InCallUI/src/com/android/incallui/VideoCallFragment.java +++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java @@ -598,58 +598,6 @@ public class VideoCallFragment extends BaseFragment Date: Thu, 16 Apr 2015 14:54:06 -0700 Subject: DO NOT MERGE Remove unused system properties import Change-Id: I4659ef1232afeb6257b056135d123ecabf788d9b --- InCallUI/src/com/android/incallui/VideoPauseController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/InCallUI/src/com/android/incallui/VideoPauseController.java b/InCallUI/src/com/android/incallui/VideoPauseController.java index dd47c7f4a..c465bd22e 100644 --- a/InCallUI/src/com/android/incallui/VideoPauseController.java +++ b/InCallUI/src/com/android/incallui/VideoPauseController.java @@ -28,7 +28,6 @@ package com.android.incallui; -import android.os.SystemProperties; import android.telecom.VideoProfile; import com.android.incallui.Call.State; import com.android.incallui.InCallPresenter.InCallState; -- cgit v1.2.3 From b8536d16bad1e00f3bb1c35a3337f4d588ca6f9a Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Wed, 15 Apr 2015 12:44:08 -0700 Subject: DO NOT MERGE Remove usage of Phone.java in InCallService APIs. Start using the direct methods of InCallService instead of using the Phone object. InCallService methods represent the public API which is what In-Call needs to compile against. Bug: 20160495 Change-Id: I223347e239e5d5954b6118c7ba5befdaea2932a0 --- .../com/android/incallui/AudioModeProvider.java | 30 +---- InCallUI/src/com/android/incallui/CallList.java | 61 ++++----- .../com/android/incallui/InCallPhoneListener.java | 40 ------ .../src/com/android/incallui/InCallPresenter.java | 77 ++++++------ .../com/android/incallui/InCallServiceImpl.java | 57 ++++++--- .../android/incallui/InCallServiceListener.java | 41 ++++++ .../src/com/android/incallui/TelecomAdapter.java | 139 ++++++++++----------- 7 files changed, 216 insertions(+), 229 deletions(-) delete mode 100644 InCallUI/src/com/android/incallui/InCallPhoneListener.java create mode 100644 InCallUI/src/com/android/incallui/InCallServiceListener.java diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java index 6516e820a..887bc1809 100644 --- a/InCallUI/src/com/android/incallui/AudioModeProvider.java +++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java @@ -16,18 +16,16 @@ package com.android.incallui; -import com.google.common.collect.Lists; - import android.telecom.AudioState; -import android.telecom.Phone; + +import com.google.common.collect.Lists; import java.util.List; /** * Proxy class for getting and setting the audio mode. */ -/* package */ class AudioModeProvider implements InCallPhoneListener { - +public class AudioModeProvider { static final int AUDIO_MODE_INVALID = 0; private static AudioModeProvider sAudioModeProvider = new AudioModeProvider(); @@ -36,30 +34,14 @@ import java.util.List; private int mSupportedModes = AudioState.ROUTE_EARPIECE | AudioState.ROUTE_BLUETOOTH | AudioState.ROUTE_WIRED_HEADSET | AudioState.ROUTE_SPEAKER; private final List mListeners = Lists.newArrayList(); - private Phone mPhone; - - private Phone.Listener mPhoneListener = new Phone.Listener() { - @Override - public void onAudioStateChanged(Phone phone, AudioState audioState) { - onAudioModeChange(audioState.getRoute(), audioState.isMuted()); - onSupportedAudioModeChange(audioState.getSupportedRouteMask()); - } - }; public static AudioModeProvider getInstance() { return sAudioModeProvider; } - @Override - public void setPhone(Phone phone) { - mPhone = phone; - mPhone.addListener(mPhoneListener); - } - - @Override - public void clearPhone() { - mPhone.removeListener(mPhoneListener); - mPhone = null; + public void onAudioStateChanged(AudioState audioState) { + onAudioModeChange(audioState.getRoute(), audioState.isMuted()); + onSupportedAudioModeChange(audioState.getSupportedRouteMask()); } public void onAudioModeChange(int newMode, boolean muted) { diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index aba83e586..39ada99de 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -22,7 +22,11 @@ import com.google.common.base.Preconditions; import android.os.Handler; import android.os.Message; import android.telecom.DisconnectCause; -import android.telecom.Phone; +import android.telecom.PhoneAccount; + +import com.android.contacts.common.testing.NeededForTesting; +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; import java.util.Collections; import java.util.HashMap; @@ -36,7 +40,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * as they are received from the telephony stack. Primary listener of changes to this class is * InCallPresenter. */ -public class CallList implements InCallPhoneListener { +public class CallList { private static final int DISCONNECTED_CALL_SHORT_TIMEOUT_MS = 200; private static final int DISCONNECTED_CALL_MEDIUM_TIMEOUT_MS = 2000; @@ -59,8 +63,6 @@ public class CallList implements InCallPhoneListener { private final HashMap> mCallUpdateListenerMap = Maps .newHashMap(); - private Phone mPhone; - /** * Static singleton accessor method. */ @@ -68,46 +70,33 @@ public class CallList implements InCallPhoneListener { return sInstance; } - private Phone.Listener mPhoneListener = new Phone.Listener() { - @Override - public void onCallAdded(Phone phone, android.telecom.Call telecommCall) { - Call call = new Call(telecommCall); - Log.d(this, "onCallAdded: callState=" + call.getState()); - if (call.getState() == Call.State.INCOMING || - call.getState() == Call.State.CALL_WAITING) { - onIncoming(call, call.getCannedSmsResponses()); - } else { - onUpdate(call); - } - } - @Override - public void onCallRemoved(Phone phone, android.telecom.Call telecommCall) { - if (mCallByTelecommCall.containsKey(telecommCall)) { - Call call = mCallByTelecommCall.get(telecommCall); - if (updateCallInMap(call)) { - Log.w(this, "Removing call not previously disconnected " + call.getId()); - } - updateCallTextMap(call, null); - } - } - }; - /** * Private constructor. Instance should only be acquired through getInstance(). */ private CallList() { } - @Override - public void setPhone(Phone phone) { - mPhone = phone; - mPhone.addListener(mPhoneListener); + public void onCallAdded(android.telecom.Call telecommCall) { + Trace.beginSection("onCallAdded"); + Call call = new Call(telecommCall); + Log.d(this, "onCallAdded: callState=" + call.getState()); + if (call.getState() == Call.State.INCOMING || + call.getState() == Call.State.CALL_WAITING) { + onIncoming(call, call.getCannedSmsResponses()); + } else { + onUpdate(call); + } + Trace.endSection(); } - @Override - public void clearPhone() { - mPhone.removeListener(mPhoneListener); - mPhone = null; + public void onCallRemoved(android.telecom.Call telecommCall) { + if (mCallByTelecommCall.containsKey(telecommCall)) { + Call call = mCallByTelecommCall.get(telecommCall); + if (updateCallInMap(call)) { + Log.w(this, "Removing call not previously disconnected " + call.getId()); + } + updateCallTextMap(call, null); + } } /** diff --git a/InCallUI/src/com/android/incallui/InCallPhoneListener.java b/InCallUI/src/com/android/incallui/InCallPhoneListener.java deleted file mode 100644 index 2fd6afe22..000000000 --- a/InCallUI/src/com/android/incallui/InCallPhoneListener.java +++ /dev/null @@ -1,40 +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; - -import android.telecom.Phone; - -/** - * Interface implemented by In-Call components that maintain a reference to the Telecomm API - * {@code Phone} object. Clarifies the expectations associated with the relevant method calls. - */ -public interface InCallPhoneListener { - - /** - * Called once at {@code InCallService} startup time with a valid {@code Phone}. At - * that time, there will be no existing {@code Call}s. - * - * @param phone The {@code Phone} object. - */ - void setPhone(Phone phone); - - /** - * Called once at {@code InCallService} shutdown time. At that time, any {@code Call}s - * will have transitioned through the disconnected state and will no longer exist. - */ - void clearPhone(); -} diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 078dd49ce..4225f86fa 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -27,7 +27,6 @@ import android.os.Bundle; import android.os.Handler; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; -import android.telecom.Phone; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telecom.VideoProfile; @@ -38,11 +37,10 @@ import android.view.View; import android.view.Window; import android.view.WindowManager; -import com.google.common.base.Preconditions; - import com.android.contacts.common.interactions.TouchPointManager; import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; import com.android.incalluibind.ObjectFactory; +import com.google.common.base.Preconditions; import java.util.Collections; import java.util.List; @@ -60,8 +58,8 @@ import java.util.concurrent.CopyOnWriteArrayList; * that want to listen in on the in-call state changes. * TODO: This class has become more of a state machine at this point. Consider renaming. */ -public class InCallPresenter implements CallList.Listener, InCallPhoneListener { - +public class InCallPresenter implements CallList.Listener, + CircularRevealFragment.OnCircularRevealCompleteListener { private static final String EXTRA_FIRST_TIME_SHOWN = "com.android.incallui.intent.extra.FIRST_TIME_SHOWN"; @@ -100,28 +98,6 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { private boolean mAccountSelectionCancelled = false; private InCallCameraManager mInCallCameraManager = null; - 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) { - call.addListener(mCallListener); - } - @Override - public void onCallRemoved(Phone phone, android.telecom.Call call) { - call.removeListener(mCallListener); - } - @Override - public void onCanAddCallChanged(Phone phone, boolean canAddCall) { - for (CanAddCallListener listener : mCanAddCallListeners) { - listener.onCanAddCallChanged(canAddCall); - } - } - }; - private final android.telecom.Call.Listener mCallListener = new android.telecom.Call.Listener() { @Override @@ -185,8 +161,6 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { */ private boolean mIsChangingConfigurations = false; - private Phone mPhone; - private Handler mHandler = new Handler(); /** Display colors for the UI. Consists of a primary color and secondary (darker) color */ @@ -201,16 +175,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { return sInCallPresenter; } - @Override - public void setPhone(Phone phone) { - mPhone = phone; - mPhone.addListener(mPhoneListener); - } - - @Override - public void clearPhone() { - mPhone.removeListener(mPhoneListener); - mPhone = null; + @NeededForTesting + static synchronized void setInstance(InCallPresenter inCallPresenter) { + sInCallPresenter = inCallPresenter; } public InCallState getInCallState() { @@ -401,6 +368,38 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } } + private boolean mAwaitingCallListUpdate = false; + + public void onBringToForeground(boolean showDialpad) { + Log.i(this, "Bringing UI to foreground."); + bringToForeground(showDialpad); + } + + /** + * TODO: Consider listening to CallList callbacks to do this instead of receiving a direct + * method invocation from InCallService. + */ + public void onCallAdded(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.addListener(mCallListener); + } + + /** + * TODO: Consider listening to CallList callbacks to do this instead of receiving a direct + * method invocation from InCallService. + */ + public void onCallRemoved(android.telecom.Call call) { + call.removeListener(mCallListener); + } + + public void onCanAddCallChanged(boolean canAddCall) { + for (CanAddCallListener listener : mCanAddCallListeners) { + listener.onCanAddCallChanged(canAddCall); + } + } + /** * Called when there is a change to the call list. * Sets the In-Call state for the entire in-call app based on the information it gets from diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index 17f4e174d..41656a097 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -18,8 +18,9 @@ package com.android.incallui; import android.content.Intent; import android.os.IBinder; +import android.telecom.AudioState; +import android.telecom.Call; import android.telecom.InCallService; -import android.telecom.Phone; /** * Used to receive updates about calls from the Telecomm component. This service is bound to @@ -30,25 +31,30 @@ import android.telecom.Phone; public class InCallServiceImpl extends InCallService { @Override - public void onPhoneCreated(Phone phone) { - Log.v(this, "onPhoneCreated"); - CallList.getInstance().setPhone(phone); - AudioModeProvider.getInstance().setPhone(phone); - TelecomAdapter.getInstance().setPhone(phone); - InCallPresenter.getInstance().setPhone(phone); - TelecomAdapter.getInstance().setContext(InCallServiceImpl.this); + public void onAudioStateChanged(AudioState audioState) { + AudioModeProvider.getInstance().onAudioStateChanged(audioState); } @Override - public void onPhoneDestroyed(Phone phone) { - Log.v(this, "onPhoneDestroyed"); - // Tear down the InCall system - CallList.getInstance().clearPhone(); - AudioModeProvider.getInstance().clearPhone(); - TelecomAdapter.getInstance().clearPhone(); - TelecomAdapter.getInstance().setContext(null); - CallList.getInstance().clearOnDisconnect(); - InCallPresenter.getInstance().tearDown(); + public void onBringToForeground(boolean showDialpad) { + InCallPresenter.getInstance().onBringToForeground(showDialpad); + } + + @Override + public void onCallAdded(Call call) { + CallList.getInstance().onCallAdded(call); + InCallPresenter.getInstance().onCallAdded(call); + } + + @Override + public void onCallRemoved(Call call) { + CallList.getInstance().onCallRemoved(call); + InCallPresenter.getInstance().onCallRemoved(call); + } + + @Override + public void onCanAddCallChanged(boolean canAddCall) { + InCallPresenter.getInstance().onCanAddCallChanged(canAddCall); } @Override @@ -59,12 +65,27 @@ public class InCallServiceImpl extends InCallService { AudioModeProvider.getInstance()); InCallPresenter.getInstance().onServiceBind(); InCallPresenter.getInstance().maybeStartRevealAnimation(intent); + TelecomAdapter.getInstance().setInCallService(this); + return super.onBind(intent); } @Override public boolean onUnbind(Intent intent) { + super.onUnbind(intent); + InCallPresenter.getInstance().onServiceUnbind(); - return super.onUnbind(intent); + tearDown(); + + return false; + } + + private void tearDown() { + Log.v(this, "tearDown"); + // Tear down the InCall system + TelecomAdapter.getInstance().clearInCallService(); + CallList.getInstance().clearOnDisconnect(); + InCallPresenter.getInstance().tearDown(); } + } diff --git a/InCallUI/src/com/android/incallui/InCallServiceListener.java b/InCallUI/src/com/android/incallui/InCallServiceListener.java new file mode 100644 index 000000000..295385d8e --- /dev/null +++ b/InCallUI/src/com/android/incallui/InCallServiceListener.java @@ -0,0 +1,41 @@ +/* + * 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; + +import android.telecom.InCallService; + +/** + * Interface implemented by In-Call components that maintain a reference to the Telecomm API + * {@code InCallService} object. Clarifies the expectations associated with the relevant method + * calls. + */ +public interface InCallServiceListener { + + /** + * Called once at {@code InCallService} startup time with a valid instance. At + * that time, there will be no existing {@code Call}s. + * + * @param inCallService The {@code InCallService} object. + */ + void setInCallService(InCallService inCallService); + + /** + * Called once at {@code InCallService} shutdown time. At that time, any {@code Call}s + * will have transitioned through the disconnected state and will no longer exist. + */ + void clearInCallService(); +} diff --git a/InCallUI/src/com/android/incallui/TelecomAdapter.java b/InCallUI/src/com/android/incallui/TelecomAdapter.java index 10c230713..37efdee59 100644 --- a/InCallUI/src/com/android/incallui/TelecomAdapter.java +++ b/InCallUI/src/com/android/incallui/TelecomAdapter.java @@ -17,22 +17,20 @@ package com.android.incallui; import android.content.ActivityNotFoundException; -import android.content.Context; import android.content.Intent; import android.os.Looper; -import android.telecom.Phone; +import android.telecom.InCallService; import android.telecom.PhoneAccountHandle; import com.google.common.base.Preconditions; import java.util.List; -final class TelecomAdapter implements InCallPhoneListener { +final class TelecomAdapter implements InCallServiceListener { private static final String ADD_CALL_MODE_KEY = "add_call_mode"; private static TelecomAdapter sInstance; - private Context mContext; - private Phone mPhone; + private InCallService mInCallService; static TelecomAdapter getInstance() { Preconditions.checkState(Looper.getMainLooper().getThread() == Thread.currentThread()); @@ -45,102 +43,94 @@ final class TelecomAdapter implements InCallPhoneListener { private TelecomAdapter() { } - void setContext(Context context) { - mContext = context; - } - @Override - public void setPhone(Phone phone) { - mPhone = phone; + public void setInCallService(InCallService inCallService) { + mInCallService = inCallService; } @Override - public void clearPhone() { - mPhone = null; + public void clearInCallService() { + mInCallService = null; } private android.telecom.Call getTelecommCallById(String callId) { - final Call call = CallList.getInstance().getCallById(callId); + Call call = CallList.getInstance().getCallById(callId); return call == null ? null : call.getTelecommCall(); } void answerCall(String callId, int videoState) { - if (mPhone != null) { - final android.telecom.Call call = getTelecommCallById(callId); - if (call != null) { - call.answer(videoState); - } else { - Log.e(this, "error answerCall, call not in call list: " + callId); - } + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.answer(videoState); } else { - Log.e(this, "error answerCall, mPhone is null"); + Log.e(this, "error answerCall, call not in call list: " + callId); } } void rejectCall(String callId, boolean rejectWithMessage, String message) { - if (mPhone != null) { - final android.telecom.Call call = getTelecommCallById(callId); - if (call != null) { - call.reject(rejectWithMessage, message); - } else { - Log.e(this, "error rejectCall, call not in call list: " + callId); - } + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.reject(rejectWithMessage, message); } else { - Log.e(this, "error rejectCall, mPhone is null"); + Log.e(this, "error rejectCall, call not in call list: " + callId); } } void disconnectCall(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).disconnect(); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.disconnect(); } else { - Log.e(this, "error disconnectCall, mPhone is null"); + Log.e(this, "error disconnectCall, call not in call list " + callId); } } void holdCall(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).hold(); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.hold(); } else { - Log.e(this, "error holdCall, mPhone is null"); + Log.e(this, "error holdCall, call not in call list " + callId); } } void unholdCall(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).unhold(); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.unhold(); } else { - Log.e(this, "error unholdCall, mPhone is null"); + Log.e(this, "error unholdCall, call not in call list " + callId); } } void mute(boolean shouldMute) { - if (mPhone != null) { - mPhone.setMuted(shouldMute); + if (mInCallService != null) { + mInCallService.setMuted(shouldMute); } else { - Log.e(this, "error mute, mPhone is null"); + Log.e(this, "error mute, mInCallService is null"); } } void setAudioRoute(int route) { - if (mPhone != null) { - mPhone.setAudioRoute(route); + if (mInCallService != null) { + mInCallService.setAudioRoute(route); } else { - Log.e(this, "error setAudioRoute, mPhone is null"); + Log.e(this, "error setAudioRoute, mInCallService is null"); } } void separateCall(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).splitFromConference(); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.splitFromConference(); } else { - Log.e(this, "error separateCall, mPhone is null."); + Log.e(this, "error separateCall, call not in call list " + callId); } } void merge(String callId) { - if (mPhone != null) { - android.telecom.Call call = getTelecommCallById(callId); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { List conferenceable = call.getConferenceableCalls(); if (!conferenceable.isEmpty()) { call.conference(conferenceable.get(0)); @@ -151,24 +141,24 @@ final class TelecomAdapter implements InCallPhoneListener { } } } else { - Log.e(this, "error merge, mPhone is null."); + Log.e(this, "error merge, call not in call list " + callId); } } void swap(String callId) { - if (mPhone != null) { - android.telecom.Call call = getTelecommCallById(callId); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { if (call.getDetails().can( android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE)) { call.swapConference(); } } else { - Log.e(this, "Error swap, mPhone is null."); + Log.e(this, "error swap, call not in call list " + callId); } } void addCall() { - if (mContext != null) { + if (mInCallService != null) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -178,7 +168,7 @@ final class TelecomAdapter implements InCallPhoneListener { intent.putExtra(ADD_CALL_MODE_KEY, true); try { Log.d(this, "Sending the add Call intent"); - mContext.startActivity(intent); + mInCallService.startActivity(intent); } catch (ActivityNotFoundException e) { // This is rather rare but possible. // Note: this method is used even when the phone is encrypted. At that moment @@ -189,43 +179,48 @@ final class TelecomAdapter implements InCallPhoneListener { } void playDtmfTone(String callId, char digit) { - if (mPhone != null) { - getTelecommCallById(callId).playDtmfTone(digit); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.playDtmfTone(digit); } else { - Log.e(this, "error playDtmfTone, mPhone is null"); + Log.e(this, "error playDtmfTone, call not in call list " + callId); } } void stopDtmfTone(String callId) { - if (mPhone != null) { - getTelecommCallById(callId).stopDtmfTone(); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.stopDtmfTone(); } else { - Log.e(this, "error stopDtmfTone, mPhone is null"); + Log.e(this, "error stopDtmfTone, call not in call list " + callId); } } void postDialContinue(String callId, boolean proceed) { - if (mPhone != null) { - getTelecommCallById(callId).postDialContinue(proceed); + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.postDialContinue(proceed); } else { - Log.e(this, "error postDialContinue, mPhone is null"); + Log.e(this, "error postDialContinue, call not in call list " + callId); } } void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle, boolean setDefault) { - if (mPhone != null) { - getTelecommCallById(callId).phoneAccountSelected(accountHandle, setDefault); - } else { - Log.e(this, "error phoneAccountSelected, mAdapter is null"); - } - if (accountHandle == null) { Log.e(this, "error phoneAccountSelected, accountHandle is null"); + // TODO: Do we really want to send null accountHandle? + } + + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.phoneAccountSelected(accountHandle, setDefault); + } else { + Log.e(this, "error phoneAccountSelected, call not in call list " + callId); } } boolean canAddCall() { // Default to true if we are not connected to telecom. - return mPhone == null ? true : mPhone.canAddCall(); + return mInCallService == null ? true : mInCallService.canAddCall(); } } -- cgit v1.2.3 From cc30bc033063aa1a2e027db6be8731cfa8476d88 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 15 Apr 2015 14:13:32 -0700 Subject: DO NOT MERGE Rename CallListener to CallCallback. To match API changes. Plus, random fixes because of master being out of sync with MW. Bug: 20160491 Change-Id: I664cb0c3db7e0affc42179d467828246887069e8 --- InCallUI/src/com/android/incallui/Call.java | 30 +- InCallUI/src/com/android/incallui/CallList.java | 2 - .../src/com/android/incallui/InCallPresenter.java | 15 +- .../android/incallui/InCallVideoCallCallback.java | 156 ++++++++++ .../incallui/InCallVideoCallCallbackNotifier.java | 342 +++++++++++++++++++++ .../android/incallui/InCallVideoCallListener.java | 154 ---------- .../incallui/InCallVideoCallListenerNotifier.java | 341 -------------------- .../com/android/incallui/VideoCallPresenter.java | 18 +- .../com/android/incallui/VideoPauseController.java | 6 +- 9 files changed, 531 insertions(+), 533 deletions(-) create mode 100644 InCallUI/src/com/android/incallui/InCallVideoCallCallback.java create mode 100644 InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java delete mode 100644 InCallUI/src/com/android/incallui/InCallVideoCallListener.java delete mode 100644 InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index a3fcd4db7..254460d76 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -168,11 +168,11 @@ public final 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(); } @@ -180,7 +180,7 @@ public final 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(); } @@ -194,7 +194,7 @@ public final 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(); } @@ -202,7 +202,7 @@ public final class Call { @Override public void onCannedTextResponsesLoaded(android.telecom.Call call, List cannedTextResponses) { - Log.d(this, "TelecommCallListener onStateChanged call=" + call + Log.d(this, "TelecommCallCallback onStateChanged call=" + call + " cannedTextResponses=" + cannedTextResponses); update(); } @@ -210,7 +210,7 @@ public final 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(); } @@ -218,15 +218,15 @@ public final 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 @@ -248,13 +248,13 @@ public final class Call { */ private int mModifyToVideoState = VideoProfile.VideoState.AUDIO_ONLY; - private InCallVideoCallListener mVideoCallListener; + private InCallVideoCallCallback mVideoCallCallback; public Call(android.telecom.Call telecommCall) { mTelecommCall = telecommCall; mId = ID_PREFIX + Integer.toString(sIdCounter++); updateFromTelecommCall(); - mTelecommCall.addListener(mTelecommCallListener); + mTelecommCall.registerCallback(mTelecomCallCallback); } public android.telecom.Call getTelecommCall() { @@ -285,10 +285,10 @@ public final 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(); diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 39ada99de..df2a72e5e 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -77,7 +77,6 @@ public class CallList { } public void onCallAdded(android.telecom.Call telecommCall) { - Trace.beginSection("onCallAdded"); Call call = new Call(telecommCall); Log.d(this, "onCallAdded: callState=" + call.getState()); if (call.getState() == Call.State.INCOMING || @@ -86,7 +85,6 @@ public class CallList { } else { onUpdate(call); } - Trace.endSection(); } public void onCallRemoved(android.telecom.Call telecommCall) { diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 4225f86fa..83d5af34e 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -38,6 +38,7 @@ import android.view.Window; import android.view.WindowManager; import com.android.contacts.common.interactions.TouchPointManager; +import com.android.contacts.common.testing.NeededForTesting; import com.android.contacts.common.util.MaterialColorMapUtils.MaterialPalette; import com.android.incalluibind.ObjectFactory; import com.google.common.base.Preconditions; @@ -58,8 +59,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * that want to listen in on the in-call state changes. * TODO: This class has become more of a state machine at this point. Consider renaming. */ -public class InCallPresenter implements CallList.Listener, - CircularRevealFragment.OnCircularRevealCompleteListener { +public class InCallPresenter implements CallList.Listener { private static final String EXTRA_FIRST_TIME_SHOWN = "com.android.incallui.intent.extra.FIRST_TIME_SHOWN"; @@ -98,8 +98,8 @@ public class InCallPresenter implements CallList.Listener, private boolean mAccountSelectionCancelled = false; private InCallCameraManager mInCallCameraManager = null; - private final android.telecom.Call.Listener mCallListener = - new android.telecom.Call.Listener() { + private final android.telecom.Call.Callback mCallback = + new android.telecom.Call.Callback() { @Override public void onPostDialWait(android.telecom.Call call, String remainingPostDialSequence) { onPostDialCharWait( @@ -380,10 +380,7 @@ public class InCallPresenter implements CallList.Listener, * method invocation from InCallService. */ public void onCallAdded(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.addListener(mCallListener); + call.registerCallback(mCallback); } /** @@ -391,7 +388,7 @@ public class InCallPresenter implements CallList.Listener, * method invocation from InCallService. */ public void onCallRemoved(android.telecom.Call call) { - call.removeListener(mCallListener); + call.unregisterCallback(mCallback); } public void onCanAddCallChanged(boolean canAddCall) { diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java new file mode 100644 index 000000000..f868b3baf --- /dev/null +++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java @@ -0,0 +1,156 @@ +/* + * 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; + +import android.telecom.CameraCapabilities; +import android.telecom.Connection; +import android.telecom.Connection.VideoProvider; +import android.telecom.InCallService.VideoCall; +import android.telecom.VideoProfile; + +/** + * Implements the InCallUI VideoCall Callback. + */ +public class InCallVideoCallCallback extends VideoCall.Callback { + + /** + * The call associated with this {@link InCallVideoClient}. + */ + private Call mCall; + + /** + * Creates an instance of the call video client, specifying the call it is related to. + * + * @param call The call. + */ + public InCallVideoCallCallback(Call call) { + mCall = call; + } + + /** + * Handles an incoming session modification request. + * + * @param videoProfile The requested video call profile. + */ + @Override + public void onSessionModifyRequestReceived(VideoProfile videoProfile) { + Log.d(this, " onSessionModifyRequestReceived videoProfile=" + videoProfile); + int previousVideoState = CallUtils.getUnPausedVideoState(mCall.getVideoState()); + int newVideoState = CallUtils.getUnPausedVideoState(videoProfile.getVideoState()); + + boolean wasVideoCall = VideoProfile.VideoState.isVideo(previousVideoState); + boolean isVideoCall = VideoProfile.VideoState.isVideo(newVideoState); + + // Check for upgrades to video and downgrades to audio. + if (wasVideoCall && !isVideoCall) { + InCallVideoCallCallbackNotifier.getInstance().downgradeToAudio(mCall); + } else if (previousVideoState != newVideoState) { + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoRequest(mCall, + newVideoState); + } + } + + /** + * Handles a session modification response. + * + * @param status Status of the session modify request. Valid values are + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, + * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID} + * @param requestedProfile + * @param responseProfile The actual profile changes made by the peer device. + */ + @Override + public void onSessionModifyResponseReceived(int status, VideoProfile requestedProfile, + VideoProfile responseProfile) { + Log.d(this, "onSessionModifyResponseReceived status=" + status + " requestedProfile=" + + requestedProfile + " responseProfile=" + responseProfile); + if (status != VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { + 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) { + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoSuccess(mCall); + } else if (!modifySucceeded && isVideoCall) { + InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoFail(status, mCall); + } else if (modifySucceeded && !isVideoCall) { + InCallVideoCallCallbackNotifier.getInstance().downgradeToAudio(mCall); + } + } else { + Log.d(this, "onSessionModifyResponseReceived request and response Profiles are null"); + } + } + + /** + * Handles a call session event. + * + * @param event The event. + */ + @Override + public void onCallSessionEvent(int event) { + InCallVideoCallCallbackNotifier.getInstance().callSessionEvent(event); + } + + /** + * Handles a change to the peer video dimensions. + * + * @param width The updated peer video width. + * @param height The updated peer video height. + */ + @Override + public void onPeerDimensionsChanged(int width, int height) { + InCallVideoCallCallbackNotifier.getInstance().peerDimensionsChanged(mCall, width, height); + } + + /** + * Handles a change to the video quality of the call. + * + * @param videoQuality The updated video call quality. + */ + @Override + public void onVideoQualityChanged(int videoQuality) { + InCallVideoCallCallbackNotifier.getInstance().videoQualityChanged(mCall, videoQuality); + } + + /** + * Handles a change to the call data usage. No implementation as the in-call UI does not + * display data usage. + * + * @param dataUsage The updated data usage. + */ + @Override + public void onCallDataUsageChanged(long dataUsage) { + Log.d(this, "onCallDataUsageChanged: dataUsage = " + dataUsage); + InCallVideoCallCallbackNotifier.getInstance().callDataUsageChanged(dataUsage); + } + + /** + * Handles changes to the camera capabilities. No implementation as the in-call UI does not + * make use of camera capabilities. + * + * @param cameraCapabilities The changed camera capabilities. + */ + @Override + public void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities) { + if (cameraCapabilities != null) { + InCallVideoCallCallbackNotifier.getInstance().cameraDimensionsChanged( + mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight()); + } + } +} diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java new file mode 100644 index 000000000..dfb645bfc --- /dev/null +++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallbackNotifier.java @@ -0,0 +1,342 @@ +/* + * 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; + +import com.google.common.base.Preconditions; + +import java.util.Collections; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Class used by {@link InCallService.VideoCallCallback} to notify interested parties of incoming + * events. + */ +public class InCallVideoCallCallbackNotifier { + /** + * Singleton instance of this class. + */ + private static InCallVideoCallCallbackNotifier sInstance = + new InCallVideoCallCallbackNotifier(); + + /** + * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is + * load factor before resizing, 1 means we only expect a single thread to + * access the map so make only a single shard + */ + private final Set mSessionModificationListeners = + Collections.newSetFromMap(new ConcurrentHashMap + (8, 0.9f, 1)); + private final Set mVideoEventListeners = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); + private final Set mSurfaceChangeListeners = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); + + /** + * Static singleton accessor method. + */ + public static InCallVideoCallCallbackNotifier getInstance() { + return sInstance; + } + + /** + * Private constructor. Instance should only be acquired through getInstance(). + */ + private InCallVideoCallCallbackNotifier() { + } + + /** + * Adds a new {@link SessionModificationListener}. + * + * @param listener The listener. + */ + public void addSessionModificationListener(SessionModificationListener listener) { + Preconditions.checkNotNull(listener); + mSessionModificationListeners.add(listener); + } + + /** + * Remove a {@link SessionModificationListener}. + * + * @param listener The listener. + */ + public void removeSessionModificationListener(SessionModificationListener listener) { + if (listener != null) { + mSessionModificationListeners.remove(listener); + } + } + + /** + * Adds a new {@link VideoEventListener}. + * + * @param listener The listener. + */ + public void addVideoEventListener(VideoEventListener listener) { + Preconditions.checkNotNull(listener); + mVideoEventListeners.add(listener); + } + + /** + * Remove a {@link VideoEventListener}. + * + * @param listener The listener. + */ + public void removeVideoEventListener(VideoEventListener listener) { + if (listener != null) { + mVideoEventListeners.remove(listener); + } + } + + /** + * Adds a new {@link SurfaceChangeListener}. + * + * @param listener The listener. + */ + public void addSurfaceChangeListener(SurfaceChangeListener listener) { + Preconditions.checkNotNull(listener); + mSurfaceChangeListeners.add(listener); + } + + /** + * Remove a {@link SurfaceChangeListener}. + * + * @param listener The listener. + */ + public void removeSurfaceChangeListener(SurfaceChangeListener listener) { + if (listener != null) { + mSurfaceChangeListeners.remove(listener); + } + } + + /** + * Inform listeners of an upgrade to video request for a call. + * @param call The call. + * @param videoState The video state we want to upgrade to. + */ + public void upgradeToVideoRequest(Call call, int videoState) { + Log.d(this, "upgradeToVideoRequest call = " + call + " new video state = " + videoState); + for (SessionModificationListener listener : mSessionModificationListeners) { + listener.onUpgradeToVideoRequest(call, videoState); + } + } + + /** + * Inform listeners of a successful response to a video request for a call. + * + * @param call The call. + */ + public void upgradeToVideoSuccess(Call call) { + for (SessionModificationListener listener : mSessionModificationListeners) { + listener.onUpgradeToVideoSuccess(call); + } + } + + /** + * Inform listeners of an unsuccessful response to a video request for a call. + * + * @param call The call. + */ + public void upgradeToVideoFail(int status, Call call) { + for (SessionModificationListener listener : mSessionModificationListeners) { + listener.onUpgradeToVideoFail(status, call); + } + } + + /** + * Inform listeners of a downgrade to audio. + * + * @param call The call. + */ + public void downgradeToAudio(Call call) { + for (SessionModificationListener listener : mSessionModificationListeners) { + listener.onDowngradeToAudio(call); + } + } + + /** + * Inform listeners of a call session event. + * + * @param event The call session event. + */ + public void callSessionEvent(int event) { + for (VideoEventListener listener : mVideoEventListeners) { + listener.onCallSessionEvent(event); + } + } + + /** + * Inform listeners of a downgrade to audio. + * + * @param call The call. + * @param paused The paused state. + */ + public void peerPausedStateChanged(Call call, boolean paused) { + for (VideoEventListener listener : mVideoEventListeners) { + listener.onPeerPauseStateChanged(call, paused); + } + } + + /** + * Inform listeners of any change in the video quality of the call + * + * @param call The call. + * @param videoQuality The updated video quality of the call. + */ + public void videoQualityChanged(Call call, int videoQuality) { + for (VideoEventListener listener : mVideoEventListeners) { + listener.onVideoQualityChanged(call, videoQuality); + } + } + + /** + * Inform listeners of a change to peer dimensions. + * + * @param call The call. + * @param width New peer width. + * @param height New peer height. + */ + public void peerDimensionsChanged(Call call, int width, int height) { + for (SurfaceChangeListener listener : mSurfaceChangeListeners) { + listener.onUpdatePeerDimensions(call, width, height); + } + } + + /** + * Inform listeners of a change to camera dimensions. + * + * @param call The call. + * @param width The new camera video width. + * @param height The new camera video height. + */ + public void cameraDimensionsChanged(Call call, int width, int height) { + for (SurfaceChangeListener listener : mSurfaceChangeListeners) { + listener.onCameraDimensionsChange(call, width, height); + } + } + + /** + * Inform listeners of a change to call data usage. + * + * @param dataUsage data usage value + */ + public void callDataUsageChanged(long dataUsage) { + for (VideoEventListener listener : mVideoEventListeners) { + listener.onCallDataUsageChange(dataUsage); + } + } + + /** + * Listener interface for any class that wants to be notified of upgrade to video and downgrade + * to audio session modification requests. + */ + public interface SessionModificationListener { + /** + * Called when a peer request is received to upgrade an audio-only call to a video call. + * + * @param call The call the request was received for. + * @param videoState The video state that the request wants to upgrade to. + */ + public void onUpgradeToVideoRequest(Call call, int videoState); + + /** + * Called when a request to a peer to upgrade an audio-only call to a video call is + * successful. + * + * @param call The call the request was successful for. + */ + public void onUpgradeToVideoSuccess(Call call); + + /** + * Called when a request to a peer to upgrade an audio-only call to a video call is + * NOT successful. This can be if the peer chooses rejects the the video call, or if the + * peer does not support video calling, or if there is some error in sending the request. + * + * @param call The call the request was successful for. + */ + public void onUpgradeToVideoFail(int status, Call call); + + /** + * Called when a call has been downgraded to audio-only. + * + * @param call The call which was downgraded to audio-only. + */ + public void onDowngradeToAudio(Call call); + } + + /** + * Listener interface for any class that wants to be notified of video events, including pause + * and un-pause of peer video, video quality changes. + */ + public interface VideoEventListener { + /** + * Called when the peer pauses or un-pauses video transmission. + * + * @param call The call which paused or un-paused video transmission. + * @param paused {@code True} when the video transmission is paused, {@code false} + * otherwise. + */ + public void onPeerPauseStateChanged(Call call, boolean paused); + + /** + * Called when the video quality changes. + * + * @param call The call whose video quality changes. + * @param videoCallQuality - values are QUALITY_HIGH, MEDIUM, LOW and UNKNOWN. + */ + public void onVideoQualityChanged(Call call, int videoCallQuality); + + /* + * Called when call data usage value is requested or when call data usage value is updated + * because of a call state change + * + * @param dataUsage call data usage value + */ + public void onCallDataUsageChange(long dataUsage); + + /** + * Called when call session event is raised. + * + * @param event The call session event. + */ + public void onCallSessionEvent(int event); + } + + /** + * Listener interface for any class that wants to be notified of changes to the video surfaces. + */ + public interface SurfaceChangeListener { + /** + * Called when the peer video feed changes dimensions. This can occur when the peer rotates + * their device, changing the aspect ratio of the video signal. + * + * @param call The call which experienced a peer video + * @param width + * @param height + */ + public void onUpdatePeerDimensions(Call call, int width, int height); + + /** + * Called when the local camera changes dimensions. This occurs when a change in camera + * occurs. + * + * @param call The call which experienced the camera dimension change. + * @param width The new camera video width. + * @param height The new camera video height. + */ + public void onCameraDimensionsChange(Call call, int width, int height); + } +} diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java deleted file mode 100644 index 24c911949..000000000 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java +++ /dev/null @@ -1,154 +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; - -import android.telecom.CameraCapabilities; -import android.telecom.Connection; -import android.telecom.Connection.VideoProvider; -import android.telecom.InCallService.VideoCall; -import android.telecom.VideoProfile; - -/** - * Implements the InCallUI Video Call Listener. - */ -public class InCallVideoCallListener extends VideoCall.Listener { - - /** - * The call associated with this {@link InCallVideoClient}. - */ - private Call mCall; - - /** - * Creates an instance of the call video client, specifying the call it is related to. - * - * @param call The call. - */ - public InCallVideoCallListener(Call call) { - mCall = call; - } - - /** - * Handles an incoming session modification request. - * - * @param videoProfile The requested video call profile. - */ - @Override - public void onSessionModifyRequestReceived(VideoProfile videoProfile) { - Log.d(this, " onSessionModifyRequestReceived videoProfile=" + videoProfile); - int previousVideoState = CallUtils.getUnPausedVideoState(mCall.getVideoState()); - int newVideoState = CallUtils.getUnPausedVideoState(videoProfile.getVideoState()); - - boolean wasVideoCall = VideoProfile.VideoState.isVideo(previousVideoState); - boolean isVideoCall = VideoProfile.VideoState.isVideo(newVideoState); - - // Check for upgrades to video and downgrades to audio. - if (wasVideoCall && !isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall); - } else if (previousVideoState != newVideoState) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoRequest(mCall, - newVideoState); - } - } - - /** - * Handles a session modification response. - * - * @param status Status of the session modify request. Valid values are - * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, - * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, - * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID} - * @param requestedProfile - * @param responseProfile The actual profile changes made by the peer device. - */ - @Override - public void onSessionModifyResponseReceived(int status, VideoProfile requestedProfile, - VideoProfile responseProfile) { - Log.d(this, "onSessionModifyResponseReceived status=" + status + " requestedProfile=" - + requestedProfile + " responseProfile=" + responseProfile); - if (status != VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { - InCallVideoCallListenerNotifier.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); - } else if (!modifySucceeded && isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(status, mCall); - } else if (modifySucceeded && !isVideoCall) { - InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall); - } - } else { - Log.d(this, "onSessionModifyResponseReceived request and response Profiles are null"); - } - } - - /** - * Handles a call session event. - * - * @param event The event. - */ - @Override - public void onCallSessionEvent(int event) { - InCallVideoCallListenerNotifier.getInstance().callSessionEvent(event); - } - - /** - * Handles a change to the peer video dimensions. - * - * @param width The updated peer video width. - * @param height The updated peer video height. - */ - @Override - public void onPeerDimensionsChanged(int width, int height) { - InCallVideoCallListenerNotifier.getInstance().peerDimensionsChanged(mCall, width, height); - } - - /** - * Handles a change to the video quality of the call. - * - * @param videoQuality The updated video call quality. - */ - @Override - public void onVideoQualityChanged(int videoQuality) { - InCallVideoCallListenerNotifier.getInstance().videoQualityChanged(mCall, videoQuality); - } - - /** - * Handles a change to the call data usage. No implementation as the in-call UI does not - * display data usage. - * - * @param dataUsage The updated data usage. - */ - @Override - public void onCallDataUsageChanged(long dataUsage) { - Log.d(this, "onCallDataUsageChanged: dataUsage = " + dataUsage); - InCallVideoCallListenerNotifier.getInstance().callDataUsageChanged(dataUsage); - } - - /** - * Handles changes to the camera capabilities. No implementation as the in-call UI does not - * make use of camera capabilities. - * - * @param cameraCapabilities The changed camera capabilities. - */ - @Override - public void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities) { - InCallVideoCallListenerNotifier.getInstance().cameraDimensionsChanged( - mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight()); - } -} diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java b/InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java deleted file mode 100644 index 818ed032a..000000000 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListenerNotifier.java +++ /dev/null @@ -1,341 +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; - -import com.google.common.base.Preconditions; - -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Class used by {@link InCallService.VideoCallListener} to notify interested parties of incoming - * events. - */ -public class InCallVideoCallListenerNotifier { - /** - * Singleton instance of this class. - */ - private static InCallVideoCallListenerNotifier sInstance = new InCallVideoCallListenerNotifier(); - - /** - * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is - * load factor before resizing, 1 means we only expect a single thread to - * access the map so make only a single shard - */ - private final Set mSessionModificationListeners = - Collections.newSetFromMap(new ConcurrentHashMap - (8, 0.9f, 1)); - private final Set mVideoEventListeners = Collections.newSetFromMap( - new ConcurrentHashMap(8, 0.9f, 1)); - private final Set mSurfaceChangeListeners = Collections.newSetFromMap( - new ConcurrentHashMap(8, 0.9f, 1)); - - /** - * Static singleton accessor method. - */ - public static InCallVideoCallListenerNotifier getInstance() { - return sInstance; - } - - /** - * Private constructor. Instance should only be acquired through getInstance(). - */ - private InCallVideoCallListenerNotifier() { - } - - /** - * Adds a new {@link SessionModificationListener}. - * - * @param listener The listener. - */ - public void addSessionModificationListener(SessionModificationListener listener) { - Preconditions.checkNotNull(listener); - mSessionModificationListeners.add(listener); - } - - /** - * Remove a {@link SessionModificationListener}. - * - * @param listener The listener. - */ - public void removeSessionModificationListener(SessionModificationListener listener) { - if (listener != null) { - mSessionModificationListeners.remove(listener); - } - } - - /** - * Adds a new {@link VideoEventListener}. - * - * @param listener The listener. - */ - public void addVideoEventListener(VideoEventListener listener) { - Preconditions.checkNotNull(listener); - mVideoEventListeners.add(listener); - } - - /** - * Remove a {@link VideoEventListener}. - * - * @param listener The listener. - */ - public void removeVideoEventListener(VideoEventListener listener) { - if (listener != null) { - mVideoEventListeners.remove(listener); - } - } - - /** - * Adds a new {@link SurfaceChangeListener}. - * - * @param listener The listener. - */ - public void addSurfaceChangeListener(SurfaceChangeListener listener) { - Preconditions.checkNotNull(listener); - mSurfaceChangeListeners.add(listener); - } - - /** - * Remove a {@link SurfaceChangeListener}. - * - * @param listener The listener. - */ - public void removeSurfaceChangeListener(SurfaceChangeListener listener) { - if (listener != null) { - mSurfaceChangeListeners.remove(listener); - } - } - - /** - * Inform listeners of an upgrade to video request for a call. - * @param call The call. - * @param videoState The video state we want to upgrade to. - */ - public void upgradeToVideoRequest(Call call, int videoState) { - Log.d(this, "upgradeToVideoRequest call = " + call + " new video state = " + videoState); - for (SessionModificationListener listener : mSessionModificationListeners) { - listener.onUpgradeToVideoRequest(call, videoState); - } - } - - /** - * Inform listeners of a successful response to a video request for a call. - * - * @param call The call. - */ - public void upgradeToVideoSuccess(Call call) { - for (SessionModificationListener listener : mSessionModificationListeners) { - listener.onUpgradeToVideoSuccess(call); - } - } - - /** - * Inform listeners of an unsuccessful response to a video request for a call. - * - * @param call The call. - */ - public void upgradeToVideoFail(int status, Call call) { - for (SessionModificationListener listener : mSessionModificationListeners) { - listener.onUpgradeToVideoFail(status, call); - } - } - - /** - * Inform listeners of a downgrade to audio. - * - * @param call The call. - */ - public void downgradeToAudio(Call call) { - for (SessionModificationListener listener : mSessionModificationListeners) { - listener.onDowngradeToAudio(call); - } - } - - /** - * Inform listeners of a call session event. - * - * @param event The call session event. - */ - public void callSessionEvent(int event) { - for (VideoEventListener listener : mVideoEventListeners) { - listener.onCallSessionEvent(event); - } - } - - /** - * Inform listeners of a downgrade to audio. - * - * @param call The call. - * @param paused The paused state. - */ - public void peerPausedStateChanged(Call call, boolean paused) { - for (VideoEventListener listener : mVideoEventListeners) { - listener.onPeerPauseStateChanged(call, paused); - } - } - - /** - * Inform listeners of any change in the video quality of the call - * - * @param call The call. - * @param videoQuality The updated video quality of the call. - */ - public void videoQualityChanged(Call call, int videoQuality) { - for (VideoEventListener listener : mVideoEventListeners) { - listener.onVideoQualityChanged(call, videoQuality); - } - } - - /** - * Inform listeners of a change to peer dimensions. - * - * @param call The call. - * @param width New peer width. - * @param height New peer height. - */ - public void peerDimensionsChanged(Call call, int width, int height) { - for (SurfaceChangeListener listener : mSurfaceChangeListeners) { - listener.onUpdatePeerDimensions(call, width, height); - } - } - - /** - * Inform listeners of a change to camera dimensions. - * - * @param call The call. - * @param width The new camera video width. - * @param height The new camera video height. - */ - public void cameraDimensionsChanged(Call call, int width, int height) { - for (SurfaceChangeListener listener : mSurfaceChangeListeners) { - listener.onCameraDimensionsChange(call, width, height); - } - } - - /** - * Inform listeners of a change to call data usage. - * - * @param dataUsage data usage value - */ - public void callDataUsageChanged(long dataUsage) { - for (VideoEventListener listener : mVideoEventListeners) { - listener.onCallDataUsageChange(dataUsage); - } - } - - /** - * Listener interface for any class that wants to be notified of upgrade to video and downgrade - * to audio session modification requests. - */ - public interface SessionModificationListener { - /** - * Called when a peer request is received to upgrade an audio-only call to a video call. - * - * @param call The call the request was received for. - * @param videoState The video state that the request wants to upgrade to. - */ - public void onUpgradeToVideoRequest(Call call, int videoState); - - /** - * Called when a request to a peer to upgrade an audio-only call to a video call is - * successful. - * - * @param call The call the request was successful for. - */ - public void onUpgradeToVideoSuccess(Call call); - - /** - * Called when a request to a peer to upgrade an audio-only call to a video call is - * NOT successful. This can be if the peer chooses rejects the the video call, or if the - * peer does not support video calling, or if there is some error in sending the request. - * - * @param call The call the request was successful for. - */ - public void onUpgradeToVideoFail(int status, Call call); - - /** - * Called when a call has been downgraded to audio-only. - * - * @param call The call which was downgraded to audio-only. - */ - public void onDowngradeToAudio(Call call); - } - - /** - * Listener interface for any class that wants to be notified of video events, including pause - * and un-pause of peer video, video quality changes. - */ - public interface VideoEventListener { - /** - * Called when the peer pauses or un-pauses video transmission. - * - * @param call The call which paused or un-paused video transmission. - * @param paused {@code True} when the video transmission is paused, {@code false} - * otherwise. - */ - public void onPeerPauseStateChanged(Call call, boolean paused); - - /** - * Called when the video quality changes. - * - * @param call The call whose video quality changes. - * @param videoCallQuality - values are QUALITY_HIGH, MEDIUM, LOW and UNKNOWN. - */ - public void onVideoQualityChanged(Call call, int videoCallQuality); - - /* - * Called when call data usage value is requested or when call data usage value is updated - * because of a call state change - * - * @param dataUsage call data usage value - */ - public void onCallDataUsageChange(long dataUsage); - - /** - * Called when call session event is raised. - * - * @param event The call session event. - */ - public void onCallSessionEvent(int event); - } - - /** - * Listener interface for any class that wants to be notified of changes to the video surfaces. - */ - public interface SurfaceChangeListener { - /** - * Called when the peer video feed changes dimensions. This can occur when the peer rotates - * their device, changing the aspect ratio of the video signal. - * - * @param call The call which experienced a peer video - * @param width - * @param height - */ - public void onUpdatePeerDimensions(Call call, int width, int height); - - /** - * Called when the local camera changes dimensions. This occurs when a change in camera - * occurs. - * - * @param call The call which experienced the camera dimension change. - * @param width The new camera video width. - * @param height The new camera video height. - */ - public void onCameraDimensionsChange(Call call, int width, int height); - } -} diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 9589c1b49..f87112945 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 implements IncomingCallListener, InCallOrientationListener, InCallStateListener, InCallDetailsListener, SurfaceChangeListener, VideoEventListener, - InCallVideoCallListenerNotifier.SessionModificationListener { + InCallVideoCallCallbackNotifier.SessionModificationListener { public static final String TAG = "VideoCallPresenter"; /** @@ -191,9 +191,9 @@ public class VideoCallPresenter extends Presenter Date: Thu, 16 Apr 2015 17:00:39 -0700 Subject: DO NOT MERGE Don't make all buttons invisible at startup Bug: 20298277 Change-Id: Ia5db30f2e8c359f10d45f02e765e2529cb2d0d5d --- InCallUI/res/layout/call_button_fragment.xml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml index 4eac03482..81c3f69c7 100644 --- a/InCallUI/res/layout/call_button_fragment.xml +++ b/InCallUI/res/layout/call_button_fragment.xml @@ -68,8 +68,7 @@ + android:contentDescription="@string/audio_mode_speaker" /> + android:contentDescription="@string/onscreenMuteText" /> @@ -93,8 +91,7 @@ + android:contentDescription="@string/onscreenShowDialpadText" /> @@ -105,8 +102,7 @@ + android:contentDescription="@string/onscreenHoldText_unselected" /> Date: Thu, 16 Apr 2015 18:31:39 -0700 Subject: DO NOT MERGE Update buttons state once UI is ready * updateUi was not getting called for outgoing calls between DIALING -> ACTIVE * Adhere to UI directive that buttons representing disabled functionality are hidden rather than disabled. * Also fix issue where buttons are not updated for incoming call. Bug: 20295789 Change-Id: I2606aa7b27c3dfb2de441737f1ecc2cc80ffdd7e --- .../com/android/incallui/CallButtonPresenter.java | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index b89afbe06..650649479 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -58,11 +58,16 @@ public class CallButtonPresenter extends Presenter Date: Sat, 18 Apr 2015 14:12:17 -0700 Subject: DO NOT MERGE Stop using internal plural resources Change-Id: I6ddd0555c56cdd3c5269ba435b14d4c26e015e22 --- InCallUI/res/values/strings.xml | 16 ++++++++++++++++ InCallUI/src/com/android/incallui/InCallDateUtils.java | 9 +++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index b8a84c70c..f55945c50 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -457,4 +457,20 @@ Low Unknown + + + + 1 second + %d seconds + + + + 1 minute + %d minutes + + + + 1 hour + %d hours + diff --git a/InCallUI/src/com/android/incallui/InCallDateUtils.java b/InCallUI/src/com/android/incallui/InCallDateUtils.java index 88c5354c0..156eea06f 100644 --- a/InCallUI/src/com/android/incallui/InCallDateUtils.java +++ b/InCallUI/src/com/android/incallui/InCallDateUtils.java @@ -33,22 +33,19 @@ public class InCallDateUtils { final Resources res = Resources.getSystem(); StringBuilder duration = new StringBuilder(); if (hours > 0) { - duration.append(res.getQuantityString( - com.android.internal.R.plurals.duration_hours, hours, hours)); + duration.append(res.getQuantityString(R.plurals.duration_hours, hours, hours)); } if (minutes > 0) { if (hours > 0) { duration.append(' '); } - duration.append(res.getQuantityString( - com.android.internal.R.plurals.duration_minutes, minutes, minutes)); + duration.append(res.getQuantityString(R.plurals.duration_minutes, minutes, minutes)); } if (seconds > 0) { if (hours > 0 || minutes > 0) { duration.append(' '); } - duration.append(res.getQuantityString( - com.android.internal.R.plurals.duration_seconds, seconds, seconds)); + duration.append(res.getQuantityString(R.plurals.duration_seconds, seconds, seconds)); } return duration.toString(); } -- cgit v1.2.3 From 70a57bc30af026e8e3a9c5d715acdd3897b8ed12 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 17 Apr 2015 17:40:40 -0700 Subject: DO NOT MERGE Remove use of VideoProfile.VideoState.isVideo Don't further increase API surface, make this a utility method in our own package instead. Change-Id: Ib7036b20980afcb5d0fdb1c03c6d943ab9d7ece7 --- InCallUI/src/com/android/incallui/Call.java | 2 +- InCallUI/src/com/android/incallui/CallCardFragment.java | 4 ++-- InCallUI/src/com/android/incallui/CallUtils.java | 8 +++++++- InCallUI/src/com/android/incallui/InCallVideoCallCallback.java | 6 +++--- InCallUI/src/com/android/incallui/VideoPauseController.java | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 254460d76..729d87c8c 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -443,7 +443,7 @@ public final class Call { public boolean isVideoCall(Context context) { return CallUtil.isVideoEnabled(context) && - VideoProfile.VideoState.isVideo(getVideoState()); + CallUtils.isVideoCall(getVideoState()); } /** diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index c6f61be01..ba9dac505 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -552,7 +552,7 @@ public class CallCardFragment extends BaseFragment Date: Mon, 20 Apr 2015 13:57:50 -0700 Subject: DO NOT MERGE Remove code disabling VT calls when TTY mode is on To be moved into Telephony instead Bug: 20090652 Change-Id: I58aeb382d7e213b4eeae997d1f4bac3e25d34e67 --- InCallUI/res/values/strings.xml | 3 --- InCallUI/src/com/android/incallui/CallButtonFragment.java | 13 ------------- 2 files changed, 16 deletions(-) diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index f55945c50..332576d34 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -301,9 +301,6 @@ Video receive Voice Only - - Please disable TTY Mode to upgrade to video calls. - Player Started diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 1e9082791..e7cfe2c6b 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -460,12 +460,6 @@ public class CallButtonFragment } Context context = getContext(); - if (isTtyModeEnabled()) { - Toast.makeText(context, context.getResources().getString( - R.string.video_call_not_allowed_if_tty_enabled), - Toast.LENGTH_SHORT).show(); - return; - } final ArrayList items = new ArrayList(); final ArrayList itemToCallType = new ArrayList(); @@ -894,11 +888,4 @@ public class CallButtonFragment public Context getContext() { return getActivity(); } - - private boolean isTtyModeEnabled() { - return (android.provider.Settings.Secure.getInt( - getContext().getContentResolver(), - android.provider.Settings.Secure.PREFERRED_TTY_MODE, - TelecomManager.TTY_MODE_OFF) != TelecomManager.TTY_MODE_OFF); - } } -- cgit v1.2.3 From 1013a7e881d43a03d785ac2c6c172ccc0d53eecd Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 20 Feb 2015 15:26:41 -0800 Subject: DO NOT MERGE Remove use of ttsSpanAsPhoneNumber This API is deprecated (and hidden) Change-Id: Ie1fe6ed8c2aff4288c41b15a95da45090009df4b --- InCallUI/src/com/android/incallui/CallCardFragment.java | 6 +++--- .../src/com/android/incallui/ConferenceParticipantListAdapter.java | 2 +- InCallUI/src/com/android/incallui/DialpadFragment.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index ba9dac505..9d5e2650e 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -372,7 +372,7 @@ public class CallCardFragment extends BaseFragment Date: Mon, 20 Apr 2015 15:02:38 -0700 Subject: DO NOT MERGE Temporarily disable code that uses plurals Using plurals currently causes a ResourceNotFoundException because the translated counterparts for all languages must be submitted first. Temporarily disable this codepath. Bug: 20427882 Change-Id: I3a8c565bc704443fe1766e9311952481a25a2295 --- InCallUI/src/com/android/incallui/CallCardFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 9d5e2650e..783536e9e 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -611,9 +611,12 @@ public class CallCardFragment extends BaseFragment