import typing

import android.app
import android.bluetooth
import android.bluetooth.le
import android.content
import android.net
import android.net.wifi
import android.os
import java
import java.chaquopy
import java.io
import java.lang
import java.nio
import java.util
import java.util.concurrent
import java.util.regex

class AssociatedDevice(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AssociatedDevice]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getBleDevice(self) -> android.bluetooth.le.ScanResult | None: ...
    def getBluetoothDevice(self) -> android.bluetooth.BluetoothDevice | None: ...
    def getWifiDevice(self) -> android.net.wifi.ScanResult | None: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class AssociationInfo(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AssociationInfo]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getAssociatedDevice(self) -> AssociatedDevice | None: ...
    def getDeviceId(self) -> DeviceId: ...
    def getDeviceMacAddress(self) -> android.net.MacAddress | None: ...
    def getDeviceProfile(self) -> str | None: ...
    def getDisplayName(self) -> java.lang.CharSequence | None: ...
    def getId(self) -> int: ...
    def getSystemDataSyncFlags(self) -> int: ...
    def hashCode(self) -> int: ...
    def isSelfManaged(self) -> bool: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class AssociationRequest(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[AssociationRequest]] = ...
    DEVICE_PROFILE_APP_STREAMING: typing.ClassVar[str] = ...
    DEVICE_PROFILE_AUTOMOTIVE_PROJECTION: typing.ClassVar[str] = ...
    DEVICE_PROFILE_COMPUTER: typing.ClassVar[str] = ...
    DEVICE_PROFILE_GLASSES: typing.ClassVar[str] = ...
    DEVICE_PROFILE_NEARBY_DEVICE_STREAMING: typing.ClassVar[str] = ...
    DEVICE_PROFILE_WATCH: typing.ClassVar[str] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getDeviceProfile(self) -> str | None: ...
    def getDisplayName(self) -> java.lang.CharSequence | None: ...
    def hashCode(self) -> int: ...
    def isForceConfirmation(self) -> bool: ...
    def isSelfManaged(self) -> bool: ...
    def isSingleDevice(self) -> bool: ...
    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 addDeviceFilter(self, deviceFilter: DeviceFilter[java.lang.Object], /) -> AssociationRequest.Builder: ...
        def build(self) -> AssociationRequest: ...
        def setDeviceProfile(self, deviceProfile: str | java.lang.String, /) -> AssociationRequest.Builder: ...
        def setDisplayName(self, displayName: java.lang.CharSequence, /) -> AssociationRequest.Builder: ...
        def setForceConfirmation(self, forceConfirmation: bool | java.jboolean | java.lang.Boolean, /) -> AssociationRequest.Builder: ...
        def setSelfManaged(self, selfManaged: bool | java.jboolean | java.lang.Boolean, /) -> AssociationRequest.Builder: ...
        def setSingleDevice(self, singleDevice: bool | java.jboolean | java.lang.Boolean, /) -> AssociationRequest.Builder: ...

class BluetoothDeviceFilter(DeviceFilter[android.bluetooth.BluetoothDevice]):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[BluetoothDeviceFilter]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    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 addServiceUuid(self, serviceUuid: android.os.ParcelUuid, serviceUuidMask: android.os.ParcelUuid, /) -> BluetoothDeviceFilter.Builder: ...
        def build(self) -> BluetoothDeviceFilter: ...
        def setAddress(self, address: str | java.lang.String, /) -> BluetoothDeviceFilter.Builder: ...
        def setNamePattern(self, regex: java.util.regex.Pattern, /) -> BluetoothDeviceFilter.Builder: ...

class BluetoothLeDeviceFilter(DeviceFilter[android.bluetooth.le.ScanResult]):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[BluetoothLeDeviceFilter]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    @staticmethod
    def getRenamePrefixLengthLimit() -> 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) -> None: ...
        def build(self) -> BluetoothLeDeviceFilter: ...
        def setNamePattern(self, regex: java.util.regex.Pattern, /) -> BluetoothLeDeviceFilter.Builder: ...
        def setRawDataFilter(self, rawDataFilter: java.chaquopy.JavaArrayJByte, rawDataFilterMask: java.chaquopy.JavaArrayJByte, /) -> BluetoothLeDeviceFilter.Builder: ...
        def setRenameFromBytes(self, prefix: str | java.lang.String, suffix: str | java.lang.String, bytesFrom: int | java.jint | java.lang.Integer, bytesLength: int | java.jint | java.lang.Integer, byteOrder: java.nio.ByteOrder, /) -> BluetoothLeDeviceFilter.Builder: ...
        def setRenameFromName(self, prefix: str | java.lang.String, suffix: str | java.lang.String, nameFrom: int | java.jint | java.lang.Integer, nameLength: int | java.jint | java.lang.Integer, /) -> BluetoothLeDeviceFilter.Builder: ...
        def setScanFilter(self, scanFilter: android.bluetooth.le.ScanFilter, /) -> BluetoothLeDeviceFilter.Builder: ...

