Merge "Fix agents disconnecting in SUSPENDED state."

This commit is contained in:
Motomu Utsumi
2023-05-17 01:59:18 +00:00
committed by Gerrit Code Review
3 changed files with 20 additions and 3 deletions

View File

@@ -333,6 +333,24 @@ public class NetworkInfo implements Parcelable {
}
}
/**
* Indicates whether this network is suspended.
* @deprecated Apps should instead use the
* {@link android.net.ConnectivityManager.NetworkCallback} API to
* learn about connectivity changes. See
* {@link ConnectivityManager#registerDefaultNetworkCallback} and
* {@link ConnectivityManager#registerNetworkCallback}. These will
* give a more accurate picture of the connectivity state of
* the device and let apps react more easily and quickly to changes.
* @hide
*/
@Deprecated
public boolean isSuspended() {
synchronized (this) {
return mState == State.SUSPENDED;
}
}
/**
* Indicates whether network connectivity is possible. A network is unavailable
* when a persistent or semi-persistent condition prevents the possibility

View File

@@ -4546,7 +4546,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
// because they lost all their requests or because their score isn't good)
// then they would disconnect organically, report their new state and then
// disconnect the channel.
if (nai.networkInfo.isConnected()) {
if (nai.networkInfo.isConnected() || nai.networkInfo.isSuspended()) {
nai.networkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED,
null, null);
}

View File

@@ -18014,7 +18014,6 @@ public class ConnectivityServiceTest {
mCellAgent.expectDisconnected();
waitForIdle();
// TODO (aosp/2583410): update following check to verifyClatdStop
verifyNeverClatdStop(null /* inOrder */, MOBILE_IFNAME);
verifyClatdStop(null /* inOrder */, MOBILE_IFNAME);
}
}