Merge "Add lifecycle methods to telecomm services" into master-nova

This commit is contained in:
Evan Charlton
2014-04-04 17:19:02 +00:00
committed by Android (Google) Code Review
4 changed files with 57 additions and 21 deletions

View File

@@ -24901,14 +24901,15 @@ package android.telecomm {
method public abstract void answer(java.lang.String);
method public abstract void call(android.telecomm.CallInfo);
method public abstract void disconnect(java.lang.String);
method protected final android.telecomm.CallServiceAdapter getAdapter();
method public final android.os.IBinder getBinder();
method public abstract void hold(java.lang.String);
method public abstract void isCompatibleWith(android.telecomm.CallInfo);
method protected void onAdapterAttached(android.telecomm.CallServiceAdapter);
method public abstract void onAudioStateChanged(java.lang.String, android.telecomm.CallAudioState);
method public final android.os.IBinder onBind(android.content.Intent);
method public abstract void playDtmfTone(java.lang.String, char);
method public abstract void reject(java.lang.String);
method public abstract void setCallServiceAdapter(android.telecomm.CallServiceAdapter);
method public abstract void setIncomingCallId(java.lang.String, android.os.Bundle);
method public abstract void stopDtmfTone(java.lang.String);
method public abstract void unhold(java.lang.String);
@@ -24957,10 +24958,11 @@ package android.telecomm {
public abstract class CallServiceSelector extends android.app.Service {
ctor protected CallServiceSelector();
method protected final android.telecomm.CallServiceSelectorAdapter getAdapter();
method protected final java.util.Collection<android.telecomm.CallInfo> getCalls();
method protected void onAdapterAttached(android.telecomm.CallServiceSelectorAdapter);
method public final android.os.IBinder onBind(android.content.Intent);
method protected abstract void select(android.telecomm.CallInfo, java.util.List<android.telecomm.CallServiceDescriptor>);
method protected abstract void setCallServiceSelectorAdapter(android.telecomm.CallServiceSelectorAdapter);
}
public final class CallServiceSelectorAdapter {
@@ -25007,13 +25009,14 @@ package android.telecomm {
public abstract class InCallService extends android.app.Service {
ctor protected InCallService();
method protected abstract void addCall(android.telecomm.CallInfo);
method protected final android.telecomm.InCallAdapter getAdapter();
method protected void onAdapterAttached(android.telecomm.InCallAdapter);
method protected abstract void onAudioStateChanged(android.telecomm.CallAudioState);
method public final android.os.IBinder onBind(android.content.Intent);
method protected abstract void setActive(java.lang.String);
method protected abstract void setDialing(java.lang.String);
method protected abstract void setDisconnected(java.lang.String, int);
method protected abstract void setHandoffEnabled(java.lang.String, boolean);
method protected abstract void setInCallAdapter(android.telecomm.InCallAdapter);
method protected abstract void setOnHold(java.lang.String);
method protected abstract void setPostDial(java.lang.String, java.lang.String);
method protected abstract void setPostDialWait(java.lang.String, java.lang.String);

View File

@@ -70,7 +70,8 @@ public abstract class CallService extends Service {
case MSG_SET_CALL_SERVICE_ADAPTER:
CallServiceAdapter adapter =
new CallServiceAdapter((ICallServiceAdapter) msg.obj);
setCallServiceAdapter(adapter);
mAdapter = adapter;
onAdapterAttached(adapter);
break;
case MSG_IS_COMPATIBLE_WITH:
isCompatibleWith((CallInfo) msg.obj);
@@ -218,6 +219,8 @@ public abstract class CallService extends Service {
*/
private final CallServiceBinder mBinder = new CallServiceBinder();
private CallServiceAdapter mAdapter = null;
/** {@inheritDoc} */
@Override
public final IBinder onBind(Intent intent) {
@@ -232,12 +235,20 @@ public abstract class CallService extends Service {
}
/**
* Sets an implementation of CallServiceAdapter for adding new calls and communicating state
* changes of existing calls.
*
* @param callServiceAdapter Adapter object for communicating call to CallsManager
* @return The attached {@link CallServiceAdapter} if the service is bound, null otherwise.
*/
public abstract void setCallServiceAdapter(CallServiceAdapter callServiceAdapter);
protected final CallServiceAdapter getAdapter() {
return mAdapter;
}
/**
* Lifecycle callback which is called when this {@link CallService} has been attached to a
* {@link CallServiceAdapter}, indicating {@link #getAdapter()} is now safe to use.
*
* @param adapter The adapter now attached to this call service.
*/
protected void onAdapterAttached(CallServiceAdapter adapter) {
}
/**
* Determines if the CallService can place the specified call. Response is sent via

View File

@@ -52,7 +52,8 @@ public abstract class CallServiceSelector extends Service {
case MSG_SET_CALL_SERVICE_SELECTOR_ADAPTER:
CallServiceSelectorAdapter adapter = new CallServiceSelectorAdapter(
(ICallServiceSelectorAdapter) msg.obj);
setCallServiceSelectorAdapter(adapter);
mAdapter = adapter;
onAdapterAttached(adapter);
break;
case MSG_SELECT:
SomeArgs args = (SomeArgs) msg.obj;
@@ -95,6 +96,8 @@ public abstract class CallServiceSelector extends Service {
private final CallServiceSelectorBinder mBinder;
private CallServiceSelectorAdapter mAdapter = null;
protected CallServiceSelector() {
mBinder = new CallServiceSelectorBinder();
}
@@ -112,11 +115,20 @@ public abstract class CallServiceSelector extends Service {
}
/**
* Sets an adapter that allows the selector to communicate with Telecomm.
*
* @param adapter Adapter object for communicating with Telecomm.
* @return The attached {@link CallServiceSelectorAdapter} if attached, or null otherwise.
*/
protected abstract void setCallServiceSelectorAdapter(CallServiceSelectorAdapter adapter);
protected final CallServiceSelectorAdapter getAdapter() {
return mAdapter;
}
/**
* Lifecycle callback which is called when this {@link CallServiceSelector} has been attached
* to a {@link CallServiceSelectorAdapter}, indicating {@link #getAdapter()} is now safe to use.
*
* @param adapter The adapter now attached to this call service selector.
*/
protected void onAdapterAttached(CallServiceSelectorAdapter adapter) {
}
/**
* Given a list of {@link CallServiceDescriptor}s, order them into a prioritized list and return

View File

@@ -55,7 +55,8 @@ public abstract class InCallService extends Service {
switch (msg.what) {
case MSG_SET_IN_CALL_ADAPTER:
InCallAdapter adapter = new InCallAdapter((IInCallAdapter) msg.obj);
setInCallAdapter(adapter);
mAdapter = adapter;
onAdapterAttached(adapter);
break;
case MSG_ADD_CALL:
addCall((CallInfo) msg.obj);
@@ -182,6 +183,8 @@ public abstract class InCallService extends Service {
private final InCallServiceBinder mBinder;
private InCallAdapter mAdapter;
protected InCallService() {
mBinder = new InCallServiceBinder();
}
@@ -192,13 +195,20 @@ public abstract class InCallService extends Service {
}
/**
* Provides the in-call app an adapter object through which to send call-commands such as
* answering and rejecting incoming calls, disconnecting active calls, and putting calls in
* special states (mute, hold, etc).
*
* @param inCallAdapter Adapter through which an in-call app can send call-commands to Telecomm.
* @return The attached {@link CallServiceSelectorAdapter} if attached, or null otherwise.
*/
protected abstract void setInCallAdapter(InCallAdapter inCallAdapter);
protected final InCallAdapter getAdapter() {
return mAdapter;
}
/**
* Lifecycle callback which is called when this {@link InCallService} has been attached
* to a {@link InCallAdapter}, indicating {@link #getAdapter()} is now safe to use.
*
* @param adapter The adapter now attached to this in-call service.
*/
protected void onAdapterAttached(InCallAdapter adapter) {
}
/**
* Indicates to the in-call app that a new call has been created and an appropriate