Migrate smartspace as a widget and smartspace removal toggle flags to aconfig
Bug: 336823684, 336823681
Test: none
Flag: ACONFIG enable_smartspace_as_a_widget DISABLED
Flag: ACONFIG enable_smartspace_removal_toggle DISABLED
Change-Id: I4cba42e09f58365f761ab866b15a494817e6bb0f
diff --git a/src/com/android/launcher3/ModelCallbacks.kt b/src/com/android/launcher3/ModelCallbacks.kt
index f582be0..7d6d154 100644
--- a/src/com/android/launcher3/ModelCallbacks.kt
+++ b/src/com/android/launcher3/ModelCallbacks.kt
@@ -4,11 +4,12 @@
import android.os.Build
import android.os.Trace
import androidx.annotation.UiThread
+import com.android.launcher3.Flags.enableSmartspaceRemovalToggle
import com.android.launcher3.LauncherConstants.TraceEvents
+import com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET
import com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID
import com.android.launcher3.allapps.AllAppsStore
import com.android.launcher3.config.FeatureFlags
-import com.android.launcher3.config.FeatureFlags.shouldShowFirstPageWidget
import com.android.launcher3.model.BgDataModel
import com.android.launcher3.model.StringCache
import com.android.launcher3.model.data.AppInfo
@@ -34,7 +35,7 @@
var pagesToBindSynchronously = LIntSet()
private var isFirstPagePinnedItemEnabled =
- (BuildConfig.QSB_ON_FIRST_SCREEN && !FeatureFlags.ENABLE_SMARTSPACE_REMOVAL.get())
+ (BuildConfig.QSB_ON_FIRST_SCREEN && !enableSmartspaceRemovalToggle())
var stringCache: StringCache? = null
@@ -314,16 +315,16 @@
)
val firstScreenPosition = 0
if (
- (FeatureFlags.QSB_ON_FIRST_SCREEN &&
- isFirstPagePinnedItemEnabled &&
- !shouldShowFirstPageWidget()) &&
+ (isFirstPagePinnedItemEnabled &&
+ !SHOULD_SHOW_FIRST_PAGE_WIDGET) &&
orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition
) {
orderedScreenIds.removeValue(FIRST_SCREEN_ID)
orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID)
} else if (
- (!FeatureFlags.QSB_ON_FIRST_SCREEN && !isFirstPagePinnedItemEnabled ||
- shouldShowFirstPageWidget()) && orderedScreenIds.isEmpty
+ (!isFirstPagePinnedItemEnabled ||
+ SHOULD_SHOW_FIRST_PAGE_WIDGET)
+ && orderedScreenIds.isEmpty
) {
// If there are no screens, we need to have an empty screen
launcher.workspace.addExtraEmptyScreens()
@@ -379,9 +380,8 @@
}
orderedScreenIds
.filterNot { screenId ->
- FeatureFlags.QSB_ON_FIRST_SCREEN &&
isFirstPagePinnedItemEnabled &&
- !FeatureFlags.shouldShowFirstPageWidget() &&
+ !SHOULD_SHOW_FIRST_PAGE_WIDGET &&
screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID
}
.forEach { screenId ->