version:3.1

fix:
update:修改唯一标识为IMEI
This commit is contained in:
2022-07-14 20:06:43 +08:00
parent 093c0dded7
commit 8392db15e4
12 changed files with 99 additions and 26 deletions

View File

@@ -67,8 +67,8 @@ android {
productFlavors { productFlavors {
beta { beta {
flavorDimensions "default" flavorDimensions "default"
versionCode 18 versionCode 22
versionName "2.7" versionName "3.1"
} }
official { official {

View File

@@ -119,7 +119,7 @@ public class MainAPresenter implements MainAContact.Presenter {
@Override @Override
public void getQRCode() { public void getQRCode() {
String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, Utils.getSerial()); String encryptString = CXAESUtil.encrypt(CommonConfig.AES_KEY, Utils.getIMEI(mContext));
Log.e("getQRCode", "setImageAndText: " + encryptString); Log.e("getQRCode", "setImageAndText: " + encryptString);
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400); Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
mView.setQRCode(bitmap); mView.setQRCode(bitmap);

View File

@@ -115,7 +115,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
setOnClickListener(); setOnClickListener();
tv_customversion.setText(JGYUtils.getCustomVersion()); tv_customversion.setText(JGYUtils.getCustomVersion());
tv_sn.setText("SN:" + Utils.getSerial()); tv_sn.setText("IMEI:" + Utils.getIMEI(MainActivity.this));
tv_version.setText(BuildConfig.VERSION_NAME); tv_version.setText(BuildConfig.VERSION_NAME);
task = new TimeTask(); task = new TimeTask();

View File

@@ -113,7 +113,8 @@ public class BaseApplication extends Application {
//token在设备卸载重装的时候有可能会变 //token在设备卸载重装的时候有可能会变
Log.e("TPush", "注册成功设备token为" + data); Log.e("TPush", "注册成功设备token为" + data);
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>(); List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial())); // accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getIMEI(getApplicationContext())));
XGPushManager.upsertAccounts(getApplicationContext(), accountInfoList, new XGIOperateCallback() { XGPushManager.upsertAccounts(getApplicationContext(), accountInfoList, new XGIOperateCallback() {
@Override @Override
public void onSuccess(Object data, int flag) { public void onSuccess(Object data, int flag) {

View File

@@ -1,6 +1,8 @@
package com.uiui.sn.config; package com.uiui.sn.config;
public class CommonConfig { public class CommonConfig {
/*首次开机*/
public final static String JGY_FIRST_BOOT = "first_boot";
/*保存的应用版本号*/ /*保存的应用版本号*/
public final static String SN_VERSIONCODE = "SN_VERSIONCODE"; public final static String SN_VERSIONCODE = "SN_VERSIONCODE";
/*首次连接*/ /*首次连接*/
@@ -24,6 +26,7 @@ public class CommonConfig {
public static String EnableDebug = "EnableDebug"; public static String EnableDebug = "EnableDebug";
public static String SP_Userinfo_json = "USERINFO_JSON"; public static String SP_Userinfo_json = "USERINFO_JSON";
public static final String KEY_IS_CONTROL = "is_control_key";
/** /**
* 管控系统指令 * 管控系统指令

View File

@@ -84,6 +84,7 @@ public class ControlManager {
setSOSNumber(systemSettings); setSOSNumber(systemSettings);
setAppstoreAdmin(systemSettings); setAppstoreAdmin(systemSettings);
setDefaultApp(systemSettings); setDefaultApp(systemSettings);
setIsControl(systemSettings);
JGYUtils.getInstance().updateForbidList(); JGYUtils.getInstance().updateForbidList();
} }
} }
@@ -107,6 +108,7 @@ public class ControlManager {
setSOSNumber(systemSettings); setSOSNumber(systemSettings);
setAppstoreAdmin(systemSettings); setAppstoreAdmin(systemSettings);
setDefaultApp(systemSettings); setDefaultApp(systemSettings);
setIsControl(systemSettings);
JGYUtils.getInstance().updateForbidList(); JGYUtils.getInstance().updateForbidList();
} }
@@ -193,6 +195,21 @@ public class ControlManager {
} }
} }
/**
* usb连接模式管控
*/
public void setUSBstate(String action) {
//USB数据功能管控
//仅充电usb_charge
//MTP模式usb_mtp
//Midi模式usb_midi
if (!DeviceManager.isDebugMode()) {
Log.e(TAG, "qch_usb_choose:" + action);
Intent usbIntent = new Intent(action).setPackage("com.android.settings");
mContext.sendBroadcast(usbIntent);
}
}
private void setPhoneList(SystemSettings settings) { private void setPhoneList(SystemSettings settings) {
//设置电话功能,电话白名单 //设置电话功能,电话白名单
int setting_call = changeNum(settings.getSetting_call()); int setting_call = changeNum(settings.getSetting_call());
@@ -826,7 +843,13 @@ public class ControlManager {
} }
private void setIsControl(int state) { private void setIsControl(int state) {
Settings.System.putInt(mResolver, "is_control", state); Settings.System.putInt(mResolver, CommonConfig.KEY_IS_CONTROL, state);
//关闭
if (state == 0) {
// setBluetooth(0);
// setHotspot(0);
setUSBstate(CommonConfig.AOLE_ACTION_USB_USB_MTP);
}
} }
private void closeSettingsApp() { private void closeSettingsApp() {

View File

@@ -932,10 +932,10 @@ public class NetInterfaceManager {
appInfoList.add(appInfoBaseResponse3.data); appInfoList.add(appInfoBaseResponse3.data);
} }
if (appInfoBaseResponse4.code == 200) { if (appInfoBaseResponse4.code == 200) {
appInfoList.add(appInfoBaseResponse3.data); appInfoList.add(appInfoBaseResponse4.data);
} }
if (appInfoBaseResponse5.code == 200) { if (appInfoBaseResponse5.code == 200) {
appInfoList.add(appInfoBaseResponse3.data); appInfoList.add(appInfoBaseResponse5.data);
} }
return appInfoList; return appInfoList;
}) })
@@ -950,9 +950,9 @@ public class NetInterfaceManager {
@Override @Override
public void onNext(@NonNull List<AppInfo> appInfos) { public void onNext(@NonNull List<AppInfo> appInfos) {
Log.e("checkAllAppUpdate", "onNext: " + appInfos);
cacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos)); cacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos));
getAllAppUpdate(appInfos); getAllAppUpdate(appInfos);
Log.e("checkAllAppUpdate", "onNext: " + appInfos);
} }
@Override @Override
@@ -986,6 +986,7 @@ public class NetInterfaceManager {
} }
HashMap<String, AppInfo> appInfoHashMap = new HashMap<>(); HashMap<String, AppInfo> appInfoHashMap = new HashMap<>();
for (AppInfo appInfo : appInfos) { for (AppInfo appInfo : appInfos) {
if (appInfo == null) continue;
appInfoHashMap.put(appInfo.getApp_package(), appInfo); appInfoHashMap.put(appInfo.getApp_package(), appInfo);
} }
PackageManager pm = mContext.getPackageManager(); PackageManager pm = mContext.getPackageManager();
@@ -1876,6 +1877,8 @@ public class NetInterfaceManager {
String data = new Gson().toJson(BaseResponse.data); String data = new Gson().toJson(BaseResponse.data);
Log.e("getSystemSettings", "onNext: " + data); Log.e("getSystemSettings", "onNext: " + data);
ControlManager.getInstance().setSystemSetting(data); ControlManager.getInstance().setSystemSetting(data);
} else {
ControlManager.getInstance().setDisableSetting();
} }
} }

View File

@@ -37,7 +37,7 @@ public class RepeatRequestInterceptor implements Interceptor {
// Response copy = response.newBuilder().body(responseBody).build(); // Response copy = response.newBuilder().body(responseBody).build();
ResponseBody copy = ResponseBody.create(responseBody.contentType(), content); ResponseBody copy = ResponseBody.create(responseBody.contentType(), content);
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.e(TAG, "请求体返回:| Response: " + request.url().encodedPath() + "\t body: " + content); // Log.e(TAG, "请求体返回:| Response: " + request.url().encodedPath() + "\t body: " + content);
} }
//相同的请求 //相同的请求
String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString() + requestBodyToString(request.body())); String requestKey = MD5Util.getUpperMD5Str(request.method() + request.url().toString() + requestBodyToString(request.body()));

View File

@@ -112,6 +112,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
start.onstar(WiFiAlias); start.onstar(WiFiAlias);
} }
} }
//第一次开机联网后直接连接
if ((int) SPUtils.get(this, CommonConfig.JGY_FIRST_BOOT, 0) == 0) {
mPresenter.getSnInfo();
SPUtils.put(this, CommonConfig.JGY_FIRST_BOOT, 1);
}
mPresenter.checkUpdate(); mPresenter.checkUpdate();
TimeTask task = new TimeTask(); TimeTask task = new TimeTask();
task.execute("ntp.aliyun.com"); task.execute("ntp.aliyun.com");

