Incoming call support for multiuser phones

Change-Id: I18554f230398e17df7de3eb6fce2b38eae34c1a6
diff --git a/src/com/android/telecomm/InCallController.java b/src/com/android/telecomm/InCallController.java
index 395e92e..e5b8256 100644
--- a/src/com/android/telecomm/InCallController.java
+++ b/src/com/android/telecomm/InCallController.java
@@ -23,6 +23,7 @@
 import android.net.Uri;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.telecomm.CallAudioState;
 import android.telecomm.CallCapabilities;
 import android.telecomm.CallServiceDescriptor;
@@ -169,7 +170,8 @@
             serviceIntent.setComponent(component);
 
             Context context = TelecommApp.getInstance();
-            if (!context.bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE)) {
+            if (!context.bindServiceAsUser(serviceIntent, mConnection, Context.BIND_AUTO_CREATE,
+                    UserHandle.CURRENT)) {
                 Log.w(this, "Could not connect to the in-call app (%s)", component);
 
                 // TODO(santoscordon): Implement retry or fall-back-to-default logic.
diff --git a/src/com/android/telecomm/TelecommApp.java b/src/com/android/telecomm/TelecommApp.java
index 48f6ba5..7f477f9 100644
--- a/src/com/android/telecomm/TelecommApp.java
+++ b/src/com/android/telecomm/TelecommApp.java
@@ -17,6 +17,7 @@
 package com.android.telecomm;
 
 import android.app.Application;
+import android.os.UserHandle;
 
 /**
  * Top-level Application class for Telecomm.
@@ -38,7 +39,9 @@
         sInstance = this;
 
         mMissedCallNotifier = new MissedCallNotifier(this);
-        TelecommServiceImpl.init();
+        if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
+            TelecommServiceImpl.init();
+        }
     }
 
     public static TelecommApp getInstance() {