Merge "Fix Telecomm tests"
diff --git a/res/values/config.xml b/res/values/config.xml
index 60649f2..d3e253c 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -30,6 +30,9 @@
     <!-- Package name for the default in-call UI and dialer [DO NOT TRANSLATE] -->
     <string name="ui_default_package" translatable="false">com.android.dialer</string>
 
+    <!-- Class name for the default in-call UI Service [DO NOT TRANSLATE] -->
+    <string name="incall_default_class" translatable="false">com.android.incallui.InCallServiceImpl</string>
+
     <!-- Class name for the default main dialer activity [DO NOT TRANSLATE] -->
     <string name="dialer_default_class" translatable="false">com.android.dialer.DialtactsActivity</string>
 </resources>
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index 1169d5a..4265c65 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -28,15 +28,16 @@
 import android.telecomm.CallState;
 import android.telecomm.GatewayInfo;
 import android.telecomm.Response;
+import android.telecomm.Subscription;
 import android.telecomm.TelecommConstants;
 import android.telephony.DisconnectCause;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 
+import com.android.internal.telecomm.ICallVideoProvider;
 import com.android.internal.telephony.CallerInfo;
 import com.android.internal.telephony.CallerInfoAsyncQuery;
 import com.android.internal.telephony.CallerInfoAsyncQuery.OnQueryCompleteListener;
-
 import com.android.internal.telephony.SmsApplication;
 import com.android.telecomm.ContactsAsyncHelper.OnImageLoadCompleteListener;
 import com.google.common.base.Preconditions;
@@ -72,6 +73,7 @@
         void onParentChanged(Call call);
         void onChildrenChanged(Call call);
         void onCannedSmsResponsesLoaded(Call call);
+        void onCallVideoProviderChanged(Call call);
     }
 
     private static final OnQueryCompleteListener sCallerInfoQueryListener =
@@ -114,6 +116,8 @@
      * service. */
     private final GatewayInfo mGatewayInfo;
 
+    private final Subscription mSubscription;
+
     private final Handler mHandler = new Handler();
 
     private long mConnectTimeMillis;
@@ -202,13 +206,15 @@
     /** Whether an attempt has been made to load the text message responses. */
     private boolean mCannedSmsResponsesLoadingStarted = false;
 
+    private ICallVideoProvider mCallVideoProvider;
+
     /**
      * Creates an empty call object.
      *
      * @param isIncoming True if this is an incoming call.
      */
     Call(boolean isIncoming, boolean isConference) {
-        this(null, null, isIncoming, isConference);
+        this(null, null, null, isIncoming, isConference);
     }
 
     /**
@@ -216,12 +222,15 @@
      *
      * @param handle The handle to dial.
      * @param gatewayInfo Gateway information to use for the call.
+     * @param subscription Subscription information to use for the call.
      * @param isIncoming True if this is an incoming call.
      */
-    Call(Uri handle, GatewayInfo gatewayInfo, boolean isIncoming, boolean isConference) {
+    Call(Uri handle, GatewayInfo gatewayInfo, Subscription subscription,
+            boolean isIncoming, boolean isConference) {
         mState = isConference ? CallState.ACTIVE : CallState.NEW;
         setHandle(handle);
         mGatewayInfo = gatewayInfo;
+        mSubscription = subscription;
         mIsIncoming = isIncoming;
         mIsConference = isConference;
         maybeLoadCannedSmsResponses();
@@ -347,6 +356,10 @@
         return mGatewayInfo;
     }
 
+    Subscription getSubscription() {
+        return mSubscription;
+    }
+
     boolean isIncoming() {
         return mIsIncoming;
     }
@@ -699,7 +712,20 @@
         } else if (mOriginalCall != null && mOriginalCall.mCallService != null) {
             descriptor = mOriginalCall.mCallService.getDescriptor();
         }
