Skip to content

Refactor framework daemon to Kotlin#597

Open
JingMatrix wants to merge 47 commits intomasterfrom
refactor
Open

Refactor framework daemon to Kotlin#597
JingMatrix wants to merge 47 commits intomasterfrom
refactor

Conversation

@JingMatrix
Copy link
Copy Markdown
Owner

This PR transitions the framework daemon from legacy Java to a modernized Kotlin implementation, rebranded as Vector. The refactor moves beyond a literal translation to implement a more robust, domain-driven architecture.

See REAMDE in module daemon for more implementation details.

@JingMatrix JingMatrix marked this pull request as ready for review March 26, 2026 18:43
@JingMatrix JingMatrix linked an issue Mar 27, 2026 that may be closed by this pull request
@JingMatrix
Copy link
Copy Markdown
Owner Author

@AllenChangMusic @jiggs82 please test the lates CI of current branch to see if the support of Android 17 beta 3 is complete now.

@jiggs82
Copy link
Copy Markdown

jiggs82 commented Mar 27, 2026

@AllenChangMusic @jiggs82 please test the lates CI of current branch to see if the support of Android 17 beta 3 is complete now.

Vector release build still isn't working for me, on lsposed manager says it's not installed

@JingMatrix
Copy link
Copy Markdown
Owner Author

@jiggs82 Please provide logs by uploading the folder /data/adb/lspd/log.

@jiggs82
Copy link
Copy Markdown

jiggs82 commented Mar 27, 2026

> @jiggs82 Please provide logs by uploading the folder /data/adb/lspd/log.
log.zip

@JingMatrix
Copy link
Copy Markdown
Owner Author

@jiggs82 It seems that Vector CI build is not flashed correctly.
Please uninstall, reboot, install Vector again.
I hope that you won't encounter this #602 (comment)

@AllenChangMusic
Copy link
Copy Markdown

AllenChangMusic commented Mar 27, 2026

@JingMatrix debug build works, but release build does not

Also... Looks like Vector has issues enabling new modules. And if you uninstall it, and reinstall, you aren't able to enable any modules. May be related to the report in the other thread where it isn't able to create the lspd folder

@jiggs82
Copy link
Copy Markdown

jiggs82 commented Mar 27, 2026

@jiggs82 It seems that Vector CI build is not flashed correctly. Please uninstall, reboot, install Vector again. I hope that you won't encounter this #602 (comment)

