فهرست منبع

#ADD 探视功能

weizhengliang 3 سال پیش
والد
کامیت
518815aa83
24فایلهای تغییر یافته به همراه657 افزوده شده و 75 حذف شده
  1. 17 5
      WebRTC/src/main/java/com/wdkl/core/socket/SocketManager.java
  2. 3 3
      WebRTC/src/main/java/com/wdkl/core/voip/AsyncPlayer.java
  3. 13 3
      WebRTC/src/main/java/com/wdkl/core/voip/CallMultiActivity.java
  4. 7 6
      app/src/main/AndroidManifest.xml
  5. 17 3
      common/src/main/code/com/wdkl/ncs/android/lib/base/BaseActivity.kt
  6. 23 2
      common/src/main/code/com/wdkl/ncs/android/lib/utils/ConnectionObserver.kt
  7. 1 1
      home/build.gradle
  8. 10 4
      home/src/main/AndroidManifest.xml
  9. 75 9
      home/src/main/code/com/wdkl/ncs/android/component/home/activity/HomeActivity.kt
  10. 296 0
      home/src/main/code/com/wdkl/ncs/android/component/home/fragment/VisitFragment.kt
  11. 6 3
      home/src/main/code/com/wdkl/ncs/android/component/home/service/WdKeepAliveService.kt
  12. BIN
      home/src/main/res/drawable/main_bg.png
  13. 2 2
      home/src/main/res/drawable/selector_button_text_color.xml
  14. 15 9
      home/src/main/res/layout/activity_home.xml
  15. 48 0
      home/src/main/res/layout/fragment_visit.xml
  16. 37 0
      home/src/main/res/layout/fragment_visiting.xml
  17. 38 0
      home/src/main/res/layout/video_connected_action.xml
  18. 1 1
      keepalive/src/main/java/com/wdkl/ncs/keepbackground/utils/SPUtils.java
  19. 7 0
      middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constants.kt
  20. 18 7
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClient.java
  21. 16 9
      middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClientHandler.java
  22. 2 5
      resource/src/main/res/drawable/round_button.xml
  23. 4 2
      rtc-chat/src/main/java/com/wdkl/skywebrtc/engine/webrtc/WebRTCEngine.java
  24. 1 1
      settings.gradle

+ 17 - 5
WebRTC/src/main/java/com/wdkl/core/socket/SocketManager.java

@@ -7,8 +7,12 @@ import android.os.Handler;
 import android.os.Looper;
 import android.util.Log;
 
+import com.wdkl.core.voip.CallSingleActivity;
 import com.wdkl.core.voip.Utils;
+import com.wdkl.core.voip.VoipEvent;
 import com.wdkl.core.voip.VoipReceiver;
+import com.wdkl.ncs.android.component.nursehome.common.Constants;
+import com.wdkl.ncs.android.middleware.utils.MessageEvent;
 import com.wdkl.skywebrtc.CallSession;
 import com.wdkl.skywebrtc.EnumType;
 import com.wdkl.skywebrtc.SkyEngineKit;
