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

Commit eb1ea889 authored by Chalard Jean's avatar Chalard Jean
Browse files

Deprecate getActiveLinkProperties.

There are other, more idiomatic ways to do this. Deprecating this
with usage limited to P will curb usage and reduce the maintenance
load.
This also deprecates the extra EXTRA_NETWORK_TYPE, which has
survived from an old world but has only been used in deprecated
broadcasts for some time.

Bug: 109783091
Test: eyeball current.txt
Change-Id: I87b74833bb4ec362ee3fd07511a66d318c29067d
parent d6471064
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27167,7 +27167,7 @@ package android.net {
    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 public static final String EXTRA_NETWORK_TYPE = "networkType";
    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";
+13 −5
Original line number Diff line number Diff line
@@ -177,10 +177,10 @@ public class ConnectivityManager {
     * The lookup key for a {@link NetworkInfo} object. Retrieve with
     * {@link android.content.Intent#getParcelableExtra(String)}.
     *
     * @deprecated Since {@link NetworkInfo} can vary based on UID, applications
     *             should always obtain network information through
     *             {@link #getActiveNetworkInfo()}.
     * @see #EXTRA_NETWORK_TYPE
     * @deprecated The {@link NetworkInfo} object is deprecated, as many of its properties
     *             can't accurately represent modern network characteristics.
     *             Please obtain information about networks from the {@link NetworkCapabilities}
     *             or {@link LinkProperties} objects instead.
     */
    @Deprecated
    public static final String EXTRA_NETWORK_INFO = "networkInfo";
@@ -189,7 +189,11 @@ public class ConnectivityManager {
     * Network type which triggered a {@link #CONNECTIVITY_ACTION} broadcast.
     *
     * @see android.content.Intent#getIntExtra(String, int)
     * @deprecated The network type is not rich enough to represent the characteristics
     *             of modern networks. Please use {@link NetworkCapabilities} instead,
     *             in particular the transports.
     */
    @Deprecated
    public static final String EXTRA_NETWORK_TYPE = "networkType";

    /**
@@ -1243,9 +1247,13 @@ public class ConnectivityManager {
     *        is no current default network.
     *
     * {@hide}
     * @deprecated please use {@link #getLinkProperties(Network)} on the return
     *             value of {@link #getActiveNetwork()} instead. In particular,
     *             this method will return non-null LinkProperties even if the
     *             app is blocked by policy from using this network.
     */
    @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 109783091)
    public LinkProperties getActiveLinkProperties() {
        try {
            return mService.getActiveLinkProperties();