Definitely abort reconnecting to native daemon during shutdown
Symptom:
System_server crashed due to unsolved "netd" service.
Root cause:
My previous patch was not enough for avoiding this crash.
a00d4b0 Abort connecting to native daemon during shutdown
listenToSocket loop can be finished without throwing exception.
Solution:
It's better to test shutdown condition before reconnection even
though listenToSocket is finished without exception.
Bug: 68742327
Change-Id: Ifdfe43d52bef891f55bd7b07cc1aa0fa248a6030
This commit is contained in:
committed by
Koji Fukui
parent
8469cd614d
commit
47c245b6e9
@@ -134,21 +134,23 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
||||
mCallbackHandler = new Handler(mLooper, this);
|
||||
|
||||
while (true) {
|
||||
if (isShuttingDown()) break;
|
||||
try {
|
||||
listenToSocket();
|
||||
} catch (Exception e) {
|
||||
loge("Error in NativeDaemonConnector: " + e);
|
||||
String shutdownAct = SystemProperties.get(
|
||||
ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "");
|
||||
if (shutdownAct != null && shutdownAct.length() > 0) {
|
||||
// The device is in middle of shutdown.
|
||||
break;
|
||||
}
|
||||
if (isShuttingDown()) break;
|
||||
SystemClock.sleep(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isShuttingDown() {
|
||||
String shutdownAct = SystemProperties.get(
|
||||
ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "");
|
||||
return shutdownAct != null && shutdownAct.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
final String event = (String) msg.obj;
|
||||
|
||||
Reference in New Issue
Block a user