Skip to content

[Android] Respect custom system-wide text selection toolbar buttons #139361

Closed

Description

@bleroux

Edit

This feature is implemented. It is directly available in newly created Flutter project since Flutter 3.19.
For older project, the following section should be added to the Android manifest file:

 <!--  Required to query activities that can process text, see:
       https://developer.android.com/training/package-visibility and
       https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

       In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin.  -->
<queries>
  <intent>
    <action android:name="android.intent.action.PROCESS_TEXT"/>
    <data android:mimeType="text/plain"/>
  </intent>
</queries>

Use case

On Android, it's possible to write an app that adds a custom button to the system-wide text selection toolbar. For example, here the Android app AnkiDroid has added the "Anki Card" button to my text selection toolbar, and it appears in any app, such as the Google app here.

Proposal

Flutter should respect these added buttons, so that in any Flutter app running on Android, the buttons that the user has added to their device show up in the default text selection toolbar just like in any native app.

This is the Android part of #107603 which is broad (all plaforms).
Creating this issue to make it easier to follow.

Implementation steps

# Status Description Related Work
1 Done Engine - Add Android support for querying and invoking text processing actions. flutter-team-archive/engine#44579
2 Done Framework - Add ProcessTextService to intereact with the engine #137145
3 Done fluttter_tools - Add queries section to Android manifest file #137207
4 Done Framework - Add queried text processing actions to the text selection toolbar for EditableText #139738
5 Done Framework - Add queried text processing actions to the text selection toolbar for SelectionRegion #141103

Activity

  1. added
    in triagePresently being triaged by the triage team
    a: text inputEntering text in a text field or keyboard related problems
    platform-androidAndroid applications specifically
    p: material_uimaterial_ui package in flutter/packages
    a: fidelityMatching the OEM platforms better
    c: proposalA detailed proposal for a change to Flutter
    P1High-priority issues at the top of the work list
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Dec 1, 2023
  2. self-assigned this
    on Dec 1, 2023
  3. moved this from To do to In progress in Nevercodeon Dec 1, 2023
  4. moved this from In progress to PR submitted in Nevercodeon Dec 7, 2023
  5. 19 remaining items

  6. added and removed
    team-designOwned by Design Languages team
    on May 1, 2024
  7. piedcipher commented on Aug 6, 2024

    @piedcipher
    Member

    I'm removing the fixed label as issue is still open.

  8. removed
    r: fixedIssue is closed as already fixed in a newer version
    on Aug 6, 2024
  9. self-assigned this
    on Aug 7, 2024
  10. added
    r: fixedIssue is closed as already fixed in a newer version
    on Aug 7, 2024
  11. bleroux commented on Aug 7, 2024

    @bleroux
    ContributorAuthor

    Closing this issue as it is fixed since Flutter 3.19.
    For Flutter projects created since Flutter 3.19, the feature is automatically available.
    For projects created before Flutter 3.19, a section should be added to the Android manifest. I edited the issue description accordingly and I will open another issue to track the following question: "Do we have a way to change the Android manifest file for existing Flutter apps like this (see last comment)?"

    Edit: filed #152991

  12. moved this from To do to Done (PR merged) in Nevercodeon Aug 7, 2024
  13. github-actions commented on Aug 21, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  14. locked as resolved and limited conversation to collaborators on Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: fidelityMatching the OEM platforms bettera: text inputEntering text in a text field or keyboard related problemsc: proposalA detailed proposal for a change to Flutterp: material_uimaterial_ui package in flutter/packagesplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

  • Status
    Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions