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

Commit 8f77571f authored by Chalard Jean's avatar Chalard Jean Committed by Android (Google) Code Review
Browse files

Merge "Signal the suspended state with NetworkCapabilities"

parents 99a910bc 0aba189c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -606,7 +606,6 @@ public class DataConnection extends StateMachine {
        mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_MOBILE,
                networkType, NETWORK_TYPE, TelephonyManager.getNetworkTypeName(networkType));
        mNetworkInfo.setRoaming(ss.getDataRoaming());
        mNetworkInfo.setIsAvailable(true);

        addState(mDefaultState);
            addState(mInactiveState, mDefaultState);
@@ -1209,6 +1208,11 @@ public class DataConnection extends StateMachine {
    }

    /**
     * Get the network capabilities for this data connection.
     *
     * Note that this method reads fields from mNetworkInfo, so its output is only as fresh
     * as mNetworkInfo. Call updateNetworkInfoSuspendState before calling this.
     *
     * @return the {@link NetworkCapabilities} of this data connection.
     */
    public NetworkCapabilities getNetworkCapabilities() {
@@ -1349,6 +1353,10 @@ public class DataConnection extends StateMachine {
            result.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
        }

        final boolean suspended =
                mNetworkInfo.getDetailedState() == NetworkInfo.DetailedState.SUSPENDED;
        result.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED, !suspended);

        return result;
    }