Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content provider authority for clipboard manager confilcts if multiple tracks installed #535

Closed
patrickgold opened this issue Mar 30, 2021 · 4 comments
Assignees
Labels
bug A bug report bug-confirmed A confirmed and reproducible bug report
Milestone

Comments

@patrickgold
Copy link
Member

patrickgold commented Mar 30, 2021

When trying to install both a beta and debug version of FlorisBoard, the package manager of Android will reject the install because the authority is equal.

adb: failed to install /data/florisboard/$releases/florisboard-0.3.10-beta04.apk:
  Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Scanning Failed.:
    Can't install because provider name dev.patrickgold.florisboard.provider.clip
    (in package dev.patrickgold.florisboard.beta) is already used by dev.patrickgold.florisboard.debug]

@X-yl As you've implemented the clipboard manager and its content provider, do you know if the authority can be dynamic based on the package name (each track has a different package name, which could be used to prevent this conflict)?

Environment information

  • FlorisBoard Version: 0.3.10-beta04 / 0.3.10-debug
  • Install Source: ADB
  • Device: OnePlus 7T
  • Android version, ROM: 10
@patrickgold patrickgold added bug A bug report bug-confirmed A confirmed and reproducible bug report labels Mar 30, 2021
@patrickgold patrickgold added this to the 0.4.0 milestone Mar 30, 2021
@X-yl
Copy link
Contributor

X-yl commented Mar 30, 2021

Yes, it's possible (and fairly straightforward, thankfully). Just change the manifest so that dev.patrickgold.florisboard is replaced with ${applicationId}. Gradle will change it to the correct package name based on the build configuration. In fact I think you should probably be doing that for every mention of the package in the manifest.

Here's the documentation on it

If you'd like, I can make a PR with the change.

@patrickgold
Copy link
Member Author

patrickgold commented Mar 30, 2021

Ah I see thanks for the tip with the gradle variable! What I find funny is that Android has a system for uniquely identifying multiple equally named IME services but can't do this for content providers... (Edit: it does this because the syntax for full IME service names is packageName/imeName, which thus allows for multiple equally named imeNames.)

Anyways, I think I will make this change and also experiment where it makes sense to also use ${applicationId} instead of the hardcoded package name. Thanks for pointing me in the right direction!

@X-yl
Copy link
Contributor

X-yl commented Mar 30, 2021

Glad I could help :) What I find strange about Android development (or maybe it's just Java's fault) is that somehow the standard library is both massive and incomplete. There's always some convenient function to achieve some silly niche functionality, but it's impossible to copy from an OutputStream to an InputStream lol.

@patrickgold
Copy link
Member Author

Above commit fixes the authority clash with the content provider. I also made sure to edit the AUTHORITY constant in the Kotlin source code and tried it out by copying images, and I experienced no issues whatsoever.

As for other usages of ${applicationId}: There's not really another good use case for this in the manifest, as the class names are always the package name without suffixes (because that's what they get compiled with), so I left the other package names untouched.

@patrickgold patrickgold self-assigned this Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report bug-confirmed A confirmed and reproducible bug report
Projects
None yet
Development

No branches or pull requests

2 participants