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

Commit c485179d authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Make NetworkCapabilities authoritative for roaming state" am: 5c76e6a4 am: 8db22627

Change-Id: I1f14e1613d78af8664e7c0f59f5c348455403ec8
parents 4cfa9dbd 8db22627
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -5852,9 +5852,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
        }
        }
        newNc.setPrivateDnsBroken(nai.networkCapabilities.isPrivateDnsBroken());
        newNc.setPrivateDnsBroken(nai.networkCapabilities.isPrivateDnsBroken());


        // TODO : remove this once all factories are updated to send NOT_SUSPENDED
        // TODO : remove this once all factories are updated to send NOT_SUSPENDED and NOT_ROAMING
        if (!newNc.hasTransport(TRANSPORT_CELLULAR)) {
        if (!newNc.hasTransport(TRANSPORT_CELLULAR)) {
            newNc.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
            newNc.addCapability(NET_CAPABILITY_NOT_SUSPENDED);
            newNc.addCapability(NET_CAPABILITY_NOT_ROAMING);
        }
        }


        return newNc;
        return newNc;
@@ -5893,7 +5894,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
            processListenRequests(nai);
            processListenRequests(nai);
            final boolean prevSuspended = !prevNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
            final boolean prevSuspended = !prevNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
            final boolean suspended = !newNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
            final boolean suspended = !newNc.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
            if (prevSuspended != suspended) {
            final boolean prevRoaming = !prevNc.hasCapability(NET_CAPABILITY_NOT_ROAMING);
            final boolean roaming = !newNc.hasCapability(NET_CAPABILITY_NOT_ROAMING);
            if (prevSuspended != suspended || prevRoaming != roaming) {
                // TODO (b/73132094) : remove this call once the few users of onSuspended and
                // TODO (b/73132094) : remove this call once the few users of onSuspended and
                // onResumed have been removed.
                // onResumed have been removed.
                notifyNetworkCallbacks(nai, suspended ? ConnectivityManager.CALLBACK_SUSPENDED
                notifyNetworkCallbacks(nai, suspended ? ConnectivityManager.CALLBACK_SUSPENDED
@@ -6643,7 +6646,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
    @NonNull
    @NonNull
    private NetworkInfo mixInInfo(@NonNull final NetworkAgentInfo nai, @NonNull NetworkInfo info) {
    private NetworkInfo mixInInfo(@NonNull final NetworkAgentInfo nai, @NonNull NetworkInfo info) {
        final NetworkInfo newInfo = new NetworkInfo(info);
        final NetworkInfo newInfo = new NetworkInfo(info);
        // The suspended bit is managed in NetworkCapabilities.
        // The suspended and roaming bits are managed in NetworkCapabilities.
        final boolean suspended =
        final boolean suspended =
                !nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
                !nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_SUSPENDED);
        if (suspended && info.getDetailedState() == NetworkInfo.DetailedState.CONNECTED) {
        if (suspended && info.getDetailedState() == NetworkInfo.DetailedState.CONNECTED) {
@@ -6656,6 +6659,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
            newInfo.setDetailedState(NetworkInfo.DetailedState.SUSPENDED, info.getReason(),
            newInfo.setDetailedState(NetworkInfo.DetailedState.SUSPENDED, info.getReason(),
                    info.getExtraInfo());
                    info.getExtraInfo());
        }
        }
        newInfo.setRoaming(!nai.networkCapabilities.hasCapability(NET_CAPABILITY_NOT_ROAMING));
        return newInfo;
        return newInfo;
    }
    }