// Signature format: 2.0
package android.net {

  public class CaptivePortal implements android.os.Parcelable {
    method @Deprecated public void logEvent(int, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void reevaluateNetwork();
    method public void useNetwork();
    field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64
    field public static final int APP_RETURN_DISMISSED = 0; // 0x0
    field public static final int APP_RETURN_UNWANTED = 1; // 0x1
    field public static final int APP_RETURN_WANTED_AS_IS = 2; // 0x2
  }

  public final class CaptivePortalData implements android.os.Parcelable {
    method public int describeContents();
    method public long getByteLimit();
    method public long getExpiryTimeMillis();
    method public long getRefreshTimeMillis();
    method @Nullable public android.net.Uri getUserPortalUrl();
    method public int getUserPortalUrlSource();
    method @Nullable public CharSequence getVenueFriendlyName();
    method @Nullable public android.net.Uri getVenueInfoUrl();
    method public int getVenueInfoUrlSource();
    method public boolean isCaptive();
    method public boolean isSessionExtendable();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int CAPTIVE_PORTAL_DATA_SOURCE_OTHER = 0; // 0x0
    field public static final int CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT = 1; // 0x1
    field @NonNull public static final android.os.Parcelable.Creator<android.net.CaptivePortalData> CREATOR;
  }

  public static class CaptivePortalData.Builder {
    ctor public CaptivePortalData.Builder();
    ctor public CaptivePortalData.Builder(@Nullable android.net.CaptivePortalData);
    method @NonNull public android.net.CaptivePortalData build();
    method @NonNull public android.net.CaptivePortalData.Builder setBytesRemaining(long);
    method @NonNull public android.net.CaptivePortalData.Builder setCaptive(boolean);
    method @NonNull public android.net.CaptivePortalData.Builder setExpiryTime(long);
    method @NonNull public android.net.CaptivePortalData.Builder setRefreshTime(long);
    method @NonNull public android.net.CaptivePortalData.Builder setSessionExtendable(boolean);
    method @NonNull public android.net.CaptivePortalData.Builder setUserPortalUrl(@Nullable android.net.Uri);
    method @NonNull public android.net.CaptivePortalData.Builder setUserPortalUrl(@Nullable android.net.Uri, int);
    method @NonNull public android.net.CaptivePortalData.Builder setVenueFriendlyName(@Nullable CharSequence);
    method @NonNull public android.net.CaptivePortalData.Builder setVenueInfoUrl(@Nullable android.net.Uri);
    method @NonNull public android.net.CaptivePortalData.Builder setVenueInfoUrl(@Nullable android.net.Uri, int);
  }

  public class ConnectivityManager {
    method @NonNull @RequiresPermission(android.Manifest.permission.PACKET_KEEPALIVE_OFFLOAD) public android.net.SocketKeepalive createNattKeepalive(@NonNull android.net.Network, @NonNull android.os.ParcelFileDescriptor, @NonNull java.net.InetAddress, @NonNull java.net.InetAddress, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
    method @NonNull @RequiresPermission(android.Manifest.permission.PACKET_KEEPALIVE_OFFLOAD) public android.net.SocketKeepalive createSocketKeepalive(@NonNull android.net.Network, @NonNull java.net.Socket, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
    method @Deprecated @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public String getCaptivePortalServerUrl();
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void getLatestTetheringEntitlementResult(int, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.net.ConnectivityManager.OnTetheringEntitlementResultListener);
    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.TETHER_PRIVILEGED, android.Manifest.permission.WRITE_SETTINGS}) public boolean isTetheringSupported();
    method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_FACTORY}) public int registerNetworkProvider(@NonNull android.net.NetworkProvider);
    method public void registerQosCallback(@NonNull android.net.QosSocketInfo, @NonNull java.util.concurrent.Executor, @NonNull android.net.QosCallback);
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void registerTetheringEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.ConnectivityManager.OnTetheringEventCallback);
    method @RequiresPermission(android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) public void requestNetwork(@NonNull android.net.NetworkRequest, int, int, @NonNull android.os.Handler, @NonNull android.net.ConnectivityManager.NetworkCallback);
    method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_AIRPLANE_MODE, android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void setAirplaneMode(boolean);
    method @RequiresPermission(android.Manifest.permission.CONTROL_OEM_PAID_NETWORK_PREFERENCE) public void setOemNetworkPreference(@NonNull android.net.OemNetworkPreferences, @Nullable java.util.concurrent.Executor, @Nullable Runnable);
    method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK}) public boolean shouldAvoidBadWifi();
    method @RequiresPermission(android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) public void startCaptivePortalApp(@NonNull android.net.Network, @NonNull android.os.Bundle);
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback);
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void startTethering(int, boolean, android.net.ConnectivityManager.OnStartTetheringCallback, android.os.Handler);
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void stopTethering(int);
    method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_FACTORY}) public void unregisterNetworkProvider(@NonNull android.net.NetworkProvider);
    method public void unregisterQosCallback(@NonNull android.net.QosCallback);
    method @Deprecated @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void unregisterTetheringEventCallback(@NonNull android.net.ConnectivityManager.OnTetheringEventCallback);
    field public static final String EXTRA_CAPTIVE_PORTAL_PROBE_SPEC = "android.net.extra.CAPTIVE_PORTAL_PROBE_SPEC";
    field public static final String EXTRA_CAPTIVE_PORTAL_USER_AGENT = "android.net.extra.CAPTIVE_PORTAL_USER_AGENT";
    field public static final int TETHERING_BLUETOOTH = 2; // 0x2
    field public static final int TETHERING_USB = 1; // 0x1
    field public static final int TETHERING_WIFI = 0; // 0x0
    field @Deprecated public static final int TETHER_ERROR_ENTITLEMENT_UNKONWN = 13; // 0xd
    field @Deprecated public static final int TETHER_ERROR_NO_ERROR = 0; // 0x0
    field @Deprecated public static final int TETHER_ERROR_PROVISION_FAILED = 11; // 0xb
    field public static final int TYPE_NONE = -1; // 0xffffffff
    field @Deprecated public static final int TYPE_PROXY = 16; // 0x10
    field @Deprecated public static final int TYPE_WIFI_P2P = 13; // 0xd
  }

  @Deprecated public abstract static class ConnectivityManager.OnStartTetheringCallback {
    ctor @Deprecated public ConnectivityManager.OnStartTetheringCallback();
    method @Deprecated public void onTetheringFailed();
    method @Deprecated public void onTetheringStarted();
  }

  @Deprecated public static interface ConnectivityManager.OnTetheringEntitlementResultListener {
    method @Deprecated public void onTetheringEntitlementResult(int);
  }

  @Deprecated public abstract static class ConnectivityManager.OnTetheringEventCallback {
    ctor @Deprecated public ConnectivityManager.OnTetheringEventCallback();
    method @Deprecated public void onUpstreamChanged(@Nullable android.net.Network);
  }

  public final class DscpPolicy implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public java.net.InetAddress getDestinationAddress();
    method @Nullable public android.util.Range<java.lang.Integer> getDestinationPortRange();
    method public int getDscpValue();
    method public int getPolicyId();
    method public int getProtocol();
    method @Nullable public java.net.InetAddress getSourceAddress();
    method public int getSourcePort();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.DscpPolicy> CREATOR;
    field public static final int PROTOCOL_ANY = -1; // 0xffffffff
    field public static final int SOURCE_PORT_ANY = -1; // 0xffffffff
  }

  public static final class DscpPolicy.Builder {
    ctor public DscpPolicy.Builder(int, int);
    method @NonNull public android.net.DscpPolicy build();
    method @NonNull public android.net.DscpPolicy.Builder setDestinationAddress(@NonNull java.net.InetAddress);
    method @NonNull public android.net.DscpPolicy.Builder setDestinationPortRange(@NonNull android.util.Range<java.lang.Integer>);
    method @NonNull public android.net.DscpPolicy.Builder setProtocol(int);
    method @NonNull public android.net.DscpPolicy.Builder setSourceAddress(@NonNull java.net.InetAddress);
    method @NonNull public android.net.DscpPolicy.Builder setSourcePort(int);
  }

  public final class InvalidPacketException extends java.lang.Exception {
    ctor public InvalidPacketException(int);
    method public int getError();
    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_PORT = -22; // 0xffffffea
  }

  public final class IpConfiguration implements android.os.Parcelable {
    ctor public IpConfiguration();
    ctor public IpConfiguration(@NonNull android.net.IpConfiguration);
    method @NonNull public android.net.IpConfiguration.IpAssignment getIpAssignment();
    method @NonNull public android.net.IpConfiguration.ProxySettings getProxySettings();
    method public void setHttpProxy(@Nullable android.net.ProxyInfo);
    method public void setIpAssignment(@NonNull android.net.IpConfiguration.IpAssignment);
    method public void setProxySettings(@NonNull android.net.IpConfiguration.ProxySettings);
    method public void setStaticIpConfiguration(@Nullable android.net.StaticIpConfiguration);
  }

  public enum IpConfiguration.IpAssignment {
    enum_constant public static final android.net.IpConfiguration.IpAssignment DHCP;
    enum_constant public static final android.net.IpConfiguration.IpAssignment STATIC;
    enum_constant public static final android.net.IpConfiguration.IpAssignment UNASSIGNED;
  }

  public enum IpConfiguration.ProxySettings {
    enum_constant public static final android.net.IpConfiguration.ProxySettings NONE;
    enum_constant public static final android.net.IpConfiguration.ProxySettings PAC;
    enum_constant public static final android.net.IpConfiguration.ProxySettings STATIC;
    enum_constant public static final android.net.IpConfiguration.ProxySettings UNASSIGNED;
  }

  public final class IpPrefix implements android.os.Parcelable {
    ctor public IpPrefix(@NonNull String);
  }

  public class KeepalivePacketData {
    ctor protected KeepalivePacketData(@NonNull java.net.InetAddress, @IntRange(from=0, to=65535) int, @NonNull java.net.InetAddress, @IntRange(from=0, to=65535) int, @NonNull byte[]) throws android.net.InvalidPacketException;
    method @NonNull public java.net.InetAddress getDstAddress();
    method public int getDstPort();
    method @NonNull public byte[] getPacket();
    method @NonNull public java.net.InetAddress getSrcAddress();
    method public int getSrcPort();
  }

  public class LinkAddress implements android.os.Parcelable {
    ctor public LinkAddress(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int, int, int);
    ctor public LinkAddress(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int, int, int, long, long);
    ctor public LinkAddress(@NonNull java.net.InetAddress, @IntRange(from=0, to=128) int);
    ctor public LinkAddress(@NonNull String);
    ctor public LinkAddress(@NonNull String, int, int);
    method public long getDeprecationTime();
    method public long getExpirationTime();
    method public boolean isGlobalPreferred();
    method public boolean isIpv4();
    method public boolean isIpv6();
    method public boolean isSameAddressAs(@Nullable android.net.LinkAddress);
    field public static final long LIFETIME_PERMANENT = 9223372036854775807L; // 0x7fffffffffffffffL
    field public static final long LIFETIME_UNKNOWN = -1L; // 0xffffffffffffffffL
  }

  public final class LinkProperties implements android.os.Parcelable {
    ctor public LinkProperties(@Nullable android.net.LinkProperties);
    ctor public LinkProperties(@Nullable android.net.LinkProperties, boolean);
    method public boolean addDnsServer(@NonNull java.net.InetAddress);
    method public boolean addLinkAddress(@NonNull android.net.LinkAddress);
    method public boolean addPcscfServer(@NonNull java.net.InetAddress);
    method @NonNull public java.util.List<java.net.InetAddress> getAddresses();
    method @NonNull public java.util.List<java.lang.String> getAllInterfaceNames();
    method @NonNull public java.util.List<android.net.LinkAddress> getAllLinkAddresses();
    method @NonNull public java.util.List<android.net.RouteInfo> getAllRoutes();
    method @Nullable public android.net.Uri getCaptivePortalApiUrl();
    method @Nullable public android.net.CaptivePortalData getCaptivePortalData();
    method @NonNull public java.util.List<java.net.InetAddress> getPcscfServers();
    method @Nullable public String getTcpBufferSizes();
    method @NonNull public java.util.List<java.net.InetAddress> getValidatedPrivateDnsServers();
    method public boolean hasGlobalIpv6Address();
    method public boolean hasIpv4Address();
    method public boolean hasIpv4DefaultRoute();
    method public boolean hasIpv4DnsServer();
    method public boolean hasIpv6DefaultRoute();
    method public boolean hasIpv6DnsServer();
    method public boolean isIpv4Provisioned();
    method public boolean isIpv6Provisioned();
    method public boolean isProvisioned();
    method public boolean isReachable(@NonNull java.net.InetAddress);
    method public boolean removeDnsServer(@NonNull java.net.InetAddress);
    method public boolean removeLinkAddress(@NonNull android.net.LinkAddress);
    method public boolean removeRoute(@NonNull android.net.RouteInfo);
    method public void setCaptivePortalApiUrl(@Nullable android.net.Uri);
    method public void setCaptivePortalData(@Nullable android.net.CaptivePortalData);
    method public void setPcscfServers(@NonNull java.util.Collection<java.net.InetAddress>);
    method public void setPrivateDnsServerName(@Nullable String);
    method public void setTcpBufferSizes(@Nullable String);
    method public void setUsePrivateDns(boolean);
    method public void setValidatedPrivateDnsServers(@NonNull java.util.Collection<java.net.InetAddress>);
  }

  public final class NattKeepalivePacketData extends android.net.KeepalivePacketData implements android.os.Parcelable {
    ctor public NattKeepalivePacketData(@NonNull java.net.InetAddress, int, @NonNull java.net.InetAddress, int, @NonNull byte[]) throws android.net.InvalidPacketException;
    method public int describeContents();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NattKeepalivePacketData> CREATOR;
  }

  public class Network implements android.os.Parcelable {
    ctor public Network(@NonNull android.net.Network);
    method public int getNetId();
    method @NonNull public android.net.Network getPrivateDnsBypassingCopy();
  }

  public abstract class NetworkAgent {
    ctor public NetworkAgent(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String, @NonNull android.net.NetworkCapabilities, @NonNull android.net.LinkProperties, int, @NonNull android.net.NetworkAgentConfig, @Nullable android.net.NetworkProvider);
    ctor public NetworkAgent(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String, @NonNull android.net.NetworkCapabilities, @NonNull android.net.LinkProperties, @NonNull android.net.NetworkScore, @NonNull android.net.NetworkAgentConfig, @Nullable android.net.NetworkProvider);
    method @Nullable public android.net.Network getNetwork();
    method public void markConnected();
    method public void onAddKeepalivePacketFilter(int, @NonNull android.net.KeepalivePacketData);
    method public void onAutomaticReconnectDisabled();
    method public void onBandwidthUpdateRequested();
    method public void onDscpPolicyStatusUpdated(int, int);
    method public void onNetworkCreated();
    method public void onNetworkDestroyed();
    method public void onNetworkUnwanted();
    method public void onQosCallbackRegistered(int, @NonNull android.net.QosFilter);
    method public void onQosCallbackUnregistered(int);
    method public void onRemoveKeepalivePacketFilter(int);
    method public void onSaveAcceptUnvalidated(boolean);
    method public void onSignalStrengthThresholdsUpdated(@NonNull int[]);
    method public void onStartSocketKeepalive(int, @NonNull java.time.Duration, @NonNull android.net.KeepalivePacketData);
    method public void onStopSocketKeepalive(int);
    method public void onValidationStatus(int, @Nullable android.net.Uri);
    method @NonNull public android.net.Network register();
    method public void sendAddDscpPolicy(@NonNull android.net.DscpPolicy);
    method public void sendLinkProperties(@NonNull android.net.LinkProperties);
    method public void sendNetworkCapabilities(@NonNull android.net.NetworkCapabilities);
    method public void sendNetworkScore(@NonNull android.net.NetworkScore);
    method public void sendNetworkScore(@IntRange(from=0, to=99) int);
    method public final void sendQosCallbackError(int, int);
    method public final void sendQosSessionAvailable(int, int, @NonNull android.net.QosSessionAttributes);
    method public final void sendQosSessionLost(int, int, int);
    method public void sendRemoveAllDscpPolicies();
    method public void sendRemoveDscpPolicy(int);
    method public final void sendSocketKeepaliveEvent(int, int);
    method @Deprecated public void setLegacySubtype(int, @NonNull String);
    method public void setLingerDuration(@NonNull java.time.Duration);
    method public void setTeardownDelayMillis(@IntRange(from=0, to=0x1388) int);
    method public void setUnderlyingNetworks(@Nullable java.util.List<android.net.Network>);
    method public void unregister();
    method public void unregisterAfterReplacement(@IntRange(from=0, to=0x1388) int);
    field public static final int DSCP_POLICY_STATUS_DELETED = 4; // 0x4
    field public static final int DSCP_POLICY_STATUS_INSUFFICIENT_PROCESSING_RESOURCES = 3; // 0x3
    field public static final int DSCP_POLICY_STATUS_POLICY_NOT_FOUND = 5; // 0x5
    field public static final int DSCP_POLICY_STATUS_REQUESTED_CLASSIFIER_NOT_SUPPORTED = 2; // 0x2
    field public static final int DSCP_POLICY_STATUS_REQUEST_DECLINED = 1; // 0x1
    field public static final int DSCP_POLICY_STATUS_SUCCESS = 0; // 0x0
    field public static final int VALIDATION_STATUS_NOT_VALID = 2; // 0x2
    field public static final int VALIDATION_STATUS_VALID = 1; // 0x1
  }

  public final class NetworkAgentConfig implements android.os.Parcelable {
    method public int describeContents();
    method public int getLegacyType();
    method @NonNull public String getLegacyTypeName();
    method public boolean isExplicitlySelected();
    method public boolean isPartialConnectivityAcceptable();
    method public boolean isUnvalidatedConnectivityAcceptable();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkAgentConfig> CREATOR;
  }

  public static final class NetworkAgentConfig.Builder {
    ctor public NetworkAgentConfig.Builder();
    method @NonNull public android.net.NetworkAgentConfig build();
    method @NonNull public android.net.NetworkAgentConfig.Builder setExplicitlySelected(boolean);
    method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyExtraInfo(@NonNull String);
    method @NonNull public android.net.NetworkAgentConfig.Builder setLegacySubType(int);
    method @NonNull public android.net.NetworkAgentConfig.Builder setLegacySubTypeName(@NonNull String);
    method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyType(int);
    method @NonNull public android.net.NetworkAgentConfig.Builder setLegacyTypeName(@NonNull String);
    method @NonNull public android.net.NetworkAgentConfig.Builder setNat64DetectionEnabled(boolean);
    method @NonNull public android.net.NetworkAgentConfig.Builder setPartialConnectivityAcceptable(boolean);
    method @NonNull public android.net.NetworkAgentConfig.Builder setProvisioningNotificationEnabled(boolean);
    method @NonNull public android.net.NetworkAgentConfig.Builder setUnvalidatedConnectivityAcceptable(boolean);
  }

  public final class NetworkCapabilities implements android.os.Parcelable {
    method @NonNull public int[] getAdministratorUids();
    method @Nullable public static String getCapabilityCarrierName(int);
    method @Nullable public String getSsid();
    method @NonNull public int[] getTransportTypes();
    method @Nullable public java.util.List<android.net.Network> getUnderlyingNetworks();
    method public boolean isPrivateDnsBroken();
    method public boolean satisfiedByNetworkCapabilities(@Nullable android.net.NetworkCapabilities);
    field public static final int NET_CAPABILITY_BIP = 31; // 0x1f
    field public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28; // 0x1c
    field public static final int NET_CAPABILITY_OEM_PAID = 22; // 0x16
    field public static final int NET_CAPABILITY_OEM_PRIVATE = 26; // 0x1a
    field public static final int NET_CAPABILITY_PARTIAL_CONNECTIVITY = 24; // 0x18
    field public static final int NET_CAPABILITY_VEHICLE_INTERNAL = 27; // 0x1b
    field public static final int NET_CAPABILITY_VSIM = 30; // 0x1e
  }

  public static final class NetworkCapabilities.Builder {
    ctor public NetworkCapabilities.Builder();
    ctor public NetworkCapabilities.Builder(@NonNull android.net.NetworkCapabilities);
    method @NonNull public android.net.NetworkCapabilities.Builder addCapability(int);
    method @NonNull public android.net.NetworkCapabilities.Builder addEnterpriseId(int);
    method @NonNull public android.net.NetworkCapabilities.Builder addTransportType(int);
    method @NonNull public android.net.NetworkCapabilities build();
    method @NonNull public android.net.NetworkCapabilities.Builder removeCapability(int);
    method @NonNull public android.net.NetworkCapabilities.Builder removeEnterpriseId(int);
    method @NonNull public android.net.NetworkCapabilities.Builder removeTransportType(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setAdministratorUids(@NonNull int[]);
    method @NonNull public android.net.NetworkCapabilities.Builder setLinkDownstreamBandwidthKbps(int);
    method @NonNull public android.net.NetworkCapabilities.Builder setLinkUpstreamBandwidthKbps(int);
    method @NonNull public android.net.NetworkCapabilities.Builder setNetworkSpecifier(@Nullable android.net.NetworkSpecifier);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setOwnerUid(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setRequestorPackageName(@Nullable String);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setRequestorUid(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP) public android.net.NetworkCapabilities.Builder setSignalStrength(int);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setSsid(@Nullable String);
    method @NonNull public android.net.NetworkCapabilities.Builder setSubscriptionIds(@NonNull java.util.Set<java.lang.Integer>);
    method @NonNull public android.net.NetworkCapabilities.Builder setTransportInfo(@Nullable android.net.TransportInfo);
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public android.net.NetworkCapabilities.Builder setUnderlyingNetworks(@Nullable java.util.List<android.net.Network>);
    method @NonNull public static android.net.NetworkCapabilities.Builder withoutDefaultCapabilities();
  }

  public class NetworkProvider {
    ctor public NetworkProvider(@NonNull android.content.Context, @NonNull android.os.Looper, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public void declareNetworkRequestUnfulfillable(@NonNull android.net.NetworkRequest);
    method public int getProviderId();
    method public void onNetworkRequestWithdrawn(@NonNull android.net.NetworkRequest);
    method public void onNetworkRequested(@NonNull android.net.NetworkRequest, @IntRange(from=0, to=99) int, int);
    method @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public void registerNetworkOffer(@NonNull android.net.NetworkScore, @NonNull android.net.NetworkCapabilities, @NonNull java.util.concurrent.Executor, @NonNull android.net.NetworkProvider.NetworkOfferCallback);
    method @RequiresPermission(android.Manifest.permission.NETWORK_FACTORY) public void unregisterNetworkOffer(@NonNull android.net.NetworkProvider.NetworkOfferCallback);
    field public static final int ID_NONE = -1; // 0xffffffff
  }

  public static interface NetworkProvider.NetworkOfferCallback {
    method public void onNetworkNeeded(@NonNull android.net.NetworkRequest);
    method public void onNetworkUnneeded(@NonNull android.net.NetworkRequest);
  }

  public class NetworkReleasedException extends java.lang.Exception {
    ctor public NetworkReleasedException();
  }

  public class NetworkRequest implements android.os.Parcelable {
    method @Nullable public String getRequestorPackageName();
    method public int getRequestorUid();
  }

  public static class NetworkRequest.Builder {
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SIGNAL_STRENGTH_WAKEUP) public android.net.NetworkRequest.Builder setSignalStrength(int);
  }

  public final class NetworkScore implements android.os.Parcelable {
    method public int describeContents();
    method public int getKeepConnectedReason();
    method public int getLegacyInt();
    method public boolean isExiting();
    method public boolean isTransportPrimary();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkScore> CREATOR;
    field public static final int KEEP_CONNECTED_FOR_HANDOVER = 1; // 0x1
    field public static final int KEEP_CONNECTED_NONE = 0; // 0x0
  }

  public static final class NetworkScore.Builder {
    ctor public NetworkScore.Builder();
    method @NonNull public android.net.NetworkScore build();
    method @NonNull public android.net.NetworkScore.Builder setExiting(boolean);
    method @NonNull public android.net.NetworkScore.Builder setKeepConnectedReason(int);
    method @NonNull public android.net.NetworkScore.Builder setLegacyInt(int);
    method @NonNull public android.net.NetworkScore.Builder setTransportPrimary(boolean);
  }

  public final class OemNetworkPreferences implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.Map<java.lang.String,java.lang.Integer> getNetworkPreferences();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.OemNetworkPreferences> CREATOR;
    field public static final int OEM_NETWORK_PREFERENCE_OEM_PAID = 1; // 0x1
    field public static final int OEM_NETWORK_PREFERENCE_OEM_PAID_NO_FALLBACK = 2; // 0x2
    field public static final int OEM_NETWORK_PREFERENCE_OEM_PAID_ONLY = 3; // 0x3
    field public static final int OEM_NETWORK_PREFERENCE_OEM_PRIVATE_ONLY = 4; // 0x4
    field public static final int OEM_NETWORK_PREFERENCE_UNINITIALIZED = 0; // 0x0
  }

  public static final class OemNetworkPreferences.Builder {
    ctor public OemNetworkPreferences.Builder();
    ctor public OemNetworkPreferences.Builder(@NonNull android.net.OemNetworkPreferences);
    method @NonNull public android.net.OemNetworkPreferences.Builder addNetworkPreference(@NonNull String, int);
    method @NonNull public android.net.OemNetworkPreferences build();
    method @NonNull public android.net.OemNetworkPreferences.Builder clearNetworkPreference(@NonNull String);
  }

  public abstract class QosCallback {
    ctor public QosCallback();
    method public void onError(@NonNull android.net.QosCallbackException);
    method public void onQosSessionAvailable(@NonNull android.net.QosSession, @NonNull android.net.QosSessionAttributes);
    method public void onQosSessionLost(@NonNull android.net.QosSession);
  }

  public static class QosCallback.QosCallbackRegistrationException extends java.lang.RuntimeException {
  }

  public final class QosCallbackException extends java.lang.Exception {
    ctor public QosCallbackException(@NonNull String);
    ctor public QosCallbackException(@NonNull Throwable);
  }

  public abstract class QosFilter {
    method @NonNull public abstract android.net.Network getNetwork();
    method public abstract boolean matchesLocalAddress(@NonNull java.net.InetAddress, int, int);
    method public boolean matchesProtocol(int);
    method public abstract boolean matchesRemoteAddress(@NonNull java.net.InetAddress, int, int);
  }

  public final class QosSession implements android.os.Parcelable {
    ctor public QosSession(int, int);
    method public int describeContents();
    method public int getSessionId();
    method public int getSessionType();
    method public long getUniqueId();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.QosSession> CREATOR;
    field public static final int TYPE_EPS_BEARER = 1; // 0x1
    field public static final int TYPE_NR_BEARER = 2; // 0x2
  }

  public interface QosSessionAttributes {
  }

  public final class QosSocketInfo implements android.os.Parcelable {
    ctor public QosSocketInfo(@NonNull android.net.Network, @NonNull java.net.Socket) throws java.io.IOException;
    ctor public QosSocketInfo(@NonNull android.net.Network, @NonNull java.net.DatagramSocket) throws java.io.IOException;
    method public int describeContents();
    method @NonNull public java.net.InetSocketAddress getLocalSocketAddress();
    method @NonNull public android.net.Network getNetwork();
    method @Nullable public java.net.InetSocketAddress getRemoteSocketAddress();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.QosSocketInfo> CREATOR;
  }

  public final class RouteInfo implements android.os.Parcelable {
    ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int);
    ctor public RouteInfo(@Nullable android.net.IpPrefix, @Nullable java.net.InetAddress, @Nullable String, int, int);
    method public int getMtu();
  }

  public abstract class SocketKeepalive implements java.lang.AutoCloseable {
    method public final void start(@IntRange(from=0xa, to=0xe10) int, int, @Nullable android.net.Network);
    field public static final int ERROR_NO_SUCH_SLOT = -33; // 0xffffffdf
    field public static final int FLAG_AUTOMATIC_ON_OFF = 1; // 0x1
    field public static final int SUCCESS = 0; // 0x0
  }

  public class SocketLocalAddressChangedException extends java.lang.Exception {
    ctor public SocketLocalAddressChangedException();
  }

  public class SocketNotBoundException extends java.lang.Exception {
    ctor public SocketNotBoundException();
  }

  public class SocketNotConnectedException extends java.lang.Exception {
    ctor public SocketNotConnectedException();
  }

  public class SocketRemoteAddressChangedException extends java.lang.Exception {
    ctor public SocketRemoteAddressChangedException();
  }

  public final class StaticIpConfiguration implements android.os.Parcelable {
    ctor public StaticIpConfiguration();
    ctor public StaticIpConfiguration(@Nullable android.net.StaticIpConfiguration);
    method public void addDnsServer(@NonNull java.net.InetAddress);
    method public void clear();
    method @NonNull public java.util.List<android.net.RouteInfo> getRoutes(@Nullable String);
  }

  public final class TcpKeepalivePacketData extends android.net.KeepalivePacketData implements android.os.Parcelable {
    ctor public TcpKeepalivePacketData(@NonNull java.net.InetAddress, int, @NonNull java.net.InetAddress, int, @NonNull byte[], int, int, int, int, int, int) throws android.net.InvalidPacketException;
    method public int describeContents();
    method public int getIpTos();
    method public int getIpTtl();
    method public int getTcpAck();
    method public int getTcpSeq();
    method public int getTcpWindow();
    method public int getTcpWindowScale();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.TcpKeepalivePacketData> CREATOR;
  }

  public final class VpnTransportInfo implements android.os.Parcelable android.net.TransportInfo {
    ctor public VpnTransportInfo(int, @Nullable String, boolean, boolean);
    method public boolean areLongLivedTcpConnectionsExpensive();
    method public int describeContents();
    method public int getType();
    method public boolean isBypassable();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.VpnTransportInfo> CREATOR;
  }

}

package android.net.apf {

  public final class ApfCapabilities implements android.os.Parcelable {
    ctor public ApfCapabilities(int, int, int);
    method public int describeContents();
    method public static boolean getApfDrop8023Frames();
    method @NonNull public static int[] getApfEtherTypeBlackList();
    method public boolean hasDataAccess();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.apf.ApfCapabilities> CREATOR;
    field public final int apfPacketFormat;
    field public final int apfVersionSupported;
    field public final int maximumApfProgramSize;
  }

}

