merge in jb-mr2-release history after reset to jb-mr2-dev
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index eaac99e..2d0cf91 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -3661,7 +3661,11 @@
         }
         APPL_TRACE_WARNING2("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
     }
-
+    else if ((status == BTA_SYS_CONN_BUSY) || (status == BTA_SYS_CONN_IDLE))
+    {
+        /* Do not do role switch management for non-AV profiles when data flow starts/stops */
+        return;
+    }
 
     bta_dm_adjust_roles(FALSE);
 
diff --git a/bta/jv/bta_jv_api.c b/bta/jv/bta_jv_api.c
index 542559f..1ee9924 100644
--- a/bta/jv/bta_jv_api.c
+++ b/bta/jv/bta_jv_api.c
@@ -1515,7 +1515,7 @@
 *******************************************************************************/
 UINT16 BTA_JvRfcommGetPortHdl(UINT32 handle)
 {
-    UINT32  hi = ((handle & BTA_JV_RFC_HDL_MASK) & BTA_JV_RFCOMM_MASK) - 1;
+    UINT32  hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1;
     UINT32  si = BTA_JV_RFC_HDL_TO_SIDX(handle);
 
     if (hi < BTA_JV_MAX_RFC_CONN &&