version:4.2
fix:修复不能自动下载强制应用,锁定状态显示问题,增加打开主页判断是否在请求 update:
This commit is contained in:
@@ -35,6 +35,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
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.network.NetInterfaceManager;
|
||||
import com.aoleyun.sn.network.UrlAddress;
|
||||
import com.aoleyun.sn.receiver.BootReceiver;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.google.gson.Gson;
|
||||
@@ -106,6 +109,9 @@ public class JGYUtils {
|
||||
public static String ZhanruiTag = "展锐cube";
|
||||
public static String Other = "其他";
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
|
||||
|
||||
static {
|
||||
System.loadLibrary("jgy");
|
||||
}
|
||||
@@ -115,7 +121,7 @@ public class JGYUtils {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
this.mContext = context;
|
||||
|
||||
this.cacheHelper = new CacheHelper(context);
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
@@ -173,6 +179,11 @@ public class JGYUtils {
|
||||
return path + File.separator;
|
||||
}
|
||||
|
||||
public boolean getDeviceIsLocked() {
|
||||
int locked = Settings.System.getInt(mContext.getContentResolver(), JGYActions.ACTION_QCH_UNLOCK_IPAD, JGYActions.FRAME_CODE_LOCKED);
|
||||
return locked == JGYActions.FRAME_CODE_LOCKED;
|
||||
}
|
||||
|
||||
public int getBatteryLevel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
||||
@@ -325,8 +336,6 @@ public class JGYUtils {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@@ -958,11 +967,26 @@ public class JGYUtils {
|
||||
Log.e("writeAppPackageList: ", "qch_app_forbid is :" + b + " " + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
|
||||
}
|
||||
|
||||
public void checkForceDownload() {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
|
||||
//为 "" 是已经请求成功的
|
||||
if (jsonString == null) {
|
||||
NetInterfaceManager.getInstance().getForceDownload();
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
Type listType = new TypeToken<List<ForceDownloadData>>() {
|
||||
}.getType();
|
||||
List<ForceDownloadData> forceDownloadData = gson.fromJson(jsonString, listType);
|
||||
if (forceDownloadData != null) {
|
||||
JGYUtils.getInstance().forceDownload(forceDownloadData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void forceDownload(List<ForceDownloadData> data) {
|
||||
if (data == null || data.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
getSelfDownload(data);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
ForceDownloadData forceDownloadData = data.get(i);
|
||||
@@ -1008,31 +1032,8 @@ public class JGYUtils {
|
||||
Utils.ariaDownload(mContext, app_url, jsonObject);
|
||||
}
|
||||
}
|
||||
SaveListUtils.setList(list);
|
||||
SaveListUtils.sendForceAPP(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取教管壹下载,没什么用了
|
||||
*
|
||||
* @param forceDownloadDataList
|
||||
*/
|
||||
private void getSelfDownload(List<ForceDownloadData> forceDownloadDataList) {
|
||||
for (ForceDownloadData forceDownloadData : forceDownloadDataList) {
|
||||
if (PackageNames.OLD_APPSTORE.equals(forceDownloadData.getApp_package())) {
|
||||
if (!ApkUtils.isAvailable(mContext, PackageNames.OLD_APPSTORE)) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_name", forceDownloadData.getApp_name());
|
||||
jsonObject.put("app_package", forceDownloadData.getApp_package());
|
||||
Utils.ariaDownload(mContext, forceDownloadData.getApp_url(), jsonObject);
|
||||
}
|
||||
} else {
|
||||
// Log.e("fht", "未上传应用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param jsonObject 安装应用
|
||||
*/
|
||||
@@ -1150,14 +1151,10 @@ public class JGYUtils {
|
||||
versionCode = info.versionCode;
|
||||
}
|
||||
if (app_version_code > versionCode) {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Utils.ariaDownload(mContext, app_url, jsonObject);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!SaveListUtils.isDownLoading(app_url)) {
|
||||
Utils.ariaDownload(mContext, app_url, jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user