Still same issues and yes now I encounter that :(

@JingMatrix
Copy link
Copy Markdown
Owner Author

There are bugs in the refactoring, hence I create pr #603 to fix the issue for the java code before refactoring, to help isolated issues.

@mmmpipi
Copy link
Copy Markdown

mmmpipi commented Mar 27, 2026

When I use the release build, it crashes, but the debug build works fine.
lsposed.log
lsposed_verbose.log
I hope these logs are helpful to you.

@JingMatrix JingMatrix force-pushed the refactor branch 2 times, most recently from 3611782 to 0da27d9 Compare March 27, 2026 15:56
@JingMatrix
Copy link
Copy Markdown
Owner Author

@jiggs82 @AllenChangMusic @mmmpipi Please also test the latest CI builds of current branch, before I finally merge it.

@AllenChangMusic
Copy link
Copy Markdown

@jiggs82 @AllenChangMusic @mmmpipi Please also test the latest CI builds of current branch, before I finally merge it.

Tested and one module - InstaEclipse doesn't work in this version, but did in the previous CI.

One thing to note is in LSPosed manager, it keeps complaining there's an update, but it's the old pre-vector version

@JingMatrix
Copy link
Copy Markdown
Owner Author

@AllenChangMusic Please upload your debug version logs for the module not working.
Regarding the updating issue, see #585 (comment)

@AllenChangMusic
Copy link
Copy Markdown

@JingMatrix
LSPosed_2026-03-27T12_45_38.645418.zip

I'm not seeing any specific crash log, but this CI causes IG to crash

@JingMatrix
Copy link
Copy Markdown
Owner Author

@AllenChangMusic I see logs of containing InstaEclipse showing no issues. Is there a feature not working ?
Please descibe it, and I will see if it is related to the daemon refactoring.

@AllenChangMusic
Copy link
Copy Markdown

AllenChangMusic commented Mar 27, 2026

@AllenChangMusic I see logs of containing InstaEclipse showing no issues. Is there a feature not working ? Please descibe it, and I will see if it is related to the daemon refactoring.

Instagram app just crashes, won't even open. Compared to the previous CI, it opens fine, and you can open the InstaEclipse settings (long holding the search icon in the instagram app), and use the app just fine

@jiggs82
Copy link
Copy Markdown

jiggs82 commented Mar 27, 2026

@jiggs82 @AllenChangMusic @mmmpipi Please also test the latest CI builds of current branch, before I finally merge it.

Flashed latest build and all good here 👍🏻

@AllenChangMusic
Copy link
Copy Markdown

@JingMatrix anything you need me to debug or send logs for to help troubleshoot why it's causing crashing?

@JingMatrix
Copy link
Copy Markdown
Owner Author

@AllenChangMusic I think it is a problem of the module.
It works for instagram 421.0.0.51.66, but not for 422.0.0.44.64. Please contact the module developer to fix the problem is his hooks, see log:

03-27 19:02:26.011 15638 15638 V VectorLegacyBridge: Loading legacy module ps.reso.instaeclipse from /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/base.apk
03-27 19:02:26.100 15638 15638 V VectorLegacyBridge:   Loading class ps.reso.instaeclipse.Xposed.Module
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: (InstaEclipse): Zygote initialized.
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: (InstaEclipse) Module paths initialized:
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: SourceDir: /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/base.apk
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: LibDir: /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/lib/arm64
03-27 19:02:26.176 15638 15638 I VectorLegacyBridge: (InstaEclipse): Loaded package: com.instagram.android
03-27 19:02:26.506 15638 15638 I VectorLegacyBridge: InstaEclipse: Settings loaded via Application.attach for com.instagram.android
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: java.lang.NoSuchMethodError: com.instagram.mainactivity.InstagramMainActivity#onCreate(android.os.Bundle)#exact
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.lambda$findMethodExact$3(XposedHelpers.java:448)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers$$ExternalSyntheticLambda7.get(D8$$SyntheticClass:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at java.util.Optional.orElseThrow(Optional.java:403)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findMethodExact(XposedHelpers.java:448)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findAndHookMethod(XposedHelpers.java:295)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findAndHookMethod(XposedHelpers.java:370)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at ps.reso.instaeclipse.mods.ui.UIHookManager.mainActivity(UIHookManager.java:148)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at ps.reso.instaeclipse.Xposed.Module$1.afterHookedMethod(Module.java:161)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedBridge$LegacyApiSupport.handleAfter(XposedBridge.java:406)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.legacy.LegacyDelegateImpl.processLegacyHook(LegacyDelegateImpl.java:79)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.callback$lambda$0(VectorNativeHooker.kt:89)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.$r8$lambda$Gv0h3YyBQ5fX_R8flOBlfNtiIu0(VectorNativeHooker.kt:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorChain.proceedWith(VectorChain.kt:56)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorChain.proceed(VectorChain.kt:45)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.callback(VectorNativeHooker.kt:99)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at Vector_.attach(Dobby:11)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.Instrumentation.newApplication(Instrumentation.java:1363)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1658)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1590)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:8236)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(ActivityThread.java:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2753)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Handler.dispatchMessageImpl(Handler.java:142)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Handler.dispatchMessage(Handler.java:125)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Looper.loopOnce(Looper.java:292)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Looper.loop(Looper.java:393)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.main(ActivityThread.java:9486)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at java.lang.reflect.Method.invoke(Native Method)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:575)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:939)

@ReSo7200
Copy link
Copy Markdown

@AllenChangMusic I think it is a problem of the module.
It works for instagram 421.0.0.51.66, but not for 422.0.0.44.64. Please contact the module developer to fix the problem is his hooks, see log:

03-27 19:02:26.011 15638 15638 V VectorLegacyBridge: Loading legacy module ps.reso.instaeclipse from /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/base.apk
03-27 19:02:26.100 15638 15638 V VectorLegacyBridge:   Loading class ps.reso.instaeclipse.Xposed.Module
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: (InstaEclipse): Zygote initialized.
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: (InstaEclipse) Module paths initialized:
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: SourceDir: /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/base.apk
03-27 19:02:26.101 15638 15638 I VectorLegacyBridge: LibDir: /data/app/~~UWq7--TDph6kMPgIrSATyQ==/ps.reso.instaeclipse-7l8nP_qI2gNpWCo6ZqWTSw==/lib/arm64
03-27 19:02:26.176 15638 15638 I VectorLegacyBridge: (InstaEclipse): Loaded package: com.instagram.android
03-27 19:02:26.506 15638 15638 I VectorLegacyBridge: InstaEclipse: Settings loaded via Application.attach for com.instagram.android
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: java.lang.NoSuchMethodError: com.instagram.mainactivity.InstagramMainActivity#onCreate(android.os.Bundle)#exact
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.lambda$findMethodExact$3(XposedHelpers.java:448)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers$$ExternalSyntheticLambda7.get(D8$$SyntheticClass:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at java.util.Optional.orElseThrow(Optional.java:403)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findMethodExact(XposedHelpers.java:448)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findAndHookMethod(XposedHelpers.java:295)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedHelpers.findAndHookMethod(XposedHelpers.java:370)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at ps.reso.instaeclipse.mods.ui.UIHookManager.mainActivity(UIHookManager.java:148)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at ps.reso.instaeclipse.Xposed.Module$1.afterHookedMethod(Module.java:161)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at olXzXBq.bopZah.eGxFtiW.XposedBridge$LegacyApiSupport.handleAfter(XposedBridge.java:406)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.legacy.LegacyDelegateImpl.processLegacyHook(LegacyDelegateImpl.java:79)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.callback$lambda$0(VectorNativeHooker.kt:89)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.$r8$lambda$Gv0h3YyBQ5fX_R8flOBlfNtiIu0(VectorNativeHooker.kt:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorChain.proceedWith(VectorChain.kt:56)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorChain.proceed(VectorChain.kt:45)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at org.matrix.vector.impl.hooks.VectorNativeHooker.callback(VectorNativeHooker.kt:99)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at Vector_.attach(Dobby:11)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.Instrumentation.newApplication(Instrumentation.java:1363)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1658)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1590)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:8236)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(ActivityThread.java:0)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2753)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Handler.dispatchMessageImpl(Handler.java:142)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Handler.dispatchMessage(Handler.java:125)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Looper.loopOnce(Looper.java:292)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.os.Looper.loop(Looper.java:393)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at android.app.ActivityThread.main(ActivityThread.java:9486)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at java.lang.reflect.Method.invoke(Native Method)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:575)
03-27 19:02:26.510 15638 15638 E VectorLegacyBridge: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:939)

