|
@@ -6,12 +6,16 @@ import android.content.*
|
|
|
import android.content.pm.PackageManager
|
|
|
import android.media.AudioManager
|
|
|
import android.net.ConnectivityManager
|
|
|
+import android.net.Uri
|
|
|
import android.os.*
|
|
|
+import android.provider.Settings
|
|
|
import android.support.v4.app.Fragment
|
|
|
import android.support.v7.widget.LinearLayoutManager
|
|
|
import android.text.TextUtils
|
|
|
+import android.util.DisplayMetrics
|
|
|
import android.util.Log
|
|
|
import android.view.View
|
|
|
+import android.view.WindowManager
|
|
|
import android.widget.SeekBar
|
|
|
import com.alibaba.fastjson.JSON
|
|
|
import com.alibaba.fastjson.JSONObject
|
|
@@ -179,6 +183,24 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
|
|
|
Constant.LOCAL_MAC = NetHelper.getInstance().imei
|
|
|
}
|
|
|
|
|
|
+ if (!Settings.canDrawOverlays(this)) {
|
|
|
+ val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:$packageName"))
|
|
|
+ startActivityForResult(intent, 10)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Settings.System.canWrite(this)) {
|
|
|
+ val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
|
|
|
+ intent.data = Uri.parse("package:" + this.packageName)
|
|
|
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
+ startActivityForResult(intent, 11)
|
|
|
+ }
|
|
|
+
|
|
|
+ val wmanager: WindowManager = activity.windowManager
|
|
|
+ val dm = DisplayMetrics()
|
|
|
+ wmanager.getDefaultDisplay().getMetrics(dm)
|
|
|
+ Log.i(TAG, "screen size: width==${dm.widthPixels}, height==${dm.heightPixels}")
|
|
|
+ Constant.LCD_WIDTH = dm.widthPixels
|
|
|
+
|
|
|
//presenter.loadTcpServerHost()
|
|
|
|
|
|
//注册广播
|
|
@@ -215,7 +237,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
|
|
|
Utils.setStatusBarDisable(activity, Utils.STATUS_BAR_DISABLE_EXPAND)
|
|
|
|
|
|
//保持屏幕常亮
|
|
|
- AppTool.Setting.setScreenOffTimeOut(applicationContext, 2147483647)
|
|
|
+ AppTool.Setting.setScreenOffTimeOut2(applicationContext, 2147483647)
|
|
|
|
|
|
checkServer()
|
|
|
|
|
@@ -228,15 +250,14 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
|
|
|
|
|
|
private fun startYunpaiPlugin() {
|
|
|
try {
|
|
|
- val packageInfos = packageManager.getInstalledPackages(
|
|
|
- PackageManager.GET_ACTIVITIES or
|
|
|
- PackageManager.GET_SERVICES
|
|
|
- )
|
|
|
+ val packageInfos = packageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES or PackageManager.GET_SERVICES)
|
|
|
var needInstall = false
|
|
|
for (info in packageInfos) {
|
|
|
val pkg = info.packageName
|
|
|
- if (pkg.equals("com.wd.app")) {
|
|
|
+ val newVer = "1.3"
|
|
|
+ if (pkg.equals("com.wd.app") && newVer == info.versionName) {
|
|
|
//启动云派app升级监听服务
|
|
|
+ Log.d(TAG, "start app update plugin...")
|
|
|
val intent = Intent()
|
|
|
intent.setClassName("com.wd.app", "com.wd.app.MyService")
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|