Class Replies

java.lang.Object
com.aurelienpierre.sioul.Replies

final class Replies extends Object
A reply from your computers sent through a notification's own Reply, as the phone's shade sends one typed under it (docs/android.md, "Replies from your computers"; Rust's side: crates/sioul-app/src/replies.rs, crates/sioul-core/src/replies.rs). Here: which of a notification's actions is its Reply and which its Mark as read, found by what they mean, never by their titles nor their places (choose(java.util.List<com.aurelienpierre.sioul.Replies.Act>, boolean, boolean)); which may not be sent (refusal(com.aurelienpierre.sioul.Replies.Act, boolean, boolean)); and the sending, the shade's own way (send(android.content.Context, com.aurelienpierre.sioul.Replies.Found, java.lang.String, boolean)). Nothing else is ever sent: no Delete, Archive, Block, Call, a bot's button nor Copy; no notification is tapped, dismissed or cancelled; no action that would open an app on the phone. Before Android 12 nothing is offered at all: its actions do not say what refusal(com.aurelienpierre.sioul.Replies.Act, boolean, boolean) needs.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static final class 
    One action of a notification as the choice reads it: plain data, made on the phone from a Notification.Action or a car extender's bundle (found(android.app.Notification)), by hand in android/jvm-checks/RepliesCheck.java.
    (package private) static final class 
    What a notification offers (choose(java.util.List<com.aurelienpierre.sioul.Replies.Act>, boolean, boolean)): its Reply and its Mark as read, each null when none.
    (package private) static final class 
    An action found on the phone: what the choice reads, and what sends it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final int
     
    private static final String
    Where AndroidX keeps a car extender's invisible actions in the extras (NotificationCompat.CarExtender, addInvisibleAction).
    private static final String
     
    private static final int[]
    The places, in the order they are looked in.
    (package private) static final int
    Where an action was found: the notification's own actions, the car extender's invisible ones, the watch's.
    (package private) static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static List<Replies.Act>
    What the choice reads of the actions found.
    private static void
    add(List<Replies.Found> out, int place, Notification.Action action)
    One of a notification's own or a watch's actions.
    private static void
    car(Bundle extras, List<Replies.Found> out)
    A car extender's invisible actions, as AndroidX keeps them: bundles "0", "1"… each with its PendingIntent ("actionIntent"), its meaning ("semanticAction"), its title and its inputs as bundles of their own ("remoteInputs": "resultKey", "allowFreeFormInput"); an input made again here from its key, which is all the shade's filling reads of it.
    (package private) static Replies.Choice
    choose(List<Replies.Act> acts, boolean conversation, boolean smsApp)
    A notification's Reply and Mark as read, by what Android says they mean, looked for in its own actions, then the car extender's, then the watch's: Reply, an action that says it is one (SEMANTIC_ACTION_REPLY) with an input that takes free text; Mark as read, one that says it is one (SEMANTIC_ACTION_MARK_AS_READ).
    (package private) static List<Replies.Found>
    A notification's actions in the three places: its own, the car extender's invisible ones, the watch's.
    (package private) static int
    live(String[] packages, String[] keys, boolean[] own, String notice)
    Which of the notifications listed a reply names: the one whose name is its (AppNotes.talkKey of its app and Android's key, as Rust's `replies::notice`), of this phone's own profile, never a work profile's; -1 for none.
    (package private) static JSONObject
    What another profile's notification (a work profile's) offers your computers: nothing, since the listener never answers one (live(java.lang.String[], java.lang.String[], boolean[], java.lang.String)).
    (package private) static Replies.Found
    The action found for an act chosen; null for none.
    (package private) static JSONObject
    offer(Notification n, boolean conversation, boolean smsApp)
    What a notification offers a reply from your computers, for Rust (phonemsgs.rs, `Offer`): a Reply and a Mark as read there and sendable (the lock aside, which is looked at when one is sent).
    (package private) static String
    refusal(Replies.Act act, boolean fill, boolean locked)
    Why an action may not be sent; "" when it may.
    (package private) static void
    send(Context context, Replies.Found found, String words, boolean fill)
    Sent as the phone's shade sends a reply typed under a notification (SystemUI's RemoteInputViewController): the words under its first free-text input's key, in a fill-in intent sent to the foreground's receivers, marked typed by a person (SOURCE_FREE_FORM_INPUT); a Mark as read (`fill` false), with no fill-in.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • choose

      static Replies.Choice choose(List<Replies.Act> acts, boolean conversation, boolean smsApp)
      A notification's Reply and Mark as read, by what Android says they mean, looked for in its own actions, then the car extender's, then the watch's: Reply, an action that says it is one (SEMANTIC_ACTION_REPLY) with an input that takes free text; Mark as read, one that says it is one (SEMANTIC_ACTION_MARK_AS_READ). The first place that has one decides; two in that place ("Reply" and "Reply privately" in a group, two Mark as read) would be a guess: none, never the first by order. When no action says it is a Reply, the one action whose input takes free text, said nothing of, in a notification Android takes as a conversation or the phone's SMS app's; two such would be a guess: none. Never one the system added (contextual), never one found by its title or its place. Pure: android/jvm-checks/RepliesCheck.java.
    • refusal

      static String refusal(Replies.Act act, boolean fill, boolean locked)
      Why an action may not be sent; "" when it may. "none": there is none; "activity": it would open an app on the phone; "closed": a Reply (`fill`) whose PendingIntent is immutable; "locked": its app asks for an unlocked phone and the phone is locked. Pure: android/jvm-checks/RepliesCheck.java.
    • live

      static int live(String[] packages, String[] keys, boolean[] own, String notice)
      Which of the notifications listed a reply names: the one whose name is its (AppNotes.talkKey of its app and Android's key, as Rust's `replies::notice`), of this phone's own profile, never a work profile's; -1 for none. Pure: android/jvm-checks/RepliesCheck.java.
    • acts

      What the choice reads of the actions found.
    • of

      The action found for an act chosen; null for none.
    • found

      A notification's actions in the three places: its own, the car extender's invisible ones, the watch's. None before Android 12.
    • add

      private static void add(List<Replies.Found> out, int place, Notification.Action action)
      One of a notification's own or a watch's actions.
    • car

      private static void car(Bundle extras, List<Replies.Found> out)
      A car extender's invisible actions, as AndroidX keeps them: bundles "0", "1"… each with its PendingIntent ("actionIntent"), its meaning ("semanticAction"), its title and its inputs as bundles of their own ("remoteInputs": "resultKey", "allowFreeFormInput"); an input made again here from its key, which is all the shade's filling reads of it.
    • offer

      static JSONObject offer(Notification n, boolean conversation, boolean smsApp) throws JSONException
      What a notification offers a reply from your computers, for Rust (phonemsgs.rs, `Offer`): a Reply and a Mark as read there and sendable (the lock aside, which is looked at when one is sent).
      Throws:
      JSONException
    • nothing

      static JSONObject nothing() throws JSONException
      What another profile's notification (a work profile's) offers your computers: nothing, since the listener never answers one (live(java.lang.String[], java.lang.String[], boolean[], java.lang.String)).
      Throws:
      JSONException
    • send

      static void send(Context context, Replies.Found found, String words, boolean fill) throws PendingIntent.CanceledException
      Sent as the phone's shade sends a reply typed under a notification (SystemUI's RemoteInputViewController): the words under its first free-text input's key, in a fill-in intent sent to the foreground's receivers, marked typed by a person (SOURCE_FREE_FORM_INPUT); a Mark as read (`fill` false), with no fill-in. No start of an activity is asked for. Throws when the intent is spent or cancelled: its notification is gone.
      Throws:
      PendingIntent.CanceledException