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

Commit d6e4cdcd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Only show flags UI if developer options is enabled" into ub-launcher3-master

parents e3617a01 904dbcdf
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static androidx.core.util.Preconditions.checkNotNull;

import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings;

import androidx.annotation.GuardedBy;
import androidx.annotation.Keep;
@@ -51,8 +52,10 @@ abstract class BaseFlags {
        throw new UnsupportedOperationException("Don't instantiate BaseFlags");
    }

    public static boolean showFlagTogglerUi() {
        return Utilities.IS_DEBUG_DEVICE;
    public static boolean showFlagTogglerUi(Context context) {
        return Utilities.IS_DEBUG_DEVICE &&
                Settings.Global.getInt(context.getApplicationContext().getContentResolver(),
                        Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
    }

    public static final boolean IS_DOGFOOD_BUILD = false;
@@ -85,8 +88,8 @@ abstract class BaseFlags {
    public static final boolean OVERVIEW_USE_SCREENSHOT_ORIENTATION = true;

    public static void initialize(Context context) {
        // Avoid the disk read for builds without the flags UI.
        if (showFlagTogglerUi()) {
        // Avoid the disk read for user builds
        if (Utilities.IS_DEBUG_DEVICE) {
            SharedPreferences sharedPreferences =
                    context.getSharedPreferences(FLAGS_PREF_NAME, Context.MODE_PRIVATE);
            synchronized (sLock) {
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ public class SettingsActivity extends Activity

                case FLAGS_PREFERENCE_KEY:
                    // Only show flag toggler UI if this build variant implements that.
                    return FeatureFlags.showFlagTogglerUi();
                    return FeatureFlags.showFlagTogglerUi(getContext());
            }

            return true;