version:m40se 2.9.3

fix:修复m40se 管控写反失效问题
update:
This commit is contained in:
2023-02-25 10:12:07 +08:00
parent d7f0daa80c
commit b32037d123
4 changed files with 27 additions and 33 deletions

View File

@@ -73,8 +73,8 @@ android {
official {
flavorDimensions "default"
versionCode 32
versionName "2.9.2"
versionCode 33
versionName "2.9.3"
}
}

View File

@@ -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);
}

View File

@@ -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息屏不重连");
}
}
};

View File

@@ -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();