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

Commit 377447b2 authored by Amin Shaikh's avatar Amin Shaikh Committed by android-build-merger
Browse files

Merge "Merge "Add icon packs for themepicker." into qt-dev am: 2c09b3be" into qt-dev-plus-aosp

am: b800b563

Change-Id: I55c252e608a0bcdc78b83a0dd185a0d22562a504
parents 211f26c6 b800b563
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -494,4 +494,7 @@
    <!-- Launcher package name for overlaying icons. -->
    <string name="launcher_overlayable_package" translatable="false">com.android.launcher3</string>

    <!-- ThemePicker package name for overlaying icons. -->
    <string name="themepicker_overlayable_package" translatable="false">com.android.wallpaper</string>

</resources>
+2 −1
Original line number Diff line number Diff line
@@ -68,7 +68,8 @@ public class ThemeOverlayController extends SystemUI {
        mThemeManager = new ThemeOverlayManager(
                mContext.getSystemService(OverlayManager.class),
                AsyncTask.THREAD_POOL_EXECUTOR,
                mContext.getString(R.string.launcher_overlayable_package));
                mContext.getString(R.string.launcher_overlayable_package),
                mContext.getString(R.string.themepicker_overlayable_package));
        final Handler bgHandler = Dependency.get(Dependency.BG_HANDLER);
        final IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_USER_SWITCHED);
+11 −2
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ class ThemeOverlayManager {
    @VisibleForTesting
    static final String OVERLAY_CATEGORY_ICON_LAUNCHER =
            "android.theme.customization.icon_pack.launcher";
    @VisibleForTesting
    static final String OVERLAY_CATEGORY_ICON_THEME_PICKER =
            "android.theme.customization.icon_pack.themepicker";

    /*
     * All theme customization categories used by the system, in order that they should be applied,
@@ -76,7 +79,8 @@ class ThemeOverlayManager {
            OVERLAY_CATEGORY_COLOR,
            OVERLAY_CATEGORY_ICON_ANDROID,
            OVERLAY_CATEGORY_ICON_SYSUI,
            OVERLAY_CATEGORY_ICON_SETTINGS);
            OVERLAY_CATEGORY_ICON_SETTINGS,
            OVERLAY_CATEGORY_ICON_THEME_PICKER);

    /* Categories that need to applied to the current user as well as the system user. */
    @VisibleForTesting
@@ -94,12 +98,14 @@ class ThemeOverlayManager {
    private final OverlayManager mOverlayManager;
    private final Executor mExecutor;
    private final String mLauncherPackage;
    private final String mThemePickerPackage;

    ThemeOverlayManager(OverlayManager overlayManager, Executor executor,
            String launcherPackage) {
            String launcherPackage, String themePickerPackage) {
        mOverlayManager = overlayManager;
        mExecutor = executor;
        mLauncherPackage = launcherPackage;
        mThemePickerPackage = themePickerPackage;
        mTargetPackageToCategories.put(ANDROID_PACKAGE, Sets.newHashSet(
                OVERLAY_CATEGORY_COLOR, OVERLAY_CATEGORY_FONT,
                OVERLAY_CATEGORY_SHAPE, OVERLAY_CATEGORY_ICON_ANDROID));
@@ -109,6 +115,8 @@ class ThemeOverlayManager {
                Sets.newHashSet(OVERLAY_CATEGORY_ICON_SETTINGS));
        mTargetPackageToCategories.put(mLauncherPackage,
                Sets.newHashSet(OVERLAY_CATEGORY_ICON_LAUNCHER));
        mTargetPackageToCategories.put(mThemePickerPackage,
                Sets.newHashSet(OVERLAY_CATEGORY_ICON_THEME_PICKER));
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_COLOR, ANDROID_PACKAGE);
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_FONT, ANDROID_PACKAGE);
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_SHAPE, ANDROID_PACKAGE);
@@ -116,6 +124,7 @@ class ThemeOverlayManager {
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_ICON_SYSUI, SYSUI_PACKAGE);
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_ICON_SETTINGS, SETTINGS_PACKAGE);
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_ICON_LAUNCHER, mLauncherPackage);
        mCategoryToTargetPackage.put(OVERLAY_CATEGORY_ICON_THEME_PICKER, mThemePickerPackage);
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
    <item>@drawable/ic_power_low</item>
    <item>@drawable/ic_power_saver</item>
    <item>@drawable/ic_qs_bluetooth_connecting</item>
    <item>@drawable/ic_qs_bluetooth_connecting</item>
    <item>@drawable/ic_qs_cancel</item>
    <item>@drawable/ic_qs_no_sim</item>
    <item>@drawable/ic_qs_wifi_0</item>
