-
Notifications
You must be signed in to change notification settings - Fork 101
Support for Android #171
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
base: master
Are you sure you want to change the base?
Support for Android #171
Conversation
|
I tested it a bit and everything seems fine. Do you want to keep working on it?
I think with |
|
I have ended up with a separate crate, but it would be nice to have the clipboard crate, which I guess arboard is the closest to being. Would you prefer to have it as a dependency or implemented here directly? |
|
I think it's fine to leave the implementation inside arboard. |
|
While I'm not against having an Android implementation live inside My primary concern is around permissions: In modern Android versions the system has gotten fairly picky about when an app can read or modify the clipboard. Does the implementation here minimize prompts like "App accessed the clipboard"? The restrictions I'm referring to are the bits of documentation spread around
I am also aware of the fact that clearing the clipboard only works in the currently-written way when the app is in the foreground/focused, otherwise it silently fails, which might be weird to most users of the crate since things like spawning a background thread to clear the clipboard after a delay won't work all the time. |
|
These are not long-term solvable problems. Clipboard access on secure platforms like ios or android is just always going to suck. Even if you get things sorta working the way they work on desktop right now on ios or android, it's very likely to change in future OS updates and, for example, start spamming the user with "Clipboard accessed!!!" warnings again. Likewise, updates are likely to break any way of getting timered arbitrary clipboard writes (timered clipboard clearing is a special case and if people are using arboard for that then arboard should provide an interface for doing specifically that and it should not block general ios or android support). As I understand it, right now, projects that use arboard can't even compile on android without special casing all the clipboard stuff with platform-specific cfg directives, even if the clipboard functionality isn't critical. And this has been a reported issue for 3 years (#56) and an actual issue for the entire lifetime of this library. |
I admit that my approach was more like a "recon by force", hoping that rough edges are still better than not having it at all. Of course I respect your point of view and I will understand if that it is not good enough to be included in arboard. For those disappointed, I will leave an (less convenient) alternative - https://crates.io/crates/android_clipboard |
|
I'm getting this after patching egui with this change:
:[ my updated branch is here: |
|
I was able to fix this error on my branch! pasting seems to be working now on android! |
|
Hi again everyone, I'd like to followup on my past comments raising maintainability concerns. I've outlined a plan for the crate in #191 that would alleviate those and make me far more comfortable proceeding with merging Android support for Java-based applications. I wrote some words specifically about Android in the issue as well 😄.
As @wareya rightly pointed out, a lot of concerns aren't inherently solvable and just come with using a specific platform. I'm hoping that my current idea of marking Android as "tier 2/3" (TBD, I would welcome suggestions on this) communicates that to end users and sets expectations compared to the easier platforms and consistent APIs
This has been something I've idly considered since 1Password had to internally implement a foreground service for clearing the clipboard. It wouldn't be unfeasible to port that here as its own functionality AFAICT.
This is entirely correct, and I appreciate your bluntness. I am in complete agreement that the current state of things is poor and can't continue.
@podusowski In hindsight, I should have been more open to this approach when this PR was first opened, but for personal reasons I wasn't and lacked the capacity to figure out a middleground. As mentioned above, my goal now is to remove all of these stalemates between my intent to keep things "perfect" and lack of time and energy to do that. |
It is preliminary, i.e. I have only implemented text functions. I have tested in on a toy app (https://github.com/podusowski/endroid), but making workable automated tests on Android is something that needs to be yet explored.
Closes(?) #56