|
@@ -15,7 +15,6 @@ import com.atmob.common.permission.PermissionUtil;
|
|
|
import com.atmob.common.thread.ThreadPoolUtil;
|
|
import com.atmob.common.thread.ThreadPoolUtil;
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
import java.lang.reflect.Method;
|
|
|
-import java.lang.reflect.Proxy;
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
public class DeviceInfoUtil {
|
|
public class DeviceInfoUtil {
|
|
@@ -52,7 +51,7 @@ public class DeviceInfoUtil {
|
|
|
|
|
|
|
|
@SuppressLint("HardwareIds")
|
|
@SuppressLint("HardwareIds")
|
|
|
public static String getImei() {
|
|
public static String getImei() {
|
|
|
- if (!TextUtils.isEmpty(imei)) {
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(imei) || Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
|
return imei;
|
|
return imei;
|
|
|
}
|
|
}
|
|
|
Context context = getContext();
|
|
Context context = getContext();
|
|
@@ -76,7 +75,7 @@ public class DeviceInfoUtil {
|
|
|
@SuppressLint("HardwareIds")
|
|
@SuppressLint("HardwareIds")
|
|
|
public static String getSimImei(int slotIdx) {
|
|
public static String getSimImei(int slotIdx) {
|
|
|
String imei = imeiCache.get(slotIdx);
|
|
String imei = imeiCache.get(slotIdx);
|
|
|
- if (!TextUtils.isEmpty(imei)) {
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(imei) || Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
|
return imei;
|
|
return imei;
|
|
|
}
|
|
}
|
|
|
String imeiCache = KVUtils.getDefault().getString(Constants.KEY_IMEI_CACHE + slotIdx, null);
|
|
String imeiCache = KVUtils.getDefault().getString(Constants.KEY_IMEI_CACHE + slotIdx, null);
|
|
@@ -169,28 +168,9 @@ public class DeviceInfoUtil {
|
|
|
}
|
|
}
|
|
|
Context context = getContext();
|
|
Context context = getContext();
|
|
|
try {
|
|
try {
|
|
|
- Class<?> mdidSdkHelper = Class.forName("com.bun.miitmdid.core.MdidSdkHelper");
|
|
|
|
|
- Class<?> iIdentifierListener = Class.forName("com.bun.miitmdid.interfaces.IIdentifierListener");
|
|
|
|
|
- Method initSdk = mdidSdkHelper.getMethod("InitSdk", Context.class, boolean.class, iIdentifierListener);
|
|
|
|
|
- Object identifierListener = Proxy.newProxyInstance(mdidSdkHelper.getClassLoader(), new Class[]{iIdentifierListener}, (proxy, method, args) -> {
|
|
|
|
|
- if ("OnSupport".equals(method.getName())) {
|
|
|
|
|
- if (args.length == 2) {
|
|
|
|
|
- Object idSupplierObj = args[1];
|
|
|
|
|
- if (idSupplierObj != null) {
|
|
|
|
|
- Class<?> idSupplier = Class.forName("com.bun.miitmdid.interfaces.IdSupplier");
|
|
|
|
|
- Method isSupported = idSupplier.getMethod("isSupported");
|
|
|
|
|
- boolean isSupportedResult = (boolean) isSupported.invoke(idSupplierObj);
|
|
|
|
|
- if (isSupportedResult) {
|
|
|
|
|
- Method getOAID = idSupplier.getMethod("getOAID");
|
|
|
|
|
- oaid = (String) getOAID.invoke(idSupplierObj);
|
|
|
|
|
- KVUtils.getDefault().putString(Constants.KEY_OAID_CACHE, oaid);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return null;
|
|
|
|
|
- });
|
|
|
|
|
- initSdk.invoke(null, context, true, identifierListener);
|
|
|
|
|
|
|
+ Class<?> oaidHelperClass = Class.forName("com.atmob.oaid.OaidHelper");
|
|
|
|
|
+ Method getOaid = oaidHelperClass.getMethod("getOaid", Context.class);
|
|
|
|
|
+ oaid = (String) getOaid.invoke(null, context);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
oaidEnable = false;
|
|
oaidEnable = false;
|
|
|
}
|
|
}
|