Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e7ec71e authored by Sailesh Nepal's avatar Sailesh Nepal
Browse files

Handle synchronous failed connection

Change-Id: I406ccbdd1f70c85456b6e0d689332cf40a756707
parent 0fa59b89
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -28694,7 +28694,6 @@ package android.telecomm {
    method public final android.telecomm.RemoteConnection createRemoteIncomingConnection(android.telecomm.ConnectionRequest);
    method public final android.telecomm.RemoteConnection createRemoteOutgoingConnection(android.telecomm.ConnectionRequest);
    method public final java.util.Collection<android.telecomm.Connection> getAllConnections();
    method public final void maybeRespondToAccountLookup();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public void onConnectionAdded(android.telecomm.Connection);
    method public void onConnectionRemoved(android.telecomm.Connection);
+3 −15
Original line number Diff line number Diff line
@@ -80,8 +80,6 @@ public abstract class ConnectionService extends Service {
    private final Map<Connection, String> mIdByConnection = new HashMap<>();
    private final RemoteConnectionManager mRemoteConnectionManager = new RemoteConnectionManager();

    private SimpleResponse<Uri, List<PhoneAccountHandle>> mAccountLookupResponse;
    private Uri mAccountLookupHandle;
    private boolean mAreAccountsInitialized = false;
    private final ConnectionServiceAdapter mAdapter = new ConnectionServiceAdapter();

@@ -474,6 +472,9 @@ public abstract class ConnectionService extends Service {
            } else if (createdConnection.getState() == Connection.State.CANCELED) {
                // Tell telecomm not to attempt any more services.
                mAdapter.handleCreateConnectionCancelled(request);
            } else if (createdConnection.getState() == Connection.State.FAILED) {
                mAdapter.handleCreateConnectionFailed(request, createdConnection.getFailureCode(),
                        createdConnection.getFailureMessage());
            } else {
                connectionCreated(request, createdConnection);
            }
@@ -625,7 +626,6 @@ public abstract class ConnectionService extends Service {
                        }
                        mAreAccountsInitialized = true;
                        Log.d(this, "remote connection services found: " + services);
                        maybeRespondToAccountLookup();
                    }
                });
            }
@@ -635,24 +635,12 @@ public abstract class ConnectionService extends Service {
                mHandler.post(new Runnable() {
                    @Override public void run() {
                        mAreAccountsInitialized = true;
                        maybeRespondToAccountLookup();
                    }
                });
            }
        });
    }

    public final void maybeRespondToAccountLookup() {
        if (mAreAccountsInitialized && mAccountLookupResponse != null) {
            mAccountLookupResponse.onResult(
                    mAccountLookupHandle,
                    mRemoteConnectionManager.getAccounts(mAccountLookupHandle));

            mAccountLookupHandle = null;
            mAccountLookupResponse = null;
        }
    }

    public final RemoteConnection createRemoteIncomingConnection(ConnectionRequest request) {
        return mRemoteConnectionManager.createRemoteConnection(request, true);
    }