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

Commit 2fd5af10 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Definitely abort reconnecting to native daemon during shutdown"

parents 86316a4b be12b81b
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -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;