class CompanionDeviceManager(java.lang.Object):
    EXTRA_ASSOCIATION: typing.ClassVar[str] = ...
    EXTRA_DEVICE: typing.ClassVar[str] = ...
    FLAG_CALL_METADATA: typing.ClassVar[int] = ...
    RESULT_CANCELED: typing.ClassVar[int] = ...
    RESULT_DISCOVERY_TIMEOUT: typing.ClassVar[int] = ...
    RESULT_INTERNAL_ERROR: typing.ClassVar[int] = ...
    RESULT_OK: typing.ClassVar[int] = ...
    RESULT_SECURITY_ERROR: typing.ClassVar[int] = ...
    RESULT_USER_REJECTED: typing.ClassVar[int] = ...
    @typing.overload
    def associate(self, request: AssociationRequest, callback: CompanionDeviceManager.Callback, handler: android.os.Handler, /) -> None: ...
    @typing.overload
    def associate(self, request: AssociationRequest, executor: java.util.concurrent.Executor, callback: CompanionDeviceManager.Callback, /) -> None: ...
    def attachSystemDataTransport(self, associationId: int | java.jint | java.lang.Integer, in_: java.io.InputStream, out: java.io.OutputStream, /) -> None: ...
    def buildAssociationCancellationIntent(self) -> android.content.IntentSender | None: ...
    def buildPermissionTransferUserConsentIntent(self, associationId: int | java.jint | java.lang.Integer, /) -> android.content.IntentSender | None: ...
    def detachSystemDataTransport(self, associationId: int | java.jint | java.lang.Integer, /) -> None: ...
    def disableSystemDataSyncForTypes(self, associationId: int | java.jint | java.lang.Integer, flags: int | java.jint | java.lang.Integer, /) -> None: ...
    @typing.overload
    def disassociate(self, associationId: int | java.jint | java.lang.Integer, /) -> None: ...
    @typing.overload
    def disassociate(self, deviceMacAddress: str | java.lang.String, /) -> None: ...
    def enableSystemDataSyncForTypes(self, associationId: int | java.jint | java.lang.Integer, flags: int | java.jint | java.lang.Integer, /) -> None: ...
    def getAssociations(self) -> java.util.List[java.lang.String]: ...
    def getMyAssociations(self) -> java.util.List[AssociationInfo]: ...
    def hasNotificationAccess(self, component: android.content.ComponentName, /) -> bool: ...
    def isPermissionTransferUserConsented(self, associationId: int | java.jint | java.lang.Integer, /) -> bool: ...
    def removeBond(self, associationId: int | java.jint | java.lang.Integer, /) -> bool: ...
    def requestNotificationAccess(self, component: android.content.ComponentName, /) -> None: ...
    def setDeviceId(self, associationId: int | java.jint | java.lang.Integer, deviceId: DeviceId, /) -> None: ...
    @typing.overload
    def startObservingDevicePresence(self, request: ObservingDevicePresenceRequest, /) -> None: ...
    @typing.overload
    def startObservingDevicePresence(self, deviceAddress: str | java.lang.String, /) -> None: ...
    def startSystemDataTransfer(self, associationId: int | java.jint | java.lang.Integer, executor: java.util.concurrent.Executor, result: android.os.OutcomeReceiver[java.lang.Void, CompanionException], /) -> None: ...
    @typing.overload
    def stopObservingDevicePresence(self, request: ObservingDevicePresenceRequest, /) -> None: ...
    @typing.overload
    def stopObservingDevicePresence(self, deviceAddress: str | java.lang.String, /) -> None: ...

    class Callback(java.lang.Object):
        def __init__(self) -> None: ...
        def onAssociationCreated(self, associationInfo: AssociationInfo, /) -> None: ...
        def onAssociationPending(self, intentSender: android.content.IntentSender, /) -> None: ...
        def onDeviceFound(self, intentSender: android.content.IntentSender, /) -> None: ...
        @typing.overload
        def onFailure(self, arg1: java.lang.CharSequence, /) -> None: ...
        @typing.overload
        def onFailure(self, errorCode: int | java.jint | java.lang.Integer, error: java.lang.CharSequence, /) -> None: ...

