Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c497ff2 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '1919-t-parental' into 'v1-t'

Parts: Disable advance reboot for mdm

See merge request !62
parents 1f2d3797 0405d3af
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import android.Manifest;
import android.content.Context;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -30,6 +31,7 @@ import org.lineageos.lineageparts.utils.TelephonyUtils;
import java.util.List;

import lineageos.app.LineageGlobalActions;
import lineageos.providers.LineageSettings;

import static org.lineageos.internal.util.PowerMenuConstants.*;

@@ -37,8 +39,10 @@ public class PowerMenuActions extends SettingsPreferenceFragment {
    final static String TAG = "PowerMenuActions";

    private static final String CATEGORY_POWER_MENU_ITEMS = "power_menu_items";
    private static final String CATEGORY_ADVANCED_ITEMS = "advanced";

    private PreferenceCategory mPowerMenuItemsCategory;
    private PreferenceCategory mAdvancedItemsCategory;

    private CheckBoxPreference mScreenshotPref;
    private CheckBoxPreference mAirplanePref;
@@ -67,6 +71,13 @@ public class PowerMenuActions extends SettingsPreferenceFragment {
        mEmergencyAffordanceManager = new EmergencyAffordanceManager(mContext);

        mPowerMenuItemsCategory = findPreference(CATEGORY_POWER_MENU_ITEMS);
        mAdvancedItemsCategory = findPreference(CATEGORY_ADVANCED_ITEMS);

        boolean isMdmActive = SystemProperties.getInt("persist.sys.mdm_active", 0) == 1;
        if (isMdmActive && getPreferenceScreen() != null) {
            LineageSettings.Secure.putInt(getContentResolver(), LineageSettings.Secure.ADVANCED_REBOOT, 0);
            getPreferenceScreen().removePreference(mAdvancedItemsCategory);
        }

        for (String action : PowerMenuConstants.getAllActions()) {
            if (action.equals(GLOBAL_ACTION_KEY_SCREENSHOT)) {