From b32037d1238e1be4fcfd35a885636706adcd525d Mon Sep 17 00:00:00 2001 From: Fanhuitong <981964879@qq.com> Date: Sat, 25 Feb 2023 10:12:07 +0800 Subject: [PATCH] =?UTF-8?q?version:m40se=202.9.3=20fix:=E4=BF=AE=E5=A4=8Dm?= =?UTF-8?q?40se=20=E7=AE=A1=E6=8E=A7=E5=86=99=E5=8F=8D=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20update:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +-- .../com/fuying/sn/manager/ControlManager.java | 16 +--------- .../com/fuying/sn/service/StepService.java | 31 ++++++++++++++----- .../com/fuying/sn/tpush/MessageReceiver.java | 9 ------ 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d892dd8..c326e44 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,8 +73,8 @@ android { official { flavorDimensions "default" - versionCode 32 - versionName "2.9.2" + versionCode 33 + versionName "2.9.3" } } diff --git a/app/src/main/java/com/fuying/sn/manager/ControlManager.java b/app/src/main/java/com/fuying/sn/manager/ControlManager.java index 58ca65a..047a57b 100644 --- a/app/src/main/java/com/fuying/sn/manager/ControlManager.java +++ b/app/src/main/java/com/fuying/sn/manager/ControlManager.java @@ -266,6 +266,7 @@ public class ControlManager { // ToastTool.show("qch_call_forbid::"+setting_call+"----setting_phones::"+setting_phones+"----"+aole_white_list_Array+"---"+qch_call_forbid); Log.e(TAG, "aole_white_list_Array:" + aole_white_list_Array + "---" + aole_white_list_Array); if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { + //在m40se上 开启管控会造成第三方app无法读取sd卡,暂时打开 Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, 0); } else { boolean aole_sdcard_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, state); @@ -287,9 +288,6 @@ public class ControlManager { //蓝牙音频开关 int setting_bluetooth = changeNum(settings.getSetting_bluetooth()); //蓝牙传输开关 - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - setting_bht = changeNum(setting_bht); - } boolean aole_bht_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht); //写入系统数据库 Log.e("SystemSetting", "aole_bht_forbid_on:" + aole_bht_forbid_on); @@ -327,9 +325,6 @@ public class ControlManager { private void setBluetooth(int state) { try { - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - state = changeNum(state); - } boolean aole_bht_forbid_on = Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_BHT_FORBID_ON, state); //写入系统数据库 Log.e(TAG, "aole_bht_forbid_on:" + aole_bht_forbid_on); @@ -354,9 +349,6 @@ public class ControlManager { private void setHotspot(SystemSettings settings) { try { int setting_hotspot = changeNum(settings.getSetting_hotspot());//热点 - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - setting_hotspot = changeNum(setting_hotspot); - } if (setting_hotspot == 1) { Intent intent = new Intent(); intent.setAction("qch_hotspot_close"); @@ -372,9 +364,6 @@ public class ControlManager { } private void setHotspot(int state) { - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - state = changeNum(state); - } try { Intent intent = new Intent(); intent.setAction("qch_hotspot_close"); @@ -827,9 +816,6 @@ public class ControlManager { } public void setScreenShared(int state) { - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - state = changeNum(state); - } Settings.System.putInt(mResolver, CommonConfig.AOLE_ACTION_SCREEN_SHARE, state); } diff --git a/app/src/main/java/com/fuying/sn/service/StepService.java b/app/src/main/java/com/fuying/sn/service/StepService.java index 64290b6..b01cca0 100644 --- a/app/src/main/java/com/fuying/sn/service/StepService.java +++ b/app/src/main/java/com/fuying/sn/service/StepService.java @@ -24,12 +24,13 @@ import android.util.Log; import androidx.annotation.Nullable; import com.blankj.utilcode.util.NetworkUtils; -import com.google.gson.JsonObject; import com.fuying.sn.BuildConfig; import com.fuying.sn.KeepAliveConnection; +import com.fuying.sn.utils.JGYUtils; import com.fuying.sn.utils.ServiceAliveUtils; import com.fuying.sn.utils.Utils; import com.fuying.sn.websocket.JWebSocketClient; +import com.google.gson.JsonObject; import org.java_websocket.handshake.ServerHandshake; @@ -55,7 +56,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus @Override public void onConnected(NetworkUtils.NetworkType networkType) { Log.i("JWebSocketClientService", "网络已连接"); - connect(); +// connect(); } //用于Activity和service通讯 @@ -141,6 +142,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus case Intent.ACTION_BOOT_COMPLETED: case Intent.ACTION_USER_PRESENT: case Intent.ACTION_SCREEN_ON: + mHandler.post(heartBeatRunnable);//开启心跳检测 sendMsg(1); break; case Intent.ACTION_SCREEN_OFF: @@ -191,7 +193,9 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus Log.i("JWebSocketClientService", "websocket连接关闭:" + reason); // client.close(); // initSocketClient(); - mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 + if (JGYUtils.getInstance().isScreenOn()) { + mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 + } } @Override @@ -200,7 +204,11 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus Log.i("JWebSocketClientService", "websocket连接错误:" + ex.getMessage()); // client.close(); // initSocketClient(); - mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 + if (JGYUtils.getInstance().isScreenOn()) { + mHandler.postDelayed(heartBeatRunnable, HEART_BEAT_RATE);//开启心跳检测 + } else { + Log.i("JWebSocketClientService", "postDelayed off"); + } } }; connect(); @@ -223,6 +231,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus } } }.start(); + } /** @@ -276,7 +285,7 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus } // -------------------------------------websocket心跳检测------------------------------------------------ - private static final long HEART_BEAT_RATE = 60 * 1000;//每隔50秒进行一次对长连接的心跳检测 + private static final long HEART_BEAT_RATE = 30 * 1000;//每隔50秒进行一次对长连接的心跳检测 private Handler mHandler = new Handler(); private Runnable heartBeatRunnable = new Runnable() { @Override @@ -288,7 +297,11 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus sendMsg(); } else if (client.isClosed()) { Log.i("JWebSocketClientService", "websocket重连中"); - reconnectWs(); + if (JGYUtils.getInstance().isScreenOn()) { + reconnectWs(); + } else { + Log.i("JWebSocketClientService", "reconnectWs off"); + } } } else { //如果client已为空,重新初始化连接 @@ -296,7 +309,11 @@ public class StepService extends Service implements NetworkUtils.OnNetworkStatus initSocketClient(); } //每隔一定的时间,对长连接进行一次心跳检测 - mHandler.postDelayed(this, HEART_BEAT_RATE); + if (JGYUtils.getInstance().isScreenOn()) { + mHandler.postDelayed(this, HEART_BEAT_RATE); + } else { + Log.i("JWebSocketClientService", "websocket息屏不重连"); + } } }; diff --git a/app/src/main/java/com/fuying/sn/tpush/MessageReceiver.java b/app/src/main/java/com/fuying/sn/tpush/MessageReceiver.java index d7de6a2..a230f93 100644 --- a/app/src/main/java/com/fuying/sn/tpush/MessageReceiver.java +++ b/app/src/main/java/com/fuying/sn/tpush/MessageReceiver.java @@ -916,9 +916,6 @@ public class MessageReceiver extends XGPushBaseReceiver { } JsonObject extra = GsonUtils.getJsonObject(jsonString); int is_bluetooth = changeNum(extra.get("setting_bht").getAsInt()); - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - is_bluetooth = changeNum(is_bluetooth); - } Log.e(TAG, "aole_bht_forbid_on: " + is_bluetooth); try { //写入系统数据库 @@ -1396,9 +1393,6 @@ public class MessageReceiver extends XGPushBaseReceiver { private void setHotspot(Context context, String jsonString) { JsonObject jsonObject = GsonUtils.getJsonObject(jsonString); int setting_hotspot = changeNum(jsonObject.get("setting_hotspot").getAsInt());//热点 - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - setting_hotspot = changeNum(setting_hotspot); - } try { if (setting_hotspot == 1) { Intent intent = new Intent(); @@ -1509,9 +1503,6 @@ public class MessageReceiver extends XGPushBaseReceiver { private void setHotPoint(Context context, String jsonString) { JsonObject jsonObject = GsonUtils.getJsonObject(jsonString); int setting_hotspot = changeNum(jsonObject.get("hot_point").getAsInt());//热点 - if (JGYUtils.getInstance().checkAppPlatform() == JGYUtils.M40sePlatform) { - setting_hotspot = changeNum(setting_hotspot); - } try { if (setting_hotspot == 1) { Intent intent = new Intent();