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 {
// 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) {
Log.d(TAG, "Request to shutdown already running, returning.");
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);
Log.d(TAG, "Notifying thread to start shutdown longPressBehavior=" + longPressBehavior);
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() {
Log.d(TAG, "Attempting to use SysUI shutdown UI");
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.
Log.d(TAG, "SysUI handling 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
}
Log.d(TAG, "SysUI is unavailable");
if (DEBUG) {
Log.d(TAG, "SysUI is unavailable");
}
return false;
}
private static void beginShutdownSequence(Context context) {
synchronized (sIsStartedGuard) {
if (sIsStarted) {
Log.d(TAG, "Shutdown sequence already running, returning.");
if (DEBUG) {
Log.d(TAG, "Shutdown sequence already running, returning.");
}
return;
}
sIsStarted = true;