Merge "Only show flags UI if developer options is enabled" into ub-launcher3-master
This commit is contained in:
commit
d6e4cdcdb5
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue