diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1e7c183..f40fd0d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -252,6 +252,16 @@
     <string name="navigation_bar_app_switch_long_press_title">Recents long press action</string>
     <string name="navigation_bar_edge_long_swipe_title">Edge long swipe action</string>
 
+    <!-- Power menu -->
+    <string name="power_menu_title">Power menu</string>
+    <string name="power_menu_screenshot_title">Screenshot</string>
+    <string name="power_menu_screenshot_summary">Long-press for partial screenshot</string>
+    <string name="power_menu_airplane_title">Airplane mode</string>
+    <string name="power_menu_users_title">User switcher</string>
+    <string name="power_menu_bug_report_title">Bug report</string>
+    <string name="power_menu_bug_report_disabled">Bug reporting is disabled in development settings</string>
+    <string name="power_menu_lockdown_title">Lockdown</string>
+
     <string name="camera_double_tap_power_gesture_title">Press power button twice for camera</string>
 
     <!-- Description of setting that controls gesture to open camera by double tapping the power button [CHAR LIMIT=NONE] -->
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index 31dfbf9..5234a96 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -99,6 +99,11 @@
         android:key="power_key"
         android:title="@string/hardware_keys_power_key_title" >
 
+        <PreferenceScreen
+            android:key="power_menu"
+            android:title="@string/power_menu_title"
+            android:fragment="org.lineageos.lineageparts.input.PowerMenuActions" />
+
         <SwitchPreference
             android:key="power_end_call"
             android:title="@string/power_end_call_title"
diff --git a/res/xml/parts_catalog.xml b/res/xml/parts_catalog.xml
index a6f5355..a4346c7 100644
--- a/res/xml/parts_catalog.xml
+++ b/res/xml/parts_catalog.xml
@@ -75,6 +75,11 @@
           android:fragment="org.lineageos.lineageparts.lineagestats.AnonymousStats"
           lineage:xmlRes="@xml/anonymous_stats" />
 
+    <part android:key="power_menu"
+          android:title="@string/power_menu_title"
+          android:fragment="org.lineageos.lineageparts.input.PowerMenuActions"
+          lineage:xmlRes="@xml/power_menu_settings" />
+
     <part android:key="weather_settings"
           android:title="@string/weather_settings_title"
           android:fragment="org.lineageos.lineageparts.weather.WeatherServiceSettings"
