import typing

import android.app
import android.content
import android.os
import java
import java.chaquopy
import java.lang
import java.util
import java.util.concurrent

class AlternativeSpan(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AlternativeSpan]] = ...
    def __init__(self, startPosition: int | java.jint | java.lang.Integer, endPosition: int | java.jint | java.lang.Integer, alternatives: java.util.List[java.lang.String], /) -> None: ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getAlternatives(self) -> java.util.List[java.lang.String]: ...
    def getEndPosition(self) -> int: ...
    def getStartPosition(self) -> int: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class AlternativeSpans(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AlternativeSpans]] = ...
    def __init__(self, spans: java.util.List[AlternativeSpan], /) -> None: ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getSpans(self) -> java.util.List[AlternativeSpan]: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class ModelDownloadListener(java.lang.Object):
    def onError(self, arg1: int | java.jint | java.lang.Integer, /) -> None: ...
    def onProgress(self, arg1: int | java.jint | java.lang.Integer, /) -> None: ...
    def onScheduled(self) -> None: ...
    def onSuccess(self) -> None: ...

class RecognitionListener(java.lang.Object):
    def onBeginningOfSpeech(self) -> None: ...
    def onBufferReceived(self, arg1: java.chaquopy.JavaArrayJByte, /) -> None: ...
    def onEndOfSegmentedSession(self) -> None: ...
    def onEndOfSpeech(self) -> None: ...
    def onError(self, arg1: int | java.jint | java.lang.Integer, /) -> None: ...
    def onEvent(self, arg1: int | java.jint | java.lang.Integer, arg2: android.os.Bundle, /) -> None: ...
    def onLanguageDetection(self, results: android.os.Bundle, /) -> None: ...
    def onPartialResults(self, arg1: android.os.Bundle, /) -> None: ...
    def onReadyForSpeech(self, arg1: android.os.Bundle, /) -> None: ...
    def onResults(self, arg1: android.os.Bundle, /) -> None: ...
    def onRmsChanged(self, arg1: float | java.jfloat | java.lang.Float, /) -> None: ...
    def onSegmentResults(self, segmentResults: android.os.Bundle, /) -> None: ...

class RecognitionPart(android.os.Parcelable):
    CONFIDENCE_LEVEL_HIGH: typing.ClassVar[int] = ...
    CONFIDENCE_LEVEL_LOW: typing.ClassVar[int] = ...
    CONFIDENCE_LEVEL_MEDIUM: typing.ClassVar[int] = ...
    CONFIDENCE_LEVEL_MEDIUM_HIGH: typing.ClassVar[int] = ...
    CONFIDENCE_LEVEL_MEDIUM_LOW: typing.ClassVar[int] = ...
    CONFIDENCE_LEVEL_UNKNOWN: typing.ClassVar[int] = ...
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[RecognitionPart]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getConfidenceLevel(self) -> int: ...
    def getFormattedText(self) -> str | None: ...
    def getRawText(self) -> str: ...
    def getTimestampMillis(self) -> int: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self, rawText: str | java.lang.String, /) -> None: ...
        def build(self) -> RecognitionPart: ...
        def setConfidenceLevel(self, value: int | java.jint | java.lang.Integer, /) -> RecognitionPart.Builder: ...
        def setFormattedText(self, value: str | java.lang.String, /) -> RecognitionPart.Builder: ...
        def setRawText(self, value: str | java.lang.String, /) -> RecognitionPart.Builder: ...
        def setTimestampMillis(self, value: int | java.jlong | java.lang.Long, /) -> RecognitionPart.Builder: ...