-        return new CallInfo(callId, mState, mHandle, mGatewayInfo, mExtras, descriptor);
+        Bundle extras = mExtras;
+        if (mGatewayInfo != null && mGatewayInfo.getGatewayProviderPackageName() != null &&
+                mGatewayInfo.getOriginalHandle() != null) {
+            extras = (Bundle) mExtras.clone();
+            extras.putString(
+                    NewOutgoingCallIntentBroadcaster.EXTRA_GATEWAY_PROVIDER_PACKAGE,
+                    mGatewayInfo.getGatewayProviderPackageName());
+            extras.putParcelable(
+                    NewOutgoingCallIntentBroadcaster.EXTRA_GATEWAY_ORIGINAL_URI,
+                    mGatewayInfo.getOriginalHandle());
+
+        }
+        return new CallInfo(callId, mState, mHandle, mGatewayInfo, mSubscription,
+                extras, descriptor);
     }
 
     /** Checks if this is a live call or not. */
@@ -1025,4 +1051,21 @@
     public boolean getStartWithSpeakerphoneOn() {
         return mSpeakerphoneOn;
     }
+
+    /**
+     * Sets a call video provider for the call.
+     */
+    public void setCallVideoProvider(ICallVideoProvider callVideoProvider) {
+        mCallVideoProvider = callVideoProvider;
+        for (Listener l : mListeners) {
+            l.onCallVideoProviderChanged(Call.this);
+        }
+    }
+
+    /**
+     * @return Return the call video Provider binder.
+     */
+    public ICallVideoProvider getCallVideoProvider() {
+        return mCallVideoProvider;
+    }
 }
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index 2dd6214..53d2072 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -21,6 +21,7 @@
 import android.os.AsyncTask;
 import android.provider.CallLog.Calls;
 import android.telecomm.CallState;
+import android.telecomm.Subscription;
 import android.telephony.PhoneNumberUtils;
 
 import com.android.internal.telephony.PhoneConstants;
@@ -48,12 +49,14 @@
          * @param durationInMillis Duration of the call (milliseconds).
          */
         public AddCallArgs(Context context, ContactInfo contactInfo, String number,
-                int presentation, int callType, long creationDate, long durationInMillis) {
+                int presentation, int callType, Subscription subscription,
+                long creationDate, long durationInMillis) {
             this.context = context;
             this.contactInfo = contactInfo;
             this.number = number;
             this.presentation = presentation;
             this.callType = callType;
+            this.subscription = subscription;
             this.timestamp = creationDate;
             this.durationInSec = (int)(durationInMillis / 1000);
         }
@@ -64,6 +67,7 @@
         public final String number;
         public final int presentation;
         public final int callType;
+        public final Subscription subscription;
         public final long timestamp;
         public final int durationInSec;
     }
@@ -111,8 +115,9 @@
         Log.d(TAG, "logNumber set to: %s", Log.pii(logNumber));
 
         final int presentation = getPresentation(call, contactInfo);
+        final Subscription subscription = call.getSubscription();
 
