import android.os.Message;
import android.os.PowerManager;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.util.LocalLog;
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;
+import com.android.server.power.ShutdownThread;
import com.google.android.collect.Lists;
import java.io.FileDescriptor;
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;
+ }
SystemClock.sleep(5000);
}
}