Merge "Definitely abort reconnecting to native daemon during shutdown" am: 65a583bb6a am: 282c038240
am: 31a35289ee
Change-Id: I74677602cd4642c2b441fb353a9f0824a238deae
This commit is contained in:
@@ -134,21 +134,23 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
mCallbackHandler = new Handler(mLooper, this);
|
mCallbackHandler = new Handler(mLooper, this);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (isShuttingDown()) break;
|
||||||
try {
|
try {
|
||||||
listenToSocket();
|
listenToSocket();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
loge("Error in NativeDaemonConnector: " + e);
|
loge("Error in NativeDaemonConnector: " + e);
|
||||||
String shutdownAct = SystemProperties.get(
|
if (isShuttingDown()) break;
|
||||||
ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "");
|
|
||||||
if (shutdownAct != null && shutdownAct.length() > 0) {
|
|
||||||
// The device is in middle of shutdown.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SystemClock.sleep(5000);
|
SystemClock.sleep(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isShuttingDown() {
|
||||||
|
String shutdownAct = SystemProperties.get(
|
||||||
|
ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "");
|
||||||
|
return shutdownAct != null && shutdownAct.length() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(Message msg) {
|
public boolean handleMessage(Message msg) {
|
||||||
final String event = (String) msg.obj;
|
final String event = (String) msg.obj;
|
||||||
|
|||||||
Reference in New Issue
Block a user