Merge "Definitely abort reconnecting to native daemon during shutdown" am: 65a583bb6a am: 282c038240

am: 31a35289ee

Change-Id: I74677602cd4642c2b441fb353a9f0824a238deae
This commit is contained in:
Tetsutoki Shiozawa
2018-02-26 08:05:10 +00:00
committed by android-build-merger

View File

@@ -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;