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 (limited to 'InCallUI/src') 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