import typing

import android.app
import android.content
import android.content.pm
import android.graphics
import android.media.tv
import android.net
import android.os
import android.util
import android.view
import java
import java.chaquopy
import java.lang
import java.util
import java.util.concurrent

class TvAdManager(java.lang.Object):
    ACTION_APP_LINK_COMMAND: typing.ClassVar[str] = ...
    APP_LINK_KEY_BACK_URI: typing.ClassVar[str] = ...
    APP_LINK_KEY_CLASS_NAME: typing.ClassVar[str] = ...
    APP_LINK_KEY_COMMAND_TYPE: typing.ClassVar[str] = ...
    APP_LINK_KEY_PACKAGE_NAME: typing.ClassVar[str] = ...
    APP_LINK_KEY_SERVICE_ID: typing.ClassVar[str] = ...
    ERROR_BLOCKED: typing.ClassVar[int] = ...
    ERROR_ENCRYPTED: typing.ClassVar[int] = ...
    ERROR_NONE: typing.ClassVar[int] = ...
    ERROR_NOT_SUPPORTED: typing.ClassVar[int] = ...
    ERROR_RESOURCE_UNAVAILABLE: typing.ClassVar[int] = ...
    ERROR_UNKNOWN: typing.ClassVar[int] = ...
    ERROR_UNKNOWN_CHANNEL: typing.ClassVar[int] = ...
    ERROR_WEAK_SIGNAL: typing.ClassVar[int] = ...
    INTENT_KEY_AD_SERVICE_ID: typing.ClassVar[str] = ...
    INTENT_KEY_CHANNEL_URI: typing.ClassVar[str] = ...
    INTENT_KEY_COMMAND_TYPE: typing.ClassVar[str] = ...
    INTENT_KEY_TV_INPUT_ID: typing.ClassVar[str] = ...
    SESSION_DATA_KEY_AD_BUFFER: typing.ClassVar[str] = ...
    SESSION_DATA_KEY_AD_REQUEST: typing.ClassVar[str] = ...
    SESSION_DATA_KEY_BROADCAST_INFO_REQUEST: typing.ClassVar[str] = ...
    SESSION_DATA_KEY_REQUEST_ID: typing.ClassVar[str] = ...
    SESSION_DATA_TYPE_AD_BUFFER_READY: typing.ClassVar[str] = ...
    SESSION_DATA_TYPE_AD_REQUEST: typing.ClassVar[str] = ...
    SESSION_DATA_TYPE_BROADCAST_INFO_REQUEST: typing.ClassVar[str] = ...
    SESSION_DATA_TYPE_REMOVE_BROADCAST_INFO_REQUEST: typing.ClassVar[str] = ...
    SESSION_STATE_ERROR: typing.ClassVar[int] = ...
    SESSION_STATE_RUNNING: typing.ClassVar[int] = ...
    SESSION_STATE_STOPPED: typing.ClassVar[int] = ...
    def getTvAdServiceList(self) -> java.util.List[TvAdServiceInfo]: ...
    def registerCallback(self, executor: java.util.concurrent.Executor, callback: TvAdManager.TvAdServiceCallback, /) -> None: ...
    def sendAppLinkCommand(self, serviceId: str | java.lang.String, command: android.os.Bundle, /) -> None: ...
    def unregisterCallback(self, callback: TvAdManager.TvAdServiceCallback, /) -> None: ...

    class TvAdServiceCallback(java.lang.Object):
        def __init__(self) -> None: ...
        def onAdServiceAdded(self, serviceId: str | java.lang.String, /) -> None: ...
        def onAdServiceRemoved(self, serviceId: str | java.lang.String, /) -> None: ...
        def onAdServiceUpdated(self, serviceId: str | java.lang.String, /) -> None: ...

