merge in pi-release history after reset to master
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 32d21e9..c73db6a 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -39,8 +39,11 @@
 import com.android.ims.internal.IImsConfig;
 import com.android.ims.internal.IImsEcbm;
 import com.android.ims.internal.IImsMultiEndpoint;
+import com.android.ims.internal.IImsRegistration;
 import com.android.ims.internal.IImsRegistrationCallback;
 import com.android.ims.internal.IImsRegistrationListener;
+import com.android.ims.internal.IImsServiceController;
+import com.android.ims.internal.IImsSmsListener;
 import com.android.ims.internal.IImsUt;
 import com.android.ims.internal.ImsCallSession;
 import com.android.internal.annotations.VisibleForTesting;
@@ -1425,8 +1428,10 @@
                     checkAndThrowExceptionIfServiceUnavailable();
                     // TODO: Remove once new MmTelFeature is merged in
                     mImsServiceProxy.addRegistrationListener(mImsRegistrationListenerProxy);
-                    mImsServiceProxy.getRegistration().addRegistrationCallback(
-                            mRegistrationCallback);
+                    IImsRegistration regBinder = mImsServiceProxy.getRegistration();
+                    if (regBinder != null) {
+                        regBinder.addRegistrationCallback(mRegistrationCallback);
+                    }
                     log("Registration Callback/Listener registered.");
                     // Only record if there isn't a RemoteException.
                     mHasRegisteredForProxy = true;
@@ -1869,7 +1874,7 @@
         if (!mConfigDynamicBind) {
             // Deprecated method of binding
             Rlog.i(TAG, "Creating ImsService using ServiceManager");
-            mImsServiceProxy = ImsServiceProxyCompat.create(mPhoneId, mDeathRecipient);
+            mImsServiceProxy = ImsServiceProxyCompat.create(mContext, mPhoneId, mDeathRecipient);
         } else {
             Rlog.i(TAG, "Creating ImsService using ImsResolver");
             mImsServiceProxy = ImsServiceProxy.create(mContext, mPhoneId);
@@ -2301,6 +2306,50 @@
         return mEcbm;
     }
 
