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

Commit 95a41c4e authored by Chiachang Wang's avatar Chiachang Wang Committed by android-build-merger
Browse files

Merge "Signal the suspended state with NetworkCapabilities"

am: f6e15c79

Change-Id: I56ab0344862ad21306647cabd2186a487e303708
parents aa311a99 f6e15c79
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -608,7 +608,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);
@@ -1211,6 +1210,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() {
@@ -1351,6 +1355,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;
    }