import typing

import android.content.res
import android.os
import java
import java.chaquopy
import java.lang
import java.util

class ConfigurationStats(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[ConfigurationStats]] = ...
    def __init__(self, stats: ConfigurationStats, /) -> None: ...
    def describeContents(self) -> int: ...
    def getActivationCount(self) -> int: ...
    def getConfiguration(self) -> android.content.res.Configuration: ...
    def getFirstTimeStamp(self) -> int: ...
    def getLastTimeActive(self) -> int: ...
    def getLastTimeStamp(self) -> int: ...
    def getTotalTimeActive(self) -> int: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class EventStats(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[EventStats]] = ...
    def __init__(self, stats: EventStats, /) -> None: ...
    def add(self, right: EventStats, /) -> None: ...
    def describeContents(self) -> int: ...
    def getCount(self) -> int: ...
    def getEventType(self) -> int: ...
    def getFirstTimeStamp(self) -> int: ...
    def getLastEventTime(self) -> int: ...
    def getLastTimeStamp(self) -> int: ...
    def getTotalTime(self) -> int: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class ExternalStorageStats(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[ExternalStorageStats]] = ...
    def describeContents(self) -> int: ...
    def getAppBytes(self) -> int: ...
    def getAudioBytes(self) -> int: ...
    def getImageBytes(self) -> int: ...
    def getTotalBytes(self) -> int: ...
    def getVideoBytes(self) -> int: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class NetworkStats(java.lang.AutoCloseable):
    def close(self) -> None: ...
    def finalize(self) -> None: ...
    def getNextBucket(self, bucketOut: NetworkStats.Bucket, /) -> bool: ...
    def hasNextBucket(self) -> bool: ...

    class Bucket(java.lang.Object):
        DEFAULT_NETWORK_ALL: typing.ClassVar[int] = ...
        DEFAULT_NETWORK_NO: typing.ClassVar[int] = ...
        DEFAULT_NETWORK_YES: typing.ClassVar[int] = ...
        METERED_ALL: typing.ClassVar[int] = ...
        METERED_NO: typing.ClassVar[int] = ...
        METERED_YES: typing.ClassVar[int] = ...
        ROAMING_ALL: typing.ClassVar[int] = ...
        ROAMING_NO: typing.ClassVar[int] = ...
        ROAMING_YES: typing.ClassVar[int] = ...
        STATE_ALL: typing.ClassVar[int] = ...
        STATE_DEFAULT: typing.ClassVar[int] = ...
        STATE_FOREGROUND: typing.ClassVar[int] = ...
        TAG_NONE: typing.ClassVar[int] = ...
        UID_ALL: typing.ClassVar[int] = ...
        UID_REMOVED: typing.ClassVar[int] = ...
        UID_TETHERING: typing.ClassVar[int] = ...
        def __init__(self) -> None: ...
        def getDefaultNetworkStatus(self) -> int: ...
        def getEndTimeStamp(self) -> int: ...
        def getMetered(self) -> int: ...
        def getRoaming(self) -> int: ...
        def getRxBytes(self) -> int: ...
        def getRxPackets(self) -> int: ...
        def getStartTimeStamp(self) -> int: ...
        def getState(self) -> int: ...
        def getTag(self) -> int: ...
        def getTxBytes(self) -> int: ...
        def getTxPackets(self) -> int: ...
        def getUid(self) -> int: ...