View File

@@ -470,6 +470,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
private static final String ACTION_DEFAULT_BRPWSER = "77"; private static final String ACTION_DEFAULT_BRPWSER = "77";
/*输入法默认应用*/ /*输入法默认应用*/
private static final String ACTION_DEFAULT_INPUT_METHOD = "78"; private static final String ACTION_DEFAULT_INPUT_METHOD = "78";
/*家长管控开关*/
private static final String ACTION_PARENTAL_CONTROL = "79";
private void processCustomMessage(Context context, XGPushTextMessage message) { private void processCustomMessage(Context context, XGPushTextMessage message) {
if (context == null || message == null) { if (context == null || message == null) {
@@ -755,6 +758,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
case ACTION_DEFAULT_INPUT_METHOD: case ACTION_DEFAULT_INPUT_METHOD:
setDefaultInputMethod(context, extras); setDefaultInputMethod(context, extras);
break; break;
case ACTION_PARENTAL_CONTROL:
NetInterfaceManager.getInstance().getSystemSettings();
break;
default: default:
} }
} }

View File

@@ -31,6 +31,7 @@ import android.os.RemoteException;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodInfo;
@@ -1217,4 +1218,34 @@ public class JGYUtils {
} }
return false; return false;
} }
public String getIMEI() {
String IMEI = "unknow";
String IMEI1, IMEI2, IMEI3;
//获取手机设备号
TelephonyManager TelephonyMgr = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
//8.0及以后版本获取
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
IMEI = TelephonyMgr.getDeviceId();
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// try {
// Method method = TelephonyMgr.getClass().getMethod("getImei");
// IMEI = (String) method.invoke(TelephonyMgr);
// } catch (Exception e) {
// e.printStackTrace();
// Log.e("getIMEI", e.getMessage());
// }
// IMEI = TelephonyMgr.getDeviceId();
// } else {//9.0到10.0获取
IMEI = Settings.System.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);
}
// Log.e("IMEI:", "IMEI: " + IMEI);
if (null == IMEI) {
return "-";
} else {
return IMEI.toUpperCase();
}
}
} }

View File

@@ -615,22 +615,23 @@ public class Utils {
*/ */
@SuppressLint({"MissingPermission", "NewApi"}) @SuppressLint({"MissingPermission", "NewApi"})
public static String getSerial() { public static String getSerial() {
String serial = "unknow"; return JGYUtils.getInstance().getIMEI();
try { // String serial = "unknow";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+ // try {
serial = Build.getSerial(); // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+ // serial = Build.getSerial();
serial = Build.SERIAL; // } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
} else {//8.0- // serial = Build.SERIAL;
Class<?> c = Class.forName("android.os.SystemProperties"); // } else {//8.0-
Method get = c.getMethod("get", String.class); // Class<?> c = Class.forName("android.os.SystemProperties");
serial = (String) get.invoke(c, "ro.serialno"); // Method get = c.getMethod("get", String.class);
} // serial = (String) get.invoke(c, "ro.serialno");
} catch (Exception e) { // }
e.printStackTrace(); // } catch (Exception e) {
Log.e("e", "读取设备序列号异常:" + e.toString()); // e.printStackTrace();
} // Log.e("e", "读取设备序列号异常:" + e.toString());
return serial; // }
// return serial;
} }
/** /**