-        logCall(contactInfo, logNumber, presentation, callLogType, creationTime, age);
+        logCall(contactInfo, logNumber, presentation, callLogType, subscription, creationTime, age);
     }
 
     /**
@@ -130,6 +135,7 @@
             String number,
             int presentation,
             int callType,
+            Subscription subscription,
             long start,
             long duration) {
         boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mContext, number);
@@ -148,7 +154,7 @@
                     + Log.pii(number) + "," + presentation + ", " + callType
                     + ", " + start + ", " + duration);
             AddCallArgs args = new AddCallArgs(mContext, contactInfo, number, presentation,
-                    callType, start, duration);
+                    callType, subscription, start, duration);
             logCallAsync(args);
         } else {
           Log.d(TAG, "Not adding emergency call to call log.");
@@ -220,7 +226,7 @@
                 try {
                     // May block.
                     result[i] = Calls.addCall(null, c.context, c.number, c.presentation,
-                            c.callType, c.timestamp, c.durationInSec);
+                            c.callType, c.subscription, c.timestamp, c.durationInSec);
                 } catch (Exception e) {
                     // This is very rare but may happen in legitimate cases.
                     // E.g. If the phone is encrypted and thus write request fails, it may cause
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index 782f7a4..5970846 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -31,9 +31,11 @@
 import android.telephony.DisconnectCause;
 
 import com.android.internal.os.SomeArgs;
+
 import com.android.internal.telecomm.ICallService;
 import com.android.internal.telecomm.ICallServiceAdapter;
 import com.android.internal.telecomm.ICallServiceProvider;
+import com.android.internal.telecomm.ICallVideoProvider;
 import com.android.internal.telecomm.RemoteServiceCallback;
 import com.android.telecomm.BaseRepository.LookupCallback;
 import com.google.common.base.Preconditions;
@@ -74,6 +76,7 @@
         private static final int MSG_ADD_CONFERENCE_CALL = 14;
         private static final int MSG_HANDOFF_CALL = 15;
         private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 16;
+        private static final int MSG_SET_CALL_VIDEO_PROVIDER = 17;
 
         private final Handler mHandler = new Handler() {
             @Override
@@ -278,6 +281,20 @@
                     case MSG_QUERY_REMOTE_CALL_SERVICES: {
                         CallServiceWrapper.this.queryRemoteConnectionServices(
                                 (RemoteServiceCallback) msg.obj);
+                        break;
+                    }
+                    case MSG_SET_CALL_VIDEO_PROVIDER: {
+                        SomeArgs args = (SomeArgs) msg.obj;
+                        try {
+                            call = mCallIdMapper.getCall(args.arg1);
+                            ICallVideoProvider callVideoProvider = (ICallVideoProvider) args.arg2;
+                            if (call != null) {
+                                call.setCallVideoProvider(callVideoProvider);
+                            }
+                        } finally {
+                            args.recycle();
+                        }
+                        break;
                     }
                 }
             }
@@ -340,6 +357,17 @@
 
         /** {@inheritDoc} */
         @Override
+        public void setCallVideoProvider(String callId, ICallVideoProvider callVideoProvider) {
+            logIncoming("setCallVideoProvider %s", callId);
+            mCallIdMapper.checkValidCallId(callId);
+            SomeArgs args = SomeArgs.obtain();
+            args.arg1 = callId;
+            args.arg2 = callVideoProvider;
+            mHandler.obtainMessage(MSG_SET_CALL_VIDEO_PROVIDER, args).sendToTarget();
+        }
+
+        /** {@inheritDoc} */
+        @Override
         public void setDialing(String callId) {
             logIncoming("setDialing %s", callId);
             mCallIdMapper.checkValidCallId(callId);
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 174e59f..26f627f 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -23,6 +23,7 @@
 import android.telecomm.CallServiceDescriptor;
 import android.telecomm.CallState;
 import android.telecomm.GatewayInfo;
+import android.telecomm.Subscription;
 import android.telephony.DisconnectCause;
 
 import com.google.common.base.Preconditions;
@@ -64,6 +65,7 @@
         void onIsConferenceCapableChanged(Call call, boolean isConferenceCapable);
         void onIsConferencedChanged(Call call);
         void onCannedSmsResponsesLoaded(Call call);
+        void onCallVideoProviderChanged(Call call);
     }
 
     private static final CallsManager INSTANCE = new CallsManager();
@@ -224,6 +226,13 @@
         }
     }
 
+    @Override
+    public void onCallVideoProviderChanged(Call call) {
+        for (CallsManagerListener listener : mListeners) {
+            listener.onCallVideoProviderChanged(call);
+        }
+    }
+
     ImmutableCollection<Call> getCalls() {
         return ImmutableList.copyOf(mCalls);
     }