+11 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_IC
import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_ICON_LAUNCHER;
import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_ICON_SETTINGS;
import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_ICON_SYSUI;
import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_ICON_THEME_PICKER;
import static com.android.systemui.theme.ThemeOverlayManager.OVERLAY_CATEGORY_SHAPE;
import static com.android.systemui.theme.ThemeOverlayManager.SETTINGS_PACKAGE;
import static com.android.systemui.theme.ThemeOverlayManager.SYSTEM_USER_CATEGORIES;
@@ -74,6 +75,7 @@ public class ThemeOverlayManagerTest extends SysuiTestCase {
        }
    }

    private static final String THEMEPICKER_PACKAGE = "com.android.wallpaper";
    private static final String LAUNCHER_PACKAGE = "com.android.launcher3";
    private static final UserHandle TEST_USER = UserHandle.of(5);
    private static final Set<UserHandle> TEST_USER_HANDLES = Sets.newHashSet(TEST_USER);
@@ -87,7 +89,7 @@ public class ThemeOverlayManagerTest extends SysuiTestCase {
    public void setup() throws Exception {
        MockitoAnnotations.initMocks(this);
        mManager = new ThemeOverlayManager(mOverlayManager, MoreExecutors.directExecutor(),
                LAUNCHER_PACKAGE);
                LAUNCHER_PACKAGE, THEMEPICKER_PACKAGE);
        when(mOverlayManager.getOverlayInfosForTarget(ANDROID_PACKAGE, UserHandle.SYSTEM))
                .thenReturn(Lists.newArrayList(
                        createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_COLOR,
@@ -124,6 +126,12 @@ public class ThemeOverlayManagerTest extends SysuiTestCase {
                                LAUNCHER_PACKAGE, OVERLAY_CATEGORY_ICON_LAUNCHER, false),
                        createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_ICON_LAUNCHER,
                                LAUNCHER_PACKAGE, OVERLAY_CATEGORY_ICON_LAUNCHER, true)));
        when(mOverlayManager.getOverlayInfosForTarget(THEMEPICKER_PACKAGE, UserHandle.SYSTEM))
                .thenReturn(Lists.newArrayList(
                        createOverlayInfo(TEST_DISABLED_PREFIX + OVERLAY_CATEGORY_ICON_THEME_PICKER,
                                THEMEPICKER_PACKAGE, OVERLAY_CATEGORY_ICON_THEME_PICKER, false),
                        createOverlayInfo(TEST_ENABLED_PREFIX + OVERLAY_CATEGORY_ICON_THEME_PICKER,
                                THEMEPICKER_PACKAGE, OVERLAY_CATEGORY_ICON_THEME_PICKER, true)));
    }

    @Test
@@ -222,6 +230,8 @@ public class ThemeOverlayManagerTest extends SysuiTestCase {
        verify(mOverlayManager, never()).getOverlayInfosForTarget(SYSUI_PACKAGE, UserHandle.SYSTEM);
        verify(mOverlayManager, never()).getOverlayInfosForTarget(LAUNCHER_PACKAGE,
                UserHandle.SYSTEM);
        verify(mOverlayManager, never()).getOverlayInfosForTarget(THEMEPICKER_PACKAGE,
                UserHandle.SYSTEM);
    }

    private static OverlayInfo createOverlayInfo(String packageName, String targetPackageName,
Loading