Add connection serivce focus api interface
This add new api interface to ConnectionService to support the connection service focus api. Bug: 69651192 Test: manually Change-Id: Iea49d95b086d32a0ebaf8e9f34fe4556953a0fd5
This commit is contained in:
@@ -143,6 +143,8 @@ public abstract class ConnectionService extends Service {
|
||||
private static final String SESSION_START_RTT = "CS.+RTT";
|
||||
private static final String SESSION_STOP_RTT = "CS.-RTT";
|
||||
private static final String SESSION_RTT_UPGRADE_RESPONSE = "CS.rTRUR";
|
||||
private static final String SESSION_CONNECTION_SERVICE_FOCUS_LOST = "CS.cSFL";
|
||||
private static final String SESSION_CONNECTION_SERVICE_FOCUS_GAINED = "CS.cSFG";
|
||||
|
||||
private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1;
|
||||
private static final int MSG_CREATE_CONNECTION = 2;
|
||||
@@ -172,6 +174,8 @@ public abstract class ConnectionService extends Service {
|
||||
private static final int MSG_ON_STOP_RTT = 27;
|
||||
private static final int MSG_RTT_UPGRADE_RESPONSE = 28;
|
||||
private static final int MSG_CREATE_CONNECTION_COMPLETE = 29;
|
||||
private static final int MSG_CONNECTION_SERVICE_FOCUS_LOST = 30;
|
||||
private static final int MSG_CONNECTION_SERVICE_FOCUS_GAINED = 31;
|
||||
|
||||
private static Connection sNullConnection;
|
||||
|
||||
@@ -591,6 +595,26 @@ public abstract class ConnectionService extends Service {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionServiceFocusLost(Session.Info sessionInfo) throws RemoteException {
|
||||
Log.startSession(sessionInfo, SESSION_CONNECTION_SERVICE_FOCUS_LOST);
|
||||
try {
|
||||
mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_LOST).sendToTarget();
|
||||
} finally {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionServiceFocusGained(Session.Info sessionInfo) throws RemoteException {
|
||||
Log.startSession(sessionInfo, SESSION_CONNECTION_SERVICE_FOCUS_GAINED);
|
||||
try {
|
||||
mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_GAINED).sendToTarget();
|
||||
} finally {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||
@@ -1012,6 +1036,12 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_CONNECTION_SERVICE_FOCUS_GAINED:
|
||||
onConnectionServiceFocusGained();
|
||||
break;
|
||||
case MSG_CONNECTION_SERVICE_FOCUS_LOST:
|
||||
onConnectionServiceFocusLost();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1872,6 +1902,16 @@ public abstract class ConnectionService extends Service {
|
||||
addExistingConnection(phoneAccountHandle, connection, null /* conference */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to inform Telecom that your {@link ConnectionService} has released call resources (e.g
|
||||
* microphone, camera).
|
||||
*
|
||||
* @see ConnectionService#onConnectionServiceFocusLost()
|
||||
*/
|
||||
public final void connectionServiceFocusReleased() {
|
||||
mAdapter.onConnectionServiceFocusReleased();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a connection created by the {@link ConnectionService} and informs telecom of the new
|
||||
* connection.
|
||||
@@ -2145,6 +2185,20 @@ public abstract class ConnectionService extends Service {
|
||||
*/
|
||||
public void onRemoteExistingConnectionAdded(RemoteConnection connection) {}
|
||||
|
||||
/**
|
||||
* Called when the {@link ConnectionService} has lost the call focus.
|
||||
* The {@link ConnectionService} should release the call resources and invokes
|
||||
* {@link ConnectionService#connectionServiceFocusReleased()} to inform telecom that it has
|
||||
* released the call resources.
|
||||
*/
|
||||
public void onConnectionServiceFocusLost() {}
|
||||
|
||||
/**
|
||||
* Called when the {@link ConnectionService} has gained the call focus. The
|
||||
* {@link ConnectionService} can acquire the call resources at this time.
|
||||
*/
|
||||
public void onConnectionServiceFocusGained() {}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user