diff --git a/debian/dde-dock.install b/debian/dde-dock.install
index df239627e..f87cd737a 100644
--- a/debian/dde-dock.install
+++ b/debian/dde-dock.install
@@ -5,5 +5,6 @@
/usr/lib/dde-dock/plugins/libshutdown.so
/usr/lib/dde-dock/plugins/libtrash.so
/usr/lib/dde-dock/plugins/libtray.so
+/usr/lib/dde-dock/plugins/liboverlay-warning.so
/usr/lib/dde-dock/plugins/system-trays
/etc/dde-dock
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index f67eb62a2..9f2425df5 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -9,3 +9,4 @@ add_subdirectory("tray")
add_subdirectory("trash")
add_subdirectory("keyboard-layout")
add_subdirectory("onboard")
+add_subdirectory("overlay-warning")
diff --git a/plugins/overlay-warning/CMakeLists.txt b/plugins/overlay-warning/CMakeLists.txt
new file mode 100644
index 000000000..dc8f9c4c7
--- /dev/null
+++ b/plugins/overlay-warning/CMakeLists.txt
@@ -0,0 +1,31 @@
+
+set(PLUGIN_NAME "overlay-warning")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(Qt5DBus REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} overlay-warning.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS}
+ ${Qt5DBus_INCLUDE_DIRS}
+ ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
+
+# policy kit
+install(FILES com.deepin.dde.dock.overlay.policy
+ DESTINATION share/polkit-1/actions/)
diff --git a/plugins/overlay-warning/com.deepin.dde.dock.overlay.policy b/plugins/overlay-warning/com.deepin.dde.dock.overlay.policy
new file mode 100644
index 000000000..dfb8ebcda
--- /dev/null
+++ b/plugins/overlay-warning/com.deepin.dde.dock.overlay.policy
@@ -0,0 +1,20 @@
+
+
+
+ Deepin
+
+ dialog-warning
+ The system is in overlay mode, and all your work will not be saved. Do you want to exit this mode and restart?
+
+ no
+ no
+ auth_admin_keep
+
+ 本次启动处于 overlay 保护模式下,您的所有操作将不会被保存,是否要关闭此模式并重启?
+ /usr/sbin/overlayroot-disable
+ true
+
+
+
diff --git a/plugins/overlay-warning/overlay-warning-plugin.cpp b/plugins/overlay-warning/overlay-warning-plugin.cpp
new file mode 100644
index 000000000..b6225a428
--- /dev/null
+++ b/plugins/overlay-warning/overlay-warning-plugin.cpp
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ * listenerri
+ *
+ * Maintainer: listenerri
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "overlay-warning-plugin.h"
+
+#include
+#include
+
+#include
+
+#define PLUGIN_STATE_KEY "enable"
+#define OverlayFileSystemType "overlay"
+
+DWIDGET_USE_NAMESPACE
+
+OverlayWarningPlugin::OverlayWarningPlugin(QObject *parent)
+ : QObject(parent)
+ , m_pluginLoaded(false)
+{
+}
+
+const QString OverlayWarningPlugin::pluginName() const
+{
+ return "overlay-warning";
+}
+
+const QString OverlayWarningPlugin::pluginDisplayName() const
+{
+ return QString();
+}
+
+QWidget *OverlayWarningPlugin::itemWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return m_warningWidget;
+}
+
+QWidget *OverlayWarningPlugin::itemTipsWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return nullptr;
+}
+
+void OverlayWarningPlugin::init(PluginProxyInterface *proxyInter)
+{
+ m_proxyInter = proxyInter;
+
+ if (!pluginIsDisable()) {
+ loadPlugin();
+ }
+}
+
+void OverlayWarningPlugin::pluginStateSwitched()
+{
+ m_proxyInter->saveValue(this, PLUGIN_STATE_KEY, !m_proxyInter->getValue(this, PLUGIN_STATE_KEY, true).toBool());
+
+ if (pluginIsDisable())
+ {
+ m_proxyInter->itemRemoved(this, pluginName());
+ } else {
+ if (!m_pluginLoaded) {
+ loadPlugin();
+ return;
+ }
+ m_proxyInter->itemAdded(this, pluginName());
+ }
+}
+
+bool OverlayWarningPlugin::pluginIsDisable()
+{
+ return !m_proxyInter->getValue(this, PLUGIN_STATE_KEY, true).toBool();
+}
+
+const QString OverlayWarningPlugin::itemCommand(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ showCloseOverlayDialog();
+
+ return QString();
+}
+
+void OverlayWarningPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
+{
+ Q_UNUSED(displayMode);
+
+ if (!pluginIsDisable()) {
+ m_warningWidget->update();
+ }
+}
+
+int OverlayWarningPlugin::itemSortKey(const QString &itemKey)
+{
+ Dock::DisplayMode mode = displayMode();
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(mode);
+
+ if (mode == Dock::DisplayMode::Fashion) {
+ return m_proxyInter->getValue(this, key, 2).toInt();
+ } else {
+ return m_proxyInter->getValue(this, key, 5).toInt();
+ }
+}
+
+void OverlayWarningPlugin::setSortKey(const QString &itemKey, const int order)
+{
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
+ m_proxyInter->saveValue(this, key, order);
+}
+
+void OverlayWarningPlugin::loadPlugin()
+{
+ if (m_pluginLoaded) {
+ qDebug() << "overlay-warning plugin has been loaded! return";
+ return;
+ }
+
+ m_pluginLoaded = true;
+
+ m_warningWidget = new PluginWidget;
+
+ if (!isOverlayRoot()) {
+ return;
+ }
+
+ m_proxyInter->itemAdded(this, pluginName());
+ displayModeChanged(displayMode());
+
+ QTimer::singleShot(3000, this, &OverlayWarningPlugin::showCloseOverlayDialog);
+}
+
+bool OverlayWarningPlugin::isOverlayRoot()
+{
+ // ignore live/recovery mode
+ if (QString(QFile("/proc/cmdline").readAll()).contains("boot=live")) {
+ return false;
+ }
+ return QString(QStorageInfo::root().fileSystemType()) == OverlayFileSystemType;
+}
+
+void OverlayWarningPlugin::showCloseOverlayDialog()
+{
+ const int result = QProcess::execute("/usr/bin/pkexec overlayroot-disable");
+
+ if (result == 0) {
+ QProcess::startDetached("reboot");
+ } else {
+ qDebug() << "close overlayroot failed, the return code is" << result;
+ }
+}
diff --git a/plugins/overlay-warning/overlay-warning-plugin.h b/plugins/overlay-warning/overlay-warning-plugin.h
new file mode 100644
index 000000000..1b004352a
--- /dev/null
+++ b/plugins/overlay-warning/overlay-warning-plugin.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ * listenerri
+ *
+ * Maintainer: listenerri
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef SHUTDOWNPLUGIN_H
+#define SHUTDOWNPLUGIN_H
+
+#include "pluginsiteminterface.h"
+#include "pluginwidget.h"
+#include "../widgets/tipswidget.h"
+
+#include
+
+namespace Dtk {
+ namespace Widget {
+ class DDialog;
+ }
+}
+
+class OverlayWarningPlugin : public QObject, PluginsItemInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginsItemInterface)
+ Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "overlay-warning.json")
+
+public:
+ explicit OverlayWarningPlugin(QObject *parent = 0);
+
+ const QString pluginName() const override;
+ const QString pluginDisplayName() const override;
+ void init(PluginProxyInterface *proxyInter) override;
+
+ void pluginStateSwitched() override;
+ bool pluginIsAllowDisable() override { return false; }
+ bool pluginIsDisable() override;
+
+ QWidget *itemWidget(const QString &itemKey) override;
+ QWidget *itemTipsWidget(const QString &itemKey) override;
+ const QString itemCommand(const QString &itemKey) override;
+ void displayModeChanged(const Dock::DisplayMode displayMode) override;
+
+ int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
+ void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
+
+private:
+ void loadPlugin();
+ bool isOverlayRoot();
+
+private slots:
+ void showCloseOverlayDialog();
+
+private:
+ bool m_pluginLoaded;
+
+ PluginWidget *m_warningWidget;
+};
+
+#endif // SHUTDOWNPLUGIN_H
diff --git a/plugins/overlay-warning/overlay-warning.json b/plugins/overlay-warning/overlay-warning.json
new file mode 100644
index 000000000..ad498eeb3
--- /dev/null
+++ b/plugins/overlay-warning/overlay-warning.json
@@ -0,0 +1,3 @@
+{
+ "api": "1.1.1"
+}
diff --git a/plugins/overlay-warning/overlay-warning.qrc b/plugins/overlay-warning/overlay-warning.qrc
new file mode 100644
index 000000000..0c018f970
--- /dev/null
+++ b/plugins/overlay-warning/overlay-warning.qrc
@@ -0,0 +1,5 @@
+
+
+ resources/icons/overlay-warning.svg
+
+
diff --git a/plugins/overlay-warning/pluginwidget.cpp b/plugins/overlay-warning/pluginwidget.cpp
new file mode 100644
index 000000000..fe685716a
--- /dev/null
+++ b/plugins/overlay-warning/pluginwidget.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ * listenerri
+ *
+ * Maintainer: listenerri
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "pluginwidget.h"
+
+#include
+#include
+#include
+#include
+#include
+
+PluginWidget::PluginWidget(QWidget *parent)
+ : QWidget(parent)
+{
+}
+
+QSize PluginWidget::sizeHint() const
+{
+ return QSize(26, 26);
+}
+
+void PluginWidget::paintEvent(QPaintEvent *e)
+{
+ Q_UNUSED(e);
+
+ QPixmap pixmap;
+ QString iconName = ":/icons/resources/icons/overlay-warning.svg";
+ int iconSize;
+ const Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value();
+
+ if (displayMode == Dock::Efficient) {
+// iconName = iconName + "-symbolic";
+ iconSize = 16;
+ } else {
+ iconSize = std::min(width(), height()) * 0.8;
+ }
+
+ pixmap = loadSvg(iconName, QSize(iconSize, iconSize));
+
+ QPainter painter(this);
+ painter.drawPixmap(rect().center() - pixmap.rect().center() / qApp->devicePixelRatio(), pixmap);
+}
+
+const QPixmap PluginWidget::loadSvg(const QString &fileName, const QSize &size) const
+{
+ const auto ratio = qApp->devicePixelRatio();
+
+ QPixmap pixmap;
+ pixmap = QIcon::fromTheme(fileName).pixmap(size * ratio);
+ pixmap.setDevicePixelRatio(ratio);
+
+ return pixmap;
+}
diff --git a/plugins/overlay-warning/pluginwidget.h b/plugins/overlay-warning/pluginwidget.h
new file mode 100644
index 000000000..10ef77cf2
--- /dev/null
+++ b/plugins/overlay-warning/pluginwidget.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ * listenerri
+ *
+ * Maintainer: listenerri
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef PLUGINWIDGET_H
+#define PLUGINWIDGET_H
+
+#include "constants.h"
+
+#include
+
+class PluginWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit PluginWidget(QWidget *parent = 0);
+
+protected:
+ QSize sizeHint() const;
+ void paintEvent(QPaintEvent *e);
+
+private:
+ const QPixmap loadSvg(const QString &fileName, const QSize &size) const;
+
+private:
+ Dock::DisplayMode m_displayMode;
+};
+
+#endif // PLUGINWIDGET_H
diff --git a/plugins/overlay-warning/resources/icons/overlay-warning.svg b/plugins/overlay-warning/resources/icons/overlay-warning.svg
new file mode 100644
index 000000000..0d75a30f3
--- /dev/null
+++ b/plugins/overlay-warning/resources/icons/overlay-warning.svg
@@ -0,0 +1,3 @@
+