Merge 4205f2f06b03463e0fc99edf8c8576a2631417bd on remote branch

Change-Id: Iafa1b8a3a6dee88aece2a43f9bc92796b8265640
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index 793b284..feab828 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -339,6 +339,11 @@
             }
 
             @Override
+            public void onReachabilityLost(String logMsg) {
+                mHandler.post(() -> updateNeighborLostEvent(logMsg));
+            }
+
+            @Override
             public void onQuit() {
                 mIpClient = null;
                 mIpClientShutdownCv.open();
@@ -502,6 +507,17 @@
             }
         }
 
+        void updateNeighborLostEvent(String logMsg) {
+            Log.d(TAG, "updateNeighborLostEvent " + logMsg);
+            // Reachability lost will be seen only if the gateway is not reachable.
+            // Since etherert FW doesn't have the mechanism to scan for new networks
+            // like WiFi, simply restart.
+            // If there is a better network, that will become default and apps
+            // will be able to use internet. If ethernet gets connected again,
+            // and has backhaul connectivity, it will become default.
+            restart();
+        }
+
         /** Returns true if state has been modified */
         boolean updateLinkState(boolean up) {
             if (mLinkUp == up) return false;