import typing

import android.os
import java
import java.chaquopy
import java.io
import java.lang
import java.util
import java.util.concurrent
import java.util.function

class BlobHandle(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[BlobHandle]] = ...
    @staticmethod
    def createWithSha256(digest: java.chaquopy.JavaArrayJByte, label: java.lang.CharSequence, expiryTimeMillis: int | java.jlong | java.lang.Long, tag: str | java.lang.String, /) -> BlobHandle: ...
    def describeContents(self) -> int: ...
    def equals(self, obj: java.lang.Object | int | bool | float | str, /) -> bool: ...
    def getExpiryTimeMillis(self) -> int: ...
    def getLabel(self) -> java.lang.CharSequence: ...
    def getSha256Digest(self) -> java.chaquopy.JavaArrayJByte: ...
    def getTag(self) -> str: ...
    def hashCode(self) -> int: ...
    def toString(self) -> str: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class BlobStoreManager(java.lang.Object):
    def abandonSession(self, sessionId: int | java.jlong | java.lang.Long, /) -> None: ...
    @typing.overload
    def acquireLease(self, blobHandle: BlobHandle, descriptionResId: int | java.jint | java.lang.Integer, /) -> None: ...
    @typing.overload
    def acquireLease(self, blobHandle: BlobHandle, description: java.lang.CharSequence, /) -> None: ...
    @typing.overload
    def acquireLease(self, blobHandle: BlobHandle, descriptionResId: int | java.jint | java.lang.Integer, leaseExpiryTimeMillis: int | java.jlong | java.lang.Long, /) -> None: ...
    @typing.overload
    def acquireLease(self, blobHandle: BlobHandle, description: java.lang.CharSequence, leaseExpiryTimeMillis: int | java.jlong | java.lang.Long, /) -> None: ...
    def createSession(self, blobHandle: BlobHandle, /) -> int: ...
    def getLeasedBlobs(self) -> java.util.List[BlobHandle]: ...
    def getRemainingLeaseQuotaBytes(self) -> int: ...
    def openBlob(self, blobHandle: BlobHandle, /) -> android.os.ParcelFileDescriptor: ...
    def openSession(self, sessionId: int | java.jlong | java.lang.Long, /) -> BlobStoreManager.Session: ...
    def releaseLease(self, blobHandle: BlobHandle, /) -> None: ...

    class Session(java.io.Closeable):
        def abandon(self) -> None: ...
        def allowPackageAccess(self, packageName: str | java.lang.String, certificate: java.chaquopy.JavaArrayJByte, /) -> None: ...
        def allowPublicAccess(self) -> None: ...
        def allowSameSignatureAccess(self) -> None: ...
        def close(self) -> None: ...
        def commit(self, executor: java.util.concurrent.Executor, resultCallback: java.util.function.Consumer[java.lang.Integer], /) -> None: ...
        def getSize(self) -> int: ...
        def isPackageAccessAllowed(self, packageName: str | java.lang.String, certificate: java.chaquopy.JavaArrayJByte, /) -> bool: ...
        def isPublicAccessAllowed(self) -> bool: ...
        def isSameSignatureAccessAllowed(self) -> bool: ...
        def openRead(self) -> android.os.ParcelFileDescriptor: ...
        def openWrite(self, offsetBytes: int | java.jlong | java.lang.Long, lengthBytes: int | java.jlong | java.lang.Long, /) -> android.os.ParcelFileDescriptor: ...
