Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edb6946b authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by android-build-merger
Browse files

Merge "Add an API hint for metered multipath traffic." am: 7a12f7ef

am: 0ad718aa

Change-Id: I787a9722c210632539a9258e8320f88153daba55
parents dde60ac1 0ad718aa
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -23767,6 +23767,7 @@ package android.net {
    method public android.net.Network getBoundNetworkForProcess();
    method public android.net.ProxyInfo getDefaultProxy();
    method public android.net.LinkProperties getLinkProperties(android.net.Network);
    method public int getMultipathPreference(android.net.Network);
    method public android.net.NetworkCapabilities getNetworkCapabilities(android.net.Network);
    method public deprecated android.net.NetworkInfo getNetworkInfo(int);
    method public android.net.NetworkInfo getNetworkInfo(android.net.Network);
@@ -23814,6 +23815,9 @@ package android.net {
    field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final java.lang.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
+4 −0
Original line number Diff line number Diff line
@@ -25554,6 +25554,7 @@ package android.net {
    method public java.lang.String getCaptivePortalServerUrl();
    method public android.net.ProxyInfo getDefaultProxy();
    method public android.net.LinkProperties getLinkProperties(android.net.Network);
    method public int getMultipathPreference(android.net.Network);
    method public android.net.NetworkCapabilities getNetworkCapabilities(android.net.Network);
    method public deprecated android.net.NetworkInfo getNetworkInfo(int);
    method public android.net.NetworkInfo getNetworkInfo(android.net.Network);
@@ -25605,6 +25606,9 @@ package android.net {
    field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final java.lang.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
+4 −0
Original line number Diff line number Diff line
@@ -23841,6 +23841,7 @@ package android.net {
    method public android.net.Network getBoundNetworkForProcess();
    method public android.net.ProxyInfo getDefaultProxy();
    method public android.net.LinkProperties getLinkProperties(android.net.Network);
    method public int getMultipathPreference(android.net.Network);
    method public android.net.NetworkCapabilities getNetworkCapabilities(android.net.Network);
    method public deprecated android.net.NetworkInfo getNetworkInfo(int);
    method public android.net.NetworkInfo getNetworkInfo(android.net.Network);
@@ -23888,6 +23889,9 @@ package android.net {
    field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
    field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
    field public static final java.lang.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
+69 −0
Original line number Diff line number Diff line
@@ -3406,6 +3406,75 @@ public class ConnectivityManager {
        }
    }

    /**
     * It is acceptable to briefly use multipath data to provide seamless connectivity for
     * time-sensitive user-facing operations when the system default network is temporarily
     * unresponsive. The amount of data should be limited (less than one megabyte), and the
     * operation should be infrequent to ensure that data usage is limited.
     *
     * An example of such an operation might be a time-sensitive foreground activity, such as a
     * voice command, that the user is performing while walking out of range of a Wi-Fi network.
     */
    public static final int MULTIPATH_PREFERENCE_HANDOVER = 1 << 0;

    /**
     * It is acceptable to use small amounts of multipath data on an ongoing basis to provide
     * a backup channel for traffic that is primarily going over another network.
     *
     * An example might be maintaining backup connections to peers or servers for the purpose of
     * fast fallback if the default network is temporarily unresponsive or disconnects. The traffic
     * on backup paths should be negligible compared to the traffic on the main path.
     */
    public static final int MULTIPATH_PREFERENCE_RELIABILITY = 1 << 1;

    /**
     * It is acceptable to use metered data to improve network latency and performance.
     */
    public static final int MULTIPATH_PREFERENCE_PERFORMANCE = 1 << 2;

    /**
     * Return value to use for unmetered networks. On such networks we currently set all the flags
     * to true.
     * @hide
     */
    public static final int MULTIPATH_PREFERENCE_UNMETERED =
            MULTIPATH_PREFERENCE_HANDOVER |
            MULTIPATH_PREFERENCE_RELIABILITY |
            MULTIPATH_PREFERENCE_PERFORMANCE;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, value = {
            MULTIPATH_PREFERENCE_HANDOVER,
            MULTIPATH_PREFERENCE_RELIABILITY,
            MULTIPATH_PREFERENCE_PERFORMANCE,
    })
    public @interface MultipathPreference {
    }

    /**
     * Provides a hint to the calling application on whether it is desirable to use the
     * multinetwork APIs (e.g., {@link Network#openConnection}, {@link Network#bindSocket}, etc.)
     * for multipath data transfer on this network when it is not the system default network.
     * Applications desiring to use multipath network protocols should call this method before
     * each such operation.
     * <p>
     * This method requires the caller to hold the permission
     * {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
     *
     * @param network The network on which the application desires to use multipath data.
     *                If {@code null}, this method will return the a preference that will generally
     *                apply to metered networks.
     * @return a bitwise OR of zero or more of the  {@code MULTIPATH_PREFERENCE_*} constants.
     */
    public @MultipathPreference int getMultipathPreference(Network network) {
        try {
            return mService.getMultipathPreference(network);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Resets all connectivity manager settings back to factory defaults.
     * @hide
+2 −0
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@ interface IConnectivityManager
    void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
    void setAvoidUnvalidated(in Network network);

    int getMultipathPreference(in Network Network);

    int getRestoreDefaultNetworkDelay(int networkType);

    boolean addVpnAddress(String address, int prefixLength);
Loading