class TvAdService(android.app.Service):
    SERVICE_INTERFACE: typing.ClassVar[str] = ...
    SERVICE_META_DATA: typing.ClassVar[str] = ...
    def __init__(self) -> None: ...
    def onAppLinkCommand(self, command: android.os.Bundle, /) -> None: ...
    def onBind(self, intent: android.content.Intent, /) -> android.os.IBinder: ...
    def onCreateSession(self, arg1: str | java.lang.String, arg2: str | java.lang.String, /) -> TvAdService.Session: ...

    class Session(android.view.KeyEvent.Callback):
        def __init__(self, context: android.content.Context, /) -> None: ...
        def isMediaViewEnabled(self) -> bool: ...
        def layoutSurface(self, left: int | java.jint | java.lang.Integer, top: int | java.jint | java.lang.Integer, right: int | java.jint | java.lang.Integer, bottom: int | java.jint | java.lang.Integer, /) -> None: ...
        def notifySessionStateChanged(self, state: int | java.jint | java.lang.Integer, err: int | java.jint | java.lang.Integer, /) -> None: ...
        def onCreateMediaView(self) -> android.view.View: ...
        def onCurrentChannelUri(self, channelUri: android.net.Uri, /) -> None: ...
        def onCurrentTvInputId(self, inputId: str | java.lang.String, /) -> None: ...
        def onCurrentVideoBounds(self, bounds: android.graphics.Rect, /) -> None: ...
        def onError(self, errMsg: str | java.lang.String, params: android.os.Bundle, /) -> None: ...
        def onGenericMotionEvent(self, event: android.view.MotionEvent, /) -> bool: ...
        def onKeyDown(self, keyCode: int | java.jint | java.lang.Integer, event: android.view.KeyEvent, /) -> bool: ...
        def onKeyLongPress(self, keyCode: int | java.jint | java.lang.Integer, event: android.view.KeyEvent, /) -> bool: ...
        def onKeyMultiple(self, keyCode: int | java.jint | java.lang.Integer, count: int | java.jint | java.lang.Integer, event: android.view.KeyEvent, /) -> bool: ...
        def onKeyUp(self, keyCode: int | java.jint | java.lang.Integer, event: android.view.KeyEvent, /) -> bool: ...
        def onMediaViewSizeChanged(self, width: int | java.jint | java.lang.Integer, height: int | java.jint | java.lang.Integer, /) -> None: ...
        def onRelease(self) -> None: ...
        def onResetAdService(self) -> None: ...
        def onSetSurface(self, arg1: android.view.Surface, /) -> bool: ...
        def onSigningResult(self, signingId: str | java.lang.String, result: java.chaquopy.JavaArrayJByte, /) -> None: ...
        def onStartAdService(self) -> None: ...
        def onStopAdService(self) -> None: ...
        def onSurfaceChanged(self, format: int | java.jint | java.lang.Integer, width: int | java.jint | java.lang.Integer, height: int | java.jint | java.lang.Integer, /) -> None: ...
        def onTouchEvent(self, event: android.view.MotionEvent, /) -> bool: ...
        def onTrackInfoList(self, tracks: java.util.List[android.media.tv.TvTrackInfo], /) -> None: ...
        def onTrackballEvent(self, event: android.view.MotionEvent, /) -> bool: ...
        def onTvInputSessionData(self, type: str | java.lang.String, data: android.os.Bundle, /) -> None: ...
        def onTvMessage(self, type: int | java.jint | java.lang.Integer, data: android.os.Bundle, /) -> None: ...
        def requestCurrentChannelUri(self) -> None: ...
        def requestCurrentTvInputId(self) -> None: ...
        def requestCurrentVideoBounds(self) -> None: ...
        def requestSigning(self, signingId: str | java.lang.String, algorithm: str | java.lang.String, alias: str | java.lang.String, data: java.chaquopy.JavaArrayJByte, /) -> None: ...
        def requestTrackInfoList(self) -> None: ...
        def sendTvAdSessionData(self, type: str | java.lang.String, data: android.os.Bundle, /) -> None: ...
        def setMediaViewEnabled(self, enable: bool | java.jboolean | java.lang.Boolean, /) -> None: ...

