Only show flags UI if developer options is enabled

Change-Id: I69005e623dab9f1f2f0682b61311836b62337835
This commit is contained in:
Ryan Lothian committed 2018-10-22 17:06:47 -04:00
1 parent 2f7110d614
commit 904dbcdf9d
2 files changed
+8 -5

No files matched your search

@@ -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) {