Repository navigation
fix(mfi): keep local MFi documents a picker cannot grant lasting access to - #50
Open
code-new-bie wants to merge 1 commit into
Open
code-new-bie wants to merge 1 commit into
code-new-bie wants to merge 1 commit into
Conversation
…ss to A local MFi certificate or private key is kept only through a persistable URI grant. Some head-unit file pickers cannot give one: on BYD DiLink the system file picker runs as the system user, Android refuses its grants to other apps, and the returned URI carries no access at all. Picking a document there only showed "Could not keep access to the selected certificate", and local MFi could not be used. A picked document is now kept, in this order: 1. Through a persistable grant, as before. 2. Otherwise read once through the picker's temporary grant and kept as a private copy under files/mfi/. 3. Otherwise its document ID is mapped to a file path (external storage volumes, raw downloads, file URIs) and read with READ_EXTERNAL_STORAGE (maxSdkVersion 32, asked for when needed) and requestLegacyExternalStorage for Android 10, then kept as a private copy. 4. Otherwise the user is asked to pick it from internal storage or a USB drive. Copies are at most 64 KB, replace the previous copy of the same kind, show as "(private copy)" in the settings, and are excluded from backups and device transfers. Each step is written to the session log. The runtime config accepts the copies' file:// URIs besides content:// ones, and startCarPlay reports settings the runtime config rejects instead of crashing on every launch. Verified in a BYD Song PLUS (Android 10): a certificate and key picked from a USB drive are kept as private copies and CarPlay connects with them. LocalMfiDocumentsTest covers the path mapping, replacing copies, file names and the size limit; MfiTargetConfigTest covers the accepted URIs.
code-new-bie
added a commit
to code-new-bie/xcertplay
that referenced
this pull request
Oct 12, 2026
Eight pull requests (shilapi#43 to shilapi#50) and one issue (shilapi#51) went to shilapi/xcertplay, each built on upstream 1.4.0 with one change. docs/UPSTREAM.md lists them with the commits of this branch they come from, and what was left out and why.
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 local MFi certificate or private key is kept only through a persistable
URI grant. Some head-unit file pickers cannot give one: on BYD DiLink the
system file picker runs as the system user, Android refuses its grants to
other apps, and the returned URI carries no access at all. Picking a document
there only showed "Could not keep access to the selected certificate", and
local MFi could not be used.
A picked document is now kept, in this order:
private copy under files/mfi/.
volumes, raw downloads, file URIs) and read with READ_EXTERNAL_STORAGE
(maxSdkVersion 32, asked for when needed) and
requestLegacyExternalStorage for Android 10, then kept as a private copy.
drive.
Copies are at most 64 KB, replace the previous copy of the same kind, show
as "(private copy)" in the settings, and are excluded from backups and
device transfers. Each step is written to the session log. The runtime
config accepts the copies' file:// URIs besides content:// ones, and
startCarPlay reports settings the runtime config rejects instead of
crashing on every launch.
Verified in a BYD Song PLUS (Android 10): a certificate and key picked from
a USB drive are kept as private copies and CarPlay connects with them.
LocalMfiDocumentsTest covers the path mapping, replacing copies, file names
and the size limit; MfiTargetConfigTest covers the accepted URIs.