Repository navigation
Refuse a scope target that reaches nothing, and name the framework - #1062
Closed
JingMatrix wants to merge 1 commit into
Closed
JingMatrix wants to merge 1 commit into
JingMatrix wants to merge 1 commit into
Conversation
The scope table takes any string, and nothing on the way in asked whether that string named anything. `handleScope` parsed a target and wrote it: a name that resolves for nobody was accepted, listed back by `scope ls`, and expanded to no process at all — a module that is configured and never loads, with nothing anywhere to say why. `scope add` and `scope set` now refuse such a target by name, through the same predicate the manager's own installed list is filtered by, so what the editor offers and what a write may name mean one thing. The predicate has a third answer for having no package manager to ask, which this socket can reach before `main` has waited for one and which must not be read as a refusal, and `scope rm` still takes anything, because a row already written this way has to stay removable. `system` is the system server and `android` is the ordinary framework package, and the CLI spelled out neither. A row naming `android` is a legitimate row — that package's injectable process is android:ui — but it cannot reach the system server: `getModulesForSystemServer` asks the scope table for the rows spelled `system` alone, because it answers before any package manager exists to expand a package name with. The rebuild nevertheless expanded such a row into a `system`/1000 entry, which nothing ever queries, so the module held the framework in the configuration and was never loaded into it. That entry goes, and the rebuild now names the package it came from. The three target-taking commands and `scope --help` say which word means which. Also here: the scope request path kept its own copy of the "is this target there" test, which is now the one predicate beside the rebuild that depends on it, and the three commands share one target parse rather than spelling `pkg/user_id` out apiece. Fixes #1061
1 task done
Owner
Author
|
Basically, AI generated PRs are of low quality. Sometimes I wish AI could replace me, sigh... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A module scoped to the system framework through the CLI is never loaded into it, and says nothing anywhere. #1061 is that, configured entirely through
vector-clion a device with no manager:cli scope lsanswersandroid,com.google.android.gmsand the module's own package, the framework bootstraps completely insidesystem_server— injection, PreloadedDex, full LSPlant init, every framework hook, the daemon channel — and then module loading for the system package never starts. No error, no exception, no skip entry.getModulesForSystemServeris the whole of where that process's module set comes from, by way ofgetAllModulessending uid 1000 and processsystemthere rather than to the scope map, and it readssystemServerModuleRows—app_pkg_name = 'system', and nothing else, because it answers before any package manager exists to expand a package name with. A row spelledandroidis therefore invisible to it, and the reporter's correct observation that nothing was skipped is for a different reason than they took it for:SystemServerService.attachProcessdoes not consult the scope at all, soProcess channel attached for systemand noSkipped system/1000is what both a working and an unconfigured system server look like.Two things let the row be written and then kept quiet about it.
The CLI wrote whatever it was handed.
handleScopesplit a target on/and passed the halves tosetModuleScope, which normalises the user id forsystemand has never had an opinion about the name. A typo, a package that was uninstalled, a package name from another device: all accepted, all listed back byscope ls, all reaching nothing.addandsetnow refuse a target the daemon can see is not there, by name, through the predicategetInstalledPackagesFromAllUsersfilters the manager's own list by — so what the editor offers and what a write may name are one thing, hidden packages included. The predicate has a third answer for having no package manager to ask, since this socket is listening beforemainhas waited for one and a question that cannot be asked is not a no.rmdeliberately still takes anything, because the rows already written this way have to stay removable.The rebuild built an entry for it that nothing queries.
androidresolves, so the row went down the ordinary path, andfetchProcessesanswerssystemfor that package among others — the expansion added asystem/1000 entry, which no reader ever looks up, sincegetAllModulessends that process to the database instead. The module held the framework in the configuration and was never in it. That entry goes, and the rebuild logs the package the row named and the word that would have worked.com.android.providers.settingsis the same shape and gets the same line, correctly: its provider does run in the system server, andsystemis how a module reaches it.Which leaves the vocabulary, which is the actual trap.
systemis the system server andandroidis the ordinary framework package —ScopeViewModelsynthesises the first and shows it assystem_server,swapLegacyFrameworkNamesturns a legacy module's reversed spelling around, and the CLI said neither. It cannot refuseandroid: that is a legitimate row, reachingandroid:ui. Soscope --helpand the three target-taking commands spell out which word means which.Also here: the scope request path had its own inline copy of the "is this target there" test, which is now the one predicate beside the rebuild that depends on it; and the three commands share one target parse instead of spelling
pkg/user_idout apiece.Left alone: that
system/1000 can be in the scope map at all. Nothing reads it, so the entry is dead rather than wrong, and removing the special case ingetAllModuleswould mean teaching the system-server path to answer from a cache that does not exist when it is asked.Not tested on a device. The refusal and the help text are straightforward; the rebuild's warning is on a path I can only reach by configuring a module the way #1061 did.