|
YAACC - UPNP Client and Server
|
Decides what the exported launcher activity hands on to the browser. More...

Classes | |
| class | Decision |
| Either a plain launch (no text) or a SEND text/plain with a capped text. | |
| class | StreamDecision |
What to forward for a shared file: either nothing (no stream forward; the launch stays a plain one, or the text path decides), or exactly ONE content: URI to hand on as the only item of a new ClipData together with FLAG_GRANT_READ_URI_PERMISSION. | |
Static Public Member Functions | |
| static Decision | decide (String action, String type, String text) |
| static StreamDecision | decideStream (String action, String type, String streamUri, String clipItemUri, int incomingFlags, String ownAuthority) |
| Decides whether the launcher forwards a shared file. | |
| static String | rejectionReason (String action, String type, String streamUri, String clipItemUri, int incomingFlags, String ownAuthority) |
Why decideStream does not forward, as a short fixed code for the log (it names no URI, no type and no other payload), or null if it forwards. | |
| static boolean | isFileShareAttempt (String action, boolean hasExtraStream, boolean hasClipUri) |
| Whether the incoming intent is an attempt to share a file (a stream or a clip URI). | |
| static boolean | isStreamType (String type) |
| Whether a declared type selects the shared-file path (instead of the text path): an audio, video or image type, concrete or the sender's wildcard, exact lower case. | |
Decides what the exported launcher activity hands on to the browser.
Plain Java so it can be unit tested on the JVM; the Android Intent handling stays in the activity.
The launcher can be started by any app with any intent, so the forward is an allowlist: a plain launch for everything (MAIN, VIEW, no action, unknown actions), except an ACTION_SEND of exactly text/plain with a non-empty text of at most ShareUriPolicy#MAX_TEXT_LENGTH characters, which is forwarded as that text and nothing else. A text over the cap is dropped, not truncated, and the launch becomes a plain one.
Action and type are compared exactly, case-sensitively: the manifest filter and the share handler use the lower-case spelling, so another spelling is not forwarded.
|
static |
| action | the incoming action, may be null |
| type | the incoming MIME type, may be null |
| text | the incoming text (EXTRA_TEXT or clip text), may be null |
|
static |
Decides whether the launcher forwards a shared file.
Forwarded only if ALL hold:
action is exactly android.intent.action.SEND; type is an audio, video or image type, concrete (image/png) or a sender's wildcard (audio/*): exact lower-case match, no parameters, no other spelling. The real type is checked later via SharedContentPolicy#chooseMimeType; text/plain (the text path, see decide(String, String, String)), application/*, a bare */* and null are not forwarded; streamUri (EXTRA_STREAM as text) equals clipItemUri (ClipData item 0 as text) exactly: the system checks only data and ClipData for the grant, never EXTRA_STREAM, so a mismatch could name a URI the sender holds no grant for; incomingFlags contain FLAG_GRANT_READ_URI_PERMISSION: the sender really passed a read grant on; SharedContentPolicy.isAcceptableUri(streamUri, ownAuthority) (only content: URIs of other apps). Otherwise the answer is "no stream forward". Never throws.
| action | the incoming action, may be null |
| type | the incoming MIME type, may be null |
| streamUri | the incoming EXTRA_STREAM URI as text, may be null |
| clipItemUri | the URI of ClipData item 0 as text, may be null |
| incomingFlags | the incoming intent flags |
| ownAuthority | the authority of yaacc's own file provider |

|
static |
Whether the incoming intent is an attempt to share a file (a stream or a clip URI).
When such an attempt is not forwarded, the user is told once, with a fixed text, that only audio, video, images and links are accepted; a text share never counts.
|
static |
Whether a declared type selects the shared-file path (instead of the text path): an audio, video or image type, concrete or the sender's wildcard, exact lower case.
The browser side uses the same test as the launcher so the two cannot disagree about which path an intent takes.
Referenced by de.yaacc.browser.ShareIntentHandler.handle().

|
static |
Why decideStream does not forward, as a short fixed code for the log (it names no URI, no type and no other payload), or null if it forwards.
Same checks in the same order.