class TvAdServiceInfo(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[TvAdServiceInfo]] = ...
    def __init__(self, context: android.content.Context, component: android.content.ComponentName, /) -> None: ...
    def describeContents(self) -> int: ...
    def getId(self) -> str: ...
    def getServiceInfo(self) -> android.content.pm.ServiceInfo: ...
    def getSupportedTypes(self) -> java.util.List[java.lang.String]: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class TvAdView(android.view.ViewGroup):
    ERROR_KEY_ERROR_CODE: typing.ClassVar[str] = ...
    ERROR_KEY_METHOD_NAME: typing.ClassVar[str] = ...
    @typing.overload
    def __init__(self, context: android.content.Context, /) -> None: ...
    @typing.overload
    def __init__(self, context: android.content.Context, attrs: android.util.AttributeSet, /) -> None: ...
    @typing.overload
    def __init__(self, context: android.content.Context, attrs: android.util.AttributeSet, defStyleAttr: int | java.jint | java.lang.Integer, /) -> None: ...
    def clearCallback(self) -> None: ...
    def clearOnUnhandledInputEventListener(self) -> None: ...
    def dispatchKeyEvent(self, event: android.view.KeyEvent, /) -> bool: ...
    def dispatchUnhandledInputEvent(self, event: android.view.InputEvent, /) -> bool: ...
    def getOnUnhandledInputEventListener(self) -> TvAdView.OnUnhandledInputEventListener: ...
    def notifyError(self, errMsg: str | java.lang.String, params: android.os.Bundle, /) -> None: ...
    def notifyTvMessage(self, type: int | java.jint | java.lang.Integer, data: android.os.Bundle, /) -> None: ...
    def onAttachedToWindow(self) -> None: ...
    def onDetachedFromWindow(self) -> None: ...
    def onLayout(self, changed: bool | java.jboolean | java.lang.Boolean, left: int | java.jint | java.lang.Integer, top: int | java.jint | java.lang.Integer, right: int | java.jint | java.lang.Integer, bottom: int | java.jint | java.lang.Integer, /) -> None: ...
    def onMeasure(self, widthMeasureSpec: int | java.jint | java.lang.Integer, heightMeasureSpec: int | java.jint | java.lang.Integer, /) -> None: ...
    def onUnhandledInputEvent(self, event: android.view.InputEvent, /) -> bool: ...
    def onVisibilityChanged(self, changedView: android.view.View, visibility: int | java.jint | java.lang.Integer, /) -> None: ...
    def prepareAdService(self, serviceId: str | java.lang.String, type: str | java.lang.String, /) -> None: ...
    def reset(self) -> None: ...
    def resetAdService(self) -> None: ...
    def sendCurrentChannelUri(self, channelUri: android.net.Uri, /) -> None: ...
    def sendCurrentTvInputId(self, inputId: str | java.lang.String, /) -> None: ...
    def sendCurrentVideoBounds(self, bounds: android.graphics.Rect, /) -> None: ...
    def sendSigningResult(self, signingId: str | java.lang.String, result: java.chaquopy.JavaArrayJByte, /) -> None: ...
    def sendTrackInfoList(self, tracks: java.util.List[android.media.tv.TvTrackInfo], /) -> None: ...
    def setCallback(self, executor: java.util.concurrent.Executor, callback: TvAdView.TvAdCallback, /) -> None: ...
    def setOnUnhandledInputEventListener(self, listener: TvAdView.OnUnhandledInputEventListener, /) -> None: ...
    def setTvView(self, tvView: android.media.tv.TvView, /) -> bool: ...
    def setZOrderMediaOverlay(self, isMediaOverlay: bool | java.jboolean | java.lang.Boolean, /) -> None: ...
    def setZOrderOnTop(self, onTop: bool | java.jboolean | java.lang.Boolean, /) -> None: ...
    def startAdService(self) -> None: ...
    def stopAdService(self) -> None: ...

    class TvAdCallback(java.lang.Object):
        def __init__(self) -> None: ...
        def onRequestCurrentChannelUri(self, serviceId: str | java.lang.String, /) -> None: ...
        def onRequestCurrentTvInputId(self, serviceId: str | java.lang.String, /) -> None: ...
        def onRequestCurrentVideoBounds(self, serviceId: str | java.lang.String, /) -> None: ...
        def onRequestSigning(self, serviceId: str | java.lang.String, signingId: str | java.lang.String, algorithm: str | java.lang.String, alias: str | java.lang.String, data: java.chaquopy.JavaArrayJByte, /) -> None: ...
        def onRequestTrackInfoList(self, serviceId: str | java.lang.String, /) -> None: ...
        def onStateChanged(self, serviceId: str | java.lang.String, state: int | java.jint | java.lang.Integer, err: int | java.jint | java.lang.Integer, /) -> None: ...

    class OnUnhandledInputEventListener(java.lang.Object):
        def onUnhandledInputEvent(self, arg1: android.view.InputEvent, /) -> bool: ...
