需要通话界面响应改动的两大类情况
1.InCallServiceImpl继承InCallService重写几个重要方法(由这些方法通知InCallPresent,再由InCallPresent通知其它Present)
public void onCallAudioStateChanged(CallAudioState audioState)
public void onBringToForeground(boolean showDialpad)
public void onCallAdded(Call call)
public void onCallRemoved(Call call)
public void onCanAddCallChanged(boolean canAddCall)
public IBinder onBind(Intent intent)
public boolean onUnbind(Intent intent)
2.InCallUI的Call.java文件实现并注册的android.telecom.Call.Callback()(如果是VideoCall,还有VideoCall.Callback)
public void onStateChanged(Call call, int state)
public void onParentChanged(Call call, Call parent)
public void onChildrenChanged(Call call, List<Call> children)
public void onDetailsChanged(Call call, Call.Details details)
public void onCannedTextResponsesLoaded(Call call, List<String> cannedTextResponses)
public void onPostDialWait(Call call, String remainingPostDialSequence)
public void onVideoCallChanged(Call call, VideoCall videoCall)
public void onCallDestroyed(Call call)
public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls)
public void onConnectionEvent(Call call, String event, Bundle extras)
精通以上各个方法的含义,你就可以尝试自己去写通话apk了
------------------------------------------------------------------------------------------------------------------------------------
得到通知后都直接或间接通过调用CallList中的方法通知本地观察者进行相应处理,
CallList提供了接口让观察者自己去实现来处理相应功能或界面需求。
1.主要针对一路或多路通话的共有特性元素修改。
/**
* Listener interface for any class that wants to be notified of changes
* to the call list.
*/
public interface Listener {
public void onIncomingCall(Call call);
/
public void onUpgradeToVideo(Call call);
/**
* Called anytime there are changes to the call list. The change can be switching call
* states, updating information, etc. This method will NOT be called for new incoming
* calls and for calls that switch to disconnected state. Listeners must add actions
* to those method implementations if they want to deal with those actions.
*/
public void onCallListChange(CallList callList);
public void onDisconnect(Call call);
}
2.主要针对其中一路通话所独占的特性元素修改。(大部分实现该接口的onCallChanged方法中没干任何事情,主要是为了实现视频通话与语音通话切换时会调用的onSessionModificationStateChange方法)
public interface CallUpdateListener {
// TODO: refactor and limit arg to be call state. Caller info is not needed.
public void onCallChanged(Call call);
/**
* Notifies of a change to the session modification state for a call.
*
* @param sessionModificationState The new session modification state.
*/
public void onSessionModificationStateChange(Call call, int sessionModificationState);
/**
* Notifies of a change to the last forwarded number for a call.
*/
public void onLastForwardedNumberChange();
/**
* Notifies of a change to the child number for a call.
*/
public void onChildNumberChange();
}