+    public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry,
+            byte[] pdu) throws ImsException {
+        try {
+            mImsServiceProxy.sendSms(token, messageRef, format, smsc, isRetry, pdu);
+        } catch (RemoteException e) {
+            throw new ImsException("sendSms()", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+        }
+    }
+
+    public void acknowledgeSms(int token, int messageRef, int result) throws ImsException {
+        try {
+            mImsServiceProxy.acknowledgeSms(token, messageRef, result);
+        } catch (RemoteException e) {
+            throw new ImsException("acknowledgeSms()", e,
+                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+        }
+    }
+
+    public void acknowledgeSmsReport(int token, int messageRef, int result) throws  ImsException{
+        try {
+            mImsServiceProxy.acknowledgeSmsReport(token, messageRef, result);
+        } catch (RemoteException e) {
+            throw new ImsException("acknowledgeSmsReport()", e,
+                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+        }
+    }
+
+    public String getSmsFormat() throws ImsException{
+        try {
+            return mImsServiceProxy.getSmsFormat();
+        } catch (RemoteException e) {
+            throw new ImsException("getSmsFormat()", e,
+                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+        }
+    }
+
+    public void setSmsListener(IImsSmsListener listener) throws ImsException {
+        try {
+            mImsServiceProxy.setSmsListener(listener);
+        } catch (RemoteException e) {
+            throw new ImsException("setSmsListener()", e,
+                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
+        }
+    }
     /**
      * Gets the Multi-Endpoint interface to subscribe to multi-enpoint notifications..
      *
diff --git a/src/java/com/android/ims/ImsServiceProxy.java b/src/java/com/android/ims/ImsServiceProxy.java
index 543e31e..153c5f5 100644
--- a/src/java/com/android/ims/ImsServiceProxy.java
+++ b/src/java/com/android/ims/ImsServiceProxy.java
@@ -25,6 +25,8 @@
 import android.telephony.Rlog;
 import android.telephony.TelephonyManager;
 import android.telephony.ims.feature.ImsFeature;
+import android.telephony.SmsMessage;
+import android.telephony.ims.internal.SmsImplBase;
 import android.util.Log;
 
 import com.android.ims.internal.IImsCallSession;
@@ -36,6 +38,7 @@
 import com.android.ims.internal.IImsRegistration;
 import com.android.ims.internal.IImsRegistrationListener;
 import com.android.ims.internal.IImsServiceFeatureCallback;
+import com.android.ims.internal.IImsSmsListener;
 import com.android.ims.internal.IImsUt;
 
 /**
@@ -144,15 +147,15 @@
         }
     };
 
-    public ImsServiceProxy(int slotId, IBinder binder, int featureType) {
+    public ImsServiceProxy(Context context, int slotId, IBinder binder, int featureType) {
         mSlotId = slotId;
         mBinder = binder;
         mSupportedFeature = featureType;
+        mContext = context;
     }
 
     public ImsServiceProxy(Context context, int slotId, int featureType) {
-        this(slotId, null, featureType);
-        mContext = context;
+        this(context, slotId, null, featureType);
     }
 
     public @Nullable IImsRegistration getRegistration() {
@@ -336,6 +339,45 @@
         mStatusCallback = c;
     }
 
+    public void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry,
+            byte[] pdu) throws RemoteException {
+        synchronized (mLock) {
+            checkServiceIsReady();
+            getServiceInterface(mBinder).sendSms(token, messageRef, format, smsc, isRetry,
+                    pdu);
+        }
+    }
+
+    public void acknowledgeSms(int token, int messageRef,
+            @SmsImplBase.SendStatusResult int result) throws RemoteException {
+        synchronized (mLock) {
+            checkServiceIsReady();
+            getServiceInterface(mBinder).acknowledgeSms(token, messageRef, result);
+        }
+    }
+
+    public void acknowledgeSmsReport(int token, int messageRef,
+            @SmsImplBase.StatusReportResult int result) throws RemoteException {
+        synchronized (mLock) {
+            checkServiceIsReady();
+            getServiceInterface(mBinder).acknowledgeSmsReport(token, messageRef, result);
+        }
+    }
+
+    public String getSmsFormat() throws RemoteException {
+        synchronized (mLock) {
+            checkServiceIsReady();
+            return getServiceInterface(mBinder).getSmsFormat();
+        }
+    }
+
+    public void setSmsListener(IImsSmsListener listener) throws RemoteException {
+        synchronized (mLock) {
+            checkServiceIsReady();
+            getServiceInterface(mBinder).setSmsListener(listener);
+        }
+    }
+
     /**
      * @return Returns true if the ImsService is ready to take commands, false otherwise. If this
      * method returns false, it doesn't mean that the Binder connection is not available (use
diff --git a/src/java/com/android/ims/ImsServiceProxyCompat.java b/src/java/com/android/ims/ImsServiceProxyCompat.java
index 44f72e6..a6d1865 100644
--- a/src/java/com/android/ims/ImsServiceProxyCompat.java
+++ b/src/java/com/android/ims/ImsServiceProxyCompat.java
@@ -54,7 +54,8 @@
      */
     private static final String IMS_SERVICE = "ims";
 
-    public static ImsServiceProxyCompat create(int slotId, IBinder.DeathRecipient recipient) {
+    public static ImsServiceProxyCompat create(Context context, int slotId,
+            IBinder.DeathRecipient recipient) {
         IBinder binder = ServiceManager.checkService(IMS_SERVICE);
 
         if (binder != null) {
@@ -66,11 +67,11 @@
 
         // If the proxy is created with a null binder, subsequent calls that depend on a live
         // binder will fail, causing this structure to be torn down and created again.
-        return new ImsServiceProxyCompat(slotId, binder);
+        return new ImsServiceProxyCompat(context, slotId, binder);
     }
 
-    public ImsServiceProxyCompat(int slotId, IBinder binder) {
-        super(slotId, binder, SERVICE_ID);
+    public ImsServiceProxyCompat(Context context, int slotId, IBinder binder) {
+        super(context, slotId, binder, SERVICE_ID);
     }
 
     @Override