Fix a stupid NPE
Okay so this is really not a behavior change as it converts an NPE into an illegal argument exception, but still, that's what should happen (and that's what the upcoming test actually tests for). Test: upcoming NetworkAgentTest Bug: 139268426 Change-Id: I0d9b8cb8f8dcb587b9430b486b863efb9e9e77ef Merged-In: I3e17211c03bc74426bf5e2e414ec322d73b0060b (cherry picked from commit 827d7ceea1e83cca9ba3f6189e20b6780c0194ed, aosp/1277595)
This commit is contained in:
committed by
Chalard Jean
parent
3661ab430b
commit
50756739b5
@@ -556,12 +556,12 @@ public abstract class NetworkAgent {
|
||||
@NonNull
|
||||
public Network register() {
|
||||
if (VDBG) log("Registering NetworkAgent");
|
||||
final ConnectivityManager cm = (ConnectivityManager) mInitialConfiguration.context
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
synchronized (mRegisterLock) {
|
||||
if (mNetwork != null) {
|
||||
throw new IllegalStateException("Agent already registered");
|
||||
}
|
||||
final ConnectivityManager cm = (ConnectivityManager) mInitialConfiguration.context
|
||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
mNetwork = cm.registerNetworkAgent(new Messenger(mHandler),
|
||||
new NetworkInfo(mInitialConfiguration.info),
|
||||
mInitialConfiguration.properties, mInitialConfiguration.capabilities,
|
||||
|
||||
Reference in New Issue
Block a user