@@ -283,7 +292,7 @@
      * @param speakerphoneOn Whether or not to turn the speakerphone on once the call connects.
      */
     void placeOutgoingCall(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo,
-            boolean speakerphoneOn) {
+            Subscription subscription, boolean speakerphoneOn) {
         final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
 
         if (gatewayInfo == null) {
@@ -294,7 +303,8 @@
         }
 
         Call call = new Call(
-                uriHandle, gatewayInfo, false /* isIncoming */, false /* isConference */);
+                uriHandle, gatewayInfo, subscription,
+                false /* isIncoming */, false /* isConference */);
         call.setStartWithSpeakerphoneOn(speakerphoneOn);
 
         // TODO(santoscordon): Move this to be a part of addCall()
@@ -474,7 +484,8 @@
         // particular the original call's call service will be updated to the new call's call
         // service.
         Call tempCall = new Call(
-                originalCall.getHandoffHandle(), originalCall.getGatewayInfo(), false, false);
+                originalCall.getHandoffHandle(), originalCall.getGatewayInfo(),
+                originalCall.getSubscription(), false, false);
         tempCall.setOriginalCall(originalCall);
         tempCall.setExtras(originalCall.getExtras());
         mPendingHandoffCalls.add(tempCall);
diff --git a/src/com/android/telecomm/CallsManagerListenerBase.java b/src/com/android/telecomm/CallsManagerListenerBase.java
index 55fa0a1..26d122b 100644
--- a/src/com/android/telecomm/CallsManagerListenerBase.java
+++ b/src/com/android/telecomm/CallsManagerListenerBase.java
@@ -86,4 +86,9 @@
     @Override
     public void onCannedSmsResponsesLoaded(Call call) {
     }
+
+    @Override
+    public void onCallVideoProviderChanged(Call call) {
+
+    }
 }
diff --git a/src/com/android/telecomm/InCallController.java b/src/com/android/telecomm/InCallController.java
index 3dd0539..871bf75 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -20,6 +20,8 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+
+import android.content.res.Resources;
 import android.net.Uri;
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -59,20 +61,6 @@
         }
     }
 
-    /**
-     * Package name of the in-call app. Although in-call code in kept in its own namespace, it is
-     * ultimately compiled into the dialer APK, hence the difference in namespaces between this and
-     * {@link #IN_CALL_SERVICE_CLASS_NAME}.
-     * TODO(santoscordon): Change this into config.xml resource entry.
-     */
-    private static final String IN_CALL_PACKAGE_NAME = "com.google.android.dialer";
-
-    /**
-     * Class name of the component within in-call app which implements {@link IInCallService}.
-     */
-    private static final String IN_CALL_SERVICE_CLASS_NAME =
-            "com.android.incallui.InCallServiceImpl";
-
     /** Maintains a binding connection to the in-call app. */
     private final InCallServiceConnection mConnection = new InCallServiceConnection();
 
@@ -174,6 +162,11 @@
         updateCall(call);
     }
 
