Initial commit
This commit is contained in:
5
sources/com/ubtrobot/analytics/device/DeviceInfo.java
Normal file
5
sources/com/ubtrobot/analytics/device/DeviceInfo.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.ubtrobot.analytics.device;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface DeviceInfo {
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.ubtrobot.analytics.device;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface DeviceInfoReporter {
|
||||
}
|
236
sources/com/ubtrobot/analytics/device/DeviceInfoUtils.java
Normal file
236
sources/com/ubtrobot/analytics/device/DeviceInfoUtils.java
Normal file
@@ -0,0 +1,236 @@
|
||||
package com.ubtrobot.analytics.device;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import com.ubt.jimu.diy.view.fragment.BuildStepFragment;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DeviceInfoUtils {
|
||||
private static final byte[] a = new byte[0];
|
||||
private static volatile String b;
|
||||
|
||||
public static String a() {
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
|
||||
public static String b() {
|
||||
return Build.MODEL;
|
||||
}
|
||||
|
||||
public static String c() {
|
||||
return Build.VERSION.RELEASE;
|
||||
}
|
||||
|
||||
public static String d(Context context) {
|
||||
try {
|
||||
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
Log.w("Analytics", "Get app version fail.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String e() {
|
||||
try {
|
||||
return TimeZone.getDefault().getDisplayName(false, 0);
|
||||
} catch (AssertionError unused) {
|
||||
Log.w("Analytics", "Fail get time zone.");
|
||||
String date = new Date(119, 5, 9).toString();
|
||||
return date.substring(20, date.length() - 5);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"MissingPermission"})
|
||||
private static String f(Context context) {
|
||||
String imei;
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
|
||||
if (telephonyManager != null) {
|
||||
try {
|
||||
imei = Build.VERSION.SDK_INT >= 26 ? telephonyManager.getImei() : telephonyManager.getDeviceId();
|
||||
} catch (SecurityException unused) {
|
||||
}
|
||||
return (imei != null || "000000000000000".equals(imei)) ? "" : imei;
|
||||
}
|
||||
imei = null;
|
||||
if (imei != null) {
|
||||
}
|
||||
}
|
||||
|
||||
private static String g(Context context) {
|
||||
String macAddress;
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
macAddress = g();
|
||||
if (TextUtils.isEmpty(macAddress)) {
|
||||
macAddress = f();
|
||||
}
|
||||
} else {
|
||||
macAddress = ((WifiManager) context.getSystemService("wifi")).getConnectionInfo().getMacAddress();
|
||||
}
|
||||
return (macAddress == null || "02:00:00:00:00:00".equals(macAddress)) ? "" : macAddress;
|
||||
}
|
||||
|
||||
public static String h(Context context) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
|
||||
return telephonyManager != null ? telephonyManager.getSimOperator() : "";
|
||||
}
|
||||
|
||||
private static String i(Context context) {
|
||||
if (b != null) {
|
||||
return b;
|
||||
}
|
||||
synchronized (a) {
|
||||
if (b != null) {
|
||||
return b;
|
||||
}
|
||||
String j = j(context);
|
||||
if (j.length() == 0) {
|
||||
j = a(context);
|
||||
}
|
||||
b = j;
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
private static String j(Context context) {
|
||||
return context.getApplicationContext().getSharedPreferences("deviceId", 0).getString(BuildStepFragment.UUID, "");
|
||||
}
|
||||
|
||||
private static String a(Context context) {
|
||||
String b2 = b(b(context));
|
||||
a(context, b2);
|
||||
return b2;
|
||||
}
|
||||
|
||||
private static String b(String str) {
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update(str.getBytes());
|
||||
return new BigInteger(1, messageDigest.digest()).toString(16);
|
||||
} catch (NoSuchAlgorithmException unused) {
|
||||
throw new IllegalStateException("MessageDigest md5 fail.");
|
||||
}
|
||||
}
|
||||
|
||||
private static String c(Context context) {
|
||||
String string = Settings.Secure.getString(context.getContentResolver(), "android_id");
|
||||
return (string == null || "9774d56d682e549c".equals(string)) ? "" : string;
|
||||
}
|
||||
|
||||
private static void a(Context context, String str) {
|
||||
SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("deviceId", 0).edit();
|
||||
edit.putString(BuildStepFragment.UUID, str);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
@SuppressLint({"MissingPermission"})
|
||||
private static String d() {
|
||||
try {
|
||||
String serial = Build.VERSION.SDK_INT >= 26 ? Build.getSerial() : Build.SERIAL;
|
||||
return CategoryModel.unknown.equals(serial.toLowerCase()) ? "" : serial;
|
||||
} catch (SecurityException unused) {
|
||||
Log.i("Analytics", "Get sn is not permission.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String f() {
|
||||
for (String str : new String[]{"/sys/class/net/wlan0/address", "/sys/class/net/eth0/address", "/sys/devices/virtual/net/wlan0/address"}) {
|
||||
String a2 = a(str);
|
||||
if (a2.length() > 0) {
|
||||
return a2;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String b(Context context) {
|
||||
String g = g(context);
|
||||
String c = c(context);
|
||||
String f = f(context);
|
||||
String d = d();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
if (g.length() != 0) {
|
||||
stringBuffer.append(g);
|
||||
}
|
||||
if (c.length() != 0) {
|
||||
stringBuffer.append(c);
|
||||
}
|
||||
if (f.length() != 0) {
|
||||
stringBuffer.append(f);
|
||||
}
|
||||
if (d.length() != 0) {
|
||||
stringBuffer.append(d);
|
||||
}
|
||||
if (stringBuffer.length() == 0) {
|
||||
stringBuffer.append(UUID.randomUUID().toString().replace("-", ""));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String e(Context context) {
|
||||
return i(context);
|
||||
}
|
||||
|
||||
private static String g() {
|
||||
try {
|
||||
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
if (!networkInterfaces.hasMoreElements()) {
|
||||
return "";
|
||||
}
|
||||
NetworkInterface nextElement = networkInterfaces.nextElement();
|
||||
String name = nextElement.getName();
|
||||
if (!"wlan0".equals(name) && !"eth0".equals(name)) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
byte[] hardwareAddress = nextElement.getHardwareAddress();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b2 : hardwareAddress) {
|
||||
sb.append(String.format("%02X:", Byte.valueOf(b2)));
|
||||
}
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
return sb.toString().toLowerCase(Locale.getDefault());
|
||||
} catch (SocketException unused) {
|
||||
return "";
|
||||
}
|
||||
} catch (SocketException unused2) {
|
||||
Log.w("Analytics", "Get Enumeration fail.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(String str) {
|
||||
String str2 = "";
|
||||
try {
|
||||
FileReader fileReader = new FileReader(str);
|
||||
str2 = new BufferedReader(fileReader, DataDecryptTool.DECRYPT_SP_FILE).readLine();
|
||||
fileReader.close();
|
||||
} catch (FileNotFoundException | IOException unused) {
|
||||
}
|
||||
return str2;
|
||||
}
|
||||
}
|
114
sources/com/ubtrobot/analytics/device/MobileDeviceInfo.java
Normal file
114
sources/com/ubtrobot/analytics/device/MobileDeviceInfo.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.ubtrobot.analytics.device;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class MobileDeviceInfo implements DeviceInfo, Parcelable {
|
||||
public static final Parcelable.Creator<MobileDeviceInfo> CREATOR = new Parcelable.Creator<MobileDeviceInfo>() { // from class: com.ubtrobot.analytics.device.MobileDeviceInfo.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public MobileDeviceInfo createFromParcel(Parcel parcel) {
|
||||
return new MobileDeviceInfo(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public MobileDeviceInfo[] newArray(int i) {
|
||||
return new MobileDeviceInfo[i];
|
||||
}
|
||||
};
|
||||
private static final String TAG = "Analytics";
|
||||
private String appVersion;
|
||||
private String channel;
|
||||
private String language;
|
||||
private String model;
|
||||
private String osVersion;
|
||||
private String simOperator;
|
||||
private String timezone;
|
||||
private String userId;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getAppVersion() {
|
||||
return this.appVersion;
|
||||
}
|
||||
|
||||
public String getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
public String getOsVersion() {
|
||||
return this.osVersion;
|
||||
}
|
||||
|
||||
public String getSimOperator() {
|
||||
return this.simOperator;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return this.timezone;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public MobileDeviceInfo setChannel(String str) {
|
||||
this.channel = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MobileDeviceInfo setUserId(String str) {
|
||||
this.userId = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "MobileDeviceInfo{model='" + this.model + "', osVersion='" + this.osVersion + "', language='" + this.language + "', timezone='" + this.timezone + "', appVersion='" + this.appVersion + "', userId='" + this.userId + "', channel='" + this.channel + "', simOperator='" + this.simOperator + "'}";
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.model);
|
||||
parcel.writeString(this.osVersion);
|
||||
parcel.writeString(this.language);
|
||||
parcel.writeString(this.timezone);
|
||||
parcel.writeString(this.appVersion);
|
||||
parcel.writeString(this.userId);
|
||||
parcel.writeString(this.channel);
|
||||
parcel.writeString(this.simOperator);
|
||||
}
|
||||
|
||||
public MobileDeviceInfo(Context context) {
|
||||
this.model = DeviceInfoUtils.b();
|
||||
this.osVersion = DeviceInfoUtils.c();
|
||||
this.language = DeviceInfoUtils.a();
|
||||
this.timezone = DeviceInfoUtils.e();
|
||||
this.appVersion = DeviceInfoUtils.d(context);
|
||||
this.simOperator = DeviceInfoUtils.h(context);
|
||||
}
|
||||
|
||||
private MobileDeviceInfo(Parcel parcel) {
|
||||
this.model = parcel.readString();
|
||||
this.osVersion = parcel.readString();
|
||||
this.language = parcel.readString();
|
||||
this.timezone = parcel.readString();
|
||||
this.appVersion = parcel.readString();
|
||||
this.userId = parcel.readString();
|
||||
this.channel = parcel.readString();
|
||||
this.simOperator = parcel.readString();
|
||||
}
|
||||
}
|
106
sources/com/ubtrobot/analytics/device/RobotDeviceInfo.java
Normal file
106
sources/com/ubtrobot/analytics/device/RobotDeviceInfo.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.ubtrobot.analytics.device;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.ubtrobot.analytics.ModuleVersion;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class RobotDeviceInfo implements DeviceInfo, Parcelable {
|
||||
public static final Parcelable.Creator<RobotDeviceInfo> CREATOR = new Parcelable.Creator<RobotDeviceInfo>() { // from class: com.ubtrobot.analytics.device.RobotDeviceInfo.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public RobotDeviceInfo createFromParcel(Parcel parcel) {
|
||||
return new RobotDeviceInfo(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public RobotDeviceInfo[] newArray(int i) {
|
||||
return new RobotDeviceInfo[i];
|
||||
}
|
||||
};
|
||||
private String channel;
|
||||
private String language;
|
||||
private String model;
|
||||
private List<ModuleVersion> moduleVersions;
|
||||
private String osVersion;
|
||||
private String timezone;
|
||||
private String userId;
|
||||
|
||||
public RobotDeviceInfo(List<ModuleVersion> list) {
|
||||
this.model = DeviceInfoUtils.b();
|
||||
this.osVersion = DeviceInfoUtils.c();
|
||||
this.language = DeviceInfoUtils.a();
|
||||
this.timezone = DeviceInfoUtils.e();
|
||||
this.moduleVersions = list;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
public List<ModuleVersion> getModuleVersions() {
|
||||
return this.moduleVersions;
|
||||
}
|
||||
|
||||
public String getOsVersion() {
|
||||
return this.osVersion;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return this.timezone;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public RobotDeviceInfo setChannel(String str) {
|
||||
this.channel = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RobotDeviceInfo setUserId(String str) {
|
||||
this.userId = str;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "RobotDeviceInfo{model='" + this.model + "', osVersion='" + this.osVersion + "', language='" + this.language + "', timezone='" + this.timezone + "', moduleVersions=" + this.moduleVersions + ", userId='" + this.userId + "', channel='" + this.channel + "'}";
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.model);
|
||||
parcel.writeString(this.osVersion);
|
||||
parcel.writeString(this.language);
|
||||
parcel.writeString(this.timezone);
|
||||
parcel.writeTypedList(this.moduleVersions);
|
||||
parcel.writeString(this.userId);
|
||||
parcel.writeString(this.channel);
|
||||
}
|
||||
|
||||
protected RobotDeviceInfo(Parcel parcel) {
|
||||
this.model = parcel.readString();
|
||||
this.osVersion = parcel.readString();
|
||||
this.language = parcel.readString();
|
||||
this.timezone = parcel.readString();
|
||||
this.moduleVersions = parcel.createTypedArrayList(ModuleVersion.CREATOR);
|
||||
this.userId = parcel.readString();
|
||||
this.channel = parcel.readString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user