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

Commit 7d3ff83b authored by Evan Charlton's avatar Evan Charlton Committed by Android Git Automerger
Browse files

am 266a63ad: Merge "Expose post-dial APIs" into lmp-preview-dev

* commit '266a63ad7731d7ebaf4c426b3d226e70c6afd2af':
  Expose post-dial APIs
parents 31363809 e62a885e
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public abstract class CallService extends Service {
    private static final int MSG_STOP_DTMF_TONE = 13;
    private static final int MSG_ADD_TO_CONFERENCE = 14;
    private static final int MSG_SPLIT_FROM_CONFERENCE = 15;
    private static final int MSG_ON_POST_DIAL_CONTINUE = 16;

    /**
     * Default Handler used to consolidate binder method calls onto a single thread.
@@ -150,6 +151,17 @@ public abstract class CallService extends Service {
                    }
                    break;
                }
                case MSG_ON_POST_DIAL_CONTINUE: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        String callId = (String) args.arg1;
                        boolean proceed = (args.argi1 == 1);
                        onPostDialContinue(callId, proceed);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                default:
                    break;
            }
@@ -247,6 +259,14 @@ public abstract class CallService extends Service {
            args.arg2 = callId;
            mMessageHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, args).sendToTarget();
        }

        @Override
        public void onPostDialContinue(String callId, boolean proceed) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.argi1 = proceed ? 1 : 0;
            mMessageHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
        }
    }

    /**
@@ -422,4 +442,7 @@ public abstract class CallService extends Service {
     * @hide
     */
    public abstract void splitFromConference(String conferenceCallId, String callId);

    public void onPostDialContinue(String callId, boolean proceed) {}
    public void onPostDialWait(Connection conn, String remaining) {}
}
+7 −0
Original line number Diff line number Diff line
@@ -217,4 +217,11 @@ public final class CallServiceAdapter {
        } catch (RemoteException ignored) {
        }
    }

    public void onPostDialWait(String callId, String remaining) {
        try {
            mAdapter.onPostDialWait(callId, remaining);
        } catch (RemoteException ignored) {
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -444,6 +444,11 @@ public abstract class Connection {
     */
    protected void onReject() {}

    /**
     * Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.
     */
    protected void onPostDialContinue(boolean proceed) {}

    private void setState(int state) {
        Log.d(this, "setState: %s", stateToString(state));
        onSetState(state);
+21 −1
Original line number Diff line number Diff line
@@ -146,7 +146,8 @@ public abstract class ConnectionService extends CallService {
                            }
                        } else {
                            addConnection(callInfo.getId(), result[0]);
                            Log.d(this, "adapter handleSuccessfulOutgoingCall %s", callInfo.getId());
                            Log.d(this, "adapter handleSuccessfulOutgoingCall %s",
                                    callInfo.getId());
                            getAdapter().handleSuccessfulOutgoingCall(callInfo.getId());
                        }
                    }
@@ -288,6 +289,25 @@ public abstract class ConnectionService extends CallService {
        // TODO(santoscordon): Find existing conference call and invoke split(connection).
    }

    @Override
    public final void onPostDialContinue(String callId, boolean proceed) {
        Log.d(this, "onPostDialContinue(%s)", callId);

        Connection connection = findConnectionForAction(callId, "onPostDialContinue");
        if (connection == NULL_CONNECTION) {
            Log.w(this, "Connection missing in post-dial request %s.", callId);
            return;
        }
        connection.onPostDialContinue(proceed);
    }

    @Override
    public final void onPostDialWait(Connection conn, String remaining) {
        Log.d(this, "onPostDialWait(%s, %s)", conn, remaining);

        getAdapter().onPostDialWait(mIdByConnection.get(conn), remaining);
    }

    /**
     * Find a set of Subscriptions matching a given handle (e.g. phone number).
     *
+4 −3
Original line number Diff line number Diff line
@@ -174,13 +174,14 @@ public final class InCallAdapter {
     * will pause playing the tones and notify the {@link InCallService} that the call is in the
     * {@link InCallService#setPostDialWait(String,String)} state. When the user decides to continue
     * the postdial sequence, the {@link InCallService} should invoke the
     * {@link #postDialContinue(String)} method.
     * {@link #postDialContinue(String,boolean)} method.
     *
     * @param callId The unique ID of the call for which postdial string playing should continue.
     * @param proceed Whether or not to continue with the post-dial sequence.
     */
    public void postDialContinue(String callId) {
    public void postDialContinue(String callId, boolean proceed) {
        try {
            mAdapter.postDialContinue(callId);
            mAdapter.postDialContinue(callId, proceed);
        } catch (RemoteException e) {
        }
    }
Loading