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

Commit a836df1b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "IMS Call Extras Feature"

parents 2b86dcac b6e1446b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import com.android.internal.telecom.IVideoProvider;

import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -49,6 +50,8 @@ import java.util.concurrent.ConcurrentHashMap;
@SystemApi
public abstract class Connection {

    private static final boolean DBG = false;

    public static final int STATE_INITIALIZING = 0;

    public static final int STATE_NEW = 1;
@@ -89,6 +92,7 @@ public abstract class Connection {
    public abstract static class Listener {
        public void onStateChanged(Connection c, int state) {}
        public void onAddressChanged(Connection c, Uri newAddress, int presentation) {}
        public void onExtrasUpdated(Connection c, Bundle extras) {}
        public void onCallerDisplayNameChanged(
                Connection c, String callerDisplayName, int presentation) {}
        public void onVideoStateChanged(Connection c, int videoState) {}
@@ -791,6 +795,19 @@ public abstract class Connection {
        setState(STATE_ACTIVE);
    }

    /**
     * Updates the call extras for the connection.
     */
    public final void setExtras(Bundle extras) {
        if (DBG) {
            Log.d(this, "setExtras extras size= " + extras.size());
        }

        for (Listener l : mListeners) {
            l.onExtrasUpdated(this, extras);
        }
    }

    /**
     * Sets state to ringing (e.g., an inbound ringing call).
     */
+9 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -465,6 +466,14 @@ public abstract class ConnectionService extends Service {
            }
        }

        @Override
        public void onExtrasUpdated(Connection c, Bundle extras) {
            String id = mIdByConnection.get(c);
            Log.d(this, "Adapter set extras size="
                    + extras.size() + " | call id= " + id);
            mAdapter.setExtras(id, extras);
        }

        @Override
        public void onDisconnected(Connection c, DisconnectCause disconnectCause) {
            String id = mIdByConnection.get(c);
+16 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telecom;

import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;

@@ -102,6 +103,21 @@ final class ConnectionServiceAdapter implements DeathRecipient {
        }
    }

    /**
     * Sets a call's extras.
     *
     * @param extras The extras.
     * @param callId The call.
     */
    void setExtras(String callId, Bundle extras) {
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setExtras(callId, extras);
            } catch (RemoteException e) {
            }
        }
    }

    /**
     * Sets a call's state to ringing (e.g., an inbound ringing call).
     *
+20 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telecom;

import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -60,6 +61,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 21;
    private static final int MSG_SET_PHONE_ACCOUNT = 22;
    private static final int MSG_SET_CALL_SUBSTATE = 23;
    private static final int MSG_SET_EXTRAS = 24;

    private final IConnectionServiceAdapter mDelegate;

@@ -90,6 +92,16 @@ final class ConnectionServiceAdapterServant {
                case MSG_SET_ACTIVE:
                    mDelegate.setActive((String) msg.obj);
                    break;
                case MSG_SET_EXTRAS: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        mDelegate.setExtras(
                                (String) args.arg1, (Bundle) args.arg2);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                case MSG_SET_RINGING:
                    mDelegate.setRinging((String) msg.obj);
                    break;
@@ -249,6 +261,14 @@ final class ConnectionServiceAdapterServant {
            mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
        }

        @Override
        public void setExtras(String callId, Bundle extras) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.arg2 = extras;
            mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget();
        }

        @Override
        public void setRinging(String connectionId) {
            mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telecom;

import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
@@ -98,6 +99,11 @@ final class RemoteConnectionService {
            }
        }

        @Override
        public void setExtras(String callId, Bundle extras) {
            // NOTE: Should this be a no-op?
        }

        @Override
        public void setRinging(String callId) {
            findConnectionForAction(callId, "setRinging")
Loading