Merge "ShutdownThread: flag off debug logging"

This commit is contained in:
Treehugger Robot
2023-01-24 23:52:31 +00:00
committed by Gerrit Code Review

View File

@@ -61,6 +61,7 @@ import java.nio.charset.StandardCharsets;
public final class ShutdownThread extends Thread { public final class ShutdownThread extends Thread {
// constants // constants
private static final boolean DEBUG = false;
private static final String TAG = "ShutdownThread"; private static final String TAG = "ShutdownThread";
private static final int ACTION_DONE_POLL_WAIT_MS = 500; private static final int ACTION_DONE_POLL_WAIT_MS = 500;
private static final int RADIOS_STATE_POLL_SLEEP_MS = 100; 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 // any additional calls are just returned
synchronized (sIsStartedGuard) { synchronized (sIsStartedGuard) {
if (sIsStarted) { if (sIsStarted) {
Log.d(TAG, "Request to shutdown already running, returning."); if (DEBUG) {
Log.d(TAG, "Request to shutdown already running, returning.");
}
return; 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_question
: com.android.internal.R.string.shutdown_confirm); : com.android.internal.R.string.shutdown_confirm);
Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior); if (DEBUG) {
Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);
}
if (confirm) { if (confirm) {
final CloseDialogReceiver closer = new CloseDialogReceiver(context); final CloseDialogReceiver closer = new CloseDialogReceiver(context);
@@ -348,26 +353,34 @@ public final class ShutdownThread extends Thread {
} }
private static boolean showSysuiReboot() { private static boolean showSysuiReboot() {
Log.d(TAG, "Attempting to use SysUI shutdown UI"); if (DEBUG) {
Log.d(TAG, "Attempting to use SysUI shutdown UI");
}
try { try {
StatusBarManagerInternal service = LocalServices.getService( StatusBarManagerInternal service = LocalServices.getService(
StatusBarManagerInternal.class); StatusBarManagerInternal.class);
if (service.showShutdownUi(mReboot, mReason)) { if (service.showShutdownUi(mReboot, mReason)) {
// Sysui will handle shutdown UI. // Sysui will handle shutdown UI.
Log.d(TAG, "SysUI handling shutdown UI"); if (DEBUG) {
Log.d(TAG, "SysUI handling shutdown UI");
}
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
// If anything went wrong, ignore it and use fallback ui // If anything went wrong, ignore it and use fallback ui
} }
Log.d(TAG, "SysUI is unavailable"); if (DEBUG) {
Log.d(TAG, "SysUI is unavailable");
}
return false; return false;
} }
private static void beginShutdownSequence(Context context) { private static void beginShutdownSequence(Context context) {
synchronized (sIsStartedGuard) { synchronized (sIsStartedGuard) {
if (sIsStarted) { if (sIsStarted) {
Log.d(TAG, "Shutdown sequence already running, returning."); if (DEBUG) {
Log.d(TAG, "Shutdown sequence already running, returning.");
}
return; return;
} }
sIsStarted = true; sIsStarted = true;