MediaProjectionHolder
Holds the MediaProjection token obtained by the host Activity.
The host app must call set after the user grants screen-capture consent (e.g. via MediaProjectionManager.createScreenCaptureIntent()). CaptureScreenTool reads the token from here.
set registers a MediaProjection.Callback, required for two reasons: the platform requires a callback to be registered before createVirtualDisplay() can be called at all — without one, CaptureScreenTool throws IllegalStateException on every call; and onStop lets this holder clear itself when the user revokes consent via the system's screen-capture notification, instead of holding a dead token that looks valid but isn't.
Properties
Functions
Stores mediaProjection as the active projection token and registers the required callback.