version:zhanrui 6.3.8,MTK 2.3.8

fix:
update:接口优化,主页优化,心跳机制优化
This commit is contained in:
2023-02-06 19:08:49 +08:00
parent 4371ae3059
commit 93f87d3b68
50 changed files with 2399 additions and 1358 deletions

View File

@@ -51,6 +51,7 @@ import com.aoleyun.sn.comm.CommonConfig;
import com.aoleyun.sn.comm.JGYActions;
import com.aoleyun.sn.comm.PackageNames;
import com.aoleyun.sn.disklrucache.CacheHelper;
import com.aoleyun.sn.gson.GsonUtils;
import com.aoleyun.sn.network.NetInterfaceManager;
import com.aoleyun.sn.network.UrlAddress;
import com.aoleyun.sn.receiver.BootReceiver;
@@ -94,6 +95,7 @@ import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -107,6 +109,7 @@ public class JGYUtils {
@SuppressLint("StaticFieldLeak")
private static JGYUtils sInstance;
private MMKV mMMKV = MMKV.defaultMMKV();
private Context mContext;
private ContentResolver crv;
@@ -136,6 +139,7 @@ public class JGYUtils {
this.mContext = context;
this.crv = context.getContentResolver();
this.cacheHelper = new CacheHelper(context);
initConnectedTimeCache();
}
public static void init(Context context) {
@@ -2165,7 +2169,7 @@ public class JGYUtils {
jsonObject.addProperty("desktop_version", Utils.getAPPVersionName("com.aoleyun.os", mContext));
jsonObject.addProperty("local_mac", Utils.getAndroid7MAC());
// jsonObject.addProperty("wifi_status", Utils.obtainWifiInfo(mContext));
jsonObject.addProperty("PN_ip", MMKV.defaultMMKV().decodeString(NetInterfaceManager.PublicIP, ""));
jsonObject.addProperty("PN_ip", mMMKV.decodeString(NetInterfaceManager.PublicIP, ""));
jsonObject.addProperty("LAN_ip", Utils.getIPAddress(mContext));
jsonObject.addProperty("bluetooth", Utils.getBluetoothList());
jsonObject.addProperty("wifi_name", Utils.getWifiAlias(mContext));
@@ -2370,4 +2374,43 @@ public class JGYUtils {
//true为打开false为关闭
return powerManager.isInteractive();
}
private static final String CONNECTED_TIME_KEY = "connectedTimeKey";
private List<Long> connectedTime;
private void initConnectedTimeCache() {
String jsonString = cacheHelper.getAsString(CONNECTED_TIME_KEY);
Gson gson = new Gson();
Type listType = new TypeToken<List<Long>>() {
}.getType();
List<Long> longList = gson.fromJson(jsonString, listType);
if (longList == null) {
connectedTime = new ArrayList<>();
} else {
connectedTime = longList;
}
}
public List<Long> getNetworkConnectedTime() {
Log.e(TAG, "getNetworkConnectedTime: " + connectedTime);
return connectedTime;
}
public void addNetworkConnectedTime(Long time) {
Log.e(TAG, "addNetworkConnectedTime: " + time);
connectedTime.add(time);
cacheHelper.put(CONNECTED_TIME_KEY, GsonUtils.toJSONString(connectedTime));
}
public void removeNetworkConnectedTime(List<Long> time) {
if (time == null || time.size() == 0) {
return;
}
List<Long> copy = new ArrayList<>(time);
for (Long l : copy) {
connectedTime.remove(l);
}
cacheHelper.put(CONNECTED_TIME_KEY, GsonUtils.toJSONString(connectedTime));
}
}