Hi, I am the dev of InstaEclipse, this issue was fixed with InstaEclipse 0.5 debug, the user is using it.

I will check myself...

Thanks for the great LSPosed/LSPatch!!

@JingMatrix
Copy link
Copy Markdown
Owner Author

@ReSo7200 Nice to hear from you, and it is my pleasure to serve the community. Please do tell me if current refactoring (this pr) is causing issues for your module.

I will wait for your test result before merging this.

@AllenChangMusic
Copy link
Copy Markdown

AllenChangMusic commented Mar 27, 2026

@ReSo7200
So I found that reinstalling instagram AND wiping data in Shell allowed the app to stop crashing on startup. Uninstalling and reinstalling LSPosed didn't fix it.

Looking through logcat, seeing these 3 errors consistently popping up, not sure if it's related to the hooking.

image image image

@mmmpipi
Copy link
Copy Markdown

mmmpipi commented Mar 28, 2026

@jiggs82 @AllenChangMusic @mmmpipi Please also test the latest CI builds of current branch, before I finally merge it.

it works fine! thanks

@JingMatrix
Copy link
Copy Markdown
Owner Author

@bikram-agarwal Please if the latest CI build from current pr works for you.

@bikram-agarwal
Copy link
Copy Markdown

@bikram-agarwal Please if the latest CI build from current pr works for you.

No, modules tab is again blank when I flash this.

@JingMatrix
Copy link
Copy Markdown
Owner Author

@CoelacanthusHex Thanks for continued testing, we do need users to test this build constantly.

Please try out the latest CI build: https://github.com/JingMatrix/Vector/actions/runs/23792001714

@CoelacanthusHex
Copy link
Copy Markdown

@CoelacanthusHex Thanks for continued testing, we do need users to test this build constantly.

Please try out the latest CI build: JingMatrix/Vector/actions/runs/23792001714

Still broken.
verbose_2026-03-31T18:26:39.731054.log

@JingMatrix
Copy link
Copy Markdown
Owner Author

@CoelacanthusHex Please test again and upload logs: https://github.com/JingMatrix/Vector/actions/runs/23796827077

@owocado
Copy link
Copy Markdown

owocado commented Mar 31, 2026

@JingMatrix I'm interested in helping test this PR and send logs but I want to ask this first. I'm currently on Vector 2.0 (3023, API version 100) and have 3 xposed modules: CorePatch, HMA, Revanced Xposed. Will these modules stop working once I install CI build which is using lsposed API 101?

@CoelacanthusHex
Copy link
Copy Markdown

@JingMatrix
Copy link
Copy Markdown
Owner Author

JingMatrix commented Mar 31, 2026

@owocado all the three module are legacy modules, independent of libxposed API and will continue to work even you are using CI build for API 101.

@CoelacanthusHex Please test CI build https://github.com/JingMatrix/Vector/actions/runs/23811965146 https://github.com/JingMatrix/Vector/actions/runs/23820803010

It is observed on Android 11, the SQLite engine attempts to read global configuration flags (sqlite_compatibility_wal_flags) from Settings.Global during the first database connection.

In the daemon process—which is initialized via ActivityThread.systemMain() but not "attached" to the ActivityManagerService—this lookup triggers an IPC call that AMS rejects because the PID is not a registered application, resulting in a "SecurityException: Unable to find app for caller".

This commit introduces a workaround that uses reflection to set:
- sInitialized = true
- sCallingGlobalSettings = true

inside android.database.sqlite.SQLiteCompatibilityWalFlags. This forces the framework to skip the initialization logic, bypassing the crashing ContentResolver call and allowing the database to open with default configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete support for legacy and libxposed API 101 modules [BUG] Support for Android 17 beta 13

8 participants