class NetworkStatsManager(java.lang.Object):
    def queryDetails(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> NetworkStats | None: ...
    def queryDetailsForUid(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, uid: int | java.jint | java.lang.Integer, /) -> NetworkStats: ...
    def queryDetailsForUidTag(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, uid: int | java.jint | java.lang.Integer, tag: int | java.jint | java.lang.Integer, /) -> NetworkStats: ...
    def queryDetailsForUidTagState(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, uid: int | java.jint | java.lang.Integer, tag: int | java.jint | java.lang.Integer, state: int | java.jint | java.lang.Integer, /) -> NetworkStats: ...
    def querySummary(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> NetworkStats | None: ...
    def querySummaryForDevice(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> NetworkStats.Bucket | None: ...
    def querySummaryForUser(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, startTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> NetworkStats.Bucket | None: ...
    @typing.overload
    def registerUsageCallback(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, thresholdBytes: int | java.jlong | java.lang.Long, callback: NetworkStatsManager.UsageCallback, /) -> None: ...
    @typing.overload
    def registerUsageCallback(self, networkType: int | java.jint | java.lang.Integer, subscriberId: str | java.lang.String, thresholdBytes: int | java.jlong | java.lang.Long, callback: NetworkStatsManager.UsageCallback, handler: android.os.Handler, /) -> None: ...
    def unregisterUsageCallback(self, callback: NetworkStatsManager.UsageCallback, /) -> None: ...

    class UsageCallback(java.lang.Object):
        def __init__(self) -> None: ...
        def onThresholdReached(self, arg1: int | java.jint | java.lang.Integer, arg2: str | java.lang.String, /) -> None: ...

class StorageStats(android.os.Parcelable):
    APP_DATA_TYPE_FILE_TYPE_APK: typing.ClassVar[int] = ...
    APP_DATA_TYPE_FILE_TYPE_CURRENT_PROFILE: typing.ClassVar[int] = ...
    APP_DATA_TYPE_FILE_TYPE_DEXOPT_ARTIFACT: typing.ClassVar[int] = ...
    APP_DATA_TYPE_FILE_TYPE_DM: typing.ClassVar[int] = ...
    APP_DATA_TYPE_FILE_TYPE_REFERENCE_PROFILE: typing.ClassVar[int] = ...
    APP_DATA_TYPE_LIB: typing.ClassVar[int] = ...
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[StorageStats]] = ...
    def describeContents(self) -> int: ...
    def getAppBytes(self) -> int: ...
    def getAppBytesByDataType(self, dataType: int | java.jint | java.lang.Integer, /) -> int: ...
    def getCacheBytes(self) -> int: ...
    def getDataBytes(self) -> int: ...
    def getExternalCacheBytes(self) -> int: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class StorageStatsManager(java.lang.Object):
    def getFreeBytes(self, storageUuid: java.util.UUID, /) -> int: ...
    def getTotalBytes(self, storageUuid: java.util.UUID, /) -> int: ...
    def queryExternalStatsForUser(self, storageUuid: java.util.UUID, user: android.os.UserHandle, /) -> ExternalStorageStats: ...
    def queryStatsForPackage(self, storageUuid: java.util.UUID, packageName: str | java.lang.String, user: android.os.UserHandle, /) -> StorageStats: ...
    def queryStatsForUid(self, storageUuid: java.util.UUID, uid: int | java.jint | java.lang.Integer, /) -> StorageStats: ...
    def queryStatsForUser(self, storageUuid: java.util.UUID, user: android.os.UserHandle, /) -> StorageStats: ...

class UsageEvents(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsageEvents]] = ...
    def describeContents(self) -> int: ...
    def getNextEvent(self, eventOut: UsageEvents.Event, /) -> bool: ...
    def hasNextEvent(self) -> bool: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Event(java.lang.Object):
        ACTIVITY_PAUSED: typing.ClassVar[int] = ...
        ACTIVITY_RESUMED: typing.ClassVar[int] = ...
        ACTIVITY_STOPPED: typing.ClassVar[int] = ...
        CONFIGURATION_CHANGE: typing.ClassVar[int] = ...
        DEVICE_SHUTDOWN: typing.ClassVar[int] = ...
        DEVICE_STARTUP: typing.ClassVar[int] = ...
        FOREGROUND_SERVICE_START: typing.ClassVar[int] = ...
        FOREGROUND_SERVICE_STOP: typing.ClassVar[int] = ...
        KEYGUARD_HIDDEN: typing.ClassVar[int] = ...
        KEYGUARD_SHOWN: typing.ClassVar[int] = ...
        MOVE_TO_BACKGROUND: typing.ClassVar[int] = ...
        MOVE_TO_FOREGROUND: typing.ClassVar[int] = ...
        NONE: typing.ClassVar[int] = ...
        SCREEN_INTERACTIVE: typing.ClassVar[int] = ...
        SCREEN_NON_INTERACTIVE: typing.ClassVar[int] = ...
        SHORTCUT_INVOCATION: typing.ClassVar[int] = ...
        STANDBY_BUCKET_CHANGED: typing.ClassVar[int] = ...
        USER_INTERACTION: typing.ClassVar[int] = ...
        def __init__(self) -> None: ...
        def getAppStandbyBucket(self) -> int: ...
        def getClassName(self) -> str: ...
        def getConfiguration(self) -> android.content.res.Configuration: ...
        def getEventType(self) -> int: ...
        def getExtras(self) -> android.os.PersistableBundle: ...
        def getPackageName(self) -> str: ...
        def getShortcutId(self) -> str: ...
        def getTimeStamp(self) -> int: ...

class UsageEventsQuery(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsageEventsQuery]] = ...
    def describeContents(self) -> int: ...
    def getBeginTimeMillis(self) -> int: ...
    def getEndTimeMillis(self) -> int: ...
    def getEventTypes(self) -> java.chaquopy.JavaArrayJInt: ...
    def getPackageNames(self) -> java.util.Set[java.lang.String]: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

    class Builder(java.lang.Object):
        def __init__(self, beginTimeMillis: int | java.jlong | java.lang.Long, endTimeMillis: int | java.jlong | java.lang.Long, /) -> None: ...
        def build(self) -> UsageEventsQuery: ...
        def setEventTypes(self, *eventTypes: java.jint) -> UsageEventsQuery.Builder: ...
        def setPackageNames(self, *pkgNames: java.lang.String) -> UsageEventsQuery.Builder: ...

class UsageStats(android.os.Parcelable):
    CREATOR: typing.ClassVar[android.os.Parcelable.Creator[UsageStats]] = ...
    def __init__(self, stats: UsageStats, /) -> None: ...
    def add(self, right: UsageStats, /) -> None: ...
    def describeContents(self) -> int: ...
    def getFirstTimeStamp(self) -> int: ...
    def getLastTimeForegroundServiceUsed(self) -> int: ...
    def getLastTimeStamp(self) -> int: ...
    def getLastTimeUsed(self) -> int: ...
    def getLastTimeVisible(self) -> int: ...
    def getPackageName(self) -> str: ...
    def getTotalTimeForegroundServiceUsed(self) -> int: ...
    def getTotalTimeInForeground(self) -> int: ...
    def getTotalTimeVisible(self) -> int: ...
    def writeToParcel(self, dest: android.os.Parcel, flags: int | java.jint | java.lang.Integer, /) -> None: ...

class UsageStatsManager(java.lang.Object):
    EXTRA_EVENT_ACTION: typing.ClassVar[str] = ...
    EXTRA_EVENT_CATEGORY: typing.ClassVar[str] = ...
    INTERVAL_BEST: typing.ClassVar[int] = ...
    INTERVAL_DAILY: typing.ClassVar[int] = ...
    INTERVAL_MONTHLY: typing.ClassVar[int] = ...
    INTERVAL_WEEKLY: typing.ClassVar[int] = ...
    INTERVAL_YEARLY: typing.ClassVar[int] = ...
    STANDBY_BUCKET_ACTIVE: typing.ClassVar[int] = ...
    STANDBY_BUCKET_FREQUENT: typing.ClassVar[int] = ...
    STANDBY_BUCKET_RARE: typing.ClassVar[int] = ...
    STANDBY_BUCKET_RESTRICTED: typing.ClassVar[int] = ...
    STANDBY_BUCKET_WORKING_SET: typing.ClassVar[int] = ...
    def getAppStandbyBucket(self) -> int: ...
    def isAppInactive(self, packageName: str | java.lang.String, /) -> bool: ...
    def queryAndAggregateUsageStats(self, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> java.util.Map[java.lang.String, UsageStats]: ...
    def queryConfigurations(self, intervalType: int | java.jint | java.lang.Integer, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> java.util.List[ConfigurationStats]: ...
    def queryEventStats(self, intervalType: int | java.jint | java.lang.Integer, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> java.util.List[EventStats]: ...
    @typing.overload
    def queryEvents(self, query: UsageEventsQuery, /) -> UsageEvents | None: ...
    @typing.overload
    def queryEvents(self, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> UsageEvents | None: ...
    def queryEventsForSelf(self, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> UsageEvents: ...
    def queryUsageStats(self, intervalType: int | java.jint | java.lang.Integer, beginTime: int | java.jlong | java.lang.Long, endTime: int | java.jlong | java.lang.Long, /) -> java.util.List[UsageStats]: ...
