version:3.1
fix: update:修改唯一标识为IMEI
This commit is contained in:
@@ -67,8 +67,8 @@ android {
|
||||
productFlavors {
|
||||
beta {
|
||||
flavorDimensions "default"
|
||||
versionCode 18
|
||||
versionName "2.7"
|
||||
versionCode 22
|
||||
versionName "3.1"
|
||||
}
|
||||
|
||||
official {
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MainAPresenter implements MainAContact.Presenter {
|
||||
|
||||
@Override
|
||||
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);
|
||||
Bitmap bitmap = Utils.createQRImage(encryptString, 400, 400);
|
||||
mView.setQRCode(bitmap);
|
||||
|
||||
@@ -115,7 +115,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
||||
|
||||
setOnClickListener();
|
||||
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);
|
||||
|
||||
task = new TimeTask();
|
||||
|
||||
@@ -113,7 +113,8 @@ public class BaseApplication extends Application {
|
||||
//token在设备卸载重装的时候有可能会变
|
||||
Log.e("TPush", "注册成功,设备token为:" + data);
|
||||
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() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.uiui.sn.config;
|
||||
|
||||
public class CommonConfig {
|
||||
/*首次开机*/
|
||||
public final static String JGY_FIRST_BOOT = "first_boot";
|
||||
/*保存的应用版本号*/
|
||||
public final static String SN_VERSIONCODE = "SN_VERSIONCODE";
|
||||
/*首次连接*/
|
||||
@@ -24,6 +26,7 @@ public class CommonConfig {
|
||||
public static String EnableDebug = "EnableDebug";
|
||||
public static String SP_Userinfo_json = "USERINFO_JSON";
|
||||
|
||||
public static final String KEY_IS_CONTROL = "is_control_key";
|
||||
|
||||
/**
|
||||
* 管控系统指令
|
||||
|
||||
@@ -84,6 +84,7 @@ public class ControlManager {
|
||||
setSOSNumber(systemSettings);
|
||||
setAppstoreAdmin(systemSettings);
|
||||
setDefaultApp(systemSettings);
|
||||
setIsControl(systemSettings);
|
||||
JGYUtils.getInstance().updateForbidList();
|
||||
}
|
||||
}
|
||||
@@ -107,6 +108,7 @@ public class ControlManager {
|
||||
setSOSNumber(systemSettings);
|
||||
setAppstoreAdmin(systemSettings);
|
||||
setDefaultApp(systemSettings);
|
||||
setIsControl(systemSettings);
|
||||
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) {
|
||||
//设置电话功能,电话白名单
|
||||
int setting_call = changeNum(settings.getSetting_call());
|
||||
@@ -826,7 +843,13 @@ public class ControlManager {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
@@ -932,10 +932,10 @@ public class NetInterfaceManager {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
}
|
||||
if (appInfoBaseResponse4.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
appInfoList.add(appInfoBaseResponse4.data);
|
||||
}
|
||||
if (appInfoBaseResponse5.code == 200) {
|
||||
appInfoList.add(appInfoBaseResponse3.data);
|
||||
appInfoList.add(appInfoBaseResponse5.data);
|
||||
}
|
||||
return appInfoList;
|
||||
})
|
||||
@@ -950,9 +950,9 @@ public class NetInterfaceManager {
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull List<AppInfo> appInfos) {
|
||||
Log.e("checkAllAppUpdate", "onNext: " + appInfos);
|
||||
cacheHelper.put(UrlAddress.GET_NEWESTAPPUPDATE, GsonUtils.toJSONString(appInfos));
|
||||
getAllAppUpdate(appInfos);
|
||||
Log.e("checkAllAppUpdate", "onNext: " + appInfos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -986,6 +986,7 @@ public class NetInterfaceManager {
|
||||
}
|
||||
HashMap<String, AppInfo> appInfoHashMap = new HashMap<>();
|
||||
for (AppInfo appInfo : appInfos) {
|
||||
if (appInfo == null) continue;
|
||||
appInfoHashMap.put(appInfo.getApp_package(), appInfo);
|
||||
}
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
@@ -1876,6 +1877,8 @@ public class NetInterfaceManager {
|
||||
String data = new Gson().toJson(BaseResponse.data);
|
||||
Log.e("getSystemSettings", "onNext: " + data);
|
||||
ControlManager.getInstance().setSystemSetting(data);
|
||||
} else {
|
||||
ControlManager.getInstance().setDisableSetting();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RepeatRequestInterceptor implements Interceptor {
|
||||
// Response copy = response.newBuilder().body(responseBody).build();
|
||||
ResponseBody copy = ResponseBody.create(responseBody.contentType(), content);
|
||||
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()));
|
||||
|
||||
@@ -112,6 +112,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
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();
|
||||
TimeTask task = new TimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
|
||||
@@ -470,6 +470,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
private static final String ACTION_DEFAULT_BRPWSER = "77";
|
||||
/*输入法默认应用*/
|
||||
private static final String ACTION_DEFAULT_INPUT_METHOD = "78";
|
||||
/*家长管控开关*/
|
||||
private static final String ACTION_PARENTAL_CONTROL = "79";
|
||||
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
if (context == null || message == null) {
|
||||
@@ -755,6 +758,9 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case ACTION_DEFAULT_INPUT_METHOD:
|
||||
setDefaultInputMethod(context, extras);
|
||||
break;
|
||||
case ACTION_PARENTAL_CONTROL:
|
||||
NetInterfaceManager.getInstance().getSystemSettings();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
@@ -1217,4 +1218,34 @@ public class JGYUtils {
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,22 +615,23 @@ public class Utils {
|
||||
*/
|
||||
@SuppressLint({"MissingPermission", "NewApi"})
|
||||
public static String getSerial() {
|
||||
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");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e("e", "读取设备序列号异常:" + e.toString());
|
||||
}
|
||||
return serial;
|
||||
return JGYUtils.getInstance().getIMEI();
|
||||
// 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");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// Log.e("e", "读取设备序列号异常:" + e.toString());
|
||||
// }
|
||||
// return serial;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user