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

Commit 9bca5544 authored by Hawkwood's avatar Hawkwood
Browse files

Forward wallpaper clock size preference to preview

This change forwards the wallpaper's clock size preference, if any, to
the lockscreen preview. In the event that the wallpaper has no
preference in it's description, the preview will continue to use the
current system setting.

Bug: 375207082
Test: Manually verified correct preview behavior
Flag: build.RELEASE_PACKAGE_MAGIC_PORTRAIT_WALLPAPERS
Change-Id: Ifd9cf4e7c8d452d1ffbc2cd40ac7568c88f34334
parent e8323055
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.drawable.Drawable
import android.util.Log
import androidx.core.content.res.ResourcesCompat
import com.android.wallpaper.R
import com.android.wallpaper.model.Screen
import com.android.wallpaper.picker.di.modules.BackgroundDispatcher
import com.android.wallpaper.util.PreviewUtils
import dagger.hilt.android.qualifiers.ApplicationContext
@@ -41,7 +42,8 @@ constructor(

    private val authorityMetadataKey: String =
        context.getString(R.string.grid_control_metadata_name)
    private val previewUtils: PreviewUtils = PreviewUtils(context, authorityMetadataKey)
    private val previewUtils: PreviewUtils =
        PreviewUtils(context, authorityMetadataKey, Screen.HOME_SCREEN)

    override suspend fun getGridOptions(): List<GridOptionModel>? =
        withContext(bgDispatcher) {
+2 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.lifecycle.MutableLiveData;
import com.android.customization.model.ResourceConstants;
import com.android.themepicker.R;
import com.android.wallpaper.config.BaseFlags;
import com.android.wallpaper.model.Screen;
import com.android.wallpaper.util.PreviewUtils;

import java.util.ArrayList;
@@ -63,7 +64,7 @@ public class LauncherGridOptionsProvider {
    private OptionChangeLiveData mLiveData;

    public LauncherGridOptionsProvider(Context context, String authorityMetadataKey) {
        mPreviewUtils = new PreviewUtils(context, authorityMetadataKey);
        mPreviewUtils = new PreviewUtils(context, authorityMetadataKey, Screen.HOME_SCREEN);
        mContext = context;
        mIsGridApplyButtonEnabled = BaseFlags.get().isGridApplyButtonEnabled(context);
    }
+0 −5
Original line number Diff line number Diff line
@@ -19,11 +19,6 @@ package com.android.customization.picker.clock.shared
import android.stats.style.StyleEnums
import com.android.customization.module.logging.ThemesUserEventLogger

enum class ClockSize {
    DYNAMIC,
    SMALL,
}

@ThemesUserEventLogger.ClockSize
fun ClockSize.toClockSizeForLogging(): Int {
    return when (this) {
+3 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import androidx.transition.Transition
import androidx.transition.doOnStart
import com.android.customization.module.ThemePickerInjector
import com.android.customization.picker.clock.ui.binder.ClockSettingsBinder
import com.android.systemui.shared.clocks.shared.model.ClockPreviewConstants
import com.android.systemui.shared.quickaffordance.shared.model.KeyguardPreviewConstants
import com.android.themepicker.R
import com.android.wallpaper.model.Screen
import com.android.wallpaper.module.InjectorProvider
@@ -90,6 +90,7 @@ class ClockSettingsFragment : AppbarFragment() {
                                    com.android.wallpaper.R.string
                                        .lock_screen_preview_provider_authority
                                ),
                            screen = Screen.LOCK_SCREEN,
                        ),
                    wallpaperInfoProvider = { forceReload ->
                        suspendCancellableCoroutine { continuation ->
@@ -110,7 +111,7 @@ class ClockSettingsFragment : AppbarFragment() {
                        Bundle().apply {
                            // Hide the clock from the system UI rendered preview so we can
                            // place the carousel on top of it.
                            putBoolean(ClockPreviewConstants.KEY_HIDE_CLOCK, true)
                            putBoolean(KeyguardPreviewConstants.KEY_HIDE_CLOCK, true)
                        }
                    },
                    wallpaperInteractor = injector.getWallpaperInteractor(requireContext()),
+9 −12
Original line number Diff line number Diff line
@@ -66,14 +66,9 @@ class ColorPickerFragment : AppbarFragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
        savedInstanceState: Bundle?,
    ): View {
        val view =
            inflater.inflate(
                R.layout.fragment_color_picker,
                container,
                false,
            )
        val view = inflater.inflate(R.layout.fragment_color_picker, container, false)
        ViewCompat.setOnApplyWindowInsetsListener(view) { v, windowInsets ->
            val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.updateLayoutParams<MarginLayoutParams> {
@@ -119,8 +114,9 @@ class ColorPickerFragment : AppbarFragment() {
                                    requireContext()
                                        .getString(
                                            com.android.wallpaper.R.string
                                                .lock_screen_preview_provider_authority,
                                                .lock_screen_preview_provider_authority
                                        ),
                                screen = Screen.LOCK_SCREEN,
                            ),
                        wallpaperInfoProvider = { forceReload ->
                            suspendCancellableCoroutine { continuation ->
@@ -136,7 +132,7 @@ class ColorPickerFragment : AppbarFragment() {
                                            loadInitialColors(
                                                wallpaperManager,
                                                wallpaperColorsRepository,
                                                Screen.LOCK_SCREEN
                                                Screen.LOCK_SCREEN,
                                            )
                                        }
                                    }
@@ -170,8 +166,9 @@ class ColorPickerFragment : AppbarFragment() {
                            authorityMetadataKey =
                                requireContext()
                                    .getString(
                                        com.android.wallpaper.R.string.grid_control_metadata_name,
                                        com.android.wallpaper.R.string.grid_control_metadata_name
                                    ),
                            screen = Screen.HOME_SCREEN,
                        ),
                    wallpaperInfoProvider = { forceReload ->
                        suspendCancellableCoroutine { continuation ->
@@ -187,7 +184,7 @@ class ColorPickerFragment : AppbarFragment() {
                                        loadInitialColors(
                                            wallpaperManager,
                                            wallpaperColorsRepository,
                                            Screen.HOME_SCREEN
                                            Screen.HOME_SCREEN,
                                        )
                                    }
                                }
@@ -265,7 +262,7 @@ class ColorPickerFragment : AppbarFragment() {
    override fun getToolbarTextColor(): Int {
        return ContextCompat.getColor(
            requireContext(),
            com.android.wallpaper.R.color.system_on_surface
            com.android.wallpaper.R.color.system_on_surface,
        )
    }
}
Loading