class RecognitionService(android.app.Service):
    SERVICE_INTERFACE: typing.ClassVar[str] = ...
    SERVICE_META_DATA: typing.ClassVar[str] = ...
    def __init__(self) -> None: ...
    def createContext(self, contextParams: android.content.ContextParams, /) -> android.content.Context: ...
    def getMaxConcurrentSessionsCount(self) -> int: ...
    def onBind(self, intent: android.content.Intent, /) -> android.os.IBinder: ...
    def onCancel(self, arg1: RecognitionService.Callback, /) -> None: ...
    @typing.overload
    def onCheckRecognitionSupport(self, recognizerIntent: android.content.Intent, supportCallback: RecognitionService.SupportCallback, /) -> None: ...
    @typing.overload
    def onCheckRecognitionSupport(self, recognizerIntent: android.content.Intent, attributionSource: android.content.AttributionSource, supportCallback: RecognitionService.SupportCallback, /) -> None: ...
    def onDestroy(self) -> None: ...
    def onStartListening(self, arg1: android.content.Intent, arg2: RecognitionService.Callback, /) -> None: ...
    def onStopListening(self, arg1: RecognitionService.Callback, /) -> None: ...
    @typing.overload
    def onTriggerModelDownload(self, recognizerIntent: android.content.Intent, /) -> None: ...
    @typing.overload
    def onTriggerModelDownload(self, recognizerIntent: android.content.Intent, attributionSource: android.content.AttributionSource, /) -> None: ...
    @typing.overload
    def onTriggerModelDownload(self, recognizerIntent: android.content.Intent, attributionSource: android.content.AttributionSource, listener: ModelDownloadListener, /) -> None: ...

    class SupportCallback(java.lang.Object):
        def onError(self, errorCode: int | java.jint | java.lang.Integer, /) -> None: ...
        def onSupportResult(self, recognitionSupport: RecognitionSupport, /) -> None: ...

    class Callback(java.lang.Object):
        def beginningOfSpeech(self) -> None: ...
        def bufferReceived(self, buffer: java.chaquopy.JavaArrayJByte, /) -> None: ...
        def endOfSegmentedSession(self) -> None: ...
        def endOfSpeech(self) -> None: ...
        def error(self, error: int | java.jint | java.lang.Integer, /) -> None: ...
        def getCallingAttributionSource(self) -> android.content.AttributionSource: ...
        def getCallingUid(self) -> int: ...
        def languageDetection(self, results: android.os.Bundle, /) -> None: ...
        def partialResults(self, partialResults: android.os.Bundle, /) -> None: ...
        def readyForSpeech(self, params: android.os.Bundle, /) -> None: ...
        def results(self, results: android.os.Bundle, /) -> None: ...
        def rmsChanged(self, rmsdB: float | java.jfloat | java.lang.Float, /) -> None: ...
        def segmentResults(self, results: android.os.Bundle, /) -> None: ...

class RecognitionSupport(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[RecognitionSupport]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getInstalledOnDeviceLanguages(self) -> java.util.List[java.lang.String]: ...
    def getOnlineLanguages(self) -> java.util.List[java.lang.String]: ...
    def getPendingOnDeviceLanguages(self) -> java.util.List[java.lang.String]: ...
    def getSupportedOnDeviceLanguages(self) -> java.util.List[java.lang.String]: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self) -> None: ...
        def addInstalledOnDeviceLanguage(self, value: str | java.lang.String, /) -> RecognitionSupport.Builder: ...
        def addOnlineLanguage(self, value: str | java.lang.String, /) -> RecognitionSupport.Builder: ...
        def addPendingOnDeviceLanguage(self, value: str | java.lang.String, /) -> RecognitionSupport.Builder: ...
        def addSupportedOnDeviceLanguage(self, value: str | java.lang.String, /) -> RecognitionSupport.Builder: ...
        def build(self) -> RecognitionSupport: ...
        def setInstalledOnDeviceLanguages(self, value: java.util.List[java.lang.String], /) -> RecognitionSupport.Builder: ...
        def setOnlineLanguages(self, value: java.util.List[java.lang.String], /) -> RecognitionSupport.Builder: ...
        def setPendingOnDeviceLanguages(self, value: java.util.List[java.lang.String], /) -> RecognitionSupport.Builder: ...
        def setSupportedOnDeviceLanguages(self, value: java.util.List[java.lang.String], /) -> RecognitionSupport.Builder: ...

class RecognitionSupportCallback(java.lang.Object):
    def onError(self, arg1: int | java.jint | java.lang.Integer, /) -> None: ...
    def onSupportResult(self, arg1: RecognitionSupport, /) -> None: ...

