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

Commit f6e15c79 authored by Chiachang Wang's avatar Chiachang Wang Committed by Gerrit Code Review
Browse files

Merge "Signal the suspended state with NetworkCapabilities"

parents 65f6df07 2452bc34
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -609,7 +609,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);
@@ -1212,6 +1211,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() {
@@ -1352,6 +1356,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;
    }