mirror of
https://github.com/PaiGramTeam/GetToken.git
synced 2024-11-21 22:48:07 +00:00
fix: get device id
This commit is contained in:
parent
40717efbf5
commit
f91faa3112
@ -48,7 +48,6 @@ class ModuleMain : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
override fun afterHookedMethod(p: MethodHookParam) {
|
||||
val app = p.args[0] as Application
|
||||
AppUtils.init(classLoader)
|
||||
DeviceManager.init(classLoader, app.applicationContext)
|
||||
AccountManager.init(classLoader)
|
||||
appendToClassPath(app.applicationContext)
|
||||
}
|
||||
@ -68,6 +67,7 @@ class ModuleMain : IXposedHookLoadPackage, IXposedHookZygoteInit {
|
||||
tokenBtn.scaleType = ImageView.ScaleType.FIT_XY
|
||||
tokenBtn.setOnClickListener {
|
||||
if (AccountManager.isLogin) {
|
||||
DeviceManager.init(classLoader, ctx)
|
||||
if (isPatch) {
|
||||
val intent = Intent(ctx, LoaderActivity::class.java)
|
||||
intent.putExtra("accountInfo", AccountManager.accountInfo)
|
||||
|
@ -10,22 +10,19 @@ object DeviceManager {
|
||||
|
||||
private lateinit var context: Context
|
||||
private lateinit var riskManager: Any
|
||||
private lateinit var deviceUtils: Any
|
||||
private lateinit var deviceId: String
|
||||
|
||||
fun init(cl: ClassLoader, ctx: Context) {
|
||||
context = ctx
|
||||
riskManager = cl
|
||||
.loadClass("com.mihoyo.platform.account.sdk.risk.RiskManager")
|
||||
.visitStaticField<Any>("INSTANCE")
|
||||
deviceUtils = cl
|
||||
.loadClass("com.mihoyo.platform.account.sdk.utils.DeviceUtils")
|
||||
.visitStaticField<Any>("INSTANCE")
|
||||
val preDevice = ctx.getSharedPreferences("pre_device.xml", 0)
|
||||
deviceId = preDevice.getString("device_id", "").toString()
|
||||
}
|
||||
|
||||
val deviceFp get() = riskManager.invokeMethod<String>("getDeviceFp")
|
||||
|
||||
val deviceId get() = deviceUtils.invokeMethod<Context, String>("getDeviceID", context)
|
||||
|
||||
val deviceInfo get() = DeviceInfo(deviceId, deviceFp)
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user