Skip to content

Send remote preference updates to the instance system_server subscribed on - #1109

Open
dev-nagisa wants to merge 1 commit into
JingMatrix:masterfrom
dev-nagisa:fix/system-server-remote-prefs
Open

dev-nagisa wants to merge 1 commit into
JingMatrix:masterfrom
dev-nagisa:fix/system-server-remote-prefs

Conversation

@dev-nagisa

Copy link
Copy Markdown

Fixes #1083.

getModulesForSystemServer can run before the first rebuild has loaded a module, and takes its own branch: it builds a LoadedModule with a fresh InjectedModuleService. system_server subscribes its remote preference callback on that instance. The rebuild then makes a second one — oldModule is still null there — and updateRemotePreferences / deleteRemotePreferences notify the cache's instance, so system_server keeps the values it read at boot and onRemotePreferencesChanged never fires.

The instance handed out on that path is now kept per package and adopted by the rebuild, so system_server and the cache hold the same object.

  • ConfigCache: new preloadedServices map. getModulesForSystemServer hands out the mapped instance (computeIfAbsent), the rebuild takes it with remove before falling back to InjectedModuleService(pkgName).
  • Nothing else changes: no mutation of state.modules on the pre-cache path, no injection, IPC or API changes.

Not verified with a local build — :daemon wants NDK 30 and this machine cannot install it into the SDK, so the CI run on this PR is the first compile. The change is Kotlin only, and formatting follows the module's ktfmt Meta style.

The diagnosis and the shape of the fix come from @varma322 in #1083.

…ed on

getModulesForSystemServer builds a LoadedModule of its own when the cache has not
loaded the module yet, and system_server subscribes its remote preference callback
on that object's service. The rebuild then made a second InjectedModuleService,
because oldModule is still null at that point, and ModuleAppService notifies the
cache's instance — so the subscriber heard nothing until the next reboot.

Keep the service the pre-cache path handed out and adopt it in the rebuild, so both
sides hold the same object.

Fixes JingMatrix#1083
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.

system_server never receives remote preference updates: getModulesForSystemServer() subscribes it on a module service the cache never adopts

1 participant