diff --git a/res/xml/power_menu_settings.xml b/res/xml/power_menu_settings.xml
new file mode 100644
index 0000000..e947f31
--- /dev/null
+++ b/res/xml/power_menu_settings.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2014-2015 The CyanogenMod Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="power_menu"
+    android:title="@string/power_menu_title">
+
+    <CheckBoxPreference
+        android:key="screenshot"
+        android:title="@string/power_menu_screenshot_title"
+        android:summary="@string/power_menu_screenshot_summary"
+        android:defaultValue="false" />
+
+    <CheckBoxPreference
+        android:key="airplane"
+        android:title="@string/power_menu_airplane_title"
+        android:defaultValue="false" />
+
+    <CheckBoxPreference
+        android:key="users"
+        android:title="@string/power_menu_users_title"
+        android:defaultValue="false" />
+
+    <CheckBoxPreference
+        android:key="bugreport"
+        android:title="@string/power_menu_bug_report_title"
+        android:defaultValue="false" />
+
+    <CheckBoxPreference
+        android:key="lockdown"
+        android:title="@string/power_menu_lockdown_title"
+        android:defaultValue="false" />
+</PreferenceScreen>
diff --git a/src/org/lineageos/lineageparts/input/PowerMenuActions.java b/src/org/lineageos/lineageparts/input/PowerMenuActions.java
new file mode 100644
index 0000000..f119769
--- /dev/null
+++ b/src/org/lineageos/lineageparts/input/PowerMenuActions.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2014-2015 The CyanogenMod Project
+ *               2017 The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.lineageos.lineageparts.input;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.UserInfo;
+import android.os.Bundle;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.provider.Settings;
+
+import androidx.preference.CheckBoxPreference;
+import androidx.preference.Preference;
+
+import org.lineageos.internal.util.PowerMenuConstants;
+import org.lineageos.lineageparts.R;
+import org.lineageos.lineageparts.SettingsPreferenceFragment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import lineageos.providers.LineageSettings;
+
+import static org.lineageos.internal.util.PowerMenuConstants.*;
+
+public class PowerMenuActions extends SettingsPreferenceFragment {
+    final static String TAG = "PowerMenuActions";
+
+    private CheckBoxPreference mScreenshotPref;
+    private CheckBoxPreference mAirplanePref;
+    private CheckBoxPreference mUsersPref;
+    private CheckBoxPreference mBugReportPref;
+    private CheckBoxPreference mLockDownPref;
+
+    Context mContext;
+    private ArrayList<String> mLocalUserConfig = new ArrayList<String>();
+    private String[] mAllActions;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        addPreferencesFromResource(R.xml.power_menu_settings);
+        mContext = getActivity().getApplicationContext();
+
+        mAllActions = PowerMenuConstants.getAllActions();
+
+        for (String action : mAllActions) {
+            if (action.equals(GLOBAL_ACTION_KEY_SCREENSHOT)) {
+                mScreenshotPref = findPreference(GLOBAL_ACTION_KEY_SCREENSHOT);
+            } else if (action.equals(GLOBAL_ACTION_KEY_AIRPLANE)) {
+                mAirplanePref = findPreference(GLOBAL_ACTION_KEY_AIRPLANE);
+            } else if (action.equals(GLOBAL_ACTION_KEY_USERS)) {
+                mUsersPref = findPreference(GLOBAL_ACTION_KEY_USERS);
+            } else if (action.equals(GLOBAL_ACTION_KEY_BUGREPORT)) {
+                mBugReportPref = findPreference(GLOBAL_ACTION_KEY_BUGREPORT);
+            } else if (action.equals(GLOBAL_ACTION_KEY_LOCKDOWN)) {
+                mLockDownPref = findPreference(GLOBAL_ACTION_KEY_LOCKDOWN);
+            }
+        }
+
+        getUserConfig();
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+
+        if (mScreenshotPref != null) {
+            mScreenshotPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_SCREENSHOT));
+        }
+
+        if (mAirplanePref != null) {
+            mAirplanePref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_AIRPLANE));
+        }
+
+        if (mUsersPref != null) {
+            if (!UserHandle.MU_ENABLED || !UserManager.supportsMultipleUsers()) {
+                getPreferenceScreen().removePreference(findPreference(GLOBAL_ACTION_KEY_USERS));
+                mUsersPref = null;
+            } else {
+                List<UserInfo> users = ((UserManager) mContext.getSystemService(
+                        Context.USER_SERVICE)).getUsers();
+                boolean enabled = (users.size() > 1);
+                mUsersPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_USERS) && enabled);
+                mUsersPref.setEnabled(enabled);
+            }
+        }
+
+        if (mBugReportPref != null) {
+            mBugReportPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_BUGREPORT));
+        }
+
+        updatePreferences();
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        updatePreferences();
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(Preference preference) {
+        boolean value;
+
+        if (preference == mScreenshotPref) {
+            value = mScreenshotPref.isChecked();
+            updateUserConfig(value, GLOBAL_ACTION_KEY_SCREENSHOT);
+
+        } else if (preference == mAirplanePref) {
+            value = mAirplanePref.isChecked();
+            updateUserConfig(value, GLOBAL_ACTION_KEY_AIRPLANE);
+
+        } else if (preference == mUsersPref) {
+            value = mUsersPref.isChecked();
+            updateUserConfig(value, GLOBAL_ACTION_KEY_USERS);
+
+        } else if (preference == mBugReportPref) {
+            value = mBugReportPref.isChecked();
+            updateUserConfig(value, GLOBAL_ACTION_KEY_BUGREPORT);
+
+        } else if (preference == mLockDownPref) {
+            value = mLockDownPref.isChecked();
+            updateUserConfig(value, GLOBAL_ACTION_KEY_LOCKDOWN);
+            Settings.Secure.putInt(getContentResolver(),
+                    Settings.Secure.LOCKDOWN_IN_POWER_MENU, value ? 1 : 0);
+
+        } else {
+            return super.onPreferenceTreeClick(preference);
+        }
+        return true;
+    }
+
+    private boolean settingsArrayContains(String preference) {
+        return mLocalUserConfig.contains(preference);
+    }
+
+    private void updateUserConfig(boolean enabled, String action) {
+        if (enabled) {
+            if (!settingsArrayContains(action)) {
+                mLocalUserConfig.add(action);
+            }
+        } else {
+            if (settingsArrayContains(action)) {
+                mLocalUserConfig.remove(action);
+            }
+        }
+        saveUserConfig();
+    }
+
+    private void updatePreferences() {
+        boolean bugreport = Settings.Global.getInt(getContentResolver(),
+                Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0;
+
+        if (mBugReportPref != null) {
+            mBugReportPref.setEnabled(bugreport);
+            if (bugreport) {
+                mBugReportPref.setSummary(null);
+            } else {
+                mBugReportPref.setSummary(R.string.power_menu_bug_report_disabled);
+            }
+        }
+    }
+
+    private void getUserConfig() {
+        mLocalUserConfig.clear();
+        String[] defaultActions;
+        String savedActions = LineageSettings.Secure.getStringForUser(mContext.getContentResolver(),
+                LineageSettings.Secure.POWER_MENU_ACTIONS, UserHandle.USER_CURRENT);
+
+        if (savedActions == null) {
+            defaultActions = mContext.getResources().getStringArray(
+                    com.android.internal.R.array.config_globalActionsList);
+            for (String action : defaultActions) {
+                mLocalUserConfig.add(action);
+            }
+        } else {
+            for (String action : savedActions.split("\\|")) {
+                mLocalUserConfig.add(action);
+            }
+        }
+    }
+
+    private void saveUserConfig() {
+        StringBuilder s = new StringBuilder();
+
+        ArrayList<String> setactions = new ArrayList<String>();
+        for (String action : mAllActions) {
+            if (settingsArrayContains(action)) {
+                setactions.add(action);
+            } else {
+                continue;
+            }
+        }
+
+        for (int i = 0; i < setactions.size(); i++) {
+            s.append(setactions.get(i).toString());
+            if (i != setactions.size() - 1) {
+                s.append("|");
+            }
+        }
+
+        LineageSettings.Secure.putStringForUser(getContentResolver(),
+                LineageSettings.Secure.POWER_MENU_ACTIONS, s.toString(), UserHandle.USER_CURRENT);
+        updatePowerMenuDialog();
+    }
+
+    private void updatePowerMenuDialog() {
+        Intent u = new Intent();
+        u.setAction(lineageos.content.Intent.ACTION_UPDATE_POWER_MENU);
+        mContext.sendBroadcastAsUser(u, UserHandle.ALL);
+    }
+}