+    @Override
+    public void onCallVideoProviderChanged(Call call) {
+        updateCall(call);
+    }
+
     void bringToForeground(boolean showDialpad) {
         if (mInCallService != null) {
             try {
@@ -204,14 +197,16 @@
     private void bind() {
         ThreadUtil.checkOnMainThread();
         if (mInCallService == null) {
-            ComponentName component =
-                    new ComponentName(IN_CALL_PACKAGE_NAME, IN_CALL_SERVICE_CLASS_NAME);
+            Context context = TelecommApp.getInstance();
+            Resources resources = context.getResources();
+            ComponentName component = new ComponentName(
+                    resources.getString(R.string.ui_default_package),
+                    resources.getString(R.string.incall_default_class));
             Log.i(this, "Attempting to bind to InCallService: %s", component);
 
             Intent serviceIntent = new Intent(IInCallService.class.getName());
             serviceIntent.setComponent(component);
 
-            Context context = TelecommApp.getInstance();
             if (!context.bindServiceAsUser(serviceIntent, mConnection, Context.BIND_AUTO_CREATE,
                     UserHandle.CURRENT)) {
                 Log.w(this, "Could not connect to the in-call app (%s)", component);
@@ -320,7 +315,8 @@
 
         return new InCallCall(callId, state, call.getDisconnectCause(), call.getDisconnectMessage(),
                 call.getCannedSmsResponses(), capabilities, connectTimeMillis, call.getHandle(),
-                call.getGatewayInfo(), descriptor, call.getHandoffCallServiceDescriptor(),
+                call.getGatewayInfo(), call.getSubscription(), descriptor,
+                call.getHandoffCallServiceDescriptor(), call.getCallVideoProvider(),
                 parentCallId, childCallIds);
     }
 
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index c40fde5..c18dbc5 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -38,6 +38,7 @@
 import android.os.UserHandle;
 import android.provider.ContactsContract;
 import android.telecomm.GatewayInfo;
+import android.telecomm.Subscription;
 import android.telecomm.TelecommConstants;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.TelephonyManager;
@@ -77,6 +78,8 @@
     public static final String EXTRA_GATEWAY_PROVIDER_PACKAGE =
             "com.android.phone.extra.GATEWAY_PROVIDER_PACKAGE";
     public static final String EXTRA_GATEWAY_URI = "com.android.phone.extra.GATEWAY_URI";
+    public static final String EXTRA_GATEWAY_ORIGINAL_URI =
+            "com.android.phone.extra.GATEWAY_ORIGINAL_URI";
 
     private static final String SCHEME_TEL = "tel";
     private static final String SCHEME_SIP = "sip";
@@ -132,7 +135,9 @@
             }
 
             GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri);
+            Subscription subscription = getSubscriptionFromIntent(intent);
             mCallsManager.placeOutgoingCall(resultHandleUri, mContactInfo, gatewayInfo,
+                    subscription,
                     mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
                             false));
         }
@@ -201,7 +206,7 @@
                     + " OutgoingCallBroadcastReceiver: %s", intent);
             String scheme = isUriNumber ? SCHEME_SIP : SCHEME_TEL;
             mCallsManager.placeOutgoingCall(
-                    Uri.fromParts(scheme, handle, null), mContactInfo, null,
+                    Uri.fromParts(scheme, handle, null), mContactInfo, null, null,
                     mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
                             false));
 
@@ -239,7 +244,7 @@
         broadcastIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
         Log.v(this, "Broadcasting intent: %s.", broadcastIntent);
 
-        checkAndCopyGatewayProviderExtras(originalCallIntent, broadcastIntent);
+        checkAndCopyProviderExtras(originalCallIntent, broadcastIntent);
 
         context.sendOrderedBroadcastAsUser(
                 broadcastIntent,
@@ -259,7 +264,10 @@
      * @param src Intent which may contain the provider's extras.
      * @param dst Intent where a copy of the extras will be added if applicable.
      */
-    public void checkAndCopyGatewayProviderExtras(Intent src, Intent dst) {
+    public void checkAndCopyProviderExtras(Intent src, Intent dst) {
+        if (src == null) {
+            return;
+        }
         if (hasGatewayProviderExtras(src)) {
             dst.putExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE,
                     src.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE));
@@ -268,8 +276,14 @@
             Log.d(this, "Found and copied gateway provider extras to broadcast intent.");
             return;
         }
+        Subscription extraSubscription = src.getParcelableExtra(
+                TelephonyManager.EXTRA_SUBSCRIPTION);
+        if (extraSubscription != null) {
+            dst.putExtra(TelephonyManager.EXTRA_SUBSCRIPTION, extraSubscription);
+            Log.d(this, "Found and copied subscription extra to broadcast intent.");
+        }
 
-        Log.d(this, "No gateway provider extras found in call intent.");
+        Log.d(this, "No provider extras found in call intent.");
     }
 
     /**
@@ -279,9 +293,6 @@
      * @return true if the intent has all the gateway information extras needed.
      */
     private boolean hasGatewayProviderExtras(Intent intent) {
-        if (intent == null) {
-            return false;
-        }
         final String name = intent.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE);
         final String uriString = intent.getStringExtra(EXTRA_GATEWAY_URI);
 
