|
YAACC - UPNP Client and Server
|
The screen/audio streaming permission flow of the yaacc server row: asks for the MediaProjection permission, applies the answer, and resets the streaming state when the projection stops. More...

Public Member Functions | |
| StreamingPermissionHelper (Context context, Runnable refreshAdapter) | |
| boolean | hasRecordAudioPermission () |
| void | onRecordAudioResult (boolean granted) |
| Applies the answer to the RECORD_AUDIO question: a denial switches the streaming buttons off, exactly like a denied screen capture permission. | |
| Intent | createRequestIntent () |
| void | onPermissionResult (int requestCode, int resultCode, Intent data) |
Applies the answer to the request issued by createRequestIntent(). | |
| void | registerStopCallback () |
| Refreshes the server row when the projection stops. | |
| void | unregisterStopCallback () |
Call from onStop. | |
Static Public Attributes | |
| static final int | REQUEST_CODE_RECORD_AUDIO = 2002 |
| Request code of the runtime permission question for the audio capture (RECORD_AUDIO). | |
The screen/audio streaming permission flow of the yaacc server row: asks for the MediaProjection permission, applies the answer, and resets the streaming state when the projection stops.
Shared by every fragment that hosts the BrowseDeviceAdapter.
Usage in the fragment: call createRequestIntent() from the adapter's permission callback and start it with startActivityForResult(intent,; pass the result of
MediaProjectionHelper.REQUEST_CODE_MEDIA_PROJECTION)onActivityResult to onPermissionResult(int, int, Intent); call registerStopCallback() in onStart and unregisterStopCallback() in onStop.
Security: the permission result Intent is a capability to capture the screen. It is handed straight to MediaProjectionHelper, which keeps it in its static fields only. It is never put in a Bundle, preferences or another Intent, and its extras are never logged. A result is accepted only after this helper issued a request and only for that request code. Only the application context is kept. Main thread only.
| de.yaacc.browser.StreamingPermissionHelper.StreamingPermissionHelper | ( | Context | context, |
| Runnable | refreshAdapter ) |
| context | any context; only the application context is kept |
| refreshAdapter | refreshes the server row after the streaming state changed; called on the main thread, between register and unregister of the stop callback and after a permission result |
| Intent de.yaacc.browser.StreamingPermissionHelper.createRequestIntent | ( | ) |
startActivityForResult and MediaProjectionHelper#REQUEST_CODE_MEDIA_PROJECTION. Returns null before Android 10. 
| boolean de.yaacc.browser.StreamingPermissionHelper.hasRecordAudioPermission | ( | ) |
| void de.yaacc.browser.StreamingPermissionHelper.onPermissionResult | ( | int | requestCode, |
| int | resultCode, | ||
| Intent | data ) |
Applies the answer to the request issued by createRequestIntent().
Results for another request code, or without a pending request, are ignored.

| void de.yaacc.browser.StreamingPermissionHelper.onRecordAudioResult | ( | boolean | granted | ) |
Applies the answer to the RECORD_AUDIO question: a denial switches the streaming buttons off, exactly like a denied screen capture permission.
A grant needs no action here; the caller goes on with the screen capture request.
| void de.yaacc.browser.StreamingPermissionHelper.registerStopCallback | ( | ) |
Refreshes the server row when the projection stops.
Call from onStart.

| void de.yaacc.browser.StreamingPermissionHelper.unregisterStopCallback | ( | ) |
Call from onStop.
Removes exactly the callback this helper added.
