import typing

import android.content
import android.os
import java
import java.chaquopy
import java.io
import java.lang

class BackupAgent(android.content.ContextWrapper):
    FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED: typing.ClassVar[int] = ...
    FLAG_DEVICE_TO_DEVICE_TRANSFER: typing.ClassVar[int] = ...
    TYPE_DIRECTORY: typing.ClassVar[int] = ...
    TYPE_FILE: typing.ClassVar[int] = ...
    def __init__(self) -> None: ...
    def fullBackupFile(self, file: java.io.File, output: FullBackupDataOutput, /) -> None: ...
    def onBackup(self, arg1: android.os.ParcelFileDescriptor, arg2: BackupDataOutput, arg3: android.os.ParcelFileDescriptor, /) -> None: ...
    def onCreate(self) -> None: ...
    def onDestroy(self) -> None: ...
    def onFullBackup(self, data: FullBackupDataOutput, /) -> None: ...
    def onQuotaExceeded(self, backupDataBytes: int | java.jlong | java.lang.Long, quotaBytes: int | java.jlong | java.lang.Long, /) -> None: ...
    @typing.overload
    def onRestore(self, arg1: BackupDataInput, arg2: int | java.jint | java.lang.Integer, arg3: android.os.ParcelFileDescriptor, /) -> None: ...
    @typing.overload
    def onRestore(self, data: BackupDataInput, appVersionCode: int | java.jlong | java.lang.Long, newState: android.os.ParcelFileDescriptor, /) -> None: ...
    def onRestoreFile(self, data: android.os.ParcelFileDescriptor, size: int | java.jlong | java.lang.Long, destination: java.io.File, type: int | java.jint | java.lang.Integer, mode: int | java.jlong | java.lang.Long, mtime: int | java.jlong | java.lang.Long, /) -> None: ...
    def onRestoreFinished(self) -> None: ...

class BackupAgentHelper(BackupAgent):
    def __init__(self) -> None: ...
    def addHelper(self, keyPrefix: str | java.lang.String, helper: BackupHelper, /) -> None: ...
    def onBackup(self, oldState: android.os.ParcelFileDescriptor, data: BackupDataOutput, newState: android.os.ParcelFileDescriptor, /) -> None: ...
    def onRestore(self, data: BackupDataInput, appVersionCode: int | java.jint | java.lang.Integer, newState: android.os.ParcelFileDescriptor, /) -> None: ...

class BackupDataInput(java.lang.Object):
    def finalize(self) -> None: ...
    def getDataSize(self) -> int: ...
    def getKey(self) -> str: ...
    def readEntityData(self, data: java.chaquopy.JavaArrayJByte, offset: int | java.jint | java.lang.Integer, size: int | java.jint | java.lang.Integer, /) -> int: ...
    def readNextHeader(self) -> bool: ...
    def skipEntityData(self) -> None: ...

class BackupDataInputStream(java.io.InputStream):
    def getKey(self) -> str: ...
    @typing.overload
    def read(self) -> int: ...
    @typing.overload
    def read(self, b: java.chaquopy.JavaArrayJByte, /) -> int: ...
    @typing.overload
    def read(self, b: java.chaquopy.JavaArrayJByte, offset: int | java.jint | java.lang.Integer, size: int | java.jint | java.lang.Integer, /) -> int: ...
    def size(self) -> int: ...

class BackupDataOutput(java.lang.Object):
    def finalize(self) -> None: ...
    def getQuota(self) -> int: ...
    def getTransportFlags(self) -> int: ...
    def writeEntityData(self, data: java.chaquopy.JavaArrayJByte, size: int | java.jint | java.lang.Integer, /) -> int: ...
    def writeEntityHeader(self, key: str | java.lang.String, dataSize: int | java.jint | java.lang.Integer, /) -> int: ...

class BackupHelper(java.lang.Object):
    def performBackup(self, arg1: android.os.ParcelFileDescriptor, arg2: BackupDataOutput, arg3: android.os.ParcelFileDescriptor, /) -> None: ...
    def restoreEntity(self, arg1: BackupDataInputStream, /) -> None: ...
    def writeNewStateDescription(self, arg1: android.os.ParcelFileDescriptor, /) -> None: ...

class BackupManager(java.lang.Object):
    def __init__(self, context: android.content.Context, /) -> None: ...
    @typing.overload
    def dataChanged(self) -> None: ...
    @typing.overload
    @staticmethod
    def dataChanged(packageName: str | java.lang.String, /) -> None: ...
    def getUserForAncestralSerialNumber(self, ancestralSerialNumber: int | java.jlong | java.lang.Long, /) -> android.os.UserHandle | None: ...
    def requestRestore(self, observer: RestoreObserver, /) -> int: ...

class FileBackupHelper(BackupHelper):
    def __init__(self, context: android.content.Context, /, *files: java.lang.String) -> None: ...
    def performBackup(self, oldState: android.os.ParcelFileDescriptor, data: BackupDataOutput, newState: android.os.ParcelFileDescriptor, /) -> None: ...
    def restoreEntity(self, data: BackupDataInputStream, /) -> None: ...
    def writeNewStateDescription(self, fd: android.os.ParcelFileDescriptor, /) -> None: ...

class FullBackupDataOutput(java.lang.Object):
    def getQuota(self) -> int: ...
    def getTransportFlags(self) -> int: ...

class RestoreObserver(java.lang.Object):
    def __init__(self) -> None: ...
    def onUpdate(self, nowBeingRestored: int | java.jint | java.lang.Integer, currentPackage: str | java.lang.String, /) -> None: ...
    def restoreFinished(self, error: int | java.jint | java.lang.Integer, /) -> None: ...
    def restoreStarting(self, numPackages: int | java.jint | java.lang.Integer, /) -> None: ...

class SharedPreferencesBackupHelper(BackupHelper):
    def __init__(self, context: android.content.Context, /, *prefGroups: java.lang.String) -> None: ...
    def performBackup(self, oldState: android.os.ParcelFileDescriptor, data: BackupDataOutput, newState: android.os.ParcelFileDescriptor, /) -> None: ...
    def restoreEntity(self, data: BackupDataInputStream, /) -> None: ...
    def writeNewStateDescription(self, fd: android.os.ParcelFileDescriptor, /) -> None: ...
