version:1.8.1
date:2021-11-03 11:12:56 fix:修复恢复出厂设置后搜题开关不显示 add:
This commit is contained in:
@@ -232,7 +232,6 @@ public class CXAESUtil {
|
||||
e.printStackTrace(); // To change body of catch statement use File |
|
||||
// Settings | File Templates.
|
||||
} catch (InvalidAlgorithmParameterException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return cipher;
|
||||
@@ -242,7 +241,6 @@ public class CXAESUtil {
|
||||
* 对文件进行AES加密
|
||||
*
|
||||
* @param sourceFile
|
||||
* @param fileType
|
||||
* @param sKey
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -74,7 +74,6 @@ public class JGYUtils {
|
||||
}
|
||||
|
||||
public static String getAuthorization() {
|
||||
// TODO: 2021/10/19 ndk代码待实现
|
||||
return "Basic ZWRmOWNlYzIyNzMxYjhiMmZlZDU2ZWU2OmIzYWRlZDRmODk5N2E0ODM5ZTI5MjRjYg==";
|
||||
}
|
||||
|
||||
@@ -98,7 +97,7 @@ public class JGYUtils {
|
||||
* 从Manifest中获取meta-data值
|
||||
* https://blog.csdn.net/yue_233/article/details/91453451
|
||||
*
|
||||
* @return
|
||||
* @return MetaData
|
||||
*/
|
||||
public String getStringMetaData() {
|
||||
ApplicationInfo appInfo = null;
|
||||
@@ -577,43 +576,43 @@ public class JGYUtils {
|
||||
return processName;
|
||||
}
|
||||
|
||||
public void setDefaultDesktop(Context context, String pkg, String className) {
|
||||
public void setDefaultDesktop( String pkg, String className) {
|
||||
Intent intent = new Intent("setDefaultLauncher");
|
||||
intent.putExtra("package", pkg);
|
||||
intent.putExtra("className", className);
|
||||
intent.setPackage("com.android.settings");
|
||||
context.sendBroadcast(intent);
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public static ArrayList<String> getForbidList(Context context) {
|
||||
public ArrayList<String> getForbidList() {
|
||||
ArrayList<String> disableApp = new ArrayList<>();
|
||||
int search_topic = (int) SPUtils.get(context, "search_topic", 0);
|
||||
int search_topic = (int) SPUtils.get(mContext, "search_topic", 0);
|
||||
Log.e(TAG, "getForbidList: search_topic = " + search_topic);
|
||||
Log.e(TAG, "getForbidList: " + JSONObject.toJSONString(SPUtils.getAll(context)));
|
||||
Log.e(TAG, "getForbidList: " + JSONObject.toJSONString(SPUtils.getAll(mContext)));
|
||||
|
||||
if (search_topic == 0) {
|
||||
disableApp.add("拍照搜题");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_camera", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_camera", 0) == 1) {
|
||||
disableApp.add("com.mediatek.camera");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_filemanager", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_filemanager", 0) == 1) {
|
||||
disableApp.add("com.android.documentsui");
|
||||
disableApp.add("com.mediatek.filemanager");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_deskclock", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_deskclock", 0) == 1) {
|
||||
disableApp.add("com.android.deskclock");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_soundrecorder", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_soundrecorder", 0) == 1) {
|
||||
disableApp.add("com.android.soundrecorder");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_gallery", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_gallery", 0) == 1) {
|
||||
disableApp.add("com.android.gallery3d");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_music", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_music", 0) == 1) {
|
||||
disableApp.add("com.android.music");
|
||||
}
|
||||
if (JGYUtils.getInt(context.getContentResolver(), "qch_app_browser", 0) == 1) {
|
||||
if (JGYUtils.getInt(mContext.getContentResolver(), "qch_app_browser", 0) == 1) {
|
||||
disableApp.add("com.android.browser");
|
||||
}
|
||||
Log.e(TAG, "getForbidAPP: " + disableApp);
|
||||
@@ -622,18 +621,18 @@ public class JGYUtils {
|
||||
|
||||
private static final String UPDATE_FORBID_APP = "UPDATE_FORBID_APP";
|
||||
|
||||
public static void updateForbidList(Context context) {
|
||||
public void updateForbidList() {
|
||||
Intent intent = new Intent(UPDATE_FORBID_APP);
|
||||
intent.putStringArrayListExtra("forbid_app_list", getForbidList(context));
|
||||
Log.e(TAG, "updateForbidList: " + getForbidList(context));
|
||||
intent.putStringArrayListExtra("forbid_app_list", getForbidList());
|
||||
Log.e(TAG, "updateForbidList: " + getForbidList());
|
||||
// intent.setComponent(new ComponentName("com.jiaoguanyi.os","com.jiaoguanyi.os.view.MainActivity"));
|
||||
intent.setPackage("com.jiaoguanyi.os");
|
||||
// intent.setPackage("com.tt.ttutils");
|
||||
context.sendBroadcast(intent);
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public static ArrayList<String> getHideList(Context context) {
|
||||
String appString = (String) SPUtils.get(context, "Hide_APP_List", "");
|
||||
public ArrayList<String> getHideList() {
|
||||
String appString = (String) SPUtils.get(mContext, "Hide_APP_List", "");
|
||||
Log.e(TAG, "Hide_APP_List: " + appString);
|
||||
if (TextUtils.isEmpty(appString)) {
|
||||
return new ArrayList<>();
|
||||
@@ -644,13 +643,13 @@ public class JGYUtils {
|
||||
|
||||
private static final String UPDATE_HIDE_APP = "UPDATE_HIDE_APP";
|
||||
|
||||
public static void updateHideList(Context context) {
|
||||
public void updateHideList() {
|
||||
Intent intent = new Intent(UPDATE_HIDE_APP);
|
||||
intent.putStringArrayListExtra("hide_app_list", getHideList(context));
|
||||
intent.putStringArrayListExtra("hide_app_list", getHideList());
|
||||
// intent.setComponent(new ComponentName("com.jiaoguanyi.os","com.jiaoguanyi.os.view.MainActivity"));
|
||||
intent.setPackage("com.jiaoguanyi.os");
|
||||
// intent.setPackage("com.tt.ttutils");
|
||||
context.sendBroadcast(intent);
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
//应用管理-允许联网
|
||||
@@ -675,13 +674,8 @@ public class JGYUtils {
|
||||
|
||||
String oldBlackList = (String) SPUtils.get(context, ACTION_HrReceiver_JGY_DIS, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackList.split(",")));
|
||||
oldBlackListSet.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
//去空
|
||||
return TextUtils.isEmpty(s.trim());
|
||||
}
|
||||
});
|
||||
//去空
|
||||
oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
//之前禁止上网得列表
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
if (oldBlackListSet.size() == 0) {
|
||||
@@ -757,12 +751,7 @@ public class JGYUtils {
|
||||
String oldBlackListString = (String) SPUtils.get(mContext, ACTION_HrReceiver_JGY_DIS, "");
|
||||
HashSet<String> oldBlackListSet = new HashSet<>(Arrays.asList(oldBlackListString.split(",")));
|
||||
Log.e(TAG, "setAppNetwork: oldBlackListSet: " + oldBlackListSet);
|
||||
oldBlackListSet.removeIf(new Predicate<String>() {
|
||||
@Override
|
||||
public boolean test(String s) {
|
||||
return TextUtils.isEmpty(s.trim());
|
||||
}
|
||||
});
|
||||
oldBlackListSet.removeIf(s -> TextUtils.isEmpty(s.trim()));
|
||||
for (String pkg : oldBlackListSet) {
|
||||
if (TextUtils.isEmpty(pkg)) continue;
|
||||
if (!ApkUtils.isAvailable(mContext, pkg)) {
|
||||
|
||||
112
app/src/main/java/com/info/sn/utils/MD5Util.java
Normal file
112
app/src/main/java/com/info/sn/utils/MD5Util.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.info.sn.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class MD5Util {
|
||||
|
||||
public static String packetMD5(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString();
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static String getUpperMD5Str(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString().toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取16位的MD5 值得
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static String getUpperMD5Str16(String str) {
|
||||
MessageDigest messageDigest = null;
|
||||
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException caught!");
|
||||
System.exit(-1);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuffer md5StrBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
|
||||
md5StrBuff.append("0").append(
|
||||
Integer.toHexString(0xFF & byteArray[i]));
|
||||
else
|
||||
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
|
||||
}
|
||||
|
||||
return md5StrBuff.toString().toUpperCase().substring(8, 24);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -160,7 +160,7 @@ public class Utils {
|
||||
try {
|
||||
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||
for (NetworkInterface nif : all) {
|
||||
if (!nif.getName().equalsIgnoreCase("wlan0"))
|
||||
if (!"wlan0".equalsIgnoreCase(nif.getName()))
|
||||
continue;
|
||||
byte[] macBytes = nif.getHardwareAddress();
|
||||
if (macBytes == null) {
|
||||
@@ -208,15 +208,15 @@ public class Utils {
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (WLANMAC != null && !WLANMAC.equals("")) {
|
||||
if (WLANMAC != null && !"".equals(WLANMAC)) {
|
||||
m.update(WLANMAC.getBytes(), 0, WLANMAC.length());
|
||||
} else if (getSimSerialNumber(context) != null && !getSimSerialNumber(context).equals("")) {
|
||||
} else if (getSimSerialNumber(context) != null && !"".equals(getSimSerialNumber(context))) {
|
||||
m.update(getSimSerialNumber(context).getBytes(), 0, getSimSerialNumber(context).length());
|
||||
} else {
|
||||
m.update(getPesudoUniqueID().getBytes(), 0, getPesudoUniqueID().length());
|
||||
}
|
||||
// get md5 bytes
|
||||
byte p_md5Data[] = m.digest();
|
||||
byte[] p_md5Data = m.digest();
|
||||
// create a hex string
|
||||
String m_szUniqueID = new String();
|
||||
for (int i = 0; i < p_md5Data.length; i++) {
|
||||
@@ -559,7 +559,6 @@ public class Utils {
|
||||
;
|
||||
return version;
|
||||
} catch (NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
@@ -1227,12 +1226,7 @@ public class Utils {
|
||||
used.setApp_name(information.getLabel());
|
||||
appUsedList.add(used);
|
||||
}
|
||||
appUsedList.removeIf(new Predicate<AppUsed>() {
|
||||
@Override
|
||||
public boolean test(AppUsed appUsed) {
|
||||
return appUsed.getUseTime() == 0;
|
||||
}
|
||||
});
|
||||
appUsedList.removeIf(appUsed -> appUsed.getUseTime() == 0);
|
||||
String jsonString = JSON.toJSONString(appUsedList);
|
||||
Log.e(TAG, "getAppUsedStatistics: " + jsonString);
|
||||
return jsonString;
|
||||
|
||||
Reference in New Issue
Block a user