Loading quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java +21 −2 Original line number Diff line number Diff line Loading @@ -23,12 +23,15 @@ import android.provider.DeviceConfig; import com.android.launcher3.config.FeatureFlags.DebugFlag; import java.util.ArrayList; @TargetApi(Build.VERSION_CODES.P) public class DeviceFlag extends DebugFlag { public static final String NAMESPACE_LAUNCHER = "launcher"; private final boolean mDefaultValueInCode; ArrayList<Runnable> mListeners; public DeviceFlag(String key, boolean defaultValue, String description) { super(key, getDeviceValue(key, defaultValue), description); Loading @@ -40,18 +43,34 @@ public class DeviceFlag extends DebugFlag { return super.appendProps(src).append(", mDefaultValueInCode=").append(mDefaultValueInCode); } @Override public void initialize(Context context) { super.initialize(context); if (mListeners == null) { mListeners = new ArrayList<>(); registerDeviceConfigChangedListener(context); } } @Override public void addChangeListener(Context context, Runnable r) { mListeners.add(r); } private void registerDeviceConfigChangedListener(Context context) { DeviceConfig.addOnPropertiesChangedListener( NAMESPACE_LAUNCHER, context.getMainExecutor(), properties -> { if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace())) { if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace()) || !properties.getKeyset().contains(key)) { return; } defaultValue = getDeviceValue(key, mDefaultValueInCode); initialize(context); for (Runnable r: mListeners) { r.run(); } }); } Loading src/com/android/launcher3/config/FeatureFlags.java +3 −2 Original line number Diff line number Diff line Loading @@ -93,8 +93,9 @@ public final class FeatureFlags { public static final BooleanFlag FAKE_LANDSCAPE_UI = getDebugFlag( "FAKE_LANDSCAPE_UI", false, "Rotate launcher UI instead of using transposed layout"); public static final BooleanFlag FOLDER_NAME_SUGGEST = getDebugFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); public static final BooleanFlag APP_SEARCH_IMPROVEMENTS = new DeviceFlag( "APP_SEARCH_IMPROVEMENTS", false, Loading Loading
quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java +21 −2 Original line number Diff line number Diff line Loading @@ -23,12 +23,15 @@ import android.provider.DeviceConfig; import com.android.launcher3.config.FeatureFlags.DebugFlag; import java.util.ArrayList; @TargetApi(Build.VERSION_CODES.P) public class DeviceFlag extends DebugFlag { public static final String NAMESPACE_LAUNCHER = "launcher"; private final boolean mDefaultValueInCode; ArrayList<Runnable> mListeners; public DeviceFlag(String key, boolean defaultValue, String description) { super(key, getDeviceValue(key, defaultValue), description); Loading @@ -40,18 +43,34 @@ public class DeviceFlag extends DebugFlag { return super.appendProps(src).append(", mDefaultValueInCode=").append(mDefaultValueInCode); } @Override public void initialize(Context context) { super.initialize(context); if (mListeners == null) { mListeners = new ArrayList<>(); registerDeviceConfigChangedListener(context); } } @Override public void addChangeListener(Context context, Runnable r) { mListeners.add(r); } private void registerDeviceConfigChangedListener(Context context) { DeviceConfig.addOnPropertiesChangedListener( NAMESPACE_LAUNCHER, context.getMainExecutor(), properties -> { if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace())) { if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace()) || !properties.getKeyset().contains(key)) { return; } defaultValue = getDeviceValue(key, mDefaultValueInCode); initialize(context); for (Runnable r: mListeners) { r.run(); } }); } Loading
src/com/android/launcher3/config/FeatureFlags.java +3 −2 Original line number Diff line number Diff line Loading @@ -93,8 +93,9 @@ public final class FeatureFlags { public static final BooleanFlag FAKE_LANDSCAPE_UI = getDebugFlag( "FAKE_LANDSCAPE_UI", false, "Rotate launcher UI instead of using transposed layout"); public static final BooleanFlag FOLDER_NAME_SUGGEST = getDebugFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag( "FOLDER_NAME_SUGGEST", true, "Suggests folder names instead of blank text."); public static final BooleanFlag APP_SEARCH_IMPROVEMENTS = new DeviceFlag( "APP_SEARCH_IMPROVEMENTS", false, Loading