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

Commit b44a5d6c authored by Will Leshner's avatar Will Leshner Committed by Android (Google) Code Review
Browse files

Merge "Reinstate widget picker size filter behind a flag." into main

parents b6778b2e de9d28e8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -7,3 +7,13 @@ flag {
    description: "Enables the communal hub experience"
    bug: "304584416"
}

flag {
    name: "enable_widget_picker_size_filter"
    namespace: "communal"
    description: "Enables passing a size filter to the widget picker"
    bug: "345482907"
   metadata {
        purpose: PURPOSE_BUGFIX
   }
}
+4 −0
Original line number Diff line number Diff line
@@ -912,6 +912,10 @@
        obvious when corner radii differ.-->
    <dimen name="communal_enforced_rounded_corner_max_radius">28dp</dimen>

    <!-- Width and height used to filter widgets displayed in the communal widget picker -->
    <dimen name="communal_widget_picker_desired_width">360dp</dimen>
    <dimen name="communal_widget_picker_desired_height">240dp</dimen>

    <!-- The width/height of the unlock icon view on keyguard. -->
    <dimen name="keyguard_lock_height">42dp</dimen>
    <dimen name="keyguard_lock_padding">20dp</dimen>
+14 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.res.Resources
import android.util.Log
import androidx.activity.result.ActivityResultLauncher
import com.android.internal.logging.UiEventLogger
import com.android.systemui.Flags.enableWidgetPickerSizeFilter
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
import com.android.systemui.communal.domain.interactor.CommunalSettingsInteractor
@@ -36,6 +37,7 @@ import com.android.systemui.log.core.Logger
import com.android.systemui.log.dagger.CommunalLog
import com.android.systemui.media.controls.ui.view.MediaHost
import com.android.systemui.media.dagger.MediaModule
import com.android.systemui.res.R
import javax.inject.Inject
import javax.inject.Named
import kotlinx.coroutines.CoroutineDispatcher
@@ -138,6 +140,16 @@ constructor(

        return Intent(Intent.ACTION_PICK).apply {
            setPackage(packageName)
            if (enableWidgetPickerSizeFilter()) {
                putExtra(
                    EXTRA_DESIRED_WIDGET_WIDTH,
                    resources.getDimensionPixelSize(R.dimen.communal_widget_picker_desired_width)
                )
                putExtra(
                    EXTRA_DESIRED_WIDGET_HEIGHT,
                    resources.getDimensionPixelSize(R.dimen.communal_widget_picker_desired_height)
                )
            }
            putExtra(
                AppWidgetManager.EXTRA_CATEGORY_FILTER,
                communalSettingsInteractor.communalWidgetCategories.value
@@ -163,6 +175,8 @@ constructor(
    companion object {
        private const val TAG = "CommunalEditModeViewModel"

        private const val EXTRA_DESIRED_WIDGET_WIDTH = "desired_widget_width"
        private const val EXTRA_DESIRED_WIDGET_HEIGHT = "desired_widget_height"
        private const val EXTRA_UI_SURFACE_KEY = "ui_surface"
        private const val EXTRA_UI_SURFACE_VALUE = "widgets_hub"
        const val EXTRA_ADDED_APP_WIDGETS_KEY = "added_app_widgets"