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

Commit 29e5d44a authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Add a flag to turn on theme picker in wallpaper picker

Bug: 122524192
Change-Id: I79bd8bde359a56185c1dd0c10964695263d0f6d5
parent fa8df691
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -177,6 +177,8 @@
    <string name="widget_button_text">Widgets</string>
    <!-- Text for wallpaper change button -->
    <string name="wallpaper_button_text">Wallpapers</string>
    <!-- Text for wallpaper change button -->
    <string name="styles_wallpaper_button_text">Styles &amp; wallpapers</string>
    <!-- Text for settings button -->
    <string name="settings_button_text">Home settings</string>
    <!-- Message shown when a feature is disabled by the administrator -->
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public class FlagOverrideSampleTest {
    public void withFlagOn() {
        assertTrue(FeatureFlags.EXAMPLE_FLAG.get());
        assertFalse(FeatureFlags.QUICK_SWITCH.get());
        assertFalse(FeatureFlags.STYLE_WALLPAPER.get());
    }


+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ public final class Utilities {

    // An intent extra to indicate the horizontal scroll of the wallpaper.
    public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
    public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";

    // These values are same as that in {@link AsyncTask}.
    private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
+4 −0
Original line number Diff line number Diff line
@@ -92,6 +92,10 @@ abstract class BaseFlags {
            = new ToggleableGlobalSettingsFlag("QUICK_SWITCH", false,
            "Swiping right on the nav bar while in an app switches to the previous app");

    public static final ToggleableGlobalSettingsFlag STYLE_WALLPAPER
            = new ToggleableGlobalSettingsFlag("STYLE_WALLPAPER", false,
            "Direct users to the new ThemePicker based WallpaperPicker");

    /**
     * Feature flag to handle define config changes dynamically instead of killing the process.
     */
+7 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.launcher3.views;

import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;

import android.content.Context;
@@ -149,7 +150,9 @@ public class OptionsPopupView extends ArrowPopup
        RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);

        ArrayList<OptionItem> options = new ArrayList<>();
        options.add(new OptionItem(R.string.wallpaper_button_text, R.drawable.ic_wallpaper,
        int res = FeatureFlags.STYLE_WALLPAPER.get() ?
                R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
        options.add(new OptionItem(res, R.drawable.ic_wallpaper,
                ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
        if (!FeatureFlags.GO_DISABLE_WIDGETS) {
            options.add(new OptionItem(R.string.widget_button_text, R.drawable.ic_widget,
@@ -197,6 +200,9 @@ public class OptionsPopupView extends ArrowPopup
                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
                .putExtra(EXTRA_WALLPAPER_OFFSET,
                        launcher.getWorkspace().getWallpaperOffsetForCenterPage());
        if (!FeatureFlags.STYLE_WALLPAPER.get()) {
            intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
        }
        String pickerPackage = launcher.getString(R.string.wallpaper_picker_package);
        if (!TextUtils.isEmpty(pickerPackage)) {
            intent.setPackage(pickerPackage);