ConnectionService API has only one completed callback (1/3)
Refactor ConnectionService API so it has only one "completed" callback, and connection state and failure codes indicates what happened. Previous design where we had separate callbacks for failure, cancellation and success was error prone because it was easy to forget to implement one of them. Bug: 16993846 Bug: 17070939 Change-Id: I84bf5d041cf78193ccf80db201b08db3b7014830
This commit is contained in:
@@ -76,37 +76,13 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
||||
}
|
||||
}
|
||||
|
||||
void handleCreateConnectionSuccessful(
|
||||
void handleCreateConnectionComplete(
|
||||
String id,
|
||||
ConnectionRequest request,
|
||||
ParcelableConnection connection) {
|
||||
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||
try {
|
||||
adapter.handleCreateConnectionSuccessful(id, request, connection);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleCreateConnectionFailed(
|
||||
String id,
|
||||
ConnectionRequest request,
|
||||
int errorCode,
|
||||
String errorMsg) {
|
||||
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||
try {
|
||||
adapter.handleCreateConnectionFailed(id, request, errorCode, errorMsg);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleCreateConnectionCancelled(
|
||||
String id,
|
||||
ConnectionRequest request) {
|
||||
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||
try {
|
||||
adapter.handleCreateConnectionCancelled(id, request);
|
||||
adapter.handleCreateConnectionComplete(id, request, connection);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user