|
@@ -28,10 +28,7 @@ import com.google.gson.JsonObject
|
|
import com.wdkl.app.ncs.callingbed.BuildConfig
|
|
import com.wdkl.app.ncs.callingbed.BuildConfig
|
|
import com.wdkl.app.ncs.callingbed.R
|
|
import com.wdkl.app.ncs.callingbed.R
|
|
import com.wdkl.app.ncs.callingbed.databinding.ActivityInitBinding
|
|
import com.wdkl.app.ncs.callingbed.databinding.ActivityInitBinding
|
|
-import com.wdkl.app.ncs.callingbed.helper.NetHelper
|
|
|
|
-import com.wdkl.app.ncs.callingbed.helper.PasswordDialogHelper
|
|
|
|
-import com.wdkl.app.ncs.callingbed.helper.ServerConfigDialogHelper
|
|
|
|
-import com.wdkl.app.ncs.callingbed.helper.SoundPoolManager
|
|
|
|
|
|
+import com.wdkl.app.ncs.callingbed.helper.*
|
|
import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
|
|
import com.wdkl.app.ncs.callingbed.launch.CallingbedLaunch
|
|
import com.wdkl.app.ncs.callingbed.service.APPService
|
|
import com.wdkl.app.ncs.callingbed.service.APPService
|
|
import com.wdkl.app.ncs.callingbed.settings.SettingConfig
|
|
import com.wdkl.app.ncs.callingbed.settings.SettingConfig
|
|
@@ -207,17 +204,7 @@ class InitActivity :BaseActivity<WelcomePresenter, ActivityInitBinding>(), Welco
|
|
count++
|
|
count++
|
|
SettingConfig.setNetErrResetCount(activity, count)
|
|
SettingConfig.setNetErrResetCount(activity, count)
|
|
AppTool.Time.delay(5000) {
|
|
AppTool.Time.delay(5000) {
|
|
- try {
|
|
|
|
- val intent = Intent(Intent.ACTION_REBOOT)
|
|
|
|
- intent.putExtra("nowait", 1)
|
|
|
|
- intent.putExtra("interval", 1)
|
|
|
|
- intent.putExtra("window", 0)
|
|
|
|
- sendBroadcast(intent)
|
|
|
|
- } catch (e: java.lang.Exception) {
|
|
|
|
- e.printStackTrace()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- SerialPortUtil.getInstance().sendCommand(SerialPortUtil.NET_STATUS, "1", "F")
|
|
|
|
|
|
+ AppUpdateHelper.reboot(activity, true)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
runOnUiThread {
|
|
runOnUiThread {
|
|
@@ -323,7 +310,7 @@ class InitActivity :BaseActivity<WelcomePresenter, ActivityInitBinding>(), Welco
|
|
showMsgMain("restart...")
|
|
showMsgMain("restart...")
|
|
handler.postDelayed({
|
|
handler.postDelayed({
|
|
if (!cancelRestart) {
|
|
if (!cancelRestart) {
|
|
- reboot()
|
|
|
|
|
|
+ AppUpdateHelper.reboot(activity, true)
|
|
}
|
|
}
|
|
}, 10000)
|
|
}, 10000)
|
|
}
|
|
}
|
|
@@ -551,7 +538,7 @@ class InitActivity :BaseActivity<WelcomePresenter, ActivityInitBinding>(), Welco
|
|
|
|
|
|
override fun bindEvent() {
|
|
override fun bindEvent() {
|
|
btn_reboot.setOnClickListener {
|
|
btn_reboot.setOnClickListener {
|
|
- reboot()
|
|
|
|
|
|
+ AppUpdateHelper.reboot(activity, true)
|
|
}
|
|
}
|
|
|
|
|
|
btn_reload.setOnClickListener {
|
|
btn_reload.setOnClickListener {
|
|
@@ -601,37 +588,6 @@ class InitActivity :BaseActivity<WelcomePresenter, ActivityInitBinding>(), Welco
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private fun reboot() {
|
|
|
|
- if (Build.MODEL == "rk3128") {
|
|
|
|
- try {
|
|
|
|
- val intent = Intent(Intent.ACTION_REBOOT)
|
|
|
|
- intent.putExtra("nowait", 1)
|
|
|
|
- intent.putExtra("interval", 1)
|
|
|
|
- intent.putExtra("window", 0)
|
|
|
|
- sendBroadcast(intent)
|
|
|
|
- } catch (e: java.lang.Exception) {
|
|
|
|
- e.printStackTrace()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- SerialPortUtil.getInstance().sendCommand(SerialPortUtil.NET_STATUS, "1", "F")
|
|
|
|
- } else if (Build.MODEL == "rk3288") {
|
|
|
|
- val process: Process
|
|
|
|
- val printWriter: PrintWriter
|
|
|
|
- try {
|
|
|
|
- process = Runtime.getRuntime().exec("su")
|
|
|
|
- printWriter = PrintWriter(process.outputStream)
|
|
|
|
- printWriter.println("reboot")
|
|
|
|
- printWriter.flush()
|
|
|
|
- printWriter.close()
|
|
|
|
- process.waitFor()
|
|
|
|
- } catch (e: java.lang.Exception) {
|
|
|
|
- e.printStackTrace()
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- restart()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private fun restart() {
|
|
private fun restart() {
|
|
//停止服务
|
|
//停止服务
|
|
val serviceIntent = Intent(BaseApplication.appContext, APPService::class.java)
|
|
val serviceIntent = Intent(BaseApplication.appContext, APPService::class.java)
|