@@ -220,8 +224,7 @@ public class SocketManager implements IEvent {
     // ========================================================================================
     @Override
     public void onInvite(String room, boolean audioOnly, String inviteId, String userList) {
-        //todo: 待处理
-        Intent intent = new Intent();
+        /*Intent intent = new Intent();
         intent.putExtra("room", room);
         intent.putExtra("audioOnly", audioOnly);
         intent.putExtra("inviteId", inviteId);
@@ -229,8 +232,15 @@ public class SocketManager implements IEvent {
         intent.setAction(Utils.ACTION_VOIP_RECEIVER);
         intent.setComponent(new ComponentName(mContext.getPackageName(), VoipReceiver.class.getName()));
         // 发送广播
-        mContext.sendBroadcast(intent);
-
+        mContext.sendBroadcast(intent);*/
+
+        Constants.Companion.setVisitRoomId(room);
+        Constants.Companion.setInviteId(inviteId);
+        SkyEngineKit.init(new VoipEvent());
+        boolean b = SkyEngineKit.Instance().startInCall(mContext, room, inviteId, audioOnly);
+        if (b) {
+            EventBus.getDefault().post(new MessageEvent("visit", Constants.VISIT_MSG));
+        }
     }
 
     @Override
@@ -366,7 +376,9 @@ public class SocketManager implements IEvent {
     @Override
     public void reConnect() {
         handler.post(() -> {
-            webSocket.reconnect();
+            if (webSocket != null) {
+                webSocket.reconnect();
+            }
         });
     }
     //===========================================================================================

+ 3 - 3
WebRTC/src/main/java/com/wdkl/core/voip/AsyncPlayer.java

@@ -56,8 +56,8 @@ public class AsyncPlayer {
         }
     }
 
-    private final class Thread extends java.lang.Thread {
-        Thread() {
+    private final class PlayThread extends java.lang.Thread {
+        PlayThread() {
             super("AsyncPlayer-" + mTag);
         }
 
@@ -146,7 +146,7 @@ public class AsyncPlayer {
         mCmdQueue.add(cmd);
         if (mThread == null) {
             acquireWakeLock();
-            mThread = new Thread();
+            mThread = new PlayThread();
             mThread.start();
         }
     }

+ 13 - 3
WebRTC/src/main/java/com/wdkl/core/voip/CallMultiActivity.java

@@ -188,6 +188,12 @@ public class CallMultiActivity extends BaseActivity implements CallSession.CallS
     @Override
     public void didUserLeave(String userId) {
         //handler.post(() -> currentFragment.didUserLeave(userId));
+
+        if (!leave) {
+            leave = true;
+            DeviceChannel.calling = false;
+            SkyEngineKit.Instance().leaveRoom();
+        }
         finish();
     }
 
@@ -217,9 +223,12 @@ public class CallMultiActivity extends BaseActivity implements CallSession.CallS
 
     // 处理挂断事件
     private void handleHangup() {
-        leave = true;
-        VideoUtil.handoffVideoCall(Constants.Companion.getDeviceId(), Constants.Companion.getFromId(), Constants.Companion.getInteractionId());
-        SkyEngineKit.Instance().leaveRoom();
+        if (!leave) {
+            leave = true;
+            DeviceChannel.calling = false;
+            VideoUtil.handoffVideoCall(Constants.Companion.getDeviceId(), Constants.Companion.getFromId(), Constants.Companion.getInteractionId());
+            SkyEngineKit.Instance().leaveRoom();
+        }
     }
 
 
@@ -229,6 +238,7 @@ public class CallMultiActivity extends BaseActivity implements CallSession.CallS
             if (messageEvent.getMessage() instanceof TcpModel) {
                 TcpModel tcpModel = (TcpModel) messageEvent.getMessage();
                 if (tcpModel.getAction() == TcpAction.VideoAction.HANDOFF && !leave) {
+                    leave = true;
                     DeviceChannel.calling = false;
                     SkyEngineKit.Instance().leaveRoom();
                 }

+ 7 - 6
app/src/main/AndroidManifest.xml

@@ -24,7 +24,8 @@
         tools:replace="android:label"
         tools:remove="android:requestLegacyExternalStorage"
         android:name="com.wdkl.app.ncs.application.Application"
-        android:theme="@style/MyAppTheme">
+        android:theme="@style/MyAppTheme"
+        android:networkSecurityConfig="@xml/network_security_config">
         <meta-data
             android:name="com.enation.javashop.imagepluin.cache.MyGlideModule"
             android:value="GlideModule" />
@@ -35,17 +36,17 @@
             android:name="design_height_in_dp"
             android:value="240"/>
 
-        <activity android:name="com.wdkl.ncs.android.component.home.activity.HomeActivity">
+<!--        <activity android:name="com.wdkl.ncs.android.component.home.activity.HomeActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
 
                 <category android:name="android.intent.category.LAUNCHER"/>
 
-                <!-- 设置成主题界面 -->
-<!--                <category android:name="android.intent.category.HOME" />-->
-<!--                <category android:name="android.intent.category.DEFAULT" />-->
+                &lt;!&ndash; 设置成主题界面 &ndash;&gt;
+&lt;!&ndash;                <category android:name="android.intent.category.HOME" />&ndash;&gt;
+&lt;!&ndash;                <category android:name="android.intent.category.DEFAULT" />&ndash;&gt;
             </intent-filter>
-        </activity>
+        </activity>-->
 
         <activity android:name="com.wdkl.app.ncs.activity.SchemeActivity"/>
         <meta-data

+ 17 - 3
common/src/main/code/com/wdkl/ncs/android/lib/base/BaseActivity.kt

@@ -58,6 +58,13 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
      */
     protected val disposableManager by lazy { DisposableManager() }
 
+    private val FULL_SCREEN_FLAG = (
+            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                    or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                    or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+                    or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+                    or View.SYSTEM_UI_FLAG_FULLSCREEN)
+
     /**
      * @author  LDD
      * @From   com.wdkl.ncs.android.lib.base.BaseActivity
@@ -72,10 +79,13 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
         }
         /**父类初始化*/
         super.onCreate(savedInstanceState)
+
+        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
+                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
+                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
+                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+
         requestWindowFeature(Window.FEATURE_NO_TITLE)
-        window.setFlags(
-            WindowManager.LayoutParams.FLAG_FULLSCREEN,
-            WindowManager.LayoutParams.FLAG_FULLSCREEN)
 
         /**执行生命周期监听*/
         lifeCycleDo(LIFE_CYCLE_CREATE)
@@ -85,6 +95,10 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
         mViewBinding = DataBindingUtil.bind(rootView)
         /**设置根视图到Activity*/
         setContentView(rootView)
+
+        //解决全屏显示时弹出界面会跳一下的问题
+        window.decorView.systemUiVisibility = FULL_SCREEN_FLAG
+
         /**执行抽象方法初始化Dagger相应操作*/
         bindDagger()
         /**Presenter绑定View*/

+ 23 - 2
common/src/main/code/com/wdkl/ncs/android/lib/utils/ConnectionObserver.kt

@@ -1,6 +1,7 @@
 package com.wdkl.ncs.android.lib.utils
 
 import android.content.Context
+import android.net.ConnectivityManager
 import com.wdkl.ncs.android.lib.base.BaseApplication
 import com.enation.javashop.net.engine.plugin.connection.ConnectionQuality
 import com.enation.javashop.net.engine.plugin.exception.ExceptionHandle
@@ -98,8 +99,14 @@ abstract class BaseObserver<T>(private val context: Context) : Observer<T> {
     override fun onSubscribe(disposable: Disposable) {
         try {
             if (VoiNetTool.getAPNType(this.context) == VoiNetTool.netType.noneNet) {
-                disposable.dispose()
-                this.onNoneNet()
+                //有线以太网会被判断为无网,增加以太网判断
+                if (checkEthernet(this.context)) {
+                    this.onStart()
+                    this.attachSubscribe(disposable)
+                } else {
+                    disposable.dispose()
+                    this.onNoneNet()
+                }
             } else {
                 this.onStart()
                 this.attachSubscribe(disposable)
@@ -112,6 +119,20 @@ abstract class BaseObserver<T>(private val context: Context) : Observer<T> {
         }
     }
 
+    fun checkEthernet(context: Context): Boolean {
+        val connMgr = context
+            .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
+        val networkInfo = connMgr.activeNetworkInfo
+        if (networkInfo == null) {
+            return false
+        }
+        if (networkInfo.type == ConnectivityManager.TYPE_ETHERNET) {
+            return true
+        }
+
+        return false
+    }
+
     override fun onError(e: Throwable) {
         if (e is HttpException) {
             var errorJSon = e.response().errorBody()!!.getJsonString()

+ 1 - 1
home/build.gradle

@@ -124,7 +124,7 @@ dependencies {
     compile project(':webrtc')
     //compile project(':libwebrtc')
     compile project(':rtc-chat')
-    compile project(':keepalive')
+    //compile project(':keepalive')
 }
 
 /**

+ 10 - 4
home/src/main/AndroidManifest.xml

@@ -15,8 +15,14 @@
         android:supportsRtl="true">
 
         <activity android:name=".activity.HomeActivity"
-            android:launchMode="singleTask"/>
-        <activity android:name=".activity.VideoActivity"/>
+            android:screenOrientation="portrait"
+            android:launchMode="singleInstance">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+        <!--<activity android:name=".activity.VideoActivity"/>-->
         <activity android:name=".activity.AppUpdateActivity" />
 
         <service android:name=".service.TcpHandleService">
@@ -24,11 +30,11 @@
                 <action android:name="com.wdkl.ncs.android.component.home.service.TcpHandleService" />
             </intent-filter>
         </service>
-        <service android:name="com.wdkl.ncs.android.component.home.service.WdKeepAliveService">
+        <!--<service android:name="com.wdkl.ncs.android.component.home.service.WdKeepAliveService">
             <intent-filter>
                 <action android:name="com.wdkl.app.ncs.service.WdKeepAliveService"/>
             </intent-filter>
-        </service>
+        </service>-->
 
         <provider
             android:name="android.support.v4.content.FileProvider"

+ 75 - 9
home/src/main/code/com/wdkl/ncs/android/component/home/activity/HomeActivity.kt

@@ -5,8 +5,10 @@ import android.content.Context
 import android.content.Intent
 import android.content.pm.PackageManager
 import android.graphics.Color
+import android.os.Bundle
 import android.provider.Settings
 import android.support.v4.app.ActivityCompat
+import android.support.v4.app.Fragment
 import android.support.v4.content.ContextCompat
 import android.telephony.PhoneStateListener
 import android.telephony.SignalStrength
@@ -23,15 +25,15 @@ import com.google.gson.Gson
 import com.wdkl.core.consts.Urls
 import com.wdkl.core.socket.IUserState
 import com.wdkl.core.socket.SocketManager
-import com.wdkl.core.voip.CallMultiActivity
 import com.wdkl.ncs.android.component.home.BuildConfig
 import com.wdkl.ncs.android.component.home.R
 import com.wdkl.ncs.android.component.home.broadcast.BatteryBroadcastReceiver
 import com.wdkl.ncs.android.component.home.databinding.ActivityHomeBinding
+import com.wdkl.ncs.android.component.home.fragment.VisitFragment
 import com.wdkl.ncs.android.component.home.launch.HomeLaunch
 import com.wdkl.ncs.android.component.home.service.TcpHandleService
 import com.wdkl.ncs.android.component.home.service.TcpHandleService.instance.updateLastTime
-import com.wdkl.ncs.android.component.home.service.WdKeepAliveService
+//import com.wdkl.ncs.android.component.home.service.WdKeepAliveService
 import com.wdkl.ncs.android.component.home.util.CallDialogHelper
 import com.wdkl.ncs.android.component.home.util.NetHelper
 import com.wdkl.ncs.android.component.home.util.SpeechUtil
@@ -54,10 +56,11 @@ import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
 import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
 import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
 import com.wdkl.ncs.android.middleware.utils.MessageEvent
-import com.wdkl.ncs.keepbackground.work.DaemonEnv
+import com.wdkl.skywebrtc.SkyEngineKit
 import io.reactivex.Observable
 import kotlinx.android.synthetic.main.activity_home.*
 import kotlinx.android.synthetic.main.activity_register.*
+import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
 
@@ -76,6 +79,8 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
 
     private lateinit var loadingDialog: LoadingDialog
 
+    var currentFragment: Fragment? = null
+
     override fun getLayId(): Int {
         return R.layout.activity_home
     }
@@ -96,7 +101,7 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
         loadingDialog = CommonTool.createLoadingDialog(this, R.layout.custom_loading,R.id.loadding_image)
 
         //保活守护进程
-        //DaemonEnv.init(this);
+        //DaemonEnv.init(this)
         //請求用戶忽略电池优化
 //        val reason = "轨迹跟踪服务的持续运行"
 //        DaemonEnv.whiteListMatters(this, reason)
@@ -125,6 +130,7 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
         }
 
         Constants.imei = Util.getIMEI(this)
+        //Constants.imei = "860475031573358"
         Log.i(TAG, "IMEI " + Constants.imei)
         Log.i(TAG, "mac " + Constants.mac)
         tv_device_imei.text = Constants.imei
@@ -137,7 +143,7 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
                     presenter.getTcpServerHost()
                 })
                 try {
-                    Thread.sleep(3000)
+                    Thread.sleep(5000)
                 } catch (e: Exception) {
                 }
             }
@@ -318,14 +324,14 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
         releaseReceiver()
     }
 
-    override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
+    /*override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
         Log.i(TAG, "keyup keyCode " + keyCode)
         return if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
             //不执行父类点击事件
             true
         } else super.onKeyUp(keyCode, event)
         //继续执行父类其他点击事件
-    }
+    }*/
 
     override fun bindEvent() {
     }
@@ -336,7 +342,7 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
             //loadingDialog.dismiss()
             val tcpModel = messageEvent.getMessage() as TcpModel
             var interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-
+            Log.e(TAG, "收到tcp消息" + tcpModel.getType() + " " + tcpModel.getAction() + ", data: " + tcpModel.data.toString())
             when (tcpModel.action){
                 TcpAction.VideoAction.CALLING->{
                     DeviceChannel.calling = false
@@ -380,13 +386,41 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
 
                 TcpAction.VideoAction.VIDEO_IN_CALL-> {
                     Constants.fromId = tcpModel.fromId
+                    Constants.visitHostId = tcpModel.fromId
                     DeviceChannel.calling = true
                     Constants.interactionId = interactionVO.id
                     CallDialogHelper.dismissCallDialog()
 
+                    //先和主机视频请求探视,得到允许后方可和分机视频
+                    /*currentFragment = VisitFragment()
+                    var bundle = Bundle()
+                    bundle.putBoolean("out_going", true)
+                    bundle.putString("show_text", "呼叫中")
+                    bundle.putString("target_id", interactionVO.fromSipId)
+                    currentFragment?.arguments = bundle
+                    supportFragmentManager.beginTransaction()
+                        .add(R.id.frame_visit, currentFragment)
+                        .commit()
+                    watch_activity_home_linyout.visibility = View.GONE*/
+
                     // 加入房间
+                    /*currentFragment = VisitingFragment()
+                    var bundle = Bundle()
+                    bundle.putString("roomId", "visit-room-" + Constants.interactionId)
+                    currentFragment?.arguments = bundle
+                    supportFragmentManager.beginTransaction()
+                        .add(R.id.frame_visit, currentFragment)
+                        .commit()
+                    watch_activity_home_linyout.visibility = View.GONE
+
                     val roomId = "visit-room-" + Constants.interactionId
-                    CallMultiActivity.openActivity(activity, roomId, false)
+                    CallMultiActivity.openActivity(activity, roomId, false)*/
+                }
+
+                TcpAction.VideoAction.VIDEO_ON -> {
+                    Constants.fromId = tcpModel.fromId
+                    DeviceChannel.calling = true
+                    Constants.interactionId = interactionVO.id
                 }
 
                 TcpAction.VideoAction.REJECT->{
@@ -394,7 +428,39 @@ class HomeActivity : BaseActivity<HomeActivityPresenter, ActivityHomeBinding>(),
                     DeviceChannel.calling = false
                     CallDialogHelper.dismissCallDialog()
                 }
+
+                TcpAction.VideoAction.HANDOFF -> {
+                    if (SkyEngineKit.Instance().currentSession != null) {
+                        SkyEngineKit.Instance().endCall()
+                    }
+                    if (currentFragment != null) {
+                        supportFragmentManager.beginTransaction()
+                            .remove(currentFragment)
+                            .commit()
+                        currentFragment = null
+                    }
+                    watch_activity_home_linyout.visibility = View.VISIBLE
+                }
+            }
+        } else if (messageEvent.tag == Constants.BACK_TO_MAIN_MSG) {
+            if (currentFragment != null) {
+                supportFragmentManager.beginTransaction()
+                    .remove(currentFragment)
+                    .commit()
+                currentFragment = null
             }
+            watch_activity_home_linyout.visibility = View.VISIBLE
+        } else if (messageEvent.tag == Constants.VISIT_MSG) {
+            currentFragment = VisitFragment()
+            var bundle = Bundle()
+            bundle.putBoolean("out_going", false)
+            bundle.putString("show_text", "连接中")
+            bundle.putString("target_id", Constants.inviteId)
+            currentFragment?.arguments = bundle
+            supportFragmentManager.beginTransaction()
+                .add(R.id.frame_visit, currentFragment)
+                .commit()
+            watch_activity_home_linyout.visibility = View.GONE
         }
     }
 }

+ 296 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/fragment/VisitFragment.kt

@@ -0,0 +1,296 @@
+package com.wdkl.ncs.android.component.home.fragment
+
+import android.content.Context
+import android.os.Bundle
+import android.os.Handler
+import android.os.Looper
+import android.os.SystemClock
+import android.support.v4.app.Fragment
+import android.text.TextUtils
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Chronometer
+import android.widget.FrameLayout
+import android.widget.ImageView
+import android.widget.TextView
+import com.wdkl.core.voip.VoipEvent
+import com.wdkl.ncs.android.component.home.R
+import com.wdkl.ncs.android.component.home.activity.HomeActivity
+import com.wdkl.ncs.android.component.nursehome.common.Constants
+import com.wdkl.ncs.android.middleware.tcp.channel.DeviceChannel
+import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
+import com.wdkl.skywebrtc.CallSession
+import com.wdkl.skywebrtc.EnumType
+import com.wdkl.skywebrtc.EnumType.CallState
+import com.wdkl.skywebrtc.SkyEngineKit
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.webrtc.SurfaceViewRenderer
+import java.util.*
+
+class VisitFragment: Fragment(), CallSession.CallSessionCallback, View.OnClickListener {
+
+    private var activity: HomeActivity? = null
+    private var gEngineKit: SkyEngineKit? = null
+
+    var currentState: CallState? = null
+
+    private var fullscreenRenderer: FrameLayout? = null
+    private var pipRenderer: FrameLayout? = null
+    private var localSurfaceView: SurfaceViewRenderer? = null
+    private var remoteSurfaceView: SurfaceViewRenderer? = null
+    private var durationTextView: Chronometer? = null
+    private var outgoingHangupImageView: ImageView? = null
+    private var stateView: TextView? = null
+
+    private val handler = Handler(Looper.getMainLooper())
+
+    private var outGoing = false
+    private var text: String? = null
+    private var targetId: String? = null
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        if (arguments != null) {
+            outGoing = arguments.getBoolean("out_going")
+            text = arguments.getString("show_text")
+            targetId = arguments.getString("target_id")
+        }
+    }
+
+    override fun onAttach(context: Context?) {
+        super.onAttach(context)
+        activity = getActivity() as HomeActivity
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater?,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        val view = inflater?.inflate(com.wdkl.ncs.android.component.home.R.layout.fragment_visit, container, false)
+        initView(view)
+        init()
+
+        /*if (!EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().register(this)
+        }*/
+
+        return view
+    }
+
+    fun initView(view: View?) {
+        fullscreenRenderer = view!!.findViewById(R.id.visit_fullscreen_video_view)
+        pipRenderer = view.findViewById(R.id.visit_pip_video_view)
+        durationTextView = view.findViewById(R.id.duration_text)
+        outgoingHangupImageView = view.findViewById(R.id.hangup_aciton)
+        stateView = view.findViewById(R.id.visit_status)
+
+        durationTextView?.visibility = View.GONE
+        stateView?.text = text
+        outgoingHangupImageView?.setOnClickListener(this)
+    }
+
+    fun init() {
+        gEngineKit = SkyEngineKit.Instance()
+        SkyEngineKit.init(VoipEvent())
+        if (outGoing) {
+            if (!TextUtils.isEmpty(targetId)) {
+                // 创建会话
+                val room = UUID.randomUUID().toString() + System.currentTimeMillis()
+                val b = gEngineKit?.startOutCall(activity?.applicationContext, room, targetId, false)
+                val session = gEngineKit?.getCurrentSession()
+                if (session != null) {
+                    session.setSessionCallback(this)
+                    session.toggleSpeaker(true)
+                }
+            }
+        } else {
+            val session = gEngineKit?.getCurrentSession()
+            if (session != null) {
+                session.setSessionCallback(this)
+                session.toggleSpeaker(true)
+
+                if (session.state == CallState.Incoming) {
+                    session.joinHome(session.roomId)
+                } else {
+                    session.sendRefuse()
+                    EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
+                }
+            }
+        }
+
+        val session = gEngineKit?.getCurrentSession()
+        if (session != null) {
+            currentState = session.state
+            if (currentState == CallState.Incoming) {
+                val surfaceView = session.setupLocalVideo(false)
+
+                if (surfaceView != null) {
+                    localSurfaceView = surfaceView as SurfaceViewRenderer
+                    localSurfaceView?.setZOrderMediaOverlay(false)
+                    fullscreenRenderer!!.addView(localSurfaceView)
+                }
+            }
+        }
+    }
+
+    override fun onClick(v: View?) {
+        val id = v!!.id
+        val session = gEngineKit!!.currentSession
+        // 挂断电话
+        if (id == R.id.hangup_aciton) {
+            if (session != null) {
+                SkyEngineKit.Instance().endCall()
+            }
+            if (Constants.visitHostId != -1) {
+                VideoUtil.handoffVideoCall(Constants.deviceId, Constants.visitHostId, Constants.interactionId)
+            }
+            EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
+        }
+    }
+
+    fun startRefreshTime() {
+        val session = SkyEngineKit.Instance().currentSession
+        if (session == null) {
+            return
+        }
+        if (durationTextView != null) {
+            durationTextView!!.visibility = View.VISIBLE
+            durationTextView!!.base = SystemClock.elapsedRealtime() - (System.currentTimeMillis() - session.startTime)
+            durationTextView!!.start()
+        }
+    }
+
+    override fun didCallEndWithReason(var1: EnumType.CallEndReason?) {
+        DeviceChannel.calling = false
+        /*if (Constants.visitHostId != -1) {
+            VideoUtil.handoffVideoCall(Constants.deviceId, Constants.visitHostId, Constants.interactionId)
+        }*/
+        EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
+    }
+
+    override fun didChangeState(var1: CallState?) {
+        currentState = var1
+        handler.post {
+            if (currentState == CallState.Connected) {
+                // 开启计时器
+                startRefreshTime()
+                stateView?.visibility = View.GONE
+            }
+        }
+    }
+
+    override fun didChangeMode(isAudioOnly: Boolean) {
+        //
+    }
+
+    override fun didCreateLocalVideoTrack() {
+        Log.d("wzlll", "didCreateLocalVideoTrack")
+        handler.post {
+            if (localSurfaceView == null) {
+                val surfaceView = gEngineKit!!.currentSession.setupLocalVideo(true)
+                if (surfaceView != null) {
+                    localSurfaceView = surfaceView as SurfaceViewRenderer
+                } else {
+                    EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
+                }
+            } else {
+                localSurfaceView!!.setZOrderMediaOverlay(true)
+            }
+
+            if (localSurfaceView!!.parent != null) {
+                (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
+            }
+            if (outGoing && remoteSurfaceView == null) {
+                if (fullscreenRenderer != null && fullscreenRenderer!!.childCount != 0) {
+                    fullscreenRenderer!!.removeAllViews()
+                }
+                fullscreenRenderer!!.addView(localSurfaceView)
+            } else {
+                if (pipRenderer!!.childCount != 0) {
+                    pipRenderer!!.removeAllViews()
+                }
+                pipRenderer!!.addView(localSurfaceView)
+            }
+        }
+    }
+
+    override fun didReceiveRemoteVideoTrack(userId: String?) {
+        Log.d("wzlll", "didReceiveRemoteVideoTrack  user: " + userId)
+
+        handler.post {
+            pipRenderer!!.visibility = View.VISIBLE
+            if (localSurfaceView != null) {
+                localSurfaceView!!.setZOrderMediaOverlay(true)
+                if (outGoing) {
+                    if (localSurfaceView!!.parent != null) {
+                        (localSurfaceView!!.parent as ViewGroup).removeView(localSurfaceView)
+                    }
+                    pipRenderer!!.addView(localSurfaceView)
+                }
+            }
+
+
+            val surfaceView = gEngineKit!!.currentSession.setupRemoteVideo(userId, false)
+            if (surfaceView != null) {
+                fullscreenRenderer!!.visibility = View.VISIBLE
+                remoteSurfaceView = surfaceView as SurfaceViewRenderer
+                fullscreenRenderer!!.removeAllViews()
+                if (remoteSurfaceView?.getParent() != null) {
+                    (remoteSurfaceView?.getParent() as ViewGroup).removeView(remoteSurfaceView)
+                }
+                fullscreenRenderer!!.addView(remoteSurfaceView)
+            }
+        }
+    }
+
+    override fun didUserLeave(userId: String?) {
+        //
+    }
+
+    override fun didError(error: String?) {
+
+    }
+
+    override fun didDisconnected(userId: String?) {
+        //
+    }
+
+    override fun onDestroyView() {
+        super.onDestroyView()
+        DeviceChannel.calling = false
+/*        if (EventBus.getDefault().isRegistered(this)) {
+            EventBus.getDefault().unregister(this)
+        }*/
+        if (durationTextView != null) {
+            durationTextView!!.stop()
+        }
+        fullscreenRenderer!!.removeAllViews()
+        pipRenderer!!.removeAllViews()
+    }
+
+
+/*    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (messageEvent.getType() == Constants.VIDEO_MSG) {
+            if (messageEvent.getMessage() is TcpModel) {
+                val tcpModel = messageEvent.getMessage() as TcpModel?
+                if (tcpModel!!.action == TcpAction.VideoAction.HANDOFF) {
+                    val session = gEngineKit!!.currentSession
+                    if (session != null) {
+                        SkyEngineKit.Instance().endCall()
+                    }
+                    EventBus.getDefault().post(MessageEvent("back_to_main", Constants.BACK_TO_MAIN_MSG))
+                }
+            }
+        }
+    }*/
+
+}

+ 6 - 3
home/src/main/code/com/wdkl/ncs/android/component/home/service/WdKeepAliveService.kt

@@ -1,3 +1,4 @@
+/*
 package com.wdkl.ncs.android.component.home.service
 
 import android.content.Intent
@@ -44,9 +45,11 @@ class WdKeepAliveService : AbsWorkService() {
     var checkNetStateTimer: Timer? = null
     var checkNetStateTimerTask: TimerTask? = null
 
-    /**
+    */
+/**
      * 重连wdklRTC
-     */
+     *//*
+
     private fun checkNetState() {
         if (!mIsRunning) {
             mIsRunning = true
@@ -69,4 +72,4 @@ class WdKeepAliveService : AbsWorkService() {
             checkNetStateTimer!!.schedule(checkNetStateTimerTask, 18000, Constants.heartBeat * 1000L)
         }
     }
-}
+}*/

BIN
home/src/main/res/drawable/main_bg.png


+ 2 - 2
home/src/main/res/drawable/selector_button_text_color.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:color="#ffffff" android:state_pressed="true"/>
-    <item android:color="#202020"/>
+    <item android:color="#202020" android:state_pressed="true"/>
+    <item android:color="#ffffff"/>
 </selector>

+ 15 - 9
home/src/main/res/layout/activity_home.xml

@@ -5,10 +5,14 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-      <include
+        <FrameLayout
+            android:id="@+id/frame_visit"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"/>
+
+       <include
           android:id="@+id/activity_register_layout"
-          layout="@layout/activity_register"
-          ></include>>
+          layout="@layout/activity_register" />
 
         <LinearLayout
             android:id="@+id/watch_activity_home_linyout"
@@ -16,18 +20,19 @@
             android:layout_height="match_parent"
             android:gravity="center"
             android:orientation="vertical"
+            android:background="@drawable/main_bg"
             android:visibility="gone">
 
             <Button
                 android:id="@+id/btn_callout"
-                android:layout_marginTop="10dp"
+                android:layout_marginTop="180dp"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center_horizontal"
                 android:background="@drawable/round_button"
-                android:textColor="#0081ff"
-                android:text="问询"
-                android:textSize="30dp" />
+                android:textColor="@drawable/selector_button_text_color"
+                android:text="探视"
+                android:textSize="24sp" />
 
         </LinearLayout>
 
@@ -44,8 +49,9 @@
             android:id="@+id/tv_version_name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textColor="@color/cardview_shadow_start_color"
-            android:layout_marginRight="5dp"
+            android:textColor="@color/black"
+            android:layout_marginRight="8dp"
+            android:layout_marginBottom="8dp"
             android:layout_alignParentEnd="true"
             android:layout_alignParentBottom="true"/>
 

+ 48 - 0
home/src/main/res/layout/fragment_visit.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@android:color/black"
+    tools:ignore="MergeRootFrame">
+
+    <FrameLayout
+        android:id="@+id/visit_fullscreen_video_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center" />
+
+    <FrameLayout
+        android:id="@+id/visit_pip_video_view"
+        android:layout_width="80dp"
+        android:layout_height="120dp"
+        android:layout_gravity="top|end"
+        android:layout_marginHorizontal="10dp"
+        android:layout_marginTop="10dp" />
+
+    <RelativeLayout
+        android:id="@+id/visit_parent_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@android:color/transparent">
+
+        <TextView
+            android:id="@+id/visit_status"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:text="连接中..."
+            android:textColor="@android:color/white" />
+
+        <!--接通控制-->
+        <include
+            android:id="@+id/visit_connected_action_container"
+            layout="@layout/video_connected_action"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:visibility="visible" />
+
+    </RelativeLayout>
+
+</FrameLayout>

+ 37 - 0
home/src/main/res/layout/fragment_visiting.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:id="@+id/ll_visit_end"
+        android:layout_width="match_parent"
+        android:layout_height="80dp"
+        android:background="@android:color/background_dark"
+        android:layout_alignParentBottom="true"
+        android:gravity="center"
+        android:orientation="vertical">
+
+        <ImageView
+            android:id="@+id/visit_end"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:src="@drawable/av_hangup_selector" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="挂断"
+            android:textColor="@android:color/white" />
+
+    </LinearLayout>
+
+    <com.wdkl.core.voip.NineGridView
+        android:id="@+id/visit_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_above="@id/ll_visit_end"/>
+
+</RelativeLayout>

+ 38 - 0
home/src/main/res/layout/video_connected_action.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:orientation="vertical"
+    android:paddingBottom="30dp">
+
+    <Chronometer
+        android:id="@+id/duration_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textColor="@android:color/white" />
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:gravity="center"
+        android:orientation="vertical">
+
+        <ImageView
+            android:id="@+id/hangup_aciton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/av_hangup_selector" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:text="挂断"
+            android:textColor="@android:color/white" />
+
+    </LinearLayout>
+
+</LinearLayout>

+ 1 - 1
keepalive/src/main/java/com/wdkl/ncs/keepbackground/utils/SPUtils.java

@@ -28,7 +28,7 @@ public class SPUtils {
      */
     public SPUtils(String spName) {
         sp = DaemonEnv.app.getSharedPreferences(spName, Context.MODE_PRIVATE);
-        if (sp!=null) {
+        if (sp != null) {
             editor = sp.edit();
             editor.apply();
         }

+ 7 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constants.kt

@@ -19,6 +19,11 @@ class Constants {
         var heartBeat: Int = 9    //tcp心跳
         var ttsState: Int = 0
 
+        //探视视频通话
+        var visitRoomId: String? = ""
+        var inviteId: String? = ""
+        //探视主机id
+        var visitHostId: Int? = -1
 
         var fromId: Int? = -1
         var interactionId: Int? = -1
@@ -37,5 +42,7 @@ class Constants {
 
         const val AUDIO_MSG = 1
         const val VIDEO_MSG = 0x06
+        const val BACK_TO_MAIN_MSG = 0x08
+        const val VISIT_MSG = 0x09
     }
 }

+ 18 - 7
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClient.java

@@ -23,16 +23,20 @@ import io.netty.util.CharsetUtil;
 public class TcpClient {
     private String TAG = TcpClient.class.getSimpleName();
 
-    private NioEventLoopGroup workGroup = new NioEventLoopGroup();
+    private NioEventLoopGroup workGroup = new NioEventLoopGroup(2);
     public Channel channel;
     private Bootstrap bootstrap;
 
     //数据处理
-    TcpClientHandler tcpClientHandler = new TcpClientHandler();
+    private TcpClientHandler tcpClientHandler = new TcpClientHandler();
+    //是否运行中
+    public boolean isRunning = false;
     //重试间隔
-    private Integer retrySeconds = 2;
+    private Integer retrySeconds = 5;
     //重试计数
     private Integer retryTimes = 1;
+    //tcp是否完成初始化
+    private boolean inited = false;
 
 
     //单例
@@ -48,9 +52,6 @@ public class TcpClient {
     public void init(String serverIP, Integer serverPort, Integer heartBeatSeconds) {
         final Integer hbSeconds = heartBeatSeconds;
         bootstrap = new Bootstrap();
-        if (workGroup==null){
-            workGroup = new NioEventLoopGroup();
-        }
         bootstrap.group(workGroup)
                 .channel(NioSocketChannel.class)
                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 15 * 1000)
@@ -64,17 +65,24 @@ public class TcpClient {
                         // LengthFieldPrepender是一个编码器,主要是在响应字节数据前面添加字节长度字段
                         socketChannel.pipeline().addLast(new LengthFieldPrepender(2));
                         //心跳包应当小于服务器间隔
-                        socketChannel.pipeline().addLast(new IdleStateHandler(hbSeconds+1, hbSeconds, 0, TimeUnit.SECONDS));
+                        socketChannel.pipeline().addLast(new IdleStateHandler(0, 0, hbSeconds, TimeUnit.SECONDS));
                         socketChannel.pipeline().addLast(new StringDecoder(CharsetUtil.UTF_8));
                         socketChannel.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8));
                         socketChannel.pipeline().addLast(tcpClientHandler);
                     }
                 }).remoteAddress(serverIP, serverPort);
+        inited = true;
         doConnect();
+        System.out.println("connect server host: " + serverIP + ", port: " + serverPort);
     }
 
     //独立连接方法,用于重新连接
     public synchronized void doConnect() {
+        if (!inited) {
+            System.out.println("tcp is not initialized");
+            return;
+        }
+
         if (channel != null && channel.isActive()) {
             System.out.println("TcpClient connecting");
             return;
@@ -86,10 +94,12 @@ public class TcpClient {
             public void operationComplete(ChannelFuture channelFuture) throws Exception {
                 if (channelFuture.isSuccess()) {
                     channel = channelFuture.channel();
+                    isRunning = true;
                     retryTimes = 0;
                     System.out.println("TcpClient connect success");
                 } else {
                     //连接失败时的处理
+                    isRunning = false;
                     System.out.println("TcpClient connect retry : " + retryTimes);
                     channelFuture.channel().eventLoop().schedule(new Runnable() {
                         @Override
@@ -98,6 +108,7 @@ public class TcpClient {
                             if (retryTimes > 30) {
                                 System.out.println("TcpClient 重试" + (retryTimes - 1) + "次,结束");
                                 workGroup.shutdownGracefully();
+                                inited = false;
                                 //从API获取新的serverIP和serverPort,全新连接
                                 TcpClient.getInstance().init(Constants.Companion.getTcpServer(), Constants.Companion.getTcpPort(), Constants.Companion.getHeartBeat());
                                 return;

+ 16 - 9
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/TcpClientHandler.java

@@ -62,7 +62,8 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<String> {
         this.ctx = null;
         Log.i(TAG, "TcpClientHandler 失去连接");
 
-        reConnect(ctx);
+        TcpClient.getInstance().doConnect();
+        //reConnect(ctx);
     }
 
     //读取String消息
@@ -89,19 +90,25 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<String> {
         if (evt instanceof IdleStateEvent){
             IdleStateEvent event = (IdleStateEvent)evt;
             if (event.state()== IdleState.WRITER_IDLE){
-                TcpClient.getInstance().sendMsg("0");
-            }else if (event.state() == IdleState.READER_IDLE){
-                Log.i(TAG,"TcpClientHandler ===> pong from server failed");
-                EventBus.getDefault().post(new MessageEvent("net off",Constants.EVENT_TCP_BREAK));
-                ctx.close();
+                //读心跳包超时执行
+                Log.i(TAG,"TcpClientHandler ===> WRITER_IDLE");
+            } else if (event.state() == IdleState.READER_IDLE){
+                //写心跳包超时
+                Log.i(TAG,"TcpClientHandler ===> READER_IDLE");
+            } else if (event.state() == IdleState.ALL_IDLE){
+                //写心跳包超时
+                Log.i(TAG,"TcpClientHandler ===> ALL_IDLE");
+                ctx.writeAndFlush("0");
             }
         }
     }
 
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
+        cause.printStackTrace();
         ctx.close();
         connected = false;
+        EventBus.getDefault().post(new MessageEvent("net off",Constants.EVENT_TCP_BREAK));
         Log.i(TAG,"TcpClientHandler 失去连接,错误引起 " + cause.getMessage());
     }
 
@@ -109,10 +116,10 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<String> {
     public void sendMsg(final String msg){
         if (ctx!=null && ctx.channel().isActive()){
             ctx.writeAndFlush(Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8));
-            return;
         }
+
         //掉线后的消息处理
-        new Thread(new Runnable() {
+        /*new Thread(new Runnable() {
             @Override
             public void run() {
                 try{
@@ -124,7 +131,7 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<String> {
                     sendMsg(msg);
                 }
             }
-        }).start();
+        }).start();*/
     }
 
     //已经连接上,中途失去连接时的处理

+ 2 - 5
resource/src/main/res/drawable/round_button.xml

@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="oval">
-    <stroke
-        android:color="#0081ff"
-        android:width="3dip"/>
-    <solid android:color="#ffffff"/>
-    <size android:width="100dp" android:height="100dp"/>
+    <solid android:color="#0081ff"/>
+    <size android:width="80dp" android:height="80dp"/>
 </shape>

+ 4 - 2
rtc-chat/src/main/java/com/wdkl/skywebrtc/engine/webrtc/WebRTCEngine.java

@@ -361,11 +361,13 @@ public class WebRTCEngine implements IEngine, Peer.IPeerEvent {
     }
 
     public boolean audioToBluetoothDevice(){
-        BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+        /*BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
         boolean isBluetoothHeadsetConnected =  (bluetoothAdapter != null && bluetoothAdapter.isEnabled()
                 && bluetoothAdapter.getProfileConnectionState(BluetoothHeadset.HEADSET) == BluetoothHeadset.STATE_CONNECTED);
 
-        return isBluetoothHeadsetConnected;
+        return isBluetoothHeadsetConnected;*/
+
+        return false;
     }
 
     public void toggleBluetooth(){

+ 1 - 1
settings.gradle

@@ -1 +1 @@
-include ':app', ':common', ':home', ':resource', ':middleware', 'webrtc', 'rtc-chat', 'libwebrtc', 'keepalive'
+include ':app', ':common', ':home', ':resource', ':middleware', 'webrtc', 'rtc-chat', 'libwebrtc'