summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2017-06-23 01:21:25 +0900
committerLorenzo Colitti <lorenzo@google.com>2017-06-23 01:41:47 +0900
commit264bef96c82961029702fcf8e12b0fddfa0d09ab (patch)
tree658a2f8a9f071a8154007b56291d2f6fe53b3f07 /java
parent5646c5243f3900011f6d855914f59c205a65c9ce (diff)
downloadethernet-264bef96c82961029702fcf8e12b0fddfa0d09ab.tar.gz
Don't crash if the interface disappears just after appearing.android-o-preview-4android-o-iot-preview-5o-iot-preview-5
If the interface disappears between interfaceAdded() and setInterfaceUp, we'll crash with an IllegalStateException in NetworkManagementService#setInterfaceConfig. Ignore the error instead. This should be safe because we don't modify any state unless our calls succeed. Bug: 62870779 Test: builds aosp_bullhead-eng Change-Id: If8c2375f7fffe25a9fa79dc4f1981c745384a276
Diffstat (limited to 'java')
-rw-r--r--java/com/android/server/ethernet/EthernetNetworkFactory.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 7ff3f6c..d6d0def 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -208,7 +208,7 @@ class EthernetNetworkFactory {
InterfaceConfiguration config = mNMService.getInterfaceConfig(iface);
if (config == null) {
- Log.e(TAG, "Null iterface config for " + iface + ". Bailing out.");
+ Log.e(TAG, "Null interface config for " + iface + ". Bailing out.");
return;
}
@@ -220,7 +220,9 @@ class EthernetNetworkFactory {
Log.e(TAG, "Interface unexpectedly changed from " + iface + " to " + mIface);
mNMService.setInterfaceDown(iface);
}
- } catch (RemoteException e) {
+ } catch (RemoteException | IllegalStateException e) {
+ // Either the system is crashing or the interface has disappeared. Just ignore the
+ // error; we haven't modified any state because we only do that if our calls succeed.
Log.e(TAG, "Error upping interface " + mIface + ": " + e);
}
}