diff --git a/modules/widgetpicker/Android.bp b/modules/widgetpicker/Android.bp
index 78320c5872..39f9c90fa5 100644
--- a/modules/widgetpicker/Android.bp
+++ b/modules/widgetpicker/Android.bp
@@ -89,11 +89,16 @@ android_library {
srcs: [
"src/com/android/launcher3/widgetpicker/domain/usecase/GroupWidgetAppsByProfileUseCase.kt",
"src/com/android/launcher3/widgetpicker/domain/usecase/FilterWidgetsForHostUseCase.kt",
+ "src/com/android/launcher3/widgetpicker/domain/interactor/WidgetsInteractor.kt",
+ "src/com/android/launcher3/widgetpicker/domain/interactor/WidgetAppIconsInteractor.kt",
],
static_libs: [
"widget_picker_shared_data_types",
+ "widget_picker_data_repositories",
"widget_picker_dagger_annotations",
"dagger2",
+ "kotlinx-coroutines-android",
+ "kotlinx-coroutines-core",
],
}
diff --git a/modules/widgetpicker/TEST_MAPPING b/modules/widgetpicker/TEST_MAPPING
index 2040beec54..62e9605e87 100644
--- a/modules/widgetpicker/TEST_MAPPING
+++ b/modules/widgetpicker/TEST_MAPPING
@@ -2,6 +2,12 @@
"presubmit": [
{
"name": "WidgetPickerScreenshotTests"
+ },
+ {
+ "name": "WidgetPickerDeviceTests"
+ },
+ {
+ "name": "WidgetPickerRoboTests"
}
]
}
\ No newline at end of file
diff --git a/modules/widgetpicker/build.gradle.kts b/modules/widgetpicker/build.gradle.kts
index 0c010e8b54..fbc0f45a48 100644
--- a/modules/widgetpicker/build.gradle.kts
+++ b/modules/widgetpicker/build.gradle.kts
@@ -108,10 +108,12 @@ dependencies {
testImplementation(libs.google.truth)
testImplementation(libs.androidx.test.runner)
testImplementation(libs.androidx.junit)
+ testImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.google.truth)
androidTestImplementation(libs.mockito.kotlin)
androidTestImplementation(libs.androidx.test.rules)
+ androidTestImplementation(libs.kotlinx.coroutines.test)
// Compose UI Tests
androidTestApi(libs.compose.ui.test.junit4)
diff --git a/modules/widgetpicker/res/values/strings.xml b/modules/widgetpicker/res/values/strings.xml
index 21a15ebe74..fbd965e019 100644
--- a/modules/widgetpicker/res/values/strings.xml
+++ b/modules/widgetpicker/res/values/strings.xml
@@ -34,6 +34,13 @@
[CHAR_LIMIT=25] -->
Featured
+
+ Browse
+
+
+ widgets on right, search and options on left
+
Search
diff --git a/modules/widgetpicker/src/com/android/launcher3/widgetpicker/Annotations.kt b/modules/widgetpicker/src/com/android/launcher3/widgetpicker/Annotations.kt
index 276ffefaf0..2309dfc5c8 100644
--- a/modules/widgetpicker/src/com/android/launcher3/widgetpicker/Annotations.kt
+++ b/modules/widgetpicker/src/com/android/launcher3/widgetpicker/Annotations.kt
@@ -25,8 +25,19 @@ import javax.inject.Scope
@Scope
annotation class WidgetPickerSingleton
+/** Qualifier annotation for the background context used in interactors. */
+@Qualifier
+@MustBeDocumented
+@Retention(AnnotationRetention.RUNTIME)
+annotation class WidgetPickerBackground
+
/** Qualifier annotation for information about the widget host. */
@Qualifier
@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class WidgetPickerHostInfo
+
+@Qualifier
+@MustBeDocumented
+@Retention(AnnotationRetention.RUNTIME)
+annotation class WidgetPickerRepository
diff --git a/modules/widgetpicker/src/com/android/launcher3/widgetpicker/domain/interactor/WidgetAppIconsInteractor.kt b/modules/widgetpicker/src/com/android/launcher3/widgetpicker/domain/interactor/WidgetAppIconsInteractor.kt
new file mode 100644
index 0000000000..3b6b00da0f
--- /dev/null
+++ b/modules/widgetpicker/src/com/android/launcher3/widgetpicker/domain/interactor/WidgetAppIconsInteractor.kt
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.widgetpicker.domain.interactor
+
+import com.android.launcher3.widgetpicker.WidgetPickerBackground
+import com.android.launcher3.widgetpicker.WidgetPickerRepository
+import com.android.launcher3.widgetpicker.WidgetPickerSingleton
+import com.android.launcher3.widgetpicker.data.repository.WidgetAppIconsRepository
+import com.android.launcher3.widgetpicker.data.repository.WidgetsRepository
+import com.android.launcher3.widgetpicker.shared.model.WidgetAppIcon
+import com.android.launcher3.widgetpicker.shared.model.WidgetAppId
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.combine
+import kotlinx.coroutines.flow.flatMapLatest
+import kotlinx.coroutines.flow.flowOn
+import kotlinx.coroutines.flow.map
+import javax.inject.Inject
+import kotlin.coroutines.CoroutineContext
+
+/**
+ * A domain layer object that enables the UI layer to get the apps icons from data layer.
+ * - Responsible for merging the necessary information from widgets and app icons repositories to
+ * provide the app icons.
+ */
+@WidgetPickerSingleton
+class WidgetAppIconsInteractor @Inject constructor(
+ @WidgetPickerRepository
+ private val widgetAppIconsRepository: WidgetAppIconsRepository,
+ @WidgetPickerRepository
+ private val widgetsRepository: WidgetsRepository,
+ @WidgetPickerBackground
+ private val backgroundContext: CoroutineContext,
+) {
+ /** Returns a flow of icons for all widget apps that host widgets. */
+ @OptIn(ExperimentalCoroutinesApi::class)
+ fun getAllWidgetAppIcons(): Flow