@SuppressLint("HardwareIds") private VDeviceInfo generateDeviceInfo() { VDeviceInfo info = generateRandomDeviceInfo(); Context context = VirtualCore.get().getContext(); if (context == null) { return info; } try { String deviceId = null; final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm != null) { deviceId = tm.getDeviceId(); } if (deviceId != null) { info.deviceId = deviceId; } String android_id = Settings.System.getString(context.getContentResolver(), Settings.System.ANDROID_ID); if (android_id != null) { info.androidId = android_id; } info.serial = Build.SERIAL; } catch (Throwable e) { e.printStackTrace(); } return info; }
@Override public VDeviceInfo getDeviceInfo(int userId, int AppId) { VDeviceInfo info; synchronized (mDeviceInfos) { info = mDeviceInfos.get(userId); if (info == null) { info = generateRandomDeviceInfo(); mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } if (AppId > 0) { char[] chars = info.bluetoothMac.toCharArray(); char[] newchars = new char[chars.length]; int count = 0; for (char aChar : chars) { if ((count + 1) % 3 != 0) newchars[count] = (char) ((aChar + AppId) % 26 + 65); else newchars[count] = 58; count += 1; } info.bluetoothMac = String.valueOf(newchars); } return info; }
@Override public VDeviceInfo getDeviceInfo(int userId) { VDeviceInfo info; synchronized (mDeviceInfos) { info = mDeviceInfos.get(userId); if (info == null) { info = generateRandomDeviceInfo(); mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } return info; }