Tell the factory it is already serving a request.
This is a cherry-pick of ag/607226 that has been rebased on top of four years of changes and with comments addressed. Gives each factory a serial number and propogates it to every NetworkAgent so when a score comes back indicating a request is being handled the factory can account for it properly. Without this, a new request that's already handled by a network offered by a factory will not cause an increment of the factorys ref count. Concretely this results in issues like the RAT icon not being displayed in spite of the network actually being up and usable. This will be ported to AOSP as soon as possible, but immediately some master-only WiFi tests need to be adjusted with this change which would not let me submit to AOSP. Bug: 18637384 Bug: 29030667 Test: manual Test: atest frameworks/opt/telephony/tests/telephonytests Test: atest frameworks-net Test: atest CtsNetTestCases CtsHostsideNetworkTests Change-Id: I597ac588f76dd507512ff02868fd1310b7e63f7e
This commit is contained in:
parent
f71c4dfb77
commit
768ea1206d
3 changed files with 186 additions and 74 deletions
|
|
@ -2918,11 +2918,11 @@ public class ConnectivityManager {
|
|||
}
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
/** {@hide} - returns the factory serial number */
|
||||
@UnsupportedAppUsage
|
||||
public void registerNetworkFactory(Messenger messenger, String name) {
|
||||
public int registerNetworkFactory(Messenger messenger, String name) {
|
||||
try {
|
||||
mService.registerNetworkFactory(messenger, name);
|
||||
return mService.registerNetworkFactory(messenger, name);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
|
@ -2938,6 +2938,10 @@ public class ConnectivityManager {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO : remove this method. It is a stopgap measure to help sheperding a number
|
||||
// of dependent changes that would conflict throughout the automerger graph. Having this
|
||||
// temporarily helps with the process of going through with all these dependent changes across
|
||||
// the entire tree.
|
||||
/**
|
||||
* @hide
|
||||
* Register a NetworkAgent with ConnectivityService.
|
||||
|
|
@ -2945,8 +2949,20 @@ public class ConnectivityManager {
|
|||
*/
|
||||
public int registerNetworkAgent(Messenger messenger, NetworkInfo ni, LinkProperties lp,
|
||||
NetworkCapabilities nc, int score, NetworkMisc misc) {
|
||||
return registerNetworkAgent(messenger, ni, lp, nc, score, misc,
|
||||
NetworkFactory.SerialNumber.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Register a NetworkAgent with ConnectivityService.
|
||||
* @return NetID corresponding to NetworkAgent.
|
||||
*/
|
||||
public int registerNetworkAgent(Messenger messenger, NetworkInfo ni, LinkProperties lp,
|
||||
NetworkCapabilities nc, int score, NetworkMisc misc, int factorySerialNumber) {
|
||||
try {
|
||||
return mService.registerNetworkAgent(messenger, ni, lp, nc, score, misc);
|
||||
return mService.registerNetworkAgent(messenger, ni, lp, nc, score, misc,
|
||||
factorySerialNumber);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,14 +139,14 @@ interface IConnectivityManager
|
|||
|
||||
void setAirplaneMode(boolean enable);
|
||||
|
||||
void registerNetworkFactory(in Messenger messenger, in String name);
|
||||
int registerNetworkFactory(in Messenger messenger, in String name);
|
||||
|
||||
boolean requestBandwidthUpdate(in Network network);
|
||||
|
||||
void unregisterNetworkFactory(in Messenger messenger);
|
||||
|
||||
int registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp,
|
||||
in NetworkCapabilities nc, int score, in NetworkMisc misc);
|
||||
in NetworkCapabilities nc, int score, in NetworkMisc misc, in int factorySerialNumber);
|
||||
|
||||
NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities,
|
||||
in Messenger messenger, int timeoutSec, in IBinder binder, int legacy);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public abstract class NetworkAgent extends Handler {
|
|||
private static final long BW_REFRESH_MIN_WIN_MS = 500;
|
||||
private boolean mPollLceScheduled = false;
|
||||
private AtomicBoolean mPollLcePending = new AtomicBoolean(false);
|
||||
public final int mFactorySerialNumber;
|
||||
|
||||
private static final int BASE = Protocol.BASE_NETWORK_AGENT;
|
||||
|
||||
|
|
@ -193,16 +194,31 @@ public abstract class NetworkAgent extends Handler {
|
|||
*/
|
||||
public static final int CMD_PREVENT_AUTOMATIC_RECONNECT = BASE + 15;
|
||||
|
||||
// TODO : remove these two constructors. They are a stopgap measure to help sheperding a number
|
||||
// of dependent changes that would conflict throughout the automerger graph. Having these
|
||||
// temporarily helps with the process of going through with all these dependent changes across
|
||||
// the entire tree.
|
||||
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
||||
NetworkCapabilities nc, LinkProperties lp, int score) {
|
||||
this(looper, context, logTag, ni, nc, lp, score, null);
|
||||
this(looper, context, logTag, ni, nc, lp, score, null, NetworkFactory.SerialNumber.NONE);
|
||||
}
|
||||
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
||||
NetworkCapabilities nc, LinkProperties lp, int score, NetworkMisc misc) {
|
||||
this(looper, context, logTag, ni, nc, lp, score, misc, NetworkFactory.SerialNumber.NONE);
|
||||
}
|
||||
|
||||
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
||||
NetworkCapabilities nc, LinkProperties lp, int score, NetworkMisc misc) {
|
||||
NetworkCapabilities nc, LinkProperties lp, int score, int factorySerialNumber) {
|
||||
this(looper, context, logTag, ni, nc, lp, score, null, factorySerialNumber);
|
||||
}
|
||||
|
||||
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
||||
NetworkCapabilities nc, LinkProperties lp, int score, NetworkMisc misc,
|
||||
int factorySerialNumber) {
|
||||
super(looper);
|
||||
LOG_TAG = logTag;
|
||||
mContext = context;
|
||||
mFactorySerialNumber = factorySerialNumber;
|
||||
if (ni == null || nc == null || lp == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
|
@ -211,7 +227,8 @@ public abstract class NetworkAgent extends Handler {
|
|||
ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService(
|
||||
Context.CONNECTIVITY_SERVICE);
|
||||
netId = cm.registerNetworkAgent(new Messenger(this), new NetworkInfo(ni),
|
||||
new LinkProperties(lp), new NetworkCapabilities(nc), score, misc);
|
||||
new LinkProperties(lp), new NetworkCapabilities(nc), score, misc,
|
||||
factorySerialNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue