version:2.0.3

update:
fix:应用市场接口屏蔽,删除应用bug,设备加锁恢复出场设置
add:
This commit is contained in:
2021-05-13 18:43:00 +08:00
parent 161b0fa9d1
commit 5efa5b5370
14 changed files with 345 additions and 877 deletions

View File

@@ -652,6 +652,8 @@ public class ApkUtils {
this.add("com.easyclient.activity");//移动课堂
this.add("com.jiandan.mobilelesson");//简单课堂
this.add("com.jiaoguanyi.store");//教官壹
this.add("com.uiuios.jgy1");
this.add("com.uiuios.jgy2");
}};
public static List<String> factoryapp = new ArrayList<String>() {{

View File

@@ -47,13 +47,11 @@ import java.util.LinkedHashSet;
import java.util.List;
public class JGYUtils {
private static final String TAG = JGYUtils.class.getSimpleName();
private static JGYUtils sInstance;
private Context mContext;
public static final String ROOT_URL = BuildConfig.ROOT_URL;
private JGYUtils(Context context) {
this.mContext = context;
@@ -435,41 +433,31 @@ public class JGYUtils {
}
public void SettingSysData(String data) {
SPUtils.put(mContext, "first_connect", 1);
SysSettingUtils.setSystemSetting(mContext, data);
}
public void writeAppPackageList(Context context, String packageList) {
StringBuilder stringBuilder = new StringBuilder(packageList);
ApkUtils.addShortcut(context);
String appstore = "com.jiaoguanyi.appstore";
String store = "com.jiaoguanyi.store";
String info = "com.info.sn";
// String iflytek = "com.estrongs.android.pop";
String jgy1 = "com.uiuios.jgy1";
String jgy2 = "com.uiuios.jgy2";
if (!TextUtils.isEmpty(packageList)) {
Log.e("writeAppPackageList", "result: is empty");
if (!packageList.contains(appstore)) {
stringBuilder.append(",").append(appstore);
}
if (!packageList.contains(store)) {
stringBuilder.append(",").append(store);
}
if (!packageList.contains(jgy1)) {
stringBuilder.append(",").append(jgy1);
}
if (!packageList.contains(jgy2)) {
stringBuilder.append(",").append(jgy2);
}
if (!packageList.contains(info)) {
stringBuilder.append(",").append(info);
List<String> packages = new ArrayList<String>() {{
this.add("com.jiaoguanyi.appstore");//设备信息
this.add("com.jiaoguanyi.store");//教管壹
this.add("com.info.sn");
this.add("com.uiuios.jgy1");
this.add("com.uiuios.jgy2");
}};
// if (!TextUtils.isEmpty(stringBuilder)) {
for (String pkg : packages) {
if (!packageList.contains(pkg)) {
stringBuilder.append(",");
stringBuilder.append(pkg);
}
}
boolean b = Settings.System.putString(mContext.getContentResolver(), "qch_app_forbid", stringBuilder.toString());
Log.e("mjsheng", "qch_app_forbid is :" + b + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
} else {
Log.e("mjsheng", "writeAppPackageList is null:");
}
Log.e("writeAppPackageList: ", "qch_app_forbid is :" + b + Settings.System.getString(mContext.getContentResolver(), "qch_app_forbid"));
// } else {
// Log.e("writeAppPackageList: ", "writeAppPackageList is null:");
// }
}
public void forceDownload(List<ForceDownloadData> data) {
@@ -660,6 +648,9 @@ public class JGYUtils {
Log.e("deleteOtherApp", "is systemApp:" + packageName);
continue;
}
if (ApkUtils.systemapp.contains(packageName)) {
continue;
}
if (ApkUtils.canremove_systemapp.contains(packageName)) {
continue;
}
@@ -779,7 +770,7 @@ public class JGYUtils {
}
}
public void setDeveloper(int state) {
public void setDeveloperOptions(int state) {
Settings.System.putInt(mContext.getContentResolver(), "qch_Developeroptions", state);
if (state == 1) {
Intent intent = new Intent();
@@ -877,13 +868,13 @@ public class JGYUtils {
}
}
public void KillOTA() {
public void KillOTA() {
ActivityManager manager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
manager.killBackgroundProcesses("com.adups.fota");
CmdUtil.execute("am force-stop " + "com.adups.fota");
}
public void openOTA() {
public void openOTA() {
Intent intent = new Intent(Intent.ACTION_MAIN);
/**知道要跳转应用的包命与目标Activity*/
ComponentName componentName = new ComponentName("com.adups.fota", "com.adups.fota.GoogleOtaClient");

View File

@@ -76,6 +76,7 @@ public class SysSettingUtils {
setIcon(context, 1);
setCanReset(context, 1);
setAutoTime(context, 1);
JGYUtils.getInstance().setDeveloperOptions(1);
}
public static void setEnableSetting(Context context) {
@@ -89,6 +90,7 @@ public class SysSettingUtils {
setIcon(context, 0);
setCanReset(context, 0);
setAutoTime(context, 0);
JGYUtils.getInstance().setDeveloperOptions(0);
}
private static void setPhoneList(Context context, int state) {
@@ -668,5 +670,4 @@ public class SysSettingUtils {
mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);//显示隐藏的虚拟按键
}
}

View File

@@ -37,7 +37,16 @@ public class URLUtils {
}
public void setBrowserList() {
String whiteList = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
boolean isOld = Settings.System.getInt(mContext.getContentResolver(), "qch_website_isBlackWebUrl", 0) == 0;
String whiteList = "";
if (isOld) {
whiteList = Settings.System.getString(mContext.getContentResolver(), "DeselectBrowserArray");
Log.e(TAG, "setBrowserList: "+ "DeselectBrowserArray");
} else {
whiteList = Settings.System.getString(mContext.getContentResolver(), "BlackBrowserArray");
Log.e(TAG, "setBrowserList: "+ "BlackBrowserArray");
}
if (TextUtils.isEmpty(whiteList)) {
Log.e(TAG, "getBrowserWhiteList: " + "whiteList is empty");
} else {
@@ -116,13 +125,18 @@ public class URLUtils {
stringBuilder.append(s);
}
String DeselectBrowserArray = stringBuilder.toString();
boolean write = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", DeselectBrowserArray);
boolean write;
if (isOld){
write = Settings.System.putString(mContext.getContentResolver(), "DeselectBrowserArray", DeselectBrowserArray);
}else {
write = Settings.System.putString(mContext.getContentResolver(), "BlackBrowserArray", DeselectBrowserArray);
}
Log.e(TAG, "onComplete: " + "white list: " + DeselectBrowserArray);
Log.e(TAG, "onComplete: " + "write :" + write);
}
});
}
}
private String getOkHttpURL(String URL) {
@@ -228,7 +242,7 @@ public class URLUtils {
sb.append(c);
}
}
Log.e(TAG, "getUserAgent: " + sb.toString());
// Log.e(TAG, "getUserAgent: " + sb.toString());
return sb.toString();
}
}

View File

@@ -99,101 +99,6 @@ import io.reactivex.schedulers.Schedulers;
public class Utils {
public static final String PACKAGE = "appstore";
public static final String DOWNLOAD_STARTALL_ACTION = PACKAGE + "_startall"; // 开始所有任务
public static final String DOWNLOAD_DELETE_UPDATE_ACTION = PACKAGE + "_download_update_delete"; // 删除应用更新文件
public static final String DOWNLOAD_DELETEALL_ACTION = PACKAGE + "_deleteall_alltask"; // 删除所有任务
public static final String DOWNLOAD_ALLTASK_ACTION = PACKAGE + "_download_alltask"; // 获取所有任务
public static final String DOWNLOAD_START_ACTION = PACKAGE + "_download_start"; // 下载标识
public static final String DOWNLOAD_STOP_ACTION = PACKAGE + "_download_stop"; // 暂停标识
public static final String DOWNLOAD_DELETE_PACKAGENAME_ACTION = PACKAGE + "_download_packagename_delete"; // 删除标识 根据包名
public static final String DOWNLOAD_DELETE_URL_ACTION = PACKAGE + "_download_url_delete"; // 删除标识 根据下载地址
public static final String DOWNLOAD_INITIALIZE_ACTION = PACKAGE + "_download_initialize"; // item初始化状态
public static final String DOWNLOAD_PACKAGENAME_ACTION = PACKAGE + "_download_packagename"; // item初始化状态 包名
public static final String DOWNLOAD_SERVICE_ACTION = PACKAGE + "_download_service"; // 下载状态回调服务
public static final String DOWNLOAD_ALLSERVICE_ACTION = PACKAGE + "_download_allservice"; // 返回所有下载任务
public static final String DOWNLOAD_NEWSERVICE_ACTION = PACKAGE + "_download_newservice"; // 一个新的下载任务
// JPush 推送消息
public static final String MESSAGE_RECEIVED_ACTION = "com.appstore.jpushdemo.MESSAGE_RECEIVED_ACTION";
public static final String KEY_TITLE = "title"; // 消息标题
public static final String KEY_MESSAGE = "message"; // 消息内容
public static final String KEY_EXTRAS = "extras"; // 消息内容类型
public static final String KEY_TYPE = "type"; // 消息内容类型
public static final String ACTION_PACKAGE_REPLACED = PACKAGE + "PACKAGE_REPLACED"; // 替换应用
public static final String ACTION_PACKAGE_REMOVED = PACKAGE + "PACKAGE_REMOVED"; // 卸载应用
public static final String ACTION_PACKAGE_ADDED = PACKAGE + "PACKAGE_ADDED"; // 安装应用
// 学习日志上传标识
public static final String APP_LRARNLOG = "com.colorflykids.alarm";
// 学习日志下载标识
public static final String APP_DOWNLOADLEARNLOG = "com.colorflykids.downloadlearnlog";
// 账号注销标识
public static final String APP_USERLOGOUT = "com.colorflykids.userlogout";
public static final String UPDATE_SYSTEMUI = "cn.colorflykids.UPDATE_SYSTEMUI";
public static final int COUNT_ONE_PAGE = 8;
public static final int COUNT_ONE_PAGE2 = 10;
public static final String YOUNGSYSTEM_APP_TONGBU = "com.school.app.syn"; // 小学系统 同步教材app
/**
*
*/
public static final String number[] = {
"1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "0", "11"};
public static final String STORE = "store";
public static final String CATEGORY_THREE = "3";
public static final String CATEGORY_SIX = "6";
public static final String CATEGORY_UPSIX = "10";
public static final String CLOSE_REST_WINDOW = "colse_rest_window";
public static final String STOP_LOOPING_TIMER = "stop_looping_timer";
public static final String START_LOOPING_TIMER = "start_looping_timer";
public static String DOWNLOADAPP_CALLBACK = "com.colorflykids.downloadapp"; // 子界面下载回调 提示更新UI
public static String MENU_YOUYOU = "youyou";
public static String MENU_LANGUAGE = "语言启蒙";
public static String MENU_HABIT = "行为习惯";
public static String MENU_KNOWLEDGE = "生活认知";
public static String MENU_SECURITY = "安全自理";
public static String MENU_PROMOTION = "入园-综合提升";
public static String MENU_LY = "优优乐园";
public static String MENU_YW = "语文知识";
public static String MENU_SX = "数理逻辑";
public static String MENU_YY = "英语启蒙";
public static String MENU_QS = "情商培养";
public static String MENU_YS = "艺术提升";
public static String MENU_ZH = "学前-综合提升";
public static String MENU_TONGBUJIAOCAI = "同步教材";
public static String MENU_YUWEN = "语文";
public static String MENU_SHUXUE = "数学";
public static String MENU_YINGYU = "英语";
public static String MENU_ZONGHETISHEGN = "小学-综合提升";
public static String[] babySystem = {MENU_LANGUAGE, MENU_HABIT, MENU_KNOWLEDGE, MENU_SECURITY, MENU_PROMOTION};
public static String[] childSystem = {MENU_LY, MENU_YW, MENU_SX, MENU_YY, MENU_QS, MENU_YS, MENU_ZH};
public static String[] youngSystem = {MENU_YUWEN, MENU_SHUXUE, MENU_YINGYU, MENU_ZONGHETISHEGN};
public static String[] sonSystem = {MENU_HABIT, MENU_SECURITY, MENU_LANGUAGE, MENU_KNOWLEDGE, MENU_PROMOTION,
MENU_LY, MENU_YW, MENU_SX, MENU_YY, MENU_QS, MENU_YS, MENU_ZH,
MENU_TONGBUJIAOCAI, MENU_YUWEN, MENU_SHUXUE, MENU_YINGYU, MENU_YINGYU, MENU_ZONGHETISHEGN};
public static String[][] tagList = {babySystem, childSystem, youngSystem};
public static String subcategories[][] = {babySystem, childSystem, youngSystem};
public static String system[] = {"入园系统", "学前系统", "小学系统"};
public static String systemandno[] = {"入园系统", "学前系统", "小学系统", "未分配"};
protected static Toast toast = null;
private static String oldMsg;
private static long oneTime = 0;
private static long twoTime = 0;
// 积分记录 达人标准次数记录
// MD5 设备地址标识
public static String getMAC(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // 如果当前设备系统大于等于6.0 使用下面的方法
@@ -577,25 +482,6 @@ public class Utils {
return new String(c);
}
public static void showToast(Context context, String s) {
if (toast == null) {
toast = Toast.makeText(context, s, Toast.LENGTH_SHORT);
toast.show();
oneTime = System.currentTimeMillis();
} else {
twoTime = System.currentTimeMillis();
if (s.equals(oldMsg)) {
if (twoTime - oneTime > Toast.LENGTH_SHORT) {
toast.show();
}
} else {
oldMsg = s;
toast.setText(s);
toast.show();
}
}
oneTime = twoTime;
}
public static boolean isShouldHideInput(View v, MotionEvent event) {
if (v != null && (v instanceof EditText)) {
@@ -724,14 +610,6 @@ public class Utils {
return t1;
}
private static void getAdmin(Context context, ComponentName componentName) {
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "宏云萌书院OS");
context.startActivity(intent);
}
/**
* 获取设备序列号
*
@@ -791,10 +669,6 @@ public class Utils {
}
public static String getSn() {
return getSerial();
}
public static Bitmap createQRImage(String content, int widthPix, int heightPix) {
try {
// if (content == null || "".equals(content)) {
@@ -850,7 +724,13 @@ public class Utils {
}
//判断是否为系统应用
/**
* 判断是否为系统应用
*
* @param context 上下文
* @param pkgName 包名
* @return
*/
public static boolean isSystemApp(Context context, String pkgName) {
boolean isSystemApp = false;
PackageInfo pi = null;
@@ -922,6 +802,14 @@ public class Utils {
// return bgBitmap;
}
/**
* 获取系统保存的字段
*
* @param key
* @param defaultValue
* @return
*/
public static String getProperty(String key, String defaultValue) {
String value = defaultValue;
try {
@@ -935,6 +823,11 @@ public class Utils {
}
}
/**
* 重置系统
*
* @param context
*/
synchronized public static void doMasterClear(Context context) {
if (BuildConfig.DEBUG) {
ToastUtil.show("收到重置设备推送消息");
@@ -960,13 +853,29 @@ public class Utils {
}
}
/**
* 获取电量
*
* @param mContext
* @return
*/
synchronized private static int getBatteryLevel(Context mContext) {
if (Build.VERSION.SDK_INT >= 21)
if (Build.VERSION.SDK_INT >= 21) {
return ((BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE)).getIntProperty(4);
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
} else {
Intent intent = (new ContextWrapper(mContext)).registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
return intent.getIntExtra("level", -1) * 100 / intent.getIntExtra("scale", -1);
}
}
/**
* 更新应用白名单禁止升级
* @param context
* @param banList
* @param notList
* @return
*/
static synchronized public boolean writeDisableUpdateList(Context context, String[] banList, String[] notList) {
String now = Settings.System.getString(context.getContentResolver(), "qch_app_forbid");
String[] nowList;
@@ -1019,6 +928,10 @@ public class Utils {
*/
}
/**
* 重启设备
* @param context
*/
public static void rebootDevices(Context context) {
Intent iReboot = new Intent(Intent.ACTION_REBOOT);
iReboot.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -1035,6 +948,12 @@ public class Utils {
return fileName.substring(position + 9, fileName.length() - 4);
}
/**
* 主要的下载
* @param context
* @param url
* @param jsonObject
*/
public static void ariaDownload(Context context, String url, JSONObject jsonObject) {
String fileName = getFileNamefromURL(url);
String urlMD5 = jsonObject.getString("MD5");