Skip to content

Commit

Permalink
Fix failure to get INSTANCE (#2)
Browse files Browse the repository at this point in the history
INSTANCE can only be captured once
  • Loading branch information
Howard20181 authored Aug 26, 2024
1 parent 596eae2 commit 5370f2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class MainHook : IXposedHookLoadPackage {
val seekBarObserver = loadClassOrNull("com.android.systemui.media.controls.models.player.SeekBarObserver")
val mediaViewHolder = loadClassOrNull("com.android.systemui.media.controls.models.player.MediaViewHolder")
val statusBarStateControllerImpl = loadClassOrNull("com.android.systemui.statusbar.StatusBarStateControllerImpl")
val miuiStubClass = loadClassOrNull("miui.stub.MiuiStub")
val miuiStubInstance = XposedHelpers.getStaticObjectField(miuiStubClass, "INSTANCE")

mediaViewHolder?.constructors?.first()?.createAfterHook {
val context = AndroidAppHelper.currentApplication().applicationContext
Expand Down Expand Up @@ -183,8 +185,6 @@ class MainHook : IXposedHookLoadPackage {
constructor.createAfterHook {
val context = AndroidAppHelper.currentApplication().applicationContext

val miuiStubClass = loadClassOrNull("miui.stub.MiuiStub")
val miuiStubInstance = XposedHelpers.getStaticObjectField(miuiStubClass, "INSTANCE")
val mSysUIProvider = XposedHelpers.getObjectField(miuiStubInstance, "mSysUIProvider")
val mStatusBarStateController = XposedHelpers.getObjectField(mSysUIProvider, "mStatusBarStateController")
val getLazyClass = XposedHelpers.callMethod(mStatusBarStateController, "get")
Expand Down

0 comments on commit 5370f2a

Please sign in to comment.