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

Commit 01e4fa96 authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "Add shims for NetCapability#getCapabilityCarrierName"

parents 63c7dc78 4c27e10f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,5 +44,6 @@ public class ConstantsShim extends com.android.networkstack.apishim.api29.Consta

    // Constants defined in android.net.NetworkCapabilities.
    public static final int NET_CAPABILITY_NOT_VCN_MANAGED = 28;
    public static final int NET_CAPABILITY_ENTERPRISE = 29;
    public static final int TRANSPORT_TEST = 7;
}
+9 −0
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
package com.android.networkstack.apishim;

import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.os.Build;

import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;

import com.android.networkstack.apishim.common.CaptivePortalDataShim;
@@ -57,4 +59,11 @@ public class NetworkInformationShimImpl
        if (lp == null || lp.getCaptivePortalData() == null) return null;
        return new CaptivePortalDataShimImpl(lp.getCaptivePortalData());
    }

    @RequiresApi(Build.VERSION_CODES.S)
    @Nullable
    @Override
    public String getCapabilityCarrierName(int capability) {
        return NetworkCapabilities.getCapabilityCarrierName(capability);
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -83,4 +83,17 @@ public interface NetworkInformationShim {
     */
    void setCaptivePortalData(@NonNull LinkProperties lp,
            @Nullable CaptivePortalDataShim captivePortalData);

    /**
     * Get the name of the given capability that carriers use.
     * If the capability does not have a carrier-name, returns null.
     *
     * @param capability The capability to get the carrier-name of.
     * @return The carrier-name of the capability, or null if it doesn't exist.
     * @hide
     */
    @Nullable
    default String getCapabilityCarrierName(int capability) {
        return null;
    }
}