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

Commit 4c6f4a65 authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Remove unwanted capability code per API council feedback.

The addition of hasUnwantedCapability was late in the release
cycle and does not simplify the API enough to be worth it. The
recommendation is, in a future release, to do something more
complete: not just add something like addUnwantedCapability, but
also deprecate all the NET_CAPABILITY_NOT_xxx constants and add
opposite NET_CAPABILITY_xxx constants for use with it.

Fix: 77601789
Test: builds, boots
Test: atest android.net.cts.NetworkRequestTest
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: Ib98fb01da4a4a0bae464787b589ad88f45002eb8
parent 54b8750b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -27263,7 +27263,6 @@ package android.net {
    method public int describeContents();
    method public boolean hasCapability(int);
    method public boolean hasTransport(int);
    method public boolean hasUnwantedCapability(int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.NetworkRequest> CREATOR;
  }
@@ -27272,7 +27271,6 @@ package android.net {
    ctor public NetworkRequest.Builder();
    method public android.net.NetworkRequest.Builder addCapability(int);
    method public android.net.NetworkRequest.Builder addTransportType(int);
    method public android.net.NetworkRequest.Builder addUnwantedCapability(int);
    method public android.net.NetworkRequest build();
    method public android.net.NetworkRequest.Builder removeCapability(int);
    method public android.net.NetworkRequest.Builder removeTransportType(int);
+8 −0
Original line number Diff line number Diff line
@@ -291,6 +291,14 @@ package android.net {
  public static abstract class NetworkBadging.Badging implements java.lang.annotation.Annotation {
  }

  public class NetworkRequest implements android.os.Parcelable {
    method public boolean hasUnwantedCapability(int);
  }

  public static class NetworkRequest.Builder {
    method public android.net.NetworkRequest.Builder addUnwantedCapability(int);
  }

  public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
    method public static deprecated org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
  }
+4 −0
Original line number Diff line number Diff line
@@ -233,6 +233,8 @@ public class NetworkRequest implements Parcelable {
         *
         * @param capability The capability to add to unwanted capability list.
         * @return The builder to facilitate chaining.
         *
         * @removed
         */
        public Builder addUnwantedCapability(@NetworkCapabilities.NetCapability int capability) {
            mNetworkCapabilities.addUnwantedCapability(capability);
@@ -439,6 +441,8 @@ public class NetworkRequest implements Parcelable {

    /**
     * @see Builder#addUnwantedCapability(int)
     *
     * @removed
     */
    public boolean hasUnwantedCapability(@NetCapability int capability) {
        return networkCapabilities.hasUnwantedCapability(capability);