class RecognizerIntent(java.lang.Object):
    ACTION_GET_LANGUAGE_DETAILS: typing.ClassVar[str] = ...
    ACTION_RECOGNIZE_SPEECH: typing.ClassVar[str] = ...
    ACTION_VOICE_SEARCH_HANDS_FREE: typing.ClassVar[str] = ...
    ACTION_WEB_SEARCH: typing.ClassVar[str] = ...
    DETAILS_META_DATA: typing.ClassVar[str] = ...
    EXTRA_AUDIO_INJECT_SOURCE: typing.ClassVar[str] = ...
    EXTRA_AUDIO_SOURCE: typing.ClassVar[str] = ...
    EXTRA_AUDIO_SOURCE_CHANNEL_COUNT: typing.ClassVar[str] = ...
    EXTRA_AUDIO_SOURCE_ENCODING: typing.ClassVar[str] = ...
    EXTRA_AUDIO_SOURCE_SAMPLING_RATE: typing.ClassVar[str] = ...
    EXTRA_BIASING_STRINGS: typing.ClassVar[str] = ...
    EXTRA_CALLING_PACKAGE: typing.ClassVar[str] = ...
    EXTRA_CONFIDENCE_SCORES: typing.ClassVar[str] = ...
    EXTRA_ENABLE_BIASING_DEVICE_CONTEXT: typing.ClassVar[str] = ...
    EXTRA_ENABLE_FORMATTING: typing.ClassVar[str] = ...
    EXTRA_ENABLE_LANGUAGE_DETECTION: typing.ClassVar[str] = ...
    EXTRA_ENABLE_LANGUAGE_SWITCH: typing.ClassVar[str] = ...
    EXTRA_HIDE_PARTIAL_TRAILING_PUNCTUATION: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_DETECTION_ALLOWED_LANGUAGES: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_MODEL: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_PREFERENCE: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_SWITCH_ALLOWED_LANGUAGES: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS: typing.ClassVar[str] = ...
    EXTRA_LANGUAGE_SWITCH_MAX_SWITCHES: typing.ClassVar[str] = ...
    EXTRA_MASK_OFFENSIVE_WORDS: typing.ClassVar[str] = ...
    EXTRA_MAX_RESULTS: typing.ClassVar[str] = ...
    EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE: typing.ClassVar[str] = ...
    EXTRA_ORIGIN: typing.ClassVar[str] = ...
    EXTRA_PARTIAL_RESULTS: typing.ClassVar[str] = ...
    EXTRA_PREFER_OFFLINE: typing.ClassVar[str] = ...
    EXTRA_PROMPT: typing.ClassVar[str] = ...
    EXTRA_REQUEST_WORD_CONFIDENCE: typing.ClassVar[str] = ...
    EXTRA_REQUEST_WORD_TIMING: typing.ClassVar[str] = ...
    EXTRA_RESULTS: typing.ClassVar[str] = ...
    EXTRA_RESULTS_PENDINGINTENT: typing.ClassVar[str] = ...
    EXTRA_RESULTS_PENDINGINTENT_BUNDLE: typing.ClassVar[str] = ...
    EXTRA_SECURE: typing.ClassVar[str] = ...
    EXTRA_SEGMENTED_SESSION: typing.ClassVar[str] = ...
    EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: typing.ClassVar[str] = ...
    EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: typing.ClassVar[str] = ...
    EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: typing.ClassVar[str] = ...
    EXTRA_SUPPORTED_LANGUAGES: typing.ClassVar[str] = ...
    EXTRA_WEB_SEARCH_ONLY: typing.ClassVar[str] = ...
    FORMATTING_OPTIMIZE_LATENCY: typing.ClassVar[str] = ...
    FORMATTING_OPTIMIZE_QUALITY: typing.ClassVar[str] = ...
    LANGUAGE_MODEL_FREE_FORM: typing.ClassVar[str] = ...
    LANGUAGE_MODEL_WEB_SEARCH: typing.ClassVar[str] = ...
    LANGUAGE_SWITCH_BALANCED: typing.ClassVar[str] = ...
    LANGUAGE_SWITCH_HIGH_PRECISION: typing.ClassVar[str] = ...
    LANGUAGE_SWITCH_QUICK_RESPONSE: typing.ClassVar[str] = ...
    RESULT_AUDIO_ERROR: typing.ClassVar[int] = ...
    RESULT_CLIENT_ERROR: typing.ClassVar[int] = ...
    RESULT_NETWORK_ERROR: typing.ClassVar[int] = ...
    RESULT_NO_MATCH: typing.ClassVar[int] = ...
    RESULT_SERVER_ERROR: typing.ClassVar[int] = ...
    @staticmethod
    def getVoiceDetailsIntent(context: android.content.Context, /) -> android.content.Intent | None: ...

class RecognizerResultsIntent(java.lang.Object):
    ACTION_VOICE_SEARCH_RESULTS: typing.ClassVar[str] = ...
    EXTRA_VOICE_SEARCH_RESULT_HTML: typing.ClassVar[str] = ...
    EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS: typing.ClassVar[str] = ...
    EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS: typing.ClassVar[str] = ...
    EXTRA_VOICE_SEARCH_RESULT_STRINGS: typing.ClassVar[str] = ...
    EXTRA_VOICE_SEARCH_RESULT_URLS: typing.ClassVar[str] = ...
    URI_SCHEME_INLINE: typing.ClassVar[str] = ...

