// Signature format: 2.0
package android.net {

  public class CaptivePortal implements android.os.Parcelable {
    method public int describeContents();
    method public void ignoreNetwork();
    method public void reportCaptivePortalDismissed();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.CaptivePortal> CREATOR;
  }

  public class ConnectivityDiagnosticsManager {
    method public void registerConnectivityDiagnosticsCallback(@NonNull android.net.NetworkRequest, @NonNull java.util.concurrent.Executor, @NonNull android.net.ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback);
    method public void unregisterConnectivityDiagnosticsCallback(@NonNull android.net.ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback);
  }

  public abstract static class ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback {
    ctor public ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback();
    method public void onConnectivityReportAvailable(@NonNull android.net.ConnectivityDiagnosticsManager.ConnectivityReport);
    method public void onDataStallSuspected(@NonNull android.net.ConnectivityDiagnosticsManager.DataStallReport);
    method public void onNetworkConnectivityReported(@NonNull android.net.Network, boolean);
  }

  public static final class ConnectivityDiagnosticsManager.ConnectivityReport implements android.os.Parcelable {
    ctor public ConnectivityDiagnosticsManager.ConnectivityReport(@NonNull android.net.Network, long, @NonNull android.net.LinkProperties, @NonNull android.net.NetworkCapabilities, @NonNull android.os.PersistableBundle);
    method public int describeContents();
    method @NonNull public android.os.PersistableBundle getAdditionalInfo();
    method @NonNull public android.net.LinkProperties getLinkProperties();
    method @NonNull public android.net.Network getNetwork();
    method @NonNull public android.net.NetworkCapabilities getNetworkCapabilities();
    method public long getReportTimestamp();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.ConnectivityDiagnosticsManager.ConnectivityReport> CREATOR;
    field public static final String KEY_NETWORK_PROBES_ATTEMPTED_BITMASK = "networkProbesAttempted";
    field public static final String KEY_NETWORK_PROBES_SUCCEEDED_BITMASK = "networkProbesSucceeded";
    field public static final String KEY_NETWORK_VALIDATION_RESULT = "networkValidationResult";
    field public static final int NETWORK_PROBE_DNS = 4; // 0x4
    field public static final int NETWORK_PROBE_FALLBACK = 32; // 0x20
    field public static final int NETWORK_PROBE_HTTP = 8; // 0x8
    field public static final int NETWORK_PROBE_HTTPS = 16; // 0x10
    field public static final int NETWORK_PROBE_PRIVATE_DNS = 64; // 0x40
    field public static final int NETWORK_VALIDATION_RESULT_INVALID = 0; // 0x0
    field public static final int NETWORK_VALIDATION_RESULT_PARTIALLY_VALID = 2; // 0x2
    field public static final int NETWORK_VALIDATION_RESULT_SKIPPED = 3; // 0x3
    field public static final int NETWORK_VALIDATION_RESULT_VALID = 1; // 0x1
  }

  public static final class ConnectivityDiagnosticsManager.DataStallReport implements android.os.Parcelable {
    ctor public ConnectivityDiagnosticsManager.DataStallReport(@NonNull android.net.Network, long, int, @NonNull android.net.LinkProperties, @NonNull android.net.NetworkCapabilities, @NonNull android.os.PersistableBundle);
    method public int describeContents();
    method public int getDetectionMethod();
    method @NonNull public android.net.LinkProperties getLinkProperties();
    method @NonNull public android.net.Network getNetwork();
    method @NonNull public android.net.NetworkCapabilities getNetworkCapabilities();
    method public long getReportTimestamp();
    method @NonNull public android.os.PersistableBundle getStallDetails();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.ConnectivityDiagnosticsManager.DataStallReport> CREATOR;
    field public static final int DETECTION_METHOD_DNS_EVENTS = 1; // 0x1
    field public static final int DETECTION_METHOD_TCP_METRICS = 2; // 0x2
    field public static final String KEY_DNS_CONSECUTIVE_TIMEOUTS = "dnsConsecutiveTimeouts";
    field public static final String KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS = "tcpMetricsCollectionPeriodMillis";
    field public static final String KEY_TCP_PACKET_FAIL_RATE = "tcpPacketFailRate";
  }

  public class ConnectivityManager {
    method public void addDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
    method public boolean bindProcessToNetwork(@Nullable android.net.Network);
    method @NonNull public android.net.SocketKeepalive createSocketKeepalive(@NonNull android.net.Network, @NonNull android.net.IpSecManager.UdpEncapsulationSocket, @NonNull java.net.InetAddress, @NonNull java.net.InetAddress, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network getActiveNetwork();
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getActiveNetworkInfo();
    method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo[] getAllNetworkInfo();
    method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network[] getAllNetworks();
    method @Deprecated public boolean getBackgroundDataSetting();
    method @Nullable public android.net.Network getBoundNetworkForProcess();
    method public int getConnectionOwnerUid(int, @NonNull java.net.InetSocketAddress, @NonNull java.net.InetSocketAddress);
    method @Nullable public android.net.ProxyInfo getDefaultProxy();
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.LinkProperties getLinkProperties(@Nullable android.net.Network);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public int getMultipathPreference(@Nullable android.net.Network);
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkCapabilities getNetworkCapabilities(@Nullable android.net.Network);
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getNetworkInfo(int);
    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getNetworkInfo(@Nullable android.net.Network);
    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public int getNetworkPreference();
    method @Nullable public byte[] getNetworkWatchlistConfigHash();
    method @Deprecated @Nullable public static android.net.Network getProcessDefaultNetwork();
    method public int getRestrictBackgroundStatus();
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public boolean isActiveNetworkMetered();
    method public boolean isDefaultNetworkActive();
    method @Deprecated public static boolean isNetworkTypeValid(int);
    method public void registerBestMatchingNetworkCallback(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerDefaultNetworkCallback(@NonNull android.net.ConnectivityManager.NetworkCallback);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerDefaultNetworkCallback(@NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerNetworkCallback(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerNetworkCallback(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
    method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public void registerNetworkCallback(@NonNull android.net.NetworkRequest, @NonNull android.app.PendingIntent);
    method public void releaseNetworkRequest(@NonNull android.app.PendingIntent);
    method public void removeDefaultNetworkActiveListener(@NonNull android.net.ConnectivityManager.OnNetworkActiveListener);
    method @Deprecated public void reportBadNetwork(@Nullable android.net.Network);
    method public void reportNetworkConnectivity(@Nullable android.net.Network, boolean);
    method public boolean requestBandwidthUpdate(@NonNull android.net.Network);
    method public void requestNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback);
    method public void requestNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler);
    method public void requestNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, int);
    method public void requestNetwork(@NonNull android.net.NetworkRequest, @NonNull android.net.ConnectivityManager.NetworkCallback, @NonNull android.os.Handler, int);
    method public void requestNetwork(@NonNull android.net.NetworkRequest, @NonNull android.app.PendingIntent);
    method @Deprecated public void setNetworkPreference(int);
    method @Deprecated public static boolean setProcessDefaultNetwork(@Nullable android.net.Network);
    method public void unregisterNetworkCallback(@NonNull android.net.ConnectivityManager.NetworkCallback);
    method public void unregisterNetworkCallback(@NonNull android.app.PendingIntent);
    field @Deprecated public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
    field public static final String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL";
    field public static final String ACTION_RESTRICT_BACKGROUND_CHANGED = "android.net.conn.RESTRICT_BACKGROUND_CHANGED";
    field @Deprecated public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
    field @Deprecated public static final int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1
    field public static final String EXTRA_CAPTIVE_PORTAL = "android.net.extra.CAPTIVE_PORTAL";
    field public static final String EXTRA_CAPTIVE_PORTAL_URL = "android.net.extra.CAPTIVE_PORTAL_URL";
    field @Deprecated public static final String EXTRA_EXTRA_INFO = "extraInfo";
    field @Deprecated public static final String EXTRA_IS_FAILOVER = "isFailover";
    field public static final String EXTRA_NETWORK = "android.net.extra.NETWORK";
    field @Deprecated public static final String EXTRA_NETWORK_INFO = "networkInfo";
    field public static final String EXTRA_NETWORK_REQUEST = "android.net.extra.NETWORK_REQUEST";
    field @Deprecated public static final String EXTRA_NETWORK_TYPE = "networkType";
    field public static final String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field @Deprecated public static final String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final String EXTRA_REASON = "reason";
    field public static final int MULTIPATH_PREFERENCE_HANDOVER = 1; // 0x1
    field public static final int MULTIPATH_PREFERENCE_PERFORMANCE = 4; // 0x4
    field public static final int MULTIPATH_PREFERENCE_RELIABILITY = 2; // 0x2
    field public static final int RESTRICT_BACKGROUND_STATUS_DISABLED = 1; // 0x1
    field public static final int RESTRICT_BACKGROUND_STATUS_ENABLED = 3; // 0x3
    field public static final int RESTRICT_BACKGROUND_STATUS_WHITELISTED = 2; // 0x2
    field @Deprecated public static final int TYPE_BLUETOOTH = 7; // 0x7
    field @Deprecated public static final int TYPE_DUMMY = 8; // 0x8
    field @Deprecated public static final int TYPE_ETHERNET = 9; // 0x9
    field @Deprecated public static final int TYPE_MOBILE = 0; // 0x0
    field @Deprecated public static final int TYPE_MOBILE_DUN = 4; // 0x4
    field @Deprecated public static final int TYPE_MOBILE_HIPRI = 5; // 0x5
    field @Deprecated public static final int TYPE_MOBILE_MMS = 2; // 0x2
    field @Deprecated public static final int TYPE_MOBILE_SUPL = 3; // 0x3
    field @Deprecated public static final int TYPE_VPN = 17; // 0x11
    field @Deprecated public static final int TYPE_WIFI = 1; // 0x1
    field @Deprecated public static final int TYPE_WIMAX = 6; // 0x6
  }

  public static class ConnectivityManager.NetworkCallback {
    ctor public ConnectivityManager.NetworkCallback();
    ctor public ConnectivityManager.NetworkCallback(int);
    method public void onAvailable(@NonNull android.net.Network);
    method public void onBlockedStatusChanged(@NonNull android.net.Network, boolean);
    method public void onCapabilitiesChanged(@NonNull android.net.Network, @NonNull android.net.NetworkCapabilities);
    method public void onLinkPropertiesChanged(@NonNull android.net.Network, @NonNull android.net.LinkProperties);
    method public void onLosing(@NonNull android.net.Network, int);
    method public void onLost(@NonNull android.net.Network);
    method public void onUnavailable();
    field public static final int FLAG_INCLUDE_LOCATION_INFO = 1; // 0x1
  }

  public static interface ConnectivityManager.OnNetworkActiveListener {
    method public void onNetworkActive();
  }

  public class DhcpInfo implements android.os.Parcelable {
    ctor public DhcpInfo();
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.DhcpInfo> CREATOR;
    field public int dns1;
    field public int dns2;
    field public int gateway;
    field public int ipAddress;
    field public int leaseDuration;
    field public int netmask;
    field public int serverAddress;
  }

  public final class DnsResolver {
    method @NonNull public static android.net.DnsResolver getInstance();
    method public void query(@Nullable android.net.Network, @NonNull String, int, @NonNull java.util.concurrent.Executor, @Nullable android.os.CancellationSignal, @NonNull android.net.DnsResolver.Callback<? super java.util.List<java.net.InetAddress>>);
    method public void query(@Nullable android.net.Network, @NonNull String, int, int, @NonNull java.util.concurrent.Executor, @Nullable android.os.CancellationSignal, @NonNull android.net.DnsResolver.Callback<? super java.util.List<java.net.InetAddress>>);
    method public void rawQuery(@Nullable android.net.Network, @NonNull byte[], int, @NonNull java.util.concurrent.Executor, @Nullable android.os.CancellationSignal, @NonNull android.net.DnsResolver.Callback<? super byte[]>);
    method public void rawQuery(@Nullable android.net.Network, @NonNull String, int, int, int, @NonNull java.util.concurrent.Executor, @Nullable android.os.CancellationSignal, @NonNull android.net.DnsResolver.Callback<? super byte[]>);
    field public static final int CLASS_IN = 1; // 0x1
    field public static final int ERROR_PARSE = 0; // 0x0
    field public static final int ERROR_SYSTEM = 1; // 0x1
    field public static final int FLAG_EMPTY = 0; // 0x0
    field public static final int FLAG_NO_CACHE_LOOKUP = 4; // 0x4
    field public static final int FLAG_NO_CACHE_STORE = 2; // 0x2
    field public static final int FLAG_NO_RETRY = 1; // 0x1
    field public static final int TYPE_A = 1; // 0x1
    field public static final int TYPE_AAAA = 28; // 0x1c
  }

  public static interface DnsResolver.Callback<T> {
    method public void onAnswer(@NonNull T, int);
    method public void onError(@NonNull android.net.DnsResolver.DnsException);
  }

  public static class DnsResolver.DnsException extends java.lang.Exception {
    ctor public DnsResolver.DnsException(int, @Nullable Throwable);
    field public final int code;
  }

  public class InetAddresses {
    method public static boolean isNumericAddress(@NonNull String);
    method @NonNull public static java.net.InetAddress parseNumericAddress(@NonNull String);
  }

  public final class IpConfiguration implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.net.ProxyInfo getHttpProxy();
    method @Nullable public android.net.StaticIpConfiguration getStaticIpConfiguration();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.IpConfiguration> CREATOR;
  }

  public static final class IpConfiguration.Builder {
    ctor public IpConfiguration.Builder();
    method @NonNull public android.net.IpConfiguration build();
    method @NonNull public android.net.IpConfiguration.Builder setHttpProxy(@Nullable android.net.ProxyInfo);
    method @NonNull public android.net.IpConfiguration.Builder setStaticIpConfiguration(@Nullable android.net.StaticIpConfiguration);
  }

  public final class IpPrefix implements android.os.Parcelable {
    ctor public IpPrefix(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int);
    method public boolean contains(@NonNull java.net.InetAddress);
    method public int describeContents();
    method @NonNull public java.net.InetAddress getAddress();
    method @IntRange(from=0, to=128) public int getPrefixLength();
    method @NonNull public byte[] getRawAddress();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.IpPrefix> CREATOR;
  }

  public class LinkAddress implements android.os.Parcelable {
    method public int describeContents();
    method public java.net.InetAddress getAddress();
    method public int getFlags();
    method @IntRange(from=0, to=128) public int getPrefixLength();
    method public int getScope();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.LinkAddress> CREATOR;
  }

  public final class LinkProperties implements android.os.Parcelable {
    ctor public LinkProperties();
    method public boolean addRoute(@NonNull android.net.RouteInfo);
    method public void clear();
    method public int describeContents();
    method @Nullable public java.net.Inet4Address getDhcpServerAddress();
    method @NonNull public java.util.List<java.net.InetAddress> getDnsServers();
    method @Nullable public String getDomains();
    method @Nullable public android.net.ProxyInfo getHttpProxy();
    method @Nullable public String getInterfaceName();
    method @NonNull public java.util.List<android.net.LinkAddress> getLinkAddresses();
    method public int getMtu();
    method @Nullable public android.net.IpPrefix getNat64Prefix();
    method @Nullable public String getPrivateDnsServerName();
    method @NonNull public java.util.List<android.net.RouteInfo> getRoutes();
    method public boolean isPrivateDnsActive();
    method public boolean isWakeOnLanSupported();
    method public void setDhcpServerAddress(@Nullable java.net.Inet4Address);
    method public void setDnsServers(@NonNull java.util.Collection<java.net.InetAddress>);
    method public void setDomains(@Nullable String);
    method public void setHttpProxy(@Nullable android.net.ProxyInfo);
    method public void setInterfaceName(@Nullable String);
    method public void setLinkAddresses(@NonNull java.util.Collection<android.net.LinkAddress>);
    method public void setMtu(int);
    method public void setNat64Prefix(@Nullable android.net.IpPrefix);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.LinkProperties> CREATOR;
  }

  public final class MacAddress implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public static android.net.MacAddress fromBytes(@NonNull byte[]);
    method @NonNull public static android.net.MacAddress fromString(@NonNull String);
    method public int getAddressType();
    method @Nullable public java.net.Inet6Address getLinkLocalIpv6FromEui48Mac();
    method public boolean isLocallyAssigned();
    method public boolean matches(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
    method @NonNull public byte[] toByteArray();
    method @NonNull public String toOuiString();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.net.MacAddress BROADCAST_ADDRESS;
    field @NonNull public static final android.os.Parcelable.Creator<android.net.MacAddress> CREATOR;
    field public static final int TYPE_BROADCAST = 3; // 0x3
    field public static final int TYPE_MULTICAST = 2; // 0x2
    field public static final int TYPE_UNICAST = 1; // 0x1
  }

  public class Network implements android.os.Parcelable {
    method public void bindSocket(java.net.DatagramSocket) throws java.io.IOException;
    method public void bindSocket(java.net.Socket) throws java.io.IOException;
    method public void bindSocket(java.io.FileDescriptor) throws java.io.IOException;
    method public int describeContents();
    method public static android.net.Network fromNetworkHandle(long);
    method public java.net.InetAddress[] getAllByName(String) throws java.net.UnknownHostException;
    method public java.net.InetAddress getByName(String) throws java.net.UnknownHostException;
    method public long getNetworkHandle();
    method public javax.net.SocketFactory getSocketFactory();
    method public java.net.URLConnection openConnection(java.net.URL) throws java.io.IOException;
    method public java.net.URLConnection openConnection(java.net.URL, java.net.Proxy) throws java.io.IOException;
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.Network> CREATOR;
  }

  public final class NetworkCapabilities implements android.os.Parcelable {
    ctor public NetworkCapabilities();
    ctor public NetworkCapabilities(android.net.NetworkCapabilities);
    method public int describeContents();
    method @NonNull public int[] getCapabilities();
    method @NonNull public int[] getEnterpriseIds();
    method public int getLinkDownstreamBandwidthKbps();
    method public int getLinkUpstreamBandwidthKbps();
    method @Nullable public android.net.NetworkSpecifier getNetworkSpecifier();
    method public int getOwnerUid();
    method public int getSignalStrength();
    method @FlaggedApi("com.android.net.flags.request_restricted_wifi") @NonNull public java.util.Set<java.lang.Integer> getSubscriptionIds();
    method @Nullable public android.net.TransportInfo getTransportInfo();
    method public boolean hasCapability(int);
    method public boolean hasEnterpriseId(int);
    method public boolean hasTransport(int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkCapabilities> CREATOR;
    field public static final int NET_CAPABILITY_CAPTIVE_PORTAL = 17; // 0x11
    field public static final int NET_CAPABILITY_CBS = 5; // 0x5
    field public static final int NET_CAPABILITY_DUN = 2; // 0x2
    field public static final int NET_CAPABILITY_EIMS = 10; // 0xa
    field public static final int NET_CAPABILITY_ENTERPRISE = 29; // 0x1d
    field public static final int NET_CAPABILITY_FOREGROUND = 19; // 0x13
    field public static final int NET_CAPABILITY_FOTA = 3; // 0x3
    field public static final int NET_CAPABILITY_HEAD_UNIT = 32; // 0x20
    field public static final int NET_CAPABILITY_IA = 7; // 0x7
    field public static final int NET_CAPABILITY_IMS = 4; // 0x4
    field public static final int NET_CAPABILITY_INTERNET = 12; // 0xc
    field @FlaggedApi("com.android.net.flags.net_capability_local_network") public static final int NET_CAPABILITY_LOCAL_NETWORK = 36; // 0x24
    field public static final int NET_CAPABILITY_MCX = 23; // 0x17
    field public static final int NET_CAPABILITY_MMS = 0; // 0x0
    field public static final int NET_CAPABILITY_MMTEL = 33; // 0x21
    field public static final int NET_CAPABILITY_NOT_CONGESTED = 20; // 0x14
    field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb
    field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd
    field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12
    field public static final int NET_CAPABILITY_NOT_SUSPENDED = 21; // 0x15
    field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf
    field public static final int NET_CAPABILITY_PRIORITIZE_BANDWIDTH = 35; // 0x23
    field public static final int NET_CAPABILITY_PRIORITIZE_LATENCY = 34; // 0x22
    field public static final int NET_CAPABILITY_RCS = 8; // 0x8
    field public static final int NET_CAPABILITY_SUPL = 1; // 0x1
    field public static final int NET_CAPABILITY_TEMPORARILY_NOT_METERED = 25; // 0x19
    field public static final int NET_CAPABILITY_TRUSTED = 14; // 0xe
    field public static final int NET_CAPABILITY_VALIDATED = 16; // 0x10
    field public static final int NET_CAPABILITY_WIFI_P2P = 6; // 0x6
    field public static final int NET_CAPABILITY_XCAP = 9; // 0x9
    field public static final int NET_ENTERPRISE_ID_1 = 1; // 0x1
    field public static final int NET_ENTERPRISE_ID_2 = 2; // 0x2
    field public static final int NET_ENTERPRISE_ID_3 = 3; // 0x3
    field public static final int NET_ENTERPRISE_ID_4 = 4; // 0x4
    field public static final int NET_ENTERPRISE_ID_5 = 5; // 0x5
    field public static final int SIGNAL_STRENGTH_UNSPECIFIED = -2147483648; // 0x80000000
    field public static final int TRANSPORT_BLUETOOTH = 2; // 0x2
    field public static final int TRANSPORT_CELLULAR = 0; // 0x0
    field public static final int TRANSPORT_ETHERNET = 3; // 0x3
    field public static final int TRANSPORT_LOWPAN = 6; // 0x6
    field @FlaggedApi("com.android.net.flags.support_transport_satellite") public static final int TRANSPORT_SATELLITE = 10; // 0xa
    field public static final int TRANSPORT_THREAD = 9; // 0x9
    field public static final int TRANSPORT_USB = 8; // 0x8
    field public static final int TRANSPORT_VPN = 4; // 0x4
    field public static final int TRANSPORT_WIFI = 1; // 0x1
    field public static final int TRANSPORT_WIFI_AWARE = 5; // 0x5
  }

  @Deprecated public class NetworkInfo implements android.os.Parcelable {
    ctor @Deprecated public NetworkInfo(int, int, @Nullable String, @Nullable String);
    method @Deprecated public int describeContents();
    method @Deprecated @NonNull public android.net.NetworkInfo.DetailedState getDetailedState();
    method @Deprecated public String getExtraInfo();
    method @Deprecated public String getReason();
    method @Deprecated public android.net.NetworkInfo.State getState();
    method @Deprecated public int getSubtype();
    method @Deprecated public String getSubtypeName();
    method @Deprecated public int getType();
    method @Deprecated public String getTypeName();
    method @Deprecated public boolean isAvailable();
    method @Deprecated public boolean isConnected();
    method @Deprecated public boolean isConnectedOrConnecting();
    method @Deprecated public boolean isFailover();
    method @Deprecated public boolean isRoaming();
    method @Deprecated public void setDetailedState(@NonNull android.net.NetworkInfo.DetailedState, @Nullable String, @Nullable String);
    method @Deprecated public void writeToParcel(android.os.Parcel, int);
    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR;
  }

  @Deprecated public enum NetworkInfo.DetailedState {
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState AUTHENTICATING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState BLOCKED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState CAPTIVE_PORTAL_CHECK;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState CONNECTED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState CONNECTING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState DISCONNECTED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState DISCONNECTING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState FAILED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState IDLE;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState OBTAINING_IPADDR;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState SCANNING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState SUSPENDED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.DetailedState VERIFYING_POOR_LINK;
  }

  @Deprecated public enum NetworkInfo.State {
    enum_constant @Deprecated public static final android.net.NetworkInfo.State CONNECTED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.State CONNECTING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.State DISCONNECTED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.State DISCONNECTING;
    enum_constant @Deprecated public static final android.net.NetworkInfo.State SUSPENDED;
    enum_constant @Deprecated public static final android.net.NetworkInfo.State UNKNOWN;
  }

  public class NetworkRequest implements android.os.Parcelable {
    method public boolean canBeSatisfiedBy(@Nullable android.net.NetworkCapabilities);
    method public int describeContents();
    method @NonNull public int[] getCapabilities();
    method @Nullable public android.net.NetworkSpecifier getNetworkSpecifier();
    method @FlaggedApi("com.android.net.flags.request_restricted_wifi") @NonNull public java.util.Set<java.lang.Integer> getSubscriptionIds();
    method @NonNull public int[] getTransportTypes();
    method public boolean hasCapability(int);
    method public boolean hasTransport(int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkRequest> CREATOR;
  }

  public static class NetworkRequest.Builder {
    ctor public NetworkRequest.Builder();
    ctor public NetworkRequest.Builder(@NonNull android.net.NetworkRequest);
    method public android.net.NetworkRequest.Builder addCapability(int);
    method public android.net.NetworkRequest.Builder addTransportType(int);
    method public android.net.NetworkRequest build();
    method @NonNull public android.net.NetworkRequest.Builder clearCapabilities();
    method public android.net.NetworkRequest.Builder removeCapability(int);
    method public android.net.NetworkRequest.Builder removeTransportType(int);
    method @NonNull public android.net.NetworkRequest.Builder setIncludeOtherUidNetworks(boolean);
    method @Deprecated public android.net.NetworkRequest.Builder setNetworkSpecifier(String);
    method public android.net.NetworkRequest.Builder setNetworkSpecifier(android.net.NetworkSpecifier);
    method @FlaggedApi("com.android.net.flags.request_restricted_wifi") @NonNull public android.net.NetworkRequest.Builder setSubscriptionIds(@NonNull java.util.Set<java.lang.Integer>);
  }

  public class ParseException extends java.lang.RuntimeException {
    ctor public ParseException(@NonNull String);
    ctor public ParseException(@NonNull String, @NonNull Throwable);
    field public String response;
  }

  public class ProxyInfo implements android.os.Parcelable {
    ctor public ProxyInfo(@Nullable android.net.ProxyInfo);
    method public static android.net.ProxyInfo buildDirectProxy(String, int);
    method public static android.net.ProxyInfo buildDirectProxy(String, int, java.util.List<java.lang.String>);
    method public static android.net.ProxyInfo buildPacProxy(android.net.Uri);
    method @NonNull public static android.net.ProxyInfo buildPacProxy(@NonNull android.net.Uri, int);
    method public int describeContents();
    method public String[] getExclusionList();
    method public String getHost();
    method public android.net.Uri getPacFileUrl();
    method public int getPort();
    method public boolean isValid();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.ProxyInfo> CREATOR;
  }

  public final class RouteInfo implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.net.IpPrefix getDestination();
    method @Nullable public java.net.InetAddress getGateway();
    method @Nullable public String getInterface();
    method public int getType();
    method public boolean hasGateway();
    method public boolean isDefaultRoute();
    method public boolean matches(java.net.InetAddress);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.RouteInfo> CREATOR;
    field public static final int RTN_THROW = 9; // 0x9
    field public static final int RTN_UNICAST = 1; // 0x1
    field public static final int RTN_UNREACHABLE = 7; // 0x7
  }

  public abstract class SocketKeepalive implements java.lang.AutoCloseable {
    method public final void close();
    method public final void start(@IntRange(from=0xa, to=0xe10) int);
    method public final void stop();
    field public static final int ERROR_HARDWARE_ERROR = -31; // 0xffffffe1
    field public static final int ERROR_INSUFFICIENT_RESOURCES = -32; // 0xffffffe0
    field public static final int ERROR_INVALID_INTERVAL = -24; // 0xffffffe8
    field public static final int ERROR_INVALID_IP_ADDRESS = -21; // 0xffffffeb
    field public static final int ERROR_INVALID_LENGTH = -23; // 0xffffffe9
    field public static final int ERROR_INVALID_NETWORK = -20; // 0xffffffec
    field public static final int ERROR_INVALID_PORT = -22; // 0xffffffea
    field public static final int ERROR_INVALID_SOCKET = -25; // 0xffffffe7
    field public static final int ERROR_SOCKET_NOT_IDLE = -26; // 0xffffffe6
    field public static final int ERROR_UNSUPPORTED = -30; // 0xffffffe2
  }

  public static class SocketKeepalive.Callback {
    ctor public SocketKeepalive.Callback();
    method public void onDataReceived();
    method public void onError(int);
    method public void onStarted();
    method public void onStopped();
  }

  public final class StaticIpConfiguration implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.List<java.net.InetAddress> getDnsServers();
    method @Nullable public String getDomains();
    method @Nullable public java.net.InetAddress getGateway();
    method @NonNull public android.net.LinkAddress getIpAddress();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.StaticIpConfiguration> CREATOR;
  }

  public static final class StaticIpConfiguration.Builder {
    ctor public StaticIpConfiguration.Builder();
    method @NonNull public android.net.StaticIpConfiguration build();
    method @NonNull public android.net.StaticIpConfiguration.Builder setDnsServers(@NonNull Iterable<java.net.InetAddress>);
    method @NonNull public android.net.StaticIpConfiguration.Builder setDomains(@Nullable String);
    method @NonNull public android.net.StaticIpConfiguration.Builder setGateway(@Nullable java.net.InetAddress);
    method @NonNull public android.net.StaticIpConfiguration.Builder setIpAddress(@NonNull android.net.LinkAddress);
  }

  public interface TransportInfo {
  }

}

package android.net.http {

  public abstract class BidirectionalStream {
    ctor public BidirectionalStream();
    method public abstract void cancel();
    method public abstract void flush();
    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
    method @NonNull public abstract String getHttpMethod();
    method public abstract int getPriority();
    method public abstract int getTrafficStatsTag();
    method public abstract int getTrafficStatsUid();
    method public abstract boolean hasTrafficStatsTag();
    method public abstract boolean hasTrafficStatsUid();
    method public abstract boolean isDelayRequestHeadersUntilFirstFlushEnabled();
    method public abstract boolean isDone();
    method public abstract void read(@NonNull java.nio.ByteBuffer);
    method public abstract void start();
    method public abstract void write(@NonNull java.nio.ByteBuffer, boolean);
    field public static final int STREAM_PRIORITY_HIGHEST = 4; // 0x4
    field public static final int STREAM_PRIORITY_IDLE = 0; // 0x0
    field public static final int STREAM_PRIORITY_LOW = 2; // 0x2
    field public static final int STREAM_PRIORITY_LOWEST = 1; // 0x1
    field public static final int STREAM_PRIORITY_MEDIUM = 3; // 0x3
  }

  public abstract static class BidirectionalStream.Builder {
    ctor public BidirectionalStream.Builder();
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder addHeader(@NonNull String, @NonNull String);
    method @NonNull public abstract android.net.http.BidirectionalStream build();
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setDelayRequestHeadersUntilFirstFlushEnabled(boolean);
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setHttpMethod(@NonNull String);
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setPriority(int);
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsTag(int);
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder setTrafficStatsUid(int);
  }

  public static interface BidirectionalStream.Callback {
    method public void onCanceled(@NonNull android.net.http.BidirectionalStream, @Nullable android.net.http.UrlResponseInfo);
    method public void onFailed(@NonNull android.net.http.BidirectionalStream, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
    method public void onReadCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
    method public void onResponseHeadersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
    method public void onResponseTrailersReceived(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull android.net.http.HeaderBlock);
    method public void onStreamReady(@NonNull android.net.http.BidirectionalStream);
    method public void onSucceeded(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo);
    method public void onWriteCompleted(@NonNull android.net.http.BidirectionalStream, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer, boolean);
  }

  public abstract class CallbackException extends android.net.http.HttpException {
    ctor protected CallbackException(@Nullable String, @Nullable Throwable);
  }

  public class ConnectionMigrationOptions {
    method public int getAllowNonDefaultNetworkUsage();
    method public int getDefaultNetworkMigration();
    method public int getPathDegradationMigration();
    field public static final int MIGRATION_OPTION_DISABLED = 2; // 0x2
    field public static final int MIGRATION_OPTION_ENABLED = 1; // 0x1
    field public static final int MIGRATION_OPTION_UNSPECIFIED = 0; // 0x0
  }

  public static final class ConnectionMigrationOptions.Builder {
    ctor public ConnectionMigrationOptions.Builder();
    method @NonNull public android.net.http.ConnectionMigrationOptions build();
    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setAllowNonDefaultNetworkUsage(int);
    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setDefaultNetworkMigration(int);
    method @NonNull public android.net.http.ConnectionMigrationOptions.Builder setPathDegradationMigration(int);
  }

  public final class DnsOptions {
    method public int getPersistHostCache();
    method @Nullable public java.time.Duration getPersistHostCachePeriod();
    method public int getPreestablishConnectionsToStaleDnsResults();
    method public int getStaleDns();
    method @Nullable public android.net.http.DnsOptions.StaleDnsOptions getStaleDnsOptions();
    method public int getUseHttpStackDnsResolver();
    field public static final int DNS_OPTION_DISABLED = 2; // 0x2
    field public static final int DNS_OPTION_ENABLED = 1; // 0x1
    field public static final int DNS_OPTION_UNSPECIFIED = 0; // 0x0
  }

  public static final class DnsOptions.Builder {
    ctor public DnsOptions.Builder();
    method @NonNull public android.net.http.DnsOptions build();
    method @NonNull public android.net.http.DnsOptions.Builder setPersistHostCache(int);
    method @NonNull public android.net.http.DnsOptions.Builder setPersistHostCachePeriod(@NonNull java.time.Duration);
    method @NonNull public android.net.http.DnsOptions.Builder setPreestablishConnectionsToStaleDnsResults(int);
    method @NonNull public android.net.http.DnsOptions.Builder setStaleDns(int);
    method @NonNull public android.net.http.DnsOptions.Builder setStaleDnsOptions(@NonNull android.net.http.DnsOptions.StaleDnsOptions);
    method @NonNull public android.net.http.DnsOptions.Builder setUseHttpStackDnsResolver(int);
  }

  public static class DnsOptions.StaleDnsOptions {
    method public int getAllowCrossNetworkUsage();
    method @Nullable public java.time.Duration getFreshLookupTimeout();
    method @Nullable public java.time.Duration getMaxExpiredDelay();
    method public int getUseStaleOnNameNotResolved();
  }

  public static final class DnsOptions.StaleDnsOptions.Builder {
    ctor public DnsOptions.StaleDnsOptions.Builder();
    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions build();
    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setAllowCrossNetworkUsage(int);
    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setFreshLookupTimeout(@NonNull java.time.Duration);
    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setMaxExpiredDelay(@NonNull java.time.Duration);
    method @NonNull public android.net.http.DnsOptions.StaleDnsOptions.Builder setUseStaleOnNameNotResolved(int);
  }

  public abstract class HeaderBlock {
    ctor public HeaderBlock();
    method @NonNull public abstract java.util.List<java.util.Map.Entry<java.lang.String,java.lang.String>> getAsList();
    method @NonNull public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAsMap();
  }

  public abstract class HttpEngine {
    method public void bindToNetwork(@Nullable android.net.Network);
    method @NonNull public abstract java.net.URLStreamHandlerFactory createUrlStreamHandlerFactory();
    method @NonNull public static String getVersionString();
    method @NonNull public abstract android.net.http.BidirectionalStream.Builder newBidirectionalStreamBuilder(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.http.BidirectionalStream.Callback);
    method @NonNull public abstract android.net.http.UrlRequest.Builder newUrlRequestBuilder(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.http.UrlRequest.Callback);
    method @NonNull public abstract java.net.URLConnection openConnection(@NonNull java.net.URL) throws java.io.IOException;
    method public abstract void shutdown();
  }

  public static class HttpEngine.Builder {
    ctor public HttpEngine.Builder(@NonNull android.content.Context);
    method @NonNull public android.net.http.HttpEngine.Builder addPublicKeyPins(@NonNull String, @NonNull java.util.Set<byte[]>, boolean, @NonNull java.time.Instant);
    method @NonNull public android.net.http.HttpEngine.Builder addQuicHint(@NonNull String, int, int);
    method @NonNull public android.net.http.HttpEngine build();
    method @NonNull public String getDefaultUserAgent();
    method @NonNull public android.net.http.HttpEngine.Builder setConnectionMigrationOptions(@NonNull android.net.http.ConnectionMigrationOptions);
    method @NonNull public android.net.http.HttpEngine.Builder setDnsOptions(@NonNull android.net.http.DnsOptions);
    method @NonNull public android.net.http.HttpEngine.Builder setEnableBrotli(boolean);
    method @NonNull public android.net.http.HttpEngine.Builder setEnableHttp2(boolean);
    method @NonNull public android.net.http.HttpEngine.Builder setEnableHttpCache(int, long);
    method @NonNull public android.net.http.HttpEngine.Builder setEnablePublicKeyPinningBypassForLocalTrustAnchors(boolean);
    method @NonNull public android.net.http.HttpEngine.Builder setEnableQuic(boolean);
    method @NonNull public android.net.http.HttpEngine.Builder setQuicOptions(@NonNull android.net.http.QuicOptions);
    method @NonNull public android.net.http.HttpEngine.Builder setStoragePath(@NonNull String);
    method @NonNull public android.net.http.HttpEngine.Builder setUserAgent(@NonNull String);
    field public static final int HTTP_CACHE_DISABLED = 0; // 0x0
    field public static final int HTTP_CACHE_DISK = 3; // 0x3
    field public static final int HTTP_CACHE_DISK_NO_HTTP = 2; // 0x2
    field public static final int HTTP_CACHE_IN_MEMORY = 1; // 0x1
  }

  public class HttpException extends java.io.IOException {
    ctor public HttpException(@Nullable String, @Nullable Throwable);
  }

  public final class InlineExecutionProhibitedException extends java.util.concurrent.RejectedExecutionException {
    ctor public InlineExecutionProhibitedException();
  }

  public abstract class NetworkException extends android.net.http.HttpException {
    ctor public NetworkException(@Nullable String, @Nullable Throwable);
    method public abstract int getErrorCode();
    method public abstract boolean isImmediatelyRetryable();
    field public static final int ERROR_ADDRESS_UNREACHABLE = 9; // 0x9
    field public static final int ERROR_CONNECTION_CLOSED = 5; // 0x5
    field public static final int ERROR_CONNECTION_REFUSED = 7; // 0x7
    field public static final int ERROR_CONNECTION_RESET = 8; // 0x8
    field public static final int ERROR_CONNECTION_TIMED_OUT = 6; // 0x6
    field public static final int ERROR_HOSTNAME_NOT_RESOLVED = 1; // 0x1
    field public static final int ERROR_INTERNET_DISCONNECTED = 2; // 0x2
    field public static final int ERROR_NETWORK_CHANGED = 3; // 0x3
    field public static final int ERROR_OTHER = 11; // 0xb
    field public static final int ERROR_QUIC_PROTOCOL_FAILED = 10; // 0xa
    field public static final int ERROR_TIMED_OUT = 4; // 0x4
  }

  public abstract class QuicException extends android.net.http.NetworkException {
    ctor protected QuicException(@Nullable String, @Nullable Throwable);
  }

  public class QuicOptions {
    method @NonNull public java.util.Set<java.lang.String> getAllowedQuicHosts();
    method @Nullable public String getHandshakeUserAgent();
    method @Nullable public java.time.Duration getIdleConnectionTimeout();
    method public int getInMemoryServerConfigsCacheSize();
    method public boolean hasInMemoryServerConfigsCacheSize();
  }

  public static final class QuicOptions.Builder {
    ctor public QuicOptions.Builder();
    method @NonNull public android.net.http.QuicOptions.Builder addAllowedQuicHost(@NonNull String);
    method @NonNull public android.net.http.QuicOptions build();
    method @NonNull public android.net.http.QuicOptions.Builder setHandshakeUserAgent(@NonNull String);
    method @NonNull public android.net.http.QuicOptions.Builder setIdleConnectionTimeout(@NonNull java.time.Duration);
    method @NonNull public android.net.http.QuicOptions.Builder setInMemoryServerConfigsCacheSize(int);
  }

  public abstract class UploadDataProvider implements java.io.Closeable {
    ctor public UploadDataProvider();
    method public void close() throws java.io.IOException;
    method public abstract long getLength() throws java.io.IOException;
    method public abstract void read(@NonNull android.net.http.UploadDataSink, @NonNull java.nio.ByteBuffer) throws java.io.IOException;
    method public abstract void rewind(@NonNull android.net.http.UploadDataSink) throws java.io.IOException;
  }

  public abstract class UploadDataSink {
    ctor public UploadDataSink();
    method public abstract void onReadError(@NonNull Exception);
    method public abstract void onReadSucceeded(boolean);
    method public abstract void onRewindError(@NonNull Exception);
    method public abstract void onRewindSucceeded();
  }

  public abstract class UrlRequest {
    method public abstract void cancel();
    method public abstract void followRedirect();
    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
    method @Nullable public abstract String getHttpMethod();
    method public abstract int getPriority();
    method public abstract void getStatus(@NonNull android.net.http.UrlRequest.StatusListener);
    method public abstract int getTrafficStatsTag();
    method public abstract int getTrafficStatsUid();
    method public abstract boolean hasTrafficStatsTag();
    method public abstract boolean hasTrafficStatsUid();
    method public abstract boolean isCacheDisabled();
    method public abstract boolean isDirectExecutorAllowed();
    method public abstract boolean isDone();
    method public abstract void read(@NonNull java.nio.ByteBuffer);
    method public abstract void start();
    field public static final int REQUEST_PRIORITY_HIGHEST = 4; // 0x4
    field public static final int REQUEST_PRIORITY_IDLE = 0; // 0x0
    field public static final int REQUEST_PRIORITY_LOW = 2; // 0x2
    field public static final int REQUEST_PRIORITY_LOWEST = 1; // 0x1
    field public static final int REQUEST_PRIORITY_MEDIUM = 3; // 0x3
  }

  public abstract static class UrlRequest.Builder {
    method @NonNull public abstract android.net.http.UrlRequest.Builder addHeader(@NonNull String, @NonNull String);
    method @NonNull public abstract android.net.http.UrlRequest.Builder bindToNetwork(@Nullable android.net.Network);
    method @NonNull public abstract android.net.http.UrlRequest build();
    method @NonNull public abstract android.net.http.UrlRequest.Builder setCacheDisabled(boolean);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setDirectExecutorAllowed(boolean);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setHttpMethod(@NonNull String);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setPriority(int);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsTag(int);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setTrafficStatsUid(int);
    method @NonNull public abstract android.net.http.UrlRequest.Builder setUploadDataProvider(@NonNull android.net.http.UploadDataProvider, @NonNull java.util.concurrent.Executor);
  }

  public static interface UrlRequest.Callback {
    method public void onCanceled(@NonNull android.net.http.UrlRequest, @Nullable android.net.http.UrlResponseInfo);
    method public void onFailed(@NonNull android.net.http.UrlRequest, @Nullable android.net.http.UrlResponseInfo, @NonNull android.net.http.HttpException);
    method public void onReadCompleted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull java.nio.ByteBuffer) throws java.lang.Exception;
    method public void onRedirectReceived(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo, @NonNull String) throws java.lang.Exception;
    method public void onResponseStarted(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo) throws java.lang.Exception;
    method public void onSucceeded(@NonNull android.net.http.UrlRequest, @NonNull android.net.http.UrlResponseInfo);
  }

  public static class UrlRequest.Status {
    field public static final int CONNECTING = 10; // 0xa
    field public static final int DOWNLOADING_PAC_FILE = 5; // 0x5
    field public static final int ESTABLISHING_PROXY_TUNNEL = 8; // 0x8
    field public static final int IDLE = 0; // 0x0
    field public static final int INVALID = -1; // 0xffffffff
    field public static final int READING_RESPONSE = 14; // 0xe
    field public static final int RESOLVING_HOST = 9; // 0x9
    field public static final int RESOLVING_HOST_IN_PAC_FILE = 7; // 0x7
    field public static final int RESOLVING_PROXY_FOR_URL = 6; // 0x6
    field public static final int SENDING_REQUEST = 12; // 0xc
    field public static final int SSL_HANDSHAKE = 11; // 0xb
    field public static final int WAITING_FOR_AVAILABLE_SOCKET = 2; // 0x2
    field public static final int WAITING_FOR_CACHE = 4; // 0x4
    field public static final int WAITING_FOR_DELEGATE = 3; // 0x3
    field public static final int WAITING_FOR_RESPONSE = 13; // 0xd
    field public static final int WAITING_FOR_STALLED_SOCKET_POOL = 1; // 0x1
  }

  public static interface UrlRequest.StatusListener {
    method public void onStatus(int);
  }

  public abstract class UrlResponseInfo {
    ctor public UrlResponseInfo();
    method @NonNull public abstract android.net.http.HeaderBlock getHeaders();
    method public abstract int getHttpStatusCode();
    method @NonNull public abstract String getHttpStatusText();
    method @NonNull public abstract String getNegotiatedProtocol();
    method public abstract long getReceivedByteCount();
    method @NonNull public abstract String getUrl();
    method @NonNull public abstract java.util.List<java.lang.String> getUrlChain();
    method public abstract boolean wasCached();
  }

}

