Skip to content

Settings: Read defaults from the bundled partition (#2852)#3394

Open
abranson wants to merge 1 commit intomicrog:masterfrom
abranson:master
Open

Settings: Read defaults from the bundled partition (#2852)#3394
abranson wants to merge 1 commit intomicrog:masterfrom
abranson:master

Conversation

@abranson
Copy link
Copy Markdown

Use ApplicationInfo partition flags to detect whether GmsCore was originally bundled on product or system_ext, and read etc/microg.xml from that partition. Keep /system/etc/microg.xml as a shared defaults source underneath partition-specific overrides.

@mar-v-in
Copy link
Copy Markdown
Member

Any reason to only allow /product/etc/microg.xml when the package is installed on /product? Same for /system_ext?

How do those internal methods (isProduct and isSystemExt) behave when a package that was originally installed in /product or/system_ext is updated by the user?

@abranson
Copy link
Copy Markdown
Author

Any reason to only allow /product/etc/microg.xml when the package is installed on /product? Same for /system_ext?

It was the suggestion here: #2852 (comment) to "first search on the same partition of the apk (whatever it is) and then fallback to system." and I thought that made a lot of sense. If we bundle then it should all be in the same partition. Falling back to system is only needed for backwards compat, but I think that's necessary.

How do those internal methods (isProduct and isSystemExt) behave when a package that was originally installed in /product or/system_ext is updated by the user?

There isn't any public docs that I found for those, but I couldn't use sourceDir precisely because it does not preserve the original installed location. These flags do get preserved: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/services/core/java/com/android/server/pm/InstallPackageHelper.java#2101
They are hidden API, but I think it's exactly what they're used for.

@ale5000-git
Copy link
Copy Markdown
Member

ale5000-git commented Apr 19, 2026

@mar-v-in
On Android various standard Android xml files are restricted to the same partition, so I think it make sense to follow the trend.

Also I suggest to change the path to /<partition-name>/etc/<package-name>/settings.xml => example: /product/etc/com.google.android.gms/settings.xml, and use /system/etc/microg.xml only as final fallback.
In this way a fork with a different package name (at compile time) would have a different path.

Use `ApplicationInfo` partition flags to detect whether GmsCore was
originally bundled on `product` or `system_ext`, and read
`etc/<package>/microg.xml` or `etc/microg.xml` from that partition.
Keep `/system/etc/microg.xml` as a shared defaults source.
@abranson
Copy link
Copy Markdown
Author

Now it checks /$partition/etc/$packageName/settings.xml, then /$partition/etc/microg.xml, and finally /system/etc/microg.xml. I've seen anticipation of /$partition/etc/microg.xml so I thought it would be nice to leave that in.

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.

3 participants