class SpeechRecognizer(java.lang.Object):
    CONFIDENCE_SCORES: typing.ClassVar[str] = ...
    DETECTED_LANGUAGE: typing.ClassVar[str] = ...
    ERROR_AUDIO: typing.ClassVar[int] = ...
    ERROR_CANNOT_CHECK_SUPPORT: typing.ClassVar[int] = ...
    ERROR_CANNOT_LISTEN_TO_DOWNLOAD_EVENTS: typing.ClassVar[int] = ...
    ERROR_CLIENT: typing.ClassVar[int] = ...
    ERROR_INSUFFICIENT_PERMISSIONS: typing.ClassVar[int] = ...
    ERROR_LANGUAGE_NOT_SUPPORTED: typing.ClassVar[int] = ...
    ERROR_LANGUAGE_UNAVAILABLE: typing.ClassVar[int] = ...
    ERROR_NETWORK: typing.ClassVar[int] = ...
    ERROR_NETWORK_TIMEOUT: typing.ClassVar[int] = ...
    ERROR_NO_MATCH: typing.ClassVar[int] = ...
    ERROR_RECOGNIZER_BUSY: typing.ClassVar[int] = ...
    ERROR_SERVER: typing.ClassVar[int] = ...
    ERROR_SERVER_DISCONNECTED: typing.ClassVar[int] = ...
    ERROR_SPEECH_TIMEOUT: typing.ClassVar[int] = ...
    ERROR_TOO_MANY_REQUESTS: typing.ClassVar[int] = ...
    LANGUAGE_DETECTION_CONFIDENCE_LEVEL: typing.ClassVar[str] = ...
    LANGUAGE_DETECTION_CONFIDENCE_LEVEL_CONFIDENT: typing.ClassVar[int] = ...
    LANGUAGE_DETECTION_CONFIDENCE_LEVEL_HIGHLY_CONFIDENT: typing.ClassVar[int] = ...
    LANGUAGE_DETECTION_CONFIDENCE_LEVEL_NOT_CONFIDENT: typing.ClassVar[int] = ...
    LANGUAGE_DETECTION_CONFIDENCE_LEVEL_UNKNOWN: typing.ClassVar[int] = ...
    LANGUAGE_SWITCH_RESULT: typing.ClassVar[str] = ...
    LANGUAGE_SWITCH_RESULT_FAILED: typing.ClassVar[int] = ...
    LANGUAGE_SWITCH_RESULT_NOT_ATTEMPTED: typing.ClassVar[int] = ...
    LANGUAGE_SWITCH_RESULT_SKIPPED_NO_MODEL: typing.ClassVar[int] = ...
    LANGUAGE_SWITCH_RESULT_SUCCEEDED: typing.ClassVar[int] = ...
    RECOGNITION_PARTS: typing.ClassVar[str] = ...
    RESULTS_ALTERNATIVES: typing.ClassVar[str] = ...
    RESULTS_RECOGNITION: typing.ClassVar[str] = ...
    TOP_LOCALE_ALTERNATIVES: typing.ClassVar[str] = ...
    def cancel(self) -> None: ...
    def checkRecognitionSupport(self, recognizerIntent: android.content.Intent, executor: java.util.concurrent.Executor, supportListener: RecognitionSupportCallback, /) -> None: ...
    @staticmethod
    def createOnDeviceSpeechRecognizer(context: android.content.Context, /) -> SpeechRecognizer: ...
    @typing.overload
    @staticmethod
    def createSpeechRecognizer(context: android.content.Context, /) -> SpeechRecognizer: ...
    @typing.overload
    @staticmethod
    def createSpeechRecognizer(context: android.content.Context, serviceComponent: android.content.ComponentName, /) -> SpeechRecognizer: ...
    def destroy(self) -> None: ...
    @staticmethod
    def isOnDeviceRecognitionAvailable(context: android.content.Context, /) -> bool: ...
    @staticmethod
    def isRecognitionAvailable(context: android.content.Context, /) -> bool: ...
    def setRecognitionListener(self, listener: RecognitionListener, /) -> None: ...
    def startListening(self, recognizerIntent: android.content.Intent, /) -> None: ...
    def stopListening(self) -> None: ...
    @typing.overload
    def triggerModelDownload(self, recognizerIntent: android.content.Intent, /) -> None: ...
    @typing.overload
    def triggerModelDownload(self, recognizerIntent: android.content.Intent, executor: java.util.concurrent.Executor, listener: ModelDownloadListener, /) -> None: ...