@@ -315,6 +326,20 @@
         return null;
     }
 
+    /**
+     * Extracts subscription/connection provider information from a provided intent..
+     *
+     * @param intent to extract subscription information from.
+     * @return Subscription object containing extracted subscription information
+     */
+    public static Subscription getSubscriptionFromIntent(Intent intent) {
+        if (intent == null) {
+            return null;
+        }
+
+        return intent.getParcelableExtra(TelephonyManager.EXTRA_SUBSCRIPTION);
+    }
+
     private void launchSystemDialer(Context context, Uri handle) {
         Intent systemDialerIntent = new Intent();
         final Resources resources = context.getResources();
diff --git a/src/com/android/telecomm/OutgoingCallProcessor.java b/src/com/android/telecomm/OutgoingCallProcessor.java
index ffcfe6d..9d1f008 100644
--- a/src/com/android/telecomm/OutgoingCallProcessor.java
+++ b/src/com/android/telecomm/OutgoingCallProcessor.java
@@ -43,15 +43,9 @@
  *
  * Except for the abort case, all other scenarios should terminate with the call notified
  * of the result.
- *
- * NOTE(gilad): Currently operating under the assumption that we'll have one timeout per (outgoing)
- * call attempt.  If we (also) like to timeout individual selectors and/or call services, the code
- * here will need to be re-factored (quite a bit) to support that.
  */
 final class OutgoingCallProcessor {
 
-    private final static int MSG_EXPIRE = 1;
-
     /**
      * The outgoing call this processor is tasked with placing.
      */
@@ -70,17 +64,6 @@
 
     private final CallServiceRepository mCallServiceRepository;
 
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MSG_EXPIRE:
-                    abort();
-                    break;
-            }
-        }
-    };
-
     /**
      * The duplicate-free list of currently-available call-service descriptors.
      */
