diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/CrsCrbtControllerBase.java b/ims/ims-ext-common/src/org/codeaurora/ims/CrsCrbtControllerBase.java
index ab75505..e1d6708 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/CrsCrbtControllerBase.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/CrsCrbtControllerBase.java
@@ -32,36 +32,60 @@
 import android.os.RemoteException;
 import org.codeaurora.ims.internal.ICrsCrbtListener;
 import org.codeaurora.ims.internal.ICrsCrbtController;
+import org.codeaurora.ims.utils.QtiImsExtUtils;
 
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.Executor;
+
+// Check the permission of the calling process
 public abstract class CrsCrbtControllerBase {
     public final class CrsCrbtBinder extends ICrsCrbtController.Stub {
 
         @Override
         public void setCrsCrbtListener(ICrsCrbtListener listener)
-            throws RemoteException{
-            CrsCrbtControllerBase.this.onSetCrsCrbtListener(listener);
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() -> {
+                try {
+                    CrsCrbtControllerBase.this.onSetCrsCrbtListener(listener);
+                } catch (RemoteException e) {
+                    throw new CompletionException(e);
+                }
+            }, "setCrsCrbtListener", mExecutor,
+            QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
         public void removeCrsCrbtListener(ICrsCrbtListener listener)
-            throws RemoteException{
-            CrsCrbtControllerBase.this.onRemoveCrsCrbtListener(listener);
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    CrsCrbtControllerBase.this.onRemoveCrsCrbtListener(listener),
+                    "removeCrsCrbtListener", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
         public boolean isPreparatorySession(String callId)
-            throws RemoteException {
-            return CrsCrbtControllerBase.this.onIsPreparatorySession(callId);
+                throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    CrsCrbtControllerBase.this.onIsPreparatorySession(callId),
+                    "isPreparatorySession", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE,
+                    mContext);
         }
 
         @Override
         public void sendSipDtmf(String requestCode)
-            throws RemoteException {
-            CrsCrbtControllerBase.this.onSendSipDtmf(requestCode);
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    CrsCrbtControllerBase.this.onSendSipDtmf(requestCode),
+                    "sendSipDtmf", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE,
+                    mContext);
         }
+
     }
 
     private ICrsCrbtController mBinder;
+    private Executor mExecutor;
+    private Context mContext;
 
     public ICrsCrbtController getBinder() {
         if (mBinder == null) {
@@ -70,24 +94,26 @@
         return mBinder;
     }
 
+    public CrsCrbtControllerBase(Executor executor, Context context) {
+        mExecutor = executor;
+        mContext = context;
+    }
+
     protected void onSetCrsCrbtListener(ICrsCrbtListener listener)
         throws RemoteException {
         //no-op
     }
 
-    protected void onRemoveCrsCrbtListener(ICrsCrbtListener listener)
-        throws RemoteException {
+    protected void onRemoveCrsCrbtListener(ICrsCrbtListener listener) {
         //no-op
     }
 
-    protected boolean onIsPreparatorySession(String callId)
-        throws RemoteException {
+    protected boolean onIsPreparatorySession(String callId) {
         //no-op
         return false;
     }
 
-    protected void onSendSipDtmf(String requestCode)
-        throws RemoteException {
+    protected void onSendSipDtmf(String requestCode) {
         //no-op
     }
 }
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/ImsMultiIdentityControllerBase.java b/ims/ims-ext-common/src/org/codeaurora/ims/ImsMultiIdentityControllerBase.java
index 05cf4e2..0615458 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/ImsMultiIdentityControllerBase.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/ImsMultiIdentityControllerBase.java
@@ -34,33 +34,55 @@
 import org.codeaurora.ims.MultiIdentityLineInfo;
 import org.codeaurora.ims.internal.IImsMultiIdentityListener;
 import org.codeaurora.ims.internal.IImsMultiIdentityInterface;
+import org.codeaurora.ims.utils.QtiImsExtUtils;
 import java.util.List;
 import java.util.ArrayList;
 
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.Executor;
+
 public abstract class ImsMultiIdentityControllerBase {
     public final class MultiIdentityBinder extends IImsMultiIdentityInterface.Stub {
 
         @Override
         public void setMultiIdentityListener(
-                IImsMultiIdentityListener listener) throws RemoteException{
-            ImsMultiIdentityControllerBase.this.
-                setMultiIdentityListener(listener);
+                IImsMultiIdentityListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() -> {
+                    try {
+                        ImsMultiIdentityControllerBase.this.
+                            setMultiIdentityListener(listener);
+                    } catch (RemoteException e) {
+                        throw new CompletionException(e);
+                    }}, "setMultiIdentityListener", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void updateRegistrationStatus(List<MultiIdentityLineInfo> linesInfo) {
-            ImsMultiIdentityControllerBase.this.
-                updateRegistrationStatus(linesInfo);
+        public void updateRegistrationStatus(List<MultiIdentityLineInfo> linesInfo)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    ImsMultiIdentityControllerBase.this.
+                    updateRegistrationStatus(linesInfo),
+                    "updateRegistrationStatus", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void queryVirtualLineInfo(String msisdn) throws RemoteException{
-           ImsMultiIdentityControllerBase.this.
-               queryVirtualLineInfo(msisdn);
+        public void queryVirtualLineInfo(String msisdn) throws RemoteException {
+            if (msisdn == null) {
+                throw new RemoteException("queryVirtualLineInfo :: msisdn is null");
+            }
+            QtiImsExtUtils.executeMethodAsync(() ->
+                        ImsMultiIdentityControllerBase.this.
+                        queryVirtualLineInfo(msisdn),
+                        "queryVirtualLineInfo", mExecutor,
+                        QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
     }
 
     private IImsMultiIdentityInterface mBinder;
+    private Executor mExecutor;
+    private Context mContext;
 
     public IImsMultiIdentityInterface getBinder() {
         if (mBinder == null) {
@@ -69,8 +91,13 @@
         return mBinder;
     }
 
+    public ImsMultiIdentityControllerBase(Executor executor, Context context) {
+        mExecutor = executor;
+        mContext = context;
+    }
+
     protected void setMultiIdentityListener(
-            IImsMultiIdentityListener listener) throws RemoteException{
+            IImsMultiIdentityListener listener) throws RemoteException {
         //no-op
     }
 
@@ -79,7 +106,7 @@
         //no-op
     }
 
-    protected void queryVirtualLineInfo(String msisdn) throws RemoteException{
+    protected void queryVirtualLineInfo(String msisdn) {
         //no-op
     }
 }
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/ImsScreenShareControllerBase.java b/ims/ims-ext-common/src/org/codeaurora/ims/ImsScreenShareControllerBase.java
index 7109f55..1af3293 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/ImsScreenShareControllerBase.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/ImsScreenShareControllerBase.java
@@ -32,28 +32,47 @@
 import android.os.RemoteException;
 import org.codeaurora.ims.internal.IImsScreenShareListener;
 import org.codeaurora.ims.internal.IImsScreenShareController;
+import org.codeaurora.ims.utils.QtiImsExtUtils;
+
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.Executor;
 
 public abstract class ImsScreenShareControllerBase {
     public final class ScreenShareBinder extends IImsScreenShareController.Stub {
 
         @Override
         public void setScreenShareListener(
-                IImsScreenShareListener listener) throws RemoteException{
-            ImsScreenShareControllerBase.this.onSetScreenShareListener(listener);
+                IImsScreenShareListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() -> {
+                    try {
+                        ImsScreenShareControllerBase.this.onSetScreenShareListener(listener);
+                    } catch (RemoteException e) {
+                        throw new CompletionException(e);
+                    }},
+                    "setScreenShareListener", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
         public void startScreenShare(int width, int height) throws RemoteException{
-            ImsScreenShareControllerBase.this.onStartScreenShare(width, height);
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    ImsScreenShareControllerBase.this.onStartScreenShare(width, height),
+                    "startScreenShare", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE,
+                    mContext);
         }
 
         @Override
         public void stopScreenShare() throws RemoteException{
-           ImsScreenShareControllerBase.this.onStopScreenShare();
+           QtiImsExtUtils.executeMethodAsync(() ->
+                    ImsScreenShareControllerBase.this.onStopScreenShare(),
+                    "stopScreenShare", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
     }
 
     private IImsScreenShareController mBinder;
+    private Executor mExecutor;
+    private Context mContext;
 
     public IImsScreenShareController getBinder() {
         if (mBinder == null) {
@@ -62,16 +81,21 @@
         return mBinder;
     }
 
+    public ImsScreenShareControllerBase(Executor executor, Context context) {
+        mExecutor = executor;
+        mContext = context;
+    }
+
     protected void onSetScreenShareListener(
             IImsScreenShareListener listener) throws RemoteException{
         //no-op
     }
 
-    protected void onStartScreenShare(int width, int height) throws RemoteException{
+    protected void onStartScreenShare(int width, int height) {
         //no-op
     }
 
-    protected void onStopScreenShare() throws RemoteException{
+    protected void onStopScreenShare() {
         //no-op
     }
 }
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/QtiImsExtBase.java b/ims/ims-ext-common/src/org/codeaurora/ims/QtiImsExtBase.java
index dee1a72..d1128b1 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/QtiImsExtBase.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/QtiImsExtBase.java
@@ -31,7 +31,9 @@
  */
 package org.codeaurora.ims;
 
+import android.content.Context;
 import android.os.Bundle;
+import android.os.RemoteException;
 import android.telephony.ims.feature.ImsFeature;
 
 import org.codeaurora.ims.internal.ICrsCrbtController;
@@ -39,10 +41,17 @@
 import org.codeaurora.ims.internal.IQtiImsExtListener;
 import org.codeaurora.ims.internal.IImsMultiIdentityInterface;
 import org.codeaurora.ims.internal.IImsScreenShareController;
+import org.codeaurora.ims.utils.QtiImsExtUtils;
 import org.codeaurora.ims.QtiCallConstants;
 import org.codeaurora.ims.VosActionInfo;
+
+import java.util.concurrent.Executor;
+
 /**
  * Base implementation for IQtiImsExt.
+ * Introduce Executor pattern where API(s) will be called on the executor thread.
+ * Except for non-oneway API(s) which call into ImsConfigImpl as setConfig/getConfig
+ * are blocking AIDL calls.
  */
 public abstract class QtiImsExtBase {
 
@@ -54,168 +63,257 @@
         @Override
         public void setCallForwardUncondTimer(int phoneId, int startHour, int startMinute,
                 int endHour, int endMinute, int action, int condition, int serviceClass,
-                String number, IQtiImsExtListener listener) {
-            onSetCallForwardUncondTimer(phoneId, startHour, startMinute, endHour, endMinute, action,
-                condition, serviceClass, number, listener);
+                String number, IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() -> QtiImsExtBase.this.onSetCallForwardUncondTimer(
+                    phoneId, startHour, startMinute, endHour, endMinute, action,
+                    condition, serviceClass, number, listener),
+                    "setCallForwardUncondTimer", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
         public void getCallForwardUncondTimer(int phoneId, int reason, int serviceClass,
-                IQtiImsExtListener listener) {
-            onGetCallForwardUncondTimer(phoneId, reason, serviceClass, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onGetCallForwardUncondTimer(phoneId, reason,
+                    serviceClass, listener), "getCallForwardUncondTimer", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void resumePendingCall(int phoneId, int videoState) {
-            onResumePendingCall(phoneId, videoState);
+        public void resumePendingCall(int phoneId, int videoState) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onResumePendingCall(phoneId, videoState),
+                    "resumePendingCall", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void sendCancelModifyCall(int phoneId, IQtiImsExtListener listener) {
-            onSendCancelModifyCall(phoneId, listener);
+        public void sendCancelModifyCall(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSendCancelModifyCall(phoneId, listener),
+                    "sendCancelModifyCall", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void queryVopsStatus(int phoneId, IQtiImsExtListener listener) {
-            onQueryVopsStatus(phoneId, listener);
+        public void queryVopsStatus(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onQueryVopsStatus(phoneId, listener),
+                    "queryVopsStatus", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void querySsacStatus(int phoneId, IQtiImsExtListener listener) {
-            onQuerySsacStatus(phoneId, listener);
+        public void querySsacStatus(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onQuerySsacStatus(phoneId, listener),
+                    "querySsacStatus", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void registerForParticipantStatusInfo(int phoneId, IQtiImsExtListener listener) {
-            onRegisterForParticipantStatusInfo(phoneId, listener);
+        public void registerForParticipantStatusInfo(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onRegisterForParticipantStatusInfo(phoneId, listener),
+                    "registerForParticipantStatusInfo", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
         public void updateVoltePreference(int phoneId, int preference,
-                IQtiImsExtListener listener) {
-            onUpdateVoltePreference(phoneId, preference, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onUpdateVoltePreference(phoneId, preference, listener),
+                    "updateVoltePreference", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void queryVoltePreference(int phoneId, IQtiImsExtListener listener) {
-            onQueryVoltePreference(phoneId, listener);
+        public void queryVoltePreference(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onQueryVoltePreference(phoneId, listener),
+                    "queryVoltePreference", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void getHandoverConfig(int phoneId, IQtiImsExtListener listener) {
-            onGetHandoverConfig(phoneId, listener);
+        public void getHandoverConfig(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onGetHandoverConfig(phoneId, listener),
+                    "getHandoverConfig", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
         public void setHandoverConfig(int phoneId, int hoConfig,
-                IQtiImsExtListener listener) {
-            onSetHandoverConfig(phoneId, hoConfig, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSetHandoverConfig(phoneId, hoConfig, listener),
+                    "setHandoverConfig", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public void setUssdInfoListener(int phoneId, IQtiImsExtListener listener) {
-            onSetUssdInfoListener(phoneId, listener);
+        public void setUssdInfoListener(int phoneId, IQtiImsExtListener listener)
+                throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSetUssdInfoListener(phoneId, listener),
+                    "setUssdInfoListener", mExecutor, QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public int setRcsAppConfig(int phoneId, int defaultSmsApp) {
-            return onSetRcsAppConfig(phoneId, defaultSmsApp);
+        public int setRcsAppConfig(int phoneId, int defaultSmsApp) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onSetRcsAppConfig(phoneId, defaultSmsApp),
+                    "setRcsAppConfig", getBinderExecutor(), QtiImsExtUtils.MODIFY_PHONE_STATE,
+                    mContext);
         }
 
         @Override
         public void setDataChannelCapabilityListener(int phoneId,
-                IQtiImsExtListener listener) {
-           onSetDataChannelCapabilityListener(phoneId, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSetDataChannelCapabilityListener(
+                    phoneId, listener), "setDataChannelCapabilityListener", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public int getRcsAppConfig(int phoneId) {
-            return onGetRcsAppConfig(phoneId);
-
+        public int getRcsAppConfig(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetRcsAppConfig(phoneId),
+                    "getRcsAppConfig", getBinderExecutor(),
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public int setVvmAppConfig(int phoneId, int defaultVvmApp) {
-            return onSetVvmAppConfig(phoneId, defaultVvmApp);
+        public int setVvmAppConfig(int phoneId, int defaultVvmApp) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onSetVvmAppConfig(phoneId, defaultVvmApp),
+                    "setVvmAppConfig", getBinderExecutor(),
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public int getVvmAppConfig(int phoneId) {
-            return onGetVvmAppConfig(phoneId);
+        public int getVvmAppConfig(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetVvmAppConfig(phoneId),
+                    "getVvmAppConfig", getBinderExecutor(),
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public IImsMultiIdentityInterface getMultiIdentityInterface(int phoneId) {
-            return onGetMultiIdentityInterface(phoneId);
+        public IImsMultiIdentityInterface getMultiIdentityInterface(int phoneId)
+                throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetMultiIdentityInterface(phoneId),
+                    "getMultiIdentityInterface", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public IImsScreenShareController getScreenShareController(int phoneId) {
-            return onGetScreenShareController(phoneId);
+        public IImsScreenShareController getScreenShareController(int phoneId)
+                throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetScreenShareController(phoneId),
+                    "getScreenShareController", mExecutor,
+                    QtiImsExtUtils.MODIFY_PHONE_STATE, mContext);
         }
 
         @Override
-        public int getImsFeatureState(int phoneId) {
-            return onGetImsFeatureState(phoneId);
+        public int getImsFeatureState(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetImsFeatureState(phoneId),
+                    "getImsFeatureState", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void setAnswerExtras(int phoneId, Bundle extras) {
-            onSetAnswerExtras(phoneId, extras);
+        public void setAnswerExtras(int phoneId, Bundle extras) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSetAnswerExtras(phoneId, extras),
+                    "setAnswerExtras", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public boolean isCallComposerEnabled(int phoneId) {
-            return onIsCallComposerEnabled(phoneId);
+        public boolean isCallComposerEnabled(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onIsCallComposerEnabled(phoneId),
+                    "isCallComposerEnabled", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public ICrsCrbtController getCrsCrbtController(int phoneId) {
-            return onGetCrsCrbtController(phoneId);
+        public ICrsCrbtController getCrsCrbtController(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onGetCrsCrbtController(phoneId),
+                    "getCrsCrbtController", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
         public void queryCallForwardStatus(int phoneId, int reason, int serviceClass,
-                boolean expectMore, IQtiImsExtListener listener) {
-            onQueryCallForwardStatus(phoneId, reason, serviceClass, expectMore, listener);
+                boolean expectMore, IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onQueryCallForwardStatus(phoneId, reason,
+                    serviceClass, expectMore, listener),
+                    "queryCallForwardStatus", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
         public void queryCallBarring(int phoneId, int cbType, String password, int serviceClass,
-                boolean expectMore, IQtiImsExtListener listener) {
-            onQueryCallBarringStatus(phoneId, cbType, password, serviceClass, expectMore,
-                    listener);
+                boolean expectMore, IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onQueryCallBarringStatus(phoneId, cbType,
+                    password, serviceClass, expectMore, listener),
+                    "queryCallBarring", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public void exitScbm(int phoneId, IQtiImsExtListener listener) {
-            onExitScbm(phoneId, listener);
+        public void exitScbm(int phoneId, IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onExitScbm(phoneId, listener),
+                    "exitScbm", mExecutor, QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public boolean isExitScbmFeatureSupported(int phoneId) {
-            return onIsExitScbmFeatureSupported(phoneId);
+        public boolean isExitScbmFeatureSupported(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onIsExitScbmFeatureSupported(phoneId),
+                    "isExitScbmFeatureSupported", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
-        public boolean isDataChannelEnabled(int phoneId) {
-            return onIsDataChannelEnabled(phoneId);
+        public boolean isDataChannelEnabled(int phoneId) throws RemoteException {
+            return QtiImsExtUtils.executeMethodAsyncForResult(() ->
+                    QtiImsExtBase.this.onIsDataChannelEnabled(phoneId),
+                    "isDataChannelEnabled", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
         public void sendVosSupportStatus(int phoneId, boolean isVosSupported,
-                IQtiImsExtListener listener) {
-            onSendVosSupportStatus(phoneId, isVosSupported, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() ->
+                    QtiImsExtBase.this.onSendVosSupportStatus(phoneId,
+                    isVosSupported, listener),
+                    "sendVosSupportStatus", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
 
         @Override
         public void sendVosActionInfo(int phoneId, VosActionInfo vosActionInfo,
-                IQtiImsExtListener listener) {
-            onSendVosActionInfo(phoneId, vosActionInfo, listener);
+                IQtiImsExtListener listener) throws RemoteException {
+            QtiImsExtUtils.executeMethodAsync(() -> QtiImsExtBase.this.onSendVosActionInfo(phoneId,
+                    vosActionInfo, listener),
+                    "sendVosActionInfo", mExecutor,
+                    QtiImsExtUtils.READ_PHONE_STATE, mContext);
         }
     };
 
     private QtiImsExtBinder mQtiImsExtBinder;
+    private Executor mExecutor;
+    private Executor mBinderExecutor = Runnable::run;
+    private Context mContext;
 
     public QtiImsExtBinder getBinder() {
         if (mQtiImsExtBinder == null) {
@@ -224,6 +322,15 @@
         return mQtiImsExtBinder;
     }
 
+    public QtiImsExtBase(Executor executor, Context context) {
+        mExecutor = executor;
+        mContext = context;
+    }
+
+    private Executor getBinderExecutor() {
+        return mBinderExecutor;
+    }
+
     protected void onSetCallForwardUncondTimer(int phoneId, int startHour, int startMinute,
             int endHour, int endMinute, int action, int condition, int serviceClass, String number,
             IQtiImsExtListener listener) {
diff --git a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
index cf5d2a5..ded9d1b 100644
--- a/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
+++ b/ims/ims-ext-common/src/org/codeaurora/ims/utils/QtiImsExtUtils.java
@@ -63,6 +63,7 @@
 
 package org.codeaurora.ims.utils;
 
+import android.Manifest;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Resources;
@@ -72,6 +73,7 @@
 import android.net.Uri;
 import android.os.ParcelFileDescriptor;
 import android.os.PersistableBundle;
+import android.os.RemoteException;
 import android.os.SystemProperties;
 import android.provider.Settings;
 import android.telephony.CarrierConfigManager;
@@ -92,6 +94,13 @@
 import org.codeaurora.ims.QtiImsException;
 import org.codeaurora.ims.QtiImsExtManager;
 
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.function.Supplier;
+
 /**
  * This class contains QtiImsExt specific utiltity functions.
  */
@@ -188,6 +197,10 @@
     /*RTT upgrade not supported */
     public static final int QTI_IMS_RTT_NOT_SUPPORTED = 0;
 
+    // Phone permissions
+    public static final String READ_PHONE_STATE = Manifest.permission.READ_PHONE_STATE;
+    public static final String MODIFY_PHONE_STATE = Manifest.permission.MODIFY_PHONE_STATE;
+
     /**
      * Private constructor for QtiImsExtUtils as we don't want to instantiate this class
      */
@@ -860,4 +873,29 @@
         return isCarrierConfigEnabled(phoneId, context,
                 QtiCarrierConfigs.KEY_CARRIER_VIDEO_ONLINE_SERVICE_SUPPORTED);
     }
+
+    public static void executeMethodAsync(Runnable r, String errorLogName, Executor executor,
+            String permission, Context context) throws RemoteException {
+        context.enforceCallingOrSelfPermission(permission, errorLogName);
+        try {
+            CompletableFuture.runAsync(r, executor).join();
+        } catch (CancellationException | CompletionException e) {
+            Log.w(LOG_TAG, "executeMethodAsync for " + errorLogName + " failed with: " +
+                    e.getMessage());
+            throw new RemoteException(e.getMessage());
+        }
+    }
+
+    public static <T> T executeMethodAsyncForResult(Supplier<T> r, String errorLogName,
+            Executor executor, String permission, Context context) throws RemoteException {
+        context.enforceCallingOrSelfPermission(permission, errorLogName);
+        try {
+            CompletableFuture<T> future = CompletableFuture.supplyAsync(r, executor);
+            return future.get();
+        } catch (ExecutionException | InterruptedException e) {
+            Log.w(LOG_TAG, "executeMethodAsyncForResult for " + errorLogName + " failed with: " +
+                    e.getMessage());
+            throw new RemoteException(e.getMessage());
+        }
+    }
 }
