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

Commit 67606be2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "ShutdownThread: flag off debug logging" am: 5cde57c3

parents 0263395a 5cde57c3
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import java.nio.charset.StandardCharsets;

public final class ShutdownThread extends Thread {
    // constants
    private static final boolean DEBUG = false;
    private static final String TAG = "ShutdownThread";
    private static final int ACTION_DONE_POLL_WAIT_MS = 500;
    private static final int RADIOS_STATE_POLL_SLEEP_MS = 100;
@@ -161,7 +162,9 @@ public final class ShutdownThread extends Thread {
        // any additional calls are just returned
        synchronized (sIsStartedGuard) {
            if (sIsStarted) {
                if (DEBUG) {
                    Log.d(TAG, "Request to shutdown already running, returning.");
                }
                return;
            }
        }
@@ -178,7 +181,9 @@ public final class ShutdownThread extends Thread {
                        ? com.android.internal.R.string.shutdown_confirm_question
                        : com.android.internal.R.string.shutdown_confirm);

        if (DEBUG) {
            Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);
        }

        if (confirm) {
            final CloseDialogReceiver closer = new CloseDialogReceiver(context);
@@ -348,26 +353,34 @@ public final class ShutdownThread extends Thread {
    }

    private static boolean showSysuiReboot() {
        if (DEBUG) {
            Log.d(TAG, "Attempting to use SysUI shutdown UI");
        }
        try {
            StatusBarManagerInternal service = LocalServices.getService(
                    StatusBarManagerInternal.class);
            if (service.showShutdownUi(mReboot, mReason)) {
                // Sysui will handle shutdown UI.
                if (DEBUG) {
                    Log.d(TAG, "SysUI handling shutdown UI");
                }
                return true;
            }
        } catch (Exception e) {
            // If anything went wrong, ignore it and use fallback ui
        }
        if (DEBUG) {
            Log.d(TAG, "SysUI is unavailable");
        }
        return false;
    }

    private static void beginShutdownSequence(Context context) {
        synchronized (sIsStartedGuard) {
            if (sIsStarted) {
                if (DEBUG) {
                    Log.d(TAG, "Shutdown sequence already running, returning.");
                }
                return;
            }
            sIsStarted = true;