version:6.4.0
fix: update:更换推送
This commit is contained in:
@@ -23,15 +23,15 @@ import android.util.Log;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.UploadAppInfo;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.comm.PackageNames;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -977,6 +977,8 @@ public class ApkUtils {
|
||||
this.add("com.wyt.wangkexueximvvm1");
|
||||
this.add("com.android.stk");
|
||||
this.add("com.shoufei.aole");
|
||||
|
||||
this.add("com.ygyb.yischool");
|
||||
}};
|
||||
|
||||
public static void showAllAPP(Context context) {
|
||||
@@ -1266,8 +1268,8 @@ public class ApkUtils {
|
||||
for (DownloadEntity entity : list) {
|
||||
long id = entity.getId();
|
||||
String extendField = Aria.download(this).load(id).getExtendField();
|
||||
JSONObject jsonObject = JSON.parseObject(extendField);
|
||||
if (packageName.equals(jsonObject.getString("app_package"))) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extendField);
|
||||
if (packageName.equals(jsonObject.get("app_package").getAsString())) {
|
||||
Log.e("RemoveTask", "subscribe: " + "删除文件:" + entity.getFilePath());
|
||||
Aria.download(this).load(id).cancel(true);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.bean.AppListInfo;
|
||||
import com.aoleyun.sn.bean.Appground;
|
||||
@@ -95,7 +93,6 @@ 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;
|
||||
@@ -118,12 +115,14 @@ public class JGYUtils {
|
||||
public static final int CubePlatform = 2;
|
||||
public static final int ZhanruiPlatform = 3;
|
||||
public static final int MTK11Platform = 5;
|
||||
public static final int TeclastP20sPlatform = 6;
|
||||
|
||||
public static final String Other = "其他";
|
||||
public static final String MTKTag = "MTK";
|
||||
public static final String CubeTag = "展锐cube";
|
||||
public static final String ZhanruiTag = "展锐";
|
||||
public static final String MTK11Tag = "MTK11";
|
||||
public static final String TeclastP20sTag = "P20S";
|
||||
|
||||
private CacheHelper cacheHelper;
|
||||
|
||||
@@ -158,6 +157,7 @@ public class JGYUtils {
|
||||
public static native String getAuthorization();
|
||||
|
||||
public int checkSNPlatform(String sn) {
|
||||
if (TextUtils.isEmpty(sn)) return UnknowPlatform;
|
||||
String secondChars = sn.substring(1, 2);
|
||||
if ("N".equalsIgnoreCase(secondChars)) {//MTK平台
|
||||
return MTKPlatform;
|
||||
@@ -180,9 +180,12 @@ public class JGYUtils {
|
||||
} else if ("ZhanRuiCube".equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "ZhanRuiCube");
|
||||
return CubePlatform;
|
||||
} else if ("MTK11".equalsIgnoreCase(platform)) {
|
||||
} else if (MTK11Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "MTK11");
|
||||
return MTK11Platform;
|
||||
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "P20S");
|
||||
return TeclastP20sPlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
@@ -212,6 +215,8 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(CubePlatform);
|
||||
} else if ("MTK11".equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(MTK11Platform);
|
||||
} else if (TeclastP20sTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(TeclastP20sPlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
@@ -227,6 +232,8 @@ public class JGYUtils {
|
||||
return CubeTag;
|
||||
} else if ("MTK11".equalsIgnoreCase(platform)) {
|
||||
return MTK11Tag;
|
||||
} else if ("P20S".equalsIgnoreCase(platform)) {
|
||||
return TeclastP20sTag;
|
||||
} else {
|
||||
return Other;
|
||||
}
|
||||
@@ -490,11 +497,11 @@ public class JGYUtils {
|
||||
Log.e(TAG, "checkPackageAndVersion: appVersionCode: " + appVersionCode + " getApp_version_code: " + info.getApp_version_code());
|
||||
Log.e(TAG, "checkPackageAndVersion: " + pkg + " 卸载");
|
||||
ApkUtils.UninstallAPP(mContext, pkg);
|
||||
JSONObject packageObj = new JSONObject();
|
||||
packageObj.put("app_name", info.getApp_name());
|
||||
packageObj.put("app_package", info.getApp_package());
|
||||
packageObj.put("app_id", info.getApp_id());
|
||||
packageObj.put("MD5", info.getApp_md5());
|
||||
JsonObject packageObj = new JsonObject();
|
||||
packageObj.addProperty("app_name", info.getApp_name());
|
||||
packageObj.addProperty("app_package", info.getApp_package());
|
||||
packageObj.addProperty("app_id", info.getApp_id());
|
||||
packageObj.addProperty("MD5", info.getApp_md5());
|
||||
Utils.ariaDownload(mContext, info.getApp_url(), packageObj);
|
||||
} else {
|
||||
Log.e(TAG, "checkPackageAndVersion: " + pkg + " 版本正常");
|
||||
@@ -762,8 +769,11 @@ public class JGYUtils {
|
||||
synchronized public void setNewAppinsideWeb(BaseResponse response) {
|
||||
Log.e(TAG, "setNewAppinsideWeb: " + "应用内部联网管控: " + response);
|
||||
if (response.code == 200) {
|
||||
String jsonString = JSONArray.toJSONString(response.data);
|
||||
List<TTAppground> appgrounds = JSONObject.parseArray(jsonString, TTAppground.class);
|
||||
String jsonString = GsonUtils.toJSONString(response.data);
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<TTAppground>>() {
|
||||
}.getType();
|
||||
List<TTAppground> appgrounds = gson.fromJson(jsonString, type);
|
||||
List<TTAppground> whiteApp = new ArrayList<>();
|
||||
List<TTAppground> blackApp = new ArrayList<>();
|
||||
if (appgrounds != null && appgrounds.size() > 0) {
|
||||
@@ -1070,39 +1080,42 @@ public class JGYUtils {
|
||||
if (TextUtils.isEmpty(data)) {
|
||||
Log.e(TAG, "SettingSysData: " + "data is empty");
|
||||
SysSettingUtils.setDisableSetting(mContext);
|
||||
SPUtils.put(mContext, JGYActions.ACTION_STATUSBAR_STATUS, "");
|
||||
} else {
|
||||
SysSettingUtils.setSystemSetting(mContext, data);
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<String> defaultPackages = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add(PackageNames.OLD_DEVICE_INFO);//设备信息
|
||||
this.add(PackageNames.OLD_APPSTORE);//教管壹
|
||||
this.add(PackageNames.DEVICE_INFO);
|
||||
this.add(PackageNames.APPSTORE);
|
||||
this.add("com.info.sn");
|
||||
this.add("com.uiuios.jgy1");
|
||||
this.add("com.uiuios.jgy2");
|
||||
this.add("com.tt.ttutils");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.notepad.uiui");
|
||||
this.add("com.calendar.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.videoplayer");
|
||||
this.add("com.ygyb.yischool");
|
||||
}};
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void writeAppPackageList(Context context, String packageList) {
|
||||
ApkUtils.addShortcut(context);
|
||||
HashSet<String> packages = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add(PackageNames.OLD_DEVICE_INFO);//设备信息
|
||||
this.add(PackageNames.OLD_APPSTORE);//教管壹
|
||||
this.add(PackageNames.DEVICE_INFO);
|
||||
this.add(PackageNames.APPSTORE);
|
||||
this.add("com.info.sn");
|
||||
this.add("com.uiuios.jgy1");
|
||||
this.add("com.uiuios.jgy2");
|
||||
this.add("com.tt.ttutils");
|
||||
this.add("com.aoleyun.browser");
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.aoleyun.os");
|
||||
this.add("com.aoleyunos.dop1");
|
||||
this.add("com.aoleyunos.dop2");
|
||||
this.add("com.aoleyun.info");
|
||||
this.add("com.calculator.uiui");
|
||||
this.add("com.notepad.uiui");
|
||||
this.add("com.calendar.uiui");
|
||||
this.add("com.alarmclock.uiui");
|
||||
this.add("com.uiui.videoplayer");
|
||||
}};
|
||||
HashSet<String> pkgSet = new HashSet<>(Arrays.asList(packageList.split(",")));
|
||||
pkgSet.addAll(packages);
|
||||
pkgSet.addAll(defaultPackages);
|
||||
pkgSet.addAll(ApkUtils.desktopAPP);
|
||||
pkgSet.addAll(ApkUtils.aoleyunAPP);
|
||||
pkgSet.addAll(ApkUtils.aihuaApp);
|
||||
@@ -1113,6 +1126,12 @@ public class JGYUtils {
|
||||
Log.e("writeAppPackageList: ", "aole_app_forbid: " + b + " " + Settings.System.getString(crv, CommonConfig.AOLE_ACTION_APP_FORBID));
|
||||
}
|
||||
|
||||
public void writeAppPackageList() {
|
||||
String aole_app_forbid = String.join(",", defaultPackages);
|
||||
Log.e(TAG, "writeAppPackageList: " + aole_app_forbid);
|
||||
Settings.System.putString(crv, CommonConfig.AOLE_ACTION_APP_FORBID, aole_app_forbid);
|
||||
}
|
||||
|
||||
public void checkForceDownload() {
|
||||
String jsonString = cacheHelper.getAsString(UrlAddress.GET_FORCE_INSTALL_LIST);
|
||||
//为 "" 是已经请求成功的
|
||||
@@ -1142,11 +1161,11 @@ public class JGYUtils {
|
||||
String app_url = forceDownloadData.getApp_url();
|
||||
String app_id = forceDownloadData.getApp_id();
|
||||
String app_md5 = forceDownloadData.getApp_md5();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_name", app_name);
|
||||
jsonObject.put("app_package", app_package);
|
||||
jsonObject.put("app_id", app_id);
|
||||
jsonObject.put("MD5", app_md5);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_name", app_name);
|
||||
jsonObject.addProperty("app_package", app_package);
|
||||
jsonObject.addProperty("app_id", app_id);
|
||||
jsonObject.addProperty("MD5", app_md5);
|
||||
long app_version_code = forceDownloadData.getApp_version_code();
|
||||
Log.e("fht ", "packageName=" + app_package + ",URL= " + app_url + ",app_version_code=" + app_version_code);
|
||||
if (BuildConfig.APPLICATION_ID.equals(data.get(i).getApp_package())) {
|
||||
@@ -1191,10 +1210,10 @@ public class JGYUtils {
|
||||
String app_name = jsonObject.get("app_name").getAsString();
|
||||
String app_md5 = jsonObject.get("app_md5").getAsString();
|
||||
// String app_id = jsonObject.get("app_id").getAsString();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
object.put("MD5", app_md5);
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("app_name", app_name);
|
||||
object.addProperty("app_package", packageName);
|
||||
object.addProperty("MD5", app_md5);
|
||||
// object.put("app_id", app_id);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
@@ -1219,9 +1238,9 @@ public class JGYUtils {
|
||||
String packageName = jsonObject.get("app_package").getAsString();
|
||||
String app_name = jsonObject.get("app_name").getAsString();
|
||||
// String app_id = jsonObject.get("app_id").getAsString();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("app_name", app_name);
|
||||
object.addProperty("app_package", packageName);
|
||||
// object.put("app_id", app_id);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
@@ -1251,10 +1270,10 @@ public class JGYUtils {
|
||||
String app_name = data.getApp_name();
|
||||
String app_md5 = data.getApp_md5();
|
||||
// String app_id = jsonObject.get("app_id").getAsString();
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
object.put("MD5", app_md5);
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("app_name", app_name);
|
||||
object.addProperty("app_package", packageName);
|
||||
object.addProperty("MD5", app_md5);
|
||||
// object.put("app_id", app_id);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
@@ -1271,11 +1290,11 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void installDesktop(JSONObject jsonObject) {
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
String app_url = jsonObject.getString("app_url");
|
||||
String app_package = jsonObject.getString("app_package");
|
||||
int app_version_code = jsonObject.getInteger("app_version_code");
|
||||
public void installDesktop(JsonObject jsonObject) {
|
||||
String app_name = jsonObject.get("app_name").getAsString();
|
||||
String app_url = jsonObject.get("app_url").getAsString();
|
||||
String app_package = jsonObject.get("app_package").getAsString();
|
||||
int app_version_code = jsonObject.get("app_version_code").getAsInt();
|
||||
if (ApkUtils.desktopAPP.get(0).equals(app_package)) {
|
||||
ApkUtils.UninstallAPP(mContext, ApkUtils.desktopAPP.get(1));
|
||||
} else {
|
||||
@@ -1311,9 +1330,9 @@ public class JGYUtils {
|
||||
public void deleteOtherApp() {
|
||||
Log.e(TAG, "deleteOtherApp: " + Build.MODEL);
|
||||
if ("K106".equalsIgnoreCase(Build.MODEL)
|
||||
||"G10".equalsIgnoreCase(Build.MODEL)
|
||||
||"G10P".equalsIgnoreCase(Build.MODEL)
|
||||
||"G10R".equalsIgnoreCase(Build.MODEL)
|
||||
|| "G10".equalsIgnoreCase(Build.MODEL)
|
||||
|| "G10P".equalsIgnoreCase(Build.MODEL)
|
||||
|| "G10R".equalsIgnoreCase(Build.MODEL)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -1442,6 +1461,24 @@ public class JGYUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void hideApp(String pkg) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "hideApp: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void showApp(String pkg) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "hideApp: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从Manifest中获取meta-data值
|
||||
@@ -1471,15 +1508,15 @@ public class JGYUtils {
|
||||
Log.e(TAG, "checkBootFile: Bootanimation file exists");
|
||||
setBootanimation(bootFile.getAbsolutePath());
|
||||
} else {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("MD5", MD5);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("MD5", MD5);
|
||||
Utils.ariaDownload(mContext, url, jsonObject);
|
||||
Log.e(TAG, "checkBootFile: " + "download file");
|
||||
}
|
||||
} else {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("MD5", MD5);
|
||||
jsonObject.put("app_name", urlFileName);
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("MD5", MD5);
|
||||
jsonObject.addProperty("app_name", urlFileName);
|
||||
Utils.ariaDownload(mContext, url, jsonObject);
|
||||
}
|
||||
}
|
||||
@@ -2037,6 +2074,9 @@ public class JGYUtils {
|
||||
setDefaultDesktop(PackageNames.DESKTOP);
|
||||
}
|
||||
|
||||
public void setYxpDefaultDesktop() {
|
||||
setDefaultDesktop(PackageNames.YIXUEPAI_DESKTOP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认桌面
|
||||
|
||||
@@ -11,12 +11,12 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.comm.CommonConfig;
|
||||
import com.aoleyun.sn.comm.JGYActions;
|
||||
import com.aoleyun.sn.gson.GsonUtils;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,7 +41,7 @@ public class SysSettingUtils {
|
||||
if (null == context) {
|
||||
throw new RuntimeException("Context it's null");
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(jsonObj);
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(jsonObj);
|
||||
setPhoneList(context, jsonObject);
|
||||
setBluetooth(context, jsonObject);
|
||||
setHotspot(context, jsonObject);
|
||||
@@ -51,8 +51,8 @@ public class SysSettingUtils {
|
||||
setIcon(context, jsonObject);
|
||||
setCanReset(context, jsonObject);
|
||||
setAutoTime(context, jsonObject);
|
||||
JSONObject navJson = jsonObject.getJSONObject("setting_nav");
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.getJSONObject("setting_nav").toJSONString());
|
||||
JsonObject navJson = jsonObject.get("setting_nav").getAsJsonObject();
|
||||
SPUtils.put(context, JGYActions.ACTION_STATUSBAR_STATUS, jsonObject.get("setting_nav").toString());
|
||||
setStatusBar(context, navJson);
|
||||
setBrowserInput(context, jsonObject);
|
||||
// TODO: 2022/4/11 不是酷比定制的会报错,无法抛出异常
|
||||
@@ -123,15 +123,15 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setPhoneList(Context context, JSONObject jsonObject) {
|
||||
private static void setPhoneList(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//设置电话功能,电话白名单
|
||||
//电话通话开关
|
||||
int setting_call = changeNum(jsonObject.getInteger("setting_call"));
|
||||
int setting_call = changeNum(jsonObject.get("setting_call").getAsInt());
|
||||
boolean qch_call_forbid = Settings.System.putInt(context.getContentResolver(), "qch_call_forbid", setting_call);
|
||||
Log.e(TAG, "qch_call_forbid:" + qch_call_forbid);
|
||||
//电话白名单开关
|
||||
int setting_phone = changeNum(jsonObject.getInteger("setting_phone"));
|
||||
int setting_phone = changeNum(jsonObject.get("setting_phone").getAsInt());
|
||||
boolean aole_white_list_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ON, setting_phone);
|
||||
Log.e(TAG, "aole_white_list_on:" + aole_white_list_on);
|
||||
//白名单列表
|
||||
@@ -140,13 +140,13 @@ public class SysSettingUtils {
|
||||
// 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);
|
||||
} else {
|
||||
String setting_phones = jsonObject.getString("setting_phones");
|
||||
String setting_phones = jsonObject.get("setting_phones").getAsString();
|
||||
boolean aole_white_list_Array = Settings.System.putString(context.getContentResolver(), CommonConfig.AOLE_ACTION_WHITE_LIST_ARRAY, setting_phones);
|
||||
// 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 + "---" + setting_phones);
|
||||
}
|
||||
//存储卡
|
||||
int setting_memory = changeNum(jsonObject.getInteger("setting_memory"));
|
||||
int setting_memory = changeNum(jsonObject.get("setting_memory").getAsInt());
|
||||
boolean aole_sdcard_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_SDCARD_FORBID_ON, setting_memory);
|
||||
Log.e(TAG, "aole_sdcard_forbid_on:" + aole_sdcard_forbid_on);
|
||||
} catch (Exception e) {
|
||||
@@ -174,12 +174,12 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setUSBstate(Context context, JSONObject jsonObject) {
|
||||
private static void setUSBstate(Context context, JsonObject jsonObject) {
|
||||
//USB数据功能管控
|
||||
//仅充电:usb_charge
|
||||
//MTP模式:usb_mtp
|
||||
//Midi模式:usb_midi
|
||||
String setting_usb = jsonObject.getString("setting_usb");
|
||||
String setting_usb = jsonObject.get("setting_usb").getAsString();
|
||||
if (!BuildConfig.DEBUG) {
|
||||
if (JGYUtils.isCubeDevice()) {
|
||||
SuperPower mService = (SuperPower) context.getSystemService("mdm");
|
||||
@@ -237,14 +237,14 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBluetooth(Context context, JSONObject jsonObject) {
|
||||
private static void setBluetooth(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//蓝牙开关
|
||||
int setting_bht = changeNum(jsonObject.getInteger("setting_bht"));
|
||||
int setting_bht = changeNum(jsonObject.get("setting_bht").getAsInt());
|
||||
//总开关
|
||||
int setting_bhtvideo = changeNum(jsonObject.getInteger("setting_bhtvideo"));
|
||||
int setting_bhtvideo = changeNum(jsonObject.get("setting_bhtvideo").getAsInt());
|
||||
//蓝牙音频开关
|
||||
int setting_bluetooth = changeNum(jsonObject.getInteger("setting_bluetooth"));
|
||||
int setting_bluetooth = changeNum(jsonObject.get("setting_bluetooth").getAsInt());
|
||||
//蓝牙传输开关
|
||||
boolean aole_bht_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_BHT_FORBID_ON, setting_bht);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class SysSettingUtils {
|
||||
}
|
||||
if (setting_bht == 0) {
|
||||
//蓝牙总开关开启
|
||||
String setting_context = jsonObject.getString("setting_context");
|
||||
String setting_context = jsonObject.get("setting_context").getAsString();
|
||||
if (setting_bhtvideo == 0) {
|
||||
if (null != setting_context && !"".equals(setting_context) && !" ".equals(setting_context) && !"null".equals(setting_context)) {
|
||||
Log.e(TAG, "setting_context:" + setting_context);
|
||||
@@ -293,9 +293,9 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setHotspot(Context context, JSONObject jsonObject) {
|
||||
private static void setHotspot(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
int setting_hotspot = changeNum(jsonObject.getInteger("setting_hotspot"));//热点
|
||||
int setting_hotspot = changeNum(jsonObject.get("setting_hotspot").getAsInt());//热点
|
||||
if (setting_hotspot == 1) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("qch_hotspot_close");
|
||||
@@ -355,9 +355,9 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBar(Context context, JSONObject jsonObject) {
|
||||
private static void setBar(Context context, JsonObject jsonObject) {
|
||||
//系统导航条显示开关
|
||||
int setting_navigation = changeNum(jsonObject.getInteger("setting_navigation"));
|
||||
int setting_navigation = changeNum(jsonObject.get("setting_navigation").getAsInt());
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
boolean aole_hide_NavigationBar = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_NAVIGATION_BAR, setting_navigation);
|
||||
Log.e(TAG, "aole_hide_NavigationBar---------" + aole_hide_NavigationBar);
|
||||
@@ -378,7 +378,7 @@ public class SysSettingUtils {
|
||||
|
||||
|
||||
//状态栏显示开关
|
||||
int setting_statusbar = changeNum(jsonObject.getInteger("setting_statusbar"));
|
||||
int setting_statusbar = changeNum(jsonObject.get("setting_statusbar").getAsInt());
|
||||
int oldNum = Settings.System.getInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_HIDE_STATUS_BAR, 0);
|
||||
if (oldNum != setting_statusbar) {
|
||||
//写入到系统不涉及任何管控,因为之前调用会频繁隐藏显示
|
||||
@@ -423,10 +423,10 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCamera(Context context, JSONObject jsonObject) {
|
||||
private static void setCamera(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//摄像头开关
|
||||
int setting_camera = changeNum(jsonObject.getInteger("setting_camera"));
|
||||
int setting_camera = changeNum(jsonObject.get("setting_camera").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_camera", setting_camera);
|
||||
Log.e(TAG, "qch_app_camera2:" + setting_camera);
|
||||
// ApkUtils.hideSystemSettingAPP(context, "com.mediatek.camera");
|
||||
@@ -479,9 +479,9 @@ public class SysSettingUtils {
|
||||
* @param context
|
||||
* @param jsonObject tfmedia开关
|
||||
*/
|
||||
private static void setTF(Context context, JSONObject jsonObject) {
|
||||
private static void setTF(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
int setting_tfmedia = jsonObject.getInteger("setting_tfmedia");
|
||||
int setting_tfmedia = jsonObject.get("setting_tfmedia").getAsInt();
|
||||
// if (JGYUtils.isOfficialVersion() ) {
|
||||
// setting_tfmedia = changeNum(setting_tfmedia);
|
||||
// }
|
||||
@@ -502,12 +502,11 @@ public class SysSettingUtils {
|
||||
Intent tfmediaIntent = new Intent(tfmediaStatus).setPackage("com.android.settings");
|
||||
context.sendBroadcast(tfmediaIntent);
|
||||
if (setting_tfmedia == 1) {
|
||||
JSONArray jSONArray = null;
|
||||
jSONArray = jsonObject.getJSONArray("setting_tfmedia_format");
|
||||
JsonArray jSONArray = jsonObject.get("setting_tfmedia_format").getAsJsonArray();
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < jSONArray.size(); i++) {
|
||||
stringBuffer.append(jSONArray.getString(i));
|
||||
stringBuffer.append(jSONArray.get(i).toString());
|
||||
stringBuffer.append(",");
|
||||
}
|
||||
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
|
||||
@@ -561,35 +560,35 @@ public class SysSettingUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIcon(Context context, JSONObject jsonObject) {
|
||||
private static void setIcon(Context context, JsonObject jsonObject) {
|
||||
try {
|
||||
//added:2019.12.6
|
||||
//设置5个app的开关
|
||||
//时钟
|
||||
int deskclock = changeNum(jsonObject.getInteger("setting_clock"));
|
||||
int deskclock = changeNum(jsonObject.get("setting_clock").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_deskclock", deskclock);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.deskclock");
|
||||
Log.e(TAG, "qch_app_deskclock" + deskclock);
|
||||
//录音机
|
||||
int soundrecorder = changeNum(jsonObject.getInteger("setting_recording"));
|
||||
int soundrecorder = changeNum(jsonObject.get("setting_recording").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_soundrecorder", soundrecorder);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.soundrecorder");
|
||||
Log.e(TAG, "qch_app_soundrecorder" + soundrecorder);
|
||||
//音乐
|
||||
int music = changeNum(jsonObject.getInteger("setting_music"));
|
||||
int music = changeNum(jsonObject.get("setting_music").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_music", music);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.music");
|
||||
Log.e(TAG, "qch_app_music" + music);
|
||||
//图库
|
||||
int gallery = changeNum(jsonObject.getInteger("setting_picture"));
|
||||
int gallery = changeNum(jsonObject.get("setting_picture").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_gallery", gallery);
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.android.gallery3d");
|
||||
Log.e(TAG, "qch_app_gallery" + gallery);
|
||||
//壁纸
|
||||
int wallpaper = changeNum(jsonObject.getInteger("setting_wallpaper"));
|
||||
int wallpaper = changeNum(jsonObject.get("setting_wallpaper").getAsInt());
|
||||
setWallpaper(context, wallpaper);
|
||||
//文件管理器
|
||||
int filemanager = changeNum(jsonObject.getInteger("setting_file"));
|
||||
int filemanager = changeNum(jsonObject.get("setting_file").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_filemanager", filemanager);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
ApkUtils.hideSystemSettingAPP(context, "com.mediatek.filemanager");
|
||||
@@ -598,11 +597,11 @@ public class SysSettingUtils {
|
||||
}
|
||||
Log.e(TAG, "qch_app_filemanager" + filemanager);
|
||||
//浏览器
|
||||
int browser = changeNum(jsonObject.getInteger("setting_browser"));
|
||||
int browser = changeNum(jsonObject.get("setting_browser").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_browser", browser);
|
||||
Log.e(TAG, "qch_app_browser" + browser);
|
||||
//短信
|
||||
int setting_sms = changeNum(jsonObject.getInteger("setting_sms"));
|
||||
int setting_sms = changeNum(jsonObject.get("setting_sms").getAsInt());
|
||||
Settings.System.putInt(context.getContentResolver(), "qch_app_sms", setting_sms);
|
||||
Log.e(TAG, "qch_app_sms" + setting_sms);
|
||||
} catch (Exception e) {
|
||||
@@ -625,8 +624,8 @@ public class SysSettingUtils {
|
||||
|
||||
//aole_restore_forbid_on=1,禁止恢复出厂设置
|
||||
//aole_restore_forbid_on=0,允许恢复出厂设置
|
||||
private static void setCanReset(Context context, JSONObject jsonObject) {
|
||||
int mode = jsonObject.getInteger("qch_restore");
|
||||
private static void setCanReset(Context context, JsonObject jsonObject) {
|
||||
int mode = jsonObject.get("qch_restore").getAsInt();
|
||||
if (mode == 1) {
|
||||
boolean aole_restore_forbid_on = Settings.System.putInt(context.getContentResolver(), CommonConfig.AOLE_ACTION_RESTORE_FORBID_ON, 0);
|
||||
Log.e(TAG, "aole_restore_forbid_on: " + aole_restore_forbid_on);
|
||||
@@ -653,8 +652,8 @@ public class SysSettingUtils {
|
||||
//intent34.setPackage("com.android.settings");
|
||||
//sendBroadcast(intent34);
|
||||
|
||||
private static void setAutoTime(Context context, JSONObject jsonObject) {
|
||||
String autoTime = jsonObject.getString("setting_autotime");
|
||||
private static void setAutoTime(Context context, JsonObject jsonObject) {
|
||||
String autoTime = jsonObject.get("setting_autotime").getAsString();
|
||||
String action = "qch_autotime_network";
|
||||
if (TextUtils.isEmpty(autoTime)) {
|
||||
action = "qch_autotime_network";
|
||||
@@ -690,23 +689,23 @@ public class SysSettingUtils {
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public static void setStatusBar(Context context, JSONObject jsonObject) {
|
||||
Log.e(TAG, "setStatusBar: " + jsonObject.toJSONString());
|
||||
public static void setStatusBar(Context context, JsonObject jsonObject) {
|
||||
Log.e(TAG, "setStatusBar: " + jsonObject.toString());
|
||||
if (null != jsonObject) {
|
||||
int whole = jsonObject.getInteger("whole");
|
||||
int whole = jsonObject.get("whole").getAsInt();
|
||||
if (whole == 1) {
|
||||
setStatusBar(context, 0);
|
||||
} else {
|
||||
List<Integer> disableWhat = new ArrayList<>();
|
||||
int home = jsonObject.getInteger("home");
|
||||
int home = jsonObject.get("home").getAsInt();
|
||||
if (home == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_HOME);
|
||||
}
|
||||
int returnKey = jsonObject.getInteger("returnKey");
|
||||
int returnKey = jsonObject.get("returnKey").getAsInt();
|
||||
if (returnKey == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_BACK);
|
||||
}
|
||||
int taskbar = jsonObject.getInteger("taskbar");
|
||||
int taskbar = jsonObject.get("taskbar").getAsInt();
|
||||
if (taskbar == 0) {
|
||||
disableWhat.add(StatusBarManager.DISABLE_RECENT);
|
||||
}
|
||||
@@ -737,12 +736,12 @@ public class SysSettingUtils {
|
||||
* @param context
|
||||
* @param jsonObject
|
||||
*/
|
||||
private static void setBrowserInput(Context context, JSONObject jsonObject) {
|
||||
private static void setBrowserInput(Context context, JsonObject jsonObject) {
|
||||
int state = 1;
|
||||
try {
|
||||
state = jsonObject.getInteger("setting_browserInput");
|
||||
state = jsonObject.get("setting_browserInput").getAsInt();
|
||||
Log.e(TAG, "setBrowserInput: " + state);
|
||||
String json = jsonObject.getString("setting_browserInput");
|
||||
String json = jsonObject.get("setting_browserInput").getAsString();
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import android.widget.Toast;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aoleyun.sn.BuildConfig;
|
||||
import com.aoleyun.sn.R;
|
||||
import com.aoleyun.sn.base.BaseApplication;
|
||||
@@ -63,6 +62,7 @@ import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.squareup.moshi.Json;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -107,6 +107,7 @@ import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import vendor.mediatek.hardware.nvram.V1_0.INvram;
|
||||
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
@@ -177,6 +178,7 @@ public class Utils {
|
||||
// } else {
|
||||
// return getAndroid7MAC();
|
||||
// }
|
||||
|
||||
return getAllMacAddress(context);
|
||||
}
|
||||
|
||||
@@ -375,6 +377,13 @@ public class Utils {
|
||||
return "未获取到设备Mac地址";
|
||||
}
|
||||
|
||||
private static String getMacAddrApiS(Context context) {
|
||||
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
|
||||
String mac = wifiInfo.getMacAddress();
|
||||
return mac;
|
||||
}
|
||||
|
||||
// MD5 设备地址标识
|
||||
public static String getMD5(Context context) {
|
||||
String WLANMAC = getMAC(context);
|
||||
@@ -781,42 +790,86 @@ public class Utils {
|
||||
return t1;
|
||||
}
|
||||
|
||||
public static String NOSN = "012345679ABCDEF";
|
||||
public static final String NOSN = "012345679ABCDEF";
|
||||
public static final String TECLAST_BRAND = "Teclast";
|
||||
|
||||
/**
|
||||
* 获取设备序列号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressLint({"MissingPermission", "HardwareIds"})
|
||||
public static String getSerial(Context context) {
|
||||
String serial = "unknow";
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
|
||||
serial = Build.getSerial();
|
||||
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
|
||||
serial = Build.SERIAL;
|
||||
} else {//8.0-
|
||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||
Method get = c.getMethod("get", String.class);
|
||||
serial = (String) get.invoke(c, "ro.serialno");
|
||||
if (TECLAST_BRAND.equalsIgnoreCase(Build.BRAND)) {
|
||||
return getPushMac(context);
|
||||
} else {
|
||||
if (NOSN.equalsIgnoreCase(getSn())) {
|
||||
return getIMEI(context);
|
||||
} else {
|
||||
return getSn();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("getSerial", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
// return "LTPKD22110000051";
|
||||
// serial = "012345679ABCDEF";
|
||||
}
|
||||
if (NOSN.equalsIgnoreCase(serial)) {
|
||||
return getIMEI(context);
|
||||
}
|
||||
return serial;
|
||||
}
|
||||
|
||||
public static String getPushMac(Context context) {
|
||||
String macaddr = Utils.getMacAddrFromNvram();
|
||||
return macaddr.replace(":", "").toUpperCase().trim();
|
||||
}
|
||||
|
||||
//mh add start----
|
||||
private static final int MAC_ADDRESS_ID = 30;
|
||||
private static final int MAC_ADDRESS_OFFSET = 4;
|
||||
private static final int MAC_ADDRESS_DIGITS = 6;
|
||||
private static final int MAX_ADDRESS_VALUE = 0xff;
|
||||
private static final int INVALID_RSSI = -200;
|
||||
|
||||
private static final String MAC_ADDRESS_FILENAME = "/mnt/vendor/nvdata/APCFG/APRDEB/WIFI";
|
||||
|
||||
private static String getMacAddrFromNvram() {
|
||||
StringBuffer nvramBuf = new StringBuffer();
|
||||
try {
|
||||
int i = 0;
|
||||
String buff = null;
|
||||
INvram agent = INvram.getService();
|
||||
if (agent == null) {
|
||||
// mToast.setText("No support MAC address writing due to NVRAM");
|
||||
// mToast.show();
|
||||
Log.e("mh_mac", "NvRAMAgent is null");
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
buff = agent.readFileByName(
|
||||
MAC_ADDRESS_FILENAME, MAC_ADDRESS_OFFSET + MAC_ADDRESS_DIGITS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
Log.i("mh_mac", "Raw data:" + buff);
|
||||
if (buff.length() < 2 * (MAC_ADDRESS_OFFSET + MAC_ADDRESS_DIGITS)) {
|
||||
// mToast.setText("The foramt of NVRAM is not correct");
|
||||
// mToast.show();
|
||||
return "";
|
||||
}
|
||||
// Remove the \0 special character.
|
||||
int macLen = buff.length() - 1;
|
||||
for (i = MAC_ADDRESS_OFFSET * 2; i < macLen; i += 2) {
|
||||
if ((i + 2) < macLen) {
|
||||
nvramBuf.append(buff.substring(i, i + 2));
|
||||
nvramBuf.append(":");
|
||||
} else {
|
||||
nvramBuf.append(buff.substring(i));
|
||||
}
|
||||
}
|
||||
Log.d("mh_mac", "buff:" + nvramBuf.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
return nvramBuf.toString();
|
||||
}
|
||||
//mh add end------
|
||||
|
||||
@SuppressLint({"MissingPermission", "HardwareIds"})
|
||||
public static String getSerial() {
|
||||
public static String getSn() {
|
||||
String serial = "unknow";
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
|
||||
@@ -832,9 +885,6 @@ public class Utils {
|
||||
e.printStackTrace();
|
||||
Log.e("getSerial", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
// return "QNG2DKB00463";
|
||||
}
|
||||
return serial;
|
||||
}
|
||||
|
||||
@@ -1138,9 +1188,9 @@ public class Utils {
|
||||
* @param url
|
||||
* @param jsonObject
|
||||
*/
|
||||
public static void ariaDownload(Context context, String url, JSONObject jsonObject) {
|
||||
public static void ariaDownload(Context context, String url, JsonObject jsonObject) {
|
||||
String fileName = getFileNamefromURL(url);
|
||||
String urlMD5 = jsonObject.getString("MD5");
|
||||
String urlMD5 = jsonObject.get("MD5").getAsString();
|
||||
Log.e("ariaDownload", "urlMD5=" + urlMD5);
|
||||
String p = JGYUtils.getInstance().getDownLoadPath();
|
||||
File file = new File(JGYUtils.getInstance().getDownLoadPath() + fileName);
|
||||
@@ -1158,7 +1208,7 @@ public class Utils {
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(JGYUtils.getInstance().getDownLoadPath() + fileName)
|
||||
.ignoreFilePathOccupy()
|
||||
.setExtendField(jsonObject.toJSONString())
|
||||
.setExtendField(jsonObject.toString())
|
||||
.create(); //启动下载}
|
||||
// }
|
||||
}
|
||||
@@ -1167,7 +1217,7 @@ public class Utils {
|
||||
.load(url) //读取下载地址
|
||||
.setFilePath(JGYUtils.getInstance().getDownLoadPath() + fileName)
|
||||
.ignoreFilePathOccupy()
|
||||
.setExtendField(jsonObject.toJSONString())
|
||||
.setExtendField(jsonObject.toString())
|
||||
.create(); //启动下载}
|
||||
}
|
||||
}
|
||||
@@ -1317,7 +1367,7 @@ public class Utils {
|
||||
imei = tm.getDeviceId(slotIndex);
|
||||
}
|
||||
if (TextUtils.isEmpty(imei)) {
|
||||
return "暂无数据";
|
||||
return context.getString(R.string.no_data);
|
||||
}
|
||||
return imei;
|
||||
}
|
||||
@@ -1330,7 +1380,7 @@ public class Utils {
|
||||
//8.0及以后版本获取
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
IMEI = TelephonyMgr.getDeviceId();
|
||||
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// try {
|
||||
// Method method = TelephonyMgr.getClass().getMethod("getImei");
|
||||
// IMEI = (String) method.invoke(TelephonyMgr);
|
||||
@@ -1341,11 +1391,11 @@ public class Utils {
|
||||
// IMEI = TelephonyMgr.getDeviceId();
|
||||
|
||||
// } else {//9.0到10.0获取
|
||||
// IMEI = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
IMEI = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
}
|
||||
Log.e("IMEI:", "IMEI: " + IMEI);
|
||||
if (null == IMEI) {
|
||||
return "-";
|
||||
return "";
|
||||
} else {
|
||||
return IMEI.toUpperCase();
|
||||
}
|
||||
@@ -1390,18 +1440,18 @@ public class Utils {
|
||||
String firmware_version = getRomVersion();
|
||||
String rom = Utils.getCustomVersion();
|
||||
String screen_rate = getAndroiodScreenProperty(context);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("device", device);
|
||||
jsonObject.put("imei", imei);
|
||||
jsonObject.put("system_version", system_version);
|
||||
jsonObject.put("firmware_version", firmware_version);
|
||||
jsonObject.put("rom", rom);
|
||||
jsonObject.put("screen_rate", screen_rate);
|
||||
jsonObject.put("working_time", SystemClock.elapsedRealtime() / 1000);
|
||||
jsonObject.put("restart_count", SPUtils.get(context, "restart_count", 0));
|
||||
jsonObject.put("storage_usable", getRemnantSize(context));
|
||||
jsonObject.put("storage_total", getDataTotalSize(context));
|
||||
String jsonString = jsonObject.toJSONString();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("device", device);
|
||||
jsonObject.addProperty("imei", imei);
|
||||
jsonObject.addProperty("system_version", system_version);
|
||||
jsonObject.addProperty("firmware_version", firmware_version);
|
||||
jsonObject.addProperty("rom", rom);
|
||||
jsonObject.addProperty("screen_rate", screen_rate);
|
||||
jsonObject.addProperty("working_time", SystemClock.elapsedRealtime() / 1000);
|
||||
jsonObject.addProperty("restart_count", (int) SPUtils.get(context, "restart_count", 0));
|
||||
jsonObject.addProperty("storage_usable", getRemnantSize(context));
|
||||
jsonObject.addProperty("storage_total", getDataTotalSize(context));
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "getMachine: " + jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
@@ -1414,14 +1464,14 @@ public class Utils {
|
||||
Log.e("getHardware", "Memory: " + memory);
|
||||
String storage = getRemnantSize(context) + "/" + getDataTotalSize(context);
|
||||
int CPU = getNumCores();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("electric", electric);
|
||||
jsonObject.put("charging", charging);
|
||||
jsonObject.put("memory", memory);
|
||||
jsonObject.put("storage", storage);
|
||||
jsonObject.put("battery_capacity", Utils.getBatterymAh(context));
|
||||
jsonObject.put("CPU", CPU + "核");
|
||||
String jsonString = jsonObject.toJSONString();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("electric", electric);
|
||||
jsonObject.addProperty("charging", charging);
|
||||
jsonObject.addProperty("memory", memory);
|
||||
jsonObject.addProperty("storage", storage);
|
||||
jsonObject.addProperty("battery_capacity", Utils.getBatterymAh(context));
|
||||
jsonObject.addProperty("CPU", CPU + "核");
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "getHardware: " + jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
@@ -1704,6 +1754,7 @@ public class Utils {
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.CubePlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTKPlatform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.MTK11Platform
|
||||
|| JGYUtils.getInstance().checkAppPlatform() == JGYUtils.TeclastP20sPlatform
|
||||
) {
|
||||
return Utils.getProperty("ro.build.display.id", "获取失败");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user