class CompanionDeviceService(android.app.Service):
    SERVICE_INTERFACE: typing.ClassVar[str] = ...
    def __init__(self) -> None: ...
    def attachSystemDataTransport(self, associationId: int | java.jint | java.lang.Integer, in_: java.io.InputStream, out: java.io.OutputStream, /) -> None: ...
    def detachSystemDataTransport(self, associationId: int | java.jint | java.lang.Integer, /) -> None: ...
    def onBind(self, intent: android.content.Intent, /) -> android.os.IBinder | None: ...
    @typing.overload
    def onDeviceAppeared(self, associationInfo: AssociationInfo, /) -> None: ...
    @typing.overload
    def onDeviceAppeared(self, address: str | java.lang.String, /) -> None: ...
    @typing.overload
    def onDeviceDisappeared(self, associationInfo: AssociationInfo, /) -> None: ...
    @typing.overload
    def onDeviceDisappeared(self, address: str | java.lang.String, /) -> None: ...
    def onDevicePresenceEvent(self, event: DevicePresenceEvent, /) -> None: ...

class CompanionException(java.lang.RuntimeException): ...

_DeviceFilter__D = typing.TypeVar('_DeviceFilter__D')  # <D>
class DeviceFilter(android.os.Parcelable, typing.Generic[_DeviceFilter__D]): ...

class DeviceId(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[DeviceId]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getCustomId(self) -> str: ...
    def getMacAddress(self) -> android.net.MacAddress: ...
    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 build(self) -> DeviceId: ...
        def setCustomId(self, customId: str | java.lang.String, /) -> DeviceId.Builder: ...
        def setMacAddress(self, macAddress: android.net.MacAddress, /) -> DeviceId.Builder: ...

class DeviceNotAssociatedException(java.lang.RuntimeException): ...

class DevicePresenceEvent(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[DevicePresenceEvent]] = ...
    EVENT_BLE_APPEARED: typing.ClassVar[int] = ...
    EVENT_BLE_DISAPPEARED: typing.ClassVar[int] = ...
    EVENT_BT_CONNECTED: typing.ClassVar[int] = ...
    EVENT_BT_DISCONNECTED: typing.ClassVar[int] = ...
    EVENT_SELF_MANAGED_APPEARED: typing.ClassVar[int] = ...
    EVENT_SELF_MANAGED_DISAPPEARED: typing.ClassVar[int] = ...
    NO_ASSOCIATION: typing.ClassVar[int] = ...
    def __init__(self, associationId: int | java.jint | java.lang.Integer, event: int | java.jint | java.lang.Integer, uuid: android.os.ParcelUuid, /) -> None: ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getAssociationId(self) -> int: ...
    def getEvent(self) -> int: ...
    def getUuid(self) -> android.os.ParcelUuid: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class ObservingDevicePresenceRequest(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[ObservingDevicePresenceRequest]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getAssociationId(self) -> int: ...
    def getUuid(self) -> android.os.ParcelUuid: ...
    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 build(self) -> ObservingDevicePresenceRequest: ...
        def setAssociationId(self, associationId: int | java.jint | java.lang.Integer, /) -> ObservingDevicePresenceRequest.Builder: ...
        def setUuid(self, uuid: android.os.ParcelUuid, /) -> ObservingDevicePresenceRequest.Builder: ...

class WifiDeviceFilter(DeviceFilter[android.net.wifi.ScanResult]):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[WifiDeviceFilter]] = ...
    def describeContents(self) -> int: ...
    def equals(self, o: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def hashCode(self) -> int: ...
    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 build(self) -> WifiDeviceFilter: ...
        def setBssid(self, value: android.net.MacAddress, /) -> WifiDeviceFilter.Builder: ...
        def setBssidMask(self, value: android.net.MacAddress, /) -> WifiDeviceFilter.Builder: ...
        def setNamePattern(self, value: java.util.regex.Pattern, /) -> WifiDeviceFilter.Builder: ...
