Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53346e39 authored by Tetsutoki Shiozawa's avatar Tetsutoki Shiozawa Committed by android-build-merger
Browse files

Merge "Definitely abort reconnecting to native daemon during shutdown" am:...

Merge "Definitely abort reconnecting to native daemon during shutdown" am: 2fd5af10 am: 282c0382
am: 89d30c03

Change-Id: I74677602cd4642c2b441fb353a9f0824a238deae
parents e772efb6 89d30c03
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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;