Skip to content

Commit

Permalink
fix: get device id
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Aug 19, 2024
1 parent aadb4e3 commit e00ea6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/hat/holo/token/ModuleMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions app/src/main/java/hat/holo/token/utils/DeviceManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}

0 comments on commit e00ea6f

Please sign in to comment.