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

Commit 538a3370 authored by DvTonder's avatar DvTonder Committed by Arne Coucheron
Browse files

Settings: Hide Development settings when it is turned off

This commit hides the Development and Performance settings items
when the user turns off Development settings. This sets things back
to tapping x number of times on the build number to once again enable
developer settings

Change-Id: I6003f73f5abee54bb000f01757ecffe7b68dba59
parent db0f0a4d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (C) 2013-2014 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.
@@ -1957,6 +1958,11 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
                        Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
                mLastEnabledState = isChecked;
                setPrefsEnabledState(mLastEnabledState);

                // Hide development settings from the Settings menu (Android 4.2 behaviour)
                getActivity().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE).edit()
                    .putBoolean(PREF_SHOW, false)
                    .apply();
            }
        }
    }
@@ -2276,6 +2282,13 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
                        Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
                mLastEnabledState = true;
                setPrefsEnabledState(mLastEnabledState);

                // Make sure the development settings is visible in the main Settings menu
                // This is needed since we may have just turned off dev settings and want to
                // turn it on again
                getActivity().getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE).edit()
                    .putBoolean(PREF_SHOW, true)
                    .apply();
            } else {
                // Reset the toggle
                mSwitchBar.setChecked(false);