@@ -126,9 +109,6 @@
     void process() {
         Log.v(this, "process, mIsAborted: %b", mIsAborted);
         if (!mIsAborted) {
-            // Start the expiration timeout.
-            mHandler.sendEmptyMessageDelayed(MSG_EXPIRE, Timeouts.getNewOutgoingCallMillis());
-
             // Lookup call services
             mCallServiceRepository.lookupServices(new LookupCallback<CallServiceWrapper>() {
                 @Override
@@ -301,8 +281,6 @@
                 mResultCallback.onOutgoingCallFailure(errorCode, errorMsg);
             }
             mResultCallback = null;
-
-            mHandler.removeMessages(MSG_EXPIRE);
         } else {
             Log.wtf(this, "Attempting to return outgoing result twice for call %s", mCall);
         }
diff --git a/src/com/android/telecomm/Timeouts.java b/src/com/android/telecomm/Timeouts.java
index 3e5899c..9fa44d3 100644
--- a/src/com/android/telecomm/Timeouts.java
+++ b/src/com/android/telecomm/Timeouts.java
@@ -53,14 +53,6 @@
     }
 
     /**
-     * Returns the longest period, in milliseconds, each new outgoing call is allowed to wait before
-     * being established. If the call does not connect before this time, abort the call.
-     */
-    public static long getNewOutgoingCallMillis() {
-        return get("new_outgoing_call_ms", 60 * 1000L);
-    }
-
-    /**
      * Returns the longest period, in milliseconds, to wait for the query for direct-to-voicemail
      * to complete. If the query goes beyond this timeout, the incoming call screen is shown to the
      * user.
diff --git a/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java b/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
index ce611fe..37fe902 100644
--- a/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
+++ b/tests/src/com/android/telecomm/testapps/TestCallVideoProvider.java
@@ -17,8 +17,10 @@
 package com.android.telecomm.testapps;
 
 import android.telecomm.CallVideoProvider;
+import android.telecomm.VideoCallProfile;
 
 import android.util.Log;
+import android.view.Surface;
 
 /**
  * Implements the CallVideoProvider.
@@ -31,6 +33,51 @@
         log("Set camera to " + cameraId);
     }
 
+    @Override
+    public void setPreviewSurface(Surface surface) {
+
+    }
+
+    @Override
+    public void setDisplaySurface(Surface surface) {
+
+    }
+
+    @Override
+    public void setDeviceOrientation(int rotation) {
+
+    }
+
+    @Override
+    public void setZoom(float value) {
+
+    }
+
+    @Override
+    public void sendSessionModifyRequest(VideoCallProfile requestProfile) {
+
+    }
+
+    @Override
+    public void sendSessionModifyResponse(VideoCallProfile responseProfile) {
+
+    }
+
+    @Override
+    public void requestCameraCapabilities() {
+
+    }
+
+    @Override
+    public void requestCallDataUsage() {
+
+    }
+
+    @Override
+    public void setPauseImage(String uri) {
+
+    }
+
     private static void log(String msg) {
         Log.w("TestCallServiceProvider", "[TestCallServiceProvider] " + msg);
     }
diff --git a/tests/src/com/android/telecomm/testapps/TestConnectionService.java b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
index 6315e9a..4ff6fa4 100644
--- a/tests/src/com/android/telecomm/testapps/TestConnectionService.java
+++ b/tests/src/com/android/telecomm/testapps/TestConnectionService.java
@@ -16,44 +16,40 @@
 
 package com.android.telecomm.testapps;
 
-import android.content.ComponentName;
 import android.content.Intent;
 import android.media.MediaPlayer;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
 import android.telecomm.CallAudioState;
-import android.telecomm.CallInfo;
 import android.telecomm.CallServiceAdapter;
-import android.telecomm.CallState;
 import android.telecomm.Connection;
 import android.telecomm.ConnectionRequest;
 import android.telecomm.ConnectionService;
 import android.telecomm.RemoteConnection;
-import android.telecomm.RemoteConnectionService;
 import android.telecomm.Response;
-
 import android.telecomm.SimpleResponse;
 import android.telecomm.Subscription;
 import android.telephony.DisconnectCause;
+import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.telecomm.tests.R;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Service which provides fake calls to test the ICallService interface. TODO(santoscordon): Rename
  * all classes in the directory to Dummy* (e.g., DummyCallService).
  */
 public class TestConnectionService extends ConnectionService {
+    public static final String EXTRA_GATEWAY_PROVIDER_PACKAGE =
+            "com.android.phone.extra.GATEWAY_PROVIDER_PACKAGE";
+    public static final String EXTRA_GATEWAY_ORIGINAL_URI =
+            "com.android.phone.extra.GATEWAY_ORIGINAL_URI";
+
     private final class TestConnection extends Connection {
         private final RemoteConnection.Listener mProxyListener = new RemoteConnection.Listener() {
             @Override
@@ -295,7 +291,7 @@
     }
 
     private static void log(String msg) {
-        Log.w("telecomtestcallservice", "[TestCallService] " + msg);
+        Log.w("telecomtestcs", "[TestConnectionService] " + msg);
     }
 
     /** ${inheritDoc} */
@@ -313,6 +309,12 @@
             throw new RuntimeException("Goodbye, cruel world.");
         }
 
+        Bundle extras = originalRequest.getExtras();
+        String gatewayPackage = extras.getString(EXTRA_GATEWAY_PROVIDER_PACKAGE);
+        Uri originalHandle = extras.getParcelable(EXTRA_GATEWAY_ORIGINAL_URI);
+        log("gateway package [" + gatewayPackage + "], original handle [" +
+                originalHandle + "]");
+
         // Normally we would use the original request as is, but for testing purposes, we are adding
         // ".." to the end of the number to follow its path more easily through the logs.
         final ConnectionRequest request = new ConnectionRequest(