From 7a5699e7213629a5ab69731ecdc9c3dfae12acfe Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Thu, 20 Nov 2025 22:51:50 +0700 Subject: [PATCH] fix: A lot of stuff --- .../src/app/lawnchair/LawnchairLauncher.kt | 10 +- .../algorithms/LawnchairSearchAlgorithm.kt | 4 + .../lawnchair/views/LauncherPreviewView.kt | 84 +++-- .../quickstep/BaseWindowInterface.java | 4 +- .../QuickstepTestInformationHandler.java | 319 +----------------- .../android/quickstep/RecentTasksList.java | 1 + .../quickstep/util/AppPairsController.java | 2 +- .../android/quickstep/views/RecentsView.java | 3 +- .../quickstep/AbstractQuickStepTest.java | 10 +- res/values/id.xml | 4 + .../launcher3/AppWidgetResizeFrame.java | 1 - src/com/android/launcher3/DeviceProfile.java | 15 +- .../android/launcher3/LauncherRootView.java | 4 +- .../launcher3/MainProcessInitializer.java | 4 +- src/com/android/launcher3/Utilities.java | 4 +- src/com/android/launcher3/Workspace.java | 4 +- .../allapps/AlphabeticalAppsList.java | 2 +- .../launcher3/deviceprofile/HotseatProfile.kt | 17 +- .../android/launcher3/folder/FolderIcon.java | 2 +- .../graphics/GridCustomizationsProxy.java | 2 +- .../android/launcher3/icons/IconCache.java | 21 +- .../launcher3/model/DatabaseHelper.java | 1 + .../model/GridSizeMigrationDBController.java | 2 +- .../android/launcher3/model/LoaderCursor.java | 3 +- .../launcher3/model/ModelDbController.java | 4 +- .../model/WorkspaceItemSpaceFinder.java | 1 + .../preview/LauncherPreviewRenderer.java | 3 +- .../testing/shared/TestProtocol.java | 45 ++- .../launcher3/views/BaseDragLayer.java | 8 +- 29 files changed, 146 insertions(+), 438 deletions(-) diff --git a/lawnchair/src/app/lawnchair/LawnchairLauncher.kt b/lawnchair/src/app/lawnchair/LawnchairLauncher.kt index 1d080d19fe..bcf2e0d0b2 100644 --- a/lawnchair/src/app/lawnchair/LawnchairLauncher.kt +++ b/lawnchair/src/app/lawnchair/LawnchairLauncher.kt @@ -251,8 +251,8 @@ class LawnchairLauncher : QuickstepLauncher() { out.add(SearchBarStateHandler(this)) } - override fun getSupportedShortcuts(): Stream> = Stream.concat( - super.getSupportedShortcuts(), + override fun getSupportedShortcuts(container: Int): Stream> = Stream.concat( + super.getSupportedShortcuts(container), Stream.concat( Stream.of(LawnchairShortcut.UNINSTALL, LawnchairShortcut.CUSTOMIZE), if (LawnchairApp.isRecentsEnabled) Stream.of(LawnchairShortcut.PAUSE_APPS) else Stream.empty(), @@ -282,20 +282,20 @@ class LawnchairLauncher : QuickstepLauncher() { } } - override fun bindItems(items: List, forceAnimateIcons: Boolean) { + fun bindItems(items: List, forceAnimateIcons: Boolean) { val inflatedItems = items.map { i -> Pair.create( i, itemInflater?.inflateItem( i, - modelWriter, + null, ), ) }.toList() bindInflatedItems(inflatedItems, if (forceAnimateIcons) AnimatorSet() else null) } - override fun handleGestureContract(intent: Intent?) { + override fun handleGestureContract(intent: Intent) { if (!LawnchairApp.isRecentsEnabled) { val gnc = GestureNavContract.fromIntent(intent) if (gnc != null) { diff --git a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairSearchAlgorithm.kt b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairSearchAlgorithm.kt index 9c334ab93f..e331064e02 100644 --- a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairSearchAlgorithm.kt +++ b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairSearchAlgorithm.kt @@ -11,6 +11,7 @@ import app.lawnchair.search.adapter.SearchTargetCompat import app.lawnchair.search.adapter.SearchTargetCompat.Companion.RESULT_TYPE_APPLICATION import app.lawnchair.search.adapter.SearchTargetCompat.Companion.RESULT_TYPE_SHORTCUT import com.android.app.search.LayoutType.CALCULATOR +import com.android.app.search.LayoutType.EDUCARD import com.android.app.search.LayoutType.EMPTY_DIVIDER import com.android.app.search.LayoutType.EMPTY_STATE import com.android.app.search.LayoutType.HORIZONTAL_MEDIUM_TEXT @@ -18,6 +19,7 @@ import com.android.app.search.LayoutType.ICON_HORIZONTAL_TEXT import com.android.app.search.LayoutType.ICON_SINGLE_VERTICAL_TEXT import com.android.app.search.LayoutType.ICON_SLICE import com.android.app.search.LayoutType.PEOPLE_TILE +import com.android.app.search.LayoutType.PLAY_PLACEHOLDER import com.android.app.search.LayoutType.SEARCH_SETTINGS import com.android.app.search.LayoutType.SMALL_ICON_HORIZONTAL_TEXT import com.android.app.search.LayoutType.TEXT_HEADER @@ -179,6 +181,8 @@ sealed class LawnchairSearchAlgorithm( layoutType == CALCULATOR && calculator.isNotEmpty() -> normalBackground layoutType == EMPTY_STATE -> transparentBackground layoutType == SEARCH_SETTINGS -> transparentBackground +// layoutType == PLAY_PLACEHOLDER -> transparentBackground +// layoutType == EDUCARD -> transparentBackground isFirst && isLast -> normalBackground isFirst -> topBackground isLast -> bottomBackground diff --git a/lawnchair/src/app/lawnchair/views/LauncherPreviewView.kt b/lawnchair/src/app/lawnchair/views/LauncherPreviewView.kt index be97ab10de..bb206973ee 100644 --- a/lawnchair/src/app/lawnchair/views/LauncherPreviewView.kt +++ b/lawnchair/src/app/lawnchair/views/LauncherPreviewView.kt @@ -11,15 +11,13 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.WindowManager import android.widget.FrameLayout import androidx.annotation.UiThread -import androidx.annotation.WorkerThread import com.android.launcher3.InvariantDeviceProfile import com.android.launcher3.LauncherAppState import com.android.launcher3.R -import com.android.launcher3.graphics.LauncherPreviewRenderer import com.android.launcher3.model.BgDataModel +import com.android.launcher3.preview.LauncherPreviewRenderer import com.android.launcher3.util.ComponentKey import com.android.launcher3.util.Executors.MAIN_EXECUTOR -import com.android.launcher3.util.Executors.MODEL_EXECUTOR import com.android.launcher3.util.RunnableList import com.android.launcher3.util.Themes import com.android.launcher3.widget.LauncherWidgetHolder @@ -31,7 +29,7 @@ class LauncherPreviewView( context: Context, private val idp: InvariantDeviceProfile, private val dummySmartspace: Boolean = false, - private val dummyInsets: Boolean = false, + private val dummyInsets: Boolean = false, // Note: New Renderer calculates insets internally based on Context private val appContext: Context = context.applicationContext, ) : FrameLayout(context) { @@ -70,48 +68,61 @@ class LauncherPreviewView( destroyed = true onDestroyCallbacks.executeAllAndDestroy() removeAllViews() + // Note: The new LauncherPreviewRenderer manages its own lifecycle observer via the Context. + // If the Renderer exposes a close/destroy method in the future, call it here to prevent Model callback leaks. } private fun loadAsync() { - MODEL_EXECUTOR.execute(this::loadModelData) - } + // The new Renderer requires the LauncherModel to be passed in, + // and it handles the loading callbacks internally. + val model = LauncherAppState.getInstance(appContext).model - @WorkerThread - private fun loadModelData() { - val widgetHostId = LauncherWidgetHolder.APPWIDGET_HOST_ID - LauncherAppState.getInstance(appContext).model.loadAsync { dataModel -> - if (dataModel != null) { - MAIN_EXECUTOR.execute { - val display = appContext.getSystemService(WindowManager::class.java).defaultDisplay - val themeContext = ContextThemeWrapper(context, Themes.getActivityThemeRes(context)) + // Create the renderer on the Main Thread (it initializes handlers) + // Workspace.FIRST_SCREEN_ID is typically 0 + val workspaceScreenId = 0 + val themeRes = Themes.getActivityThemeRes(context) - val inflationContext = themeContext.createDisplayContext(display) - renderView(inflationContext, dataModel, widgetHostId, null) - } + // We use the current context. The Renderer extends BaseContext, + // so it will wrap this context internally. + val renderer = LauncherPreviewRenderer( + context, + workspaceScreenId, + null, // Wallpaper colors + model, + themeRes + ) + + /* + pE-TODO(QPR1/Collision-Gemini3Pro): MIGRATION NOTE + The new LauncherPreviewRenderer provided is the AOSP upstream version. + It does not yet have the Lawnchair methods 'setWorkspaceSearchContainer'. + + To support 'dummySmartspace', you must re-apply the Lawnchair patch to + com.android.launcher3.preview.LauncherPreviewRenderer.java: + + 1. Add field: private int mWorkspaceSearchContainer = R.layout.qsb_preview; + 2. Add method: public void setWorkspaceSearchContainer(int resId) { mWorkspaceSearchContainer = resId; } + 3. Use 'mWorkspaceSearchContainer' inside 'bindCompleteModel' when inflating the QSB. + */ + if (dummySmartspace) { + // renderer.setWorkspaceSearchContainer(R.layout.smartspace_widget_placeholder) + } + + // The renderer exposes a CompletableFuture that completes when the model is bound and view is measured + renderer.initialRender.thenAcceptAsync({ view -> + if (destroyed) return@thenAcceptAsync + + if (view != null) { + configureAndAttachView(view) } else { onReadyCallbacks.executeAllAndDestroy() - Log.e("LauncherPreviewView", "Model loading failed") + Log.e("LauncherPreviewView", "Model loading failed or View is null") } - } + }, MAIN_EXECUTOR) } @UiThread - private fun renderView( - inflationContext: Context, - dataModel: BgDataModel, - widgetHostId: Int, - widgetProviderInfoMap: Map?, - ) { - if (destroyed) { - return - } - - val renderer = LauncherPreviewRenderer(inflationContext, idp, widgetHostId, null, null) - if (dummySmartspace) { - renderer.setWorkspaceSearchContainer(R.layout.smartspace_widget_placeholder) - } - - val view = renderer.getRenderedView(dataModel, widgetProviderInfoMap) + private fun configureAndAttachView(view: View) { updateScale(view) view.pivotX = if (layoutDirection == LAYOUT_DIRECTION_RTL) view.measuredWidth.toFloat() else 0f view.pivotY = 0f @@ -128,7 +139,8 @@ class LauncherPreviewView( } private fun updateScale(view: View) { - // This aspect scales the view to fit in the surface and centers it + if (view.measuredWidth == 0 || view.measuredHeight == 0) return + val scale: Float = min( measuredWidth / view.measuredWidth.toFloat(), measuredHeight / view.measuredHeight.toFloat(), diff --git a/quickstep/src/com/android/quickstep/BaseWindowInterface.java b/quickstep/src/com/android/quickstep/BaseWindowInterface.java index 55015f08f4..bb31602de3 100644 --- a/quickstep/src/com/android/quickstep/BaseWindowInterface.java +++ b/quickstep/src/com/android/quickstep/BaseWindowInterface.java @@ -109,7 +109,7 @@ public abstract class BaseWindowInterface extends @Override public boolean isLauncherOverlayShowing() { - if (!RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue()) { + if (!RecentsWindowFlags.enableLauncherOverviewInWindow) { return false; } Launcher launcher = Launcher.ACTIVITY_TRACKER.getCreatedContext(); @@ -257,4 +257,4 @@ public abstract class BaseWindowInterface extends }); } } -} \ No newline at end of file +} diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java index 33a7e88ec3..0330d53452 100644 --- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -1,318 +1 @@ -package com.android.quickstep; - -import static android.view.Display.DEFAULT_DISPLAY; - -import static com.android.launcher3.taskbar.TaskbarThresholdUtils.getFromNavThreshold; -import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; - -import android.content.Context; -import android.content.res.Resources; -import android.os.Bundle; -import android.view.WindowInsets; - -import androidx.annotation.Nullable; - -import com.android.launcher3.R; -import com.android.launcher3.taskbar.TaskbarActivityContext; -import com.android.launcher3.testing.TestInformationHandler; -import com.android.launcher3.testing.shared.TestProtocol; -import com.android.launcher3.util.DisplayController; -import com.android.quickstep.util.GroupTask; -import com.android.quickstep.util.LayoutUtils; -import com.android.quickstep.util.TISBindHelper; -import com.android.quickstep.views.RecentsView; -import com.android.quickstep.views.RecentsViewContainer; -import com.android.systemui.shared.recents.model.Task; -import com.android.wm.shell.shared.bubbles.DeviceConfig; - -import java.util.ArrayList; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Function; - -public class QuickstepTestInformationHandler extends TestInformationHandler { - - protected final Context mContext; - - public QuickstepTestInformationHandler(Context context) { - mContext = context; - } - - @Override - public Bundle call(String method, String arg, @Nullable Bundle extras) { - final Bundle response = new Bundle(); - switch (method) { - case TestProtocol.REQUEST_RECENT_TASKS_LIST: { - ArrayList taskBaseIntentComponents = new ArrayList<>(); - CountDownLatch latch = new CountDownLatch(1); - RecentsModel.INSTANCE.get(mContext).getTasks((taskGroups) -> { - for (GroupTask group : taskGroups) { - for (Task t : group.getTasks()) { - taskBaseIntentComponents.add( - t.key.baseIntent.getComponent().flattenToString()); - } - } - latch.countDown(); - }); - try { - latch.await(2, TimeUnit.SECONDS); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - response.putStringArrayList(TestProtocol.TEST_INFO_RESPONSE_FIELD, - taskBaseIntentComponents); - return response; - } - - case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { - final float swipeHeight = - LayoutUtils.getDefaultSwipeHeight(mContext, mDeviceProfile); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); - return response; - } - - case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: { - final float swipeHeight = mDeviceProfile.getDeviceProperties().getHeightPx() / 2f; - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); - return response; - } - - case TestProtocol.REQUEST_GET_OVERVIEW_TASK_SIZE: { - return getUIProperty(Bundle::putParcelable, - recentsViewContainer -> - recentsViewContainer.>getOverviewPanel() - .getLastComputedTaskSize(), - this::getRecentsViewContainer); - } - - case TestProtocol.REQUEST_GET_OVERVIEW_GRID_TASK_SIZE: { - return getUIProperty(Bundle::putParcelable, - recentsViewContainer -> - recentsViewContainer.>getOverviewPanel() - .getLastComputedGridTaskSize(), - this::getRecentsViewContainer); - } - - case TestProtocol.REQUEST_GET_OVERVIEW_PAGE_SPACING: { - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - mDeviceProfile.getOverviewProfile().getPageSpacing()); - return response; - } - - case TestProtocol.REQUEST_GET_BUBBLE_BAR_DROP_TARGET_SIZE: { - int dimenResId = DeviceConfig.isSmallTablet(mContext) - ? R.dimen.drag_zone_bubble_fold : R.dimen.drag_zone_bubble_tablet; - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - mContext.getResources().getDimensionPixelSize(dimenResId)); - return response; - } - - case TestProtocol.REQUEST_GET_OVERVIEW_CURRENT_PAGE_INDEX: { - return getLauncherUIProperty(Bundle::putInt, - launcher -> launcher.getOverviewPanel().getCurrentPage()); - } - - case TestProtocol.REQUEST_GET_OVERVIEW_FIRST_TASKVIEW_INDEX: { - return getLauncherUIProperty(Bundle::putInt, - launcher -> - launcher.>getOverviewPanel() - .getFirstTaskViewIndex()); - } - - case TestProtocol.REQUEST_HAS_TIS: { - response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, true); - return response; - } - - case TestProtocol.REQUEST_UNSTASH_TASKBAR_IF_STASHED: - runOnTISBinder(tisBinder -> { - // Allow null-pointer to catch illegal states. - tisBinder.getTaskbarManager().getCurrentActivityContext() - .unstashTaskbarIfStashed(); - }); - return response; - - case TestProtocol.REQUEST_TASKBAR_FROM_NAV_THRESHOLD: { - final Resources resources = mContext.getResources(); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - getFromNavThreshold(resources, mDeviceProfile)); - return response; - } - - case TestProtocol.REQUEST_STASHED_TASKBAR_SCALE: { - runOnTISBinder(tisBinder -> { - response.putFloat(TestProtocol.TEST_INFO_RESPONSE_FIELD, - tisBinder.getTaskbarManager() - .getCurrentActivityContext() - .getStashedTaskbarScale()); - }); - return response; - } - - case TestProtocol.REQUEST_TASKBAR_ALL_APPS_TOP_PADDING: { - return getTISBinderUIProperty(Bundle::putInt, tisBinder -> - tisBinder.getTaskbarManager() - .getCurrentActivityContext() - .getTaskbarAllAppsTopPadding()); - } - - case TestProtocol.REQUEST_TASKBAR_APPS_LIST_SCROLL_Y: { - return getTISBinderUIProperty(Bundle::putInt, tisBinder -> - tisBinder.getTaskbarManager() - .getCurrentActivityContext() - .getTaskbarAllAppsScroll()); - } - - case TestProtocol.REQUEST_ENABLE_BLOCK_TIMEOUT: - runOnTISBinder(tisBinder -> { - enableBlockingTimeout(tisBinder, true); - }); - return response; - - case TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT: - runOnTISBinder(tisBinder -> { - enableBlockingTimeout(tisBinder, false); - }); - return response; - - case TestProtocol.REQUEST_ENABLE_TRANSIENT_TASKBAR: - enableTransientTaskbar(true); - return response; - - case TestProtocol.REQUEST_DISABLE_TRANSIENT_TASKBAR: - enableTransientTaskbar(false); - return response; - - case TestProtocol.REQUEST_SHELL_DRAG_READY: - response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, - SystemUiProxy.INSTANCE.get(mContext).isDragAndDropReady()); - return response; - - case TestProtocol.REQUEST_REFRESH_OVERVIEW_TARGET: - runOnTISBinder(TouchInteractionService.TISBinder::refreshOverviewTargetForTest); - return response; - - case TestProtocol.REQUEST_RECREATE_TASKBAR: - // Allow null-pointer to catch illegal states. - runOnTISBinder(tisBinder -> tisBinder.getTaskbarManager().recreateTaskbars()); - return response; - case TestProtocol.REQUEST_TASKBAR_IME_DOCKED: - return getTISBinderUIProperty(Bundle::putBoolean, tisBinder -> - tisBinder.getTaskbarManager() - .getCurrentActivityContext().isImeDocked()); - case TestProtocol.REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED: - runOnTISBinder(tisBinder -> { - // Allow null-pointer to catch illegal states. - tisBinder.getTaskbarManager().getCurrentActivityContext() - .unstashBubbleBarIfStashed(); - }); - return response; - case TestProtocol.REQUEST_INJECT_FAKE_TRACKPAD: - runOnTISBinder(tisBinder -> tisBinder.injectFakeTrackpadForTesting()); - return response; - case TestProtocol.REQUEST_EJECT_FAKE_TRACKPAD: - runOnTISBinder(tisBinder -> tisBinder.ejectFakeTrackpadForTesting()); - return response; - case TestProtocol.REQUEST_TASKBAR_PRIMARY_DISPLAY_ID: { - return getTISBinderUIProperty(Bundle::putInt, tisBinder -> - tisBinder.getTaskbarManager().getPrimaryDisplayId()); - } - - case TestProtocol.REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD: { - final Resources resources = mContext.getResources(); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - resources.getDimensionPixelSize(R.dimen.task_dismiss_detach_threshold)); - return response; - } - - case TestProtocol.REQUEST_TASKBAR_ACTION_CORNER_PADDING: { - final Resources resources = mContext.getResources(); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - resources.getDimensionPixelSize( - R.dimen.transient_taskbar_action_corner_padding)); - return response; - } - case TestProtocol.REQUEST_TASKBAR_UNSTASHED_INPUT_AREA: { - final Resources resources = mContext.getResources(); - response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, - resources.getDimensionPixelSize( - R.dimen.taskbar_unstash_input_area)); - return response; - } - } - - return super.call(method, arg, extras); - } - - @Override - protected WindowInsets getWindowInsets() { - RecentsViewContainer container = getRecentsViewContainer(); - WindowInsets insets = container == null || container.getRootView() == null - ? null : container.getRootView().getRootWindowInsets(); - return insets == null ? super.getWindowInsets() : insets; - } - - @Nullable - private RecentsViewContainer getRecentsViewContainer() { - // TODO (b/400647896): support per-display container in e2e tests - BaseContainerInterface containerInterface = OverviewComponentObserver.INSTANCE.get( - mContext) - .getContainerInterface(DEFAULT_DISPLAY); - if (containerInterface != null) { - return containerInterface.getCreatedContainer(); - } else { - return null; - } - } - - @Override - protected boolean isLauncherInitialized() { - return super.isLauncherInitialized() && SystemUiProxy.INSTANCE.get(mContext).isActive(); - } - - private void enableBlockingTimeout( - TouchInteractionService.TISBinder tisBinder, boolean enable) { - TaskbarActivityContext context = tisBinder.getTaskbarManager().getCurrentActivityContext(); - if (context == null) { - return; - } - context.enableBlockingTimeoutDuringTests(enable); - } - - private void enableTransientTaskbar(boolean enable) { - DisplayController.INSTANCE.get(mContext).enableTransientTaskbarForTests(enable); - } - - /** - * Runs the given command on the UI thread, after ensuring we are connected to - * TouchInteractionService. - */ - protected void runOnTISBinder(Consumer connectionCallback) { - try { - CountDownLatch countDownLatch = new CountDownLatch(1); - TISBindHelper helper = MAIN_EXECUTOR.submit(() -> - new TISBindHelper(mContext, tisBinder -> { - connectionCallback.accept(tisBinder); - countDownLatch.countDown(); - })).get(); - countDownLatch.await(); - MAIN_EXECUTOR.execute(helper::onDestroy); - } catch (ExecutionException | InterruptedException e) { - throw new RuntimeException(e); - } - } - - private Bundle getTISBinderUIProperty( - BundleSetter bundleSetter, Function provider) { - Bundle response = new Bundle(); - - runOnTISBinder(tisBinder -> bundleSetter.set( - response, - TestProtocol.TEST_INFO_RESPONSE_FIELD, - provider.apply(tisBinder))); - - return response; - } -} +// LC: No-op diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index ed01dc5407..50e929a221 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -158,6 +158,7 @@ public class RecentTasksList { mSysUiProxy.registerRecentTasksListener(recentTasksListener); tracker.addCloseable( () -> mSysUiProxy.unregisterRecentTasksListener(recentTasksListener)); + } // We may receive onRunningTaskAppeared events later for tasks which have already been // included in the list returned by mSysUiProxy.getRunningTasks(), or may receive diff --git a/quickstep/src/com/android/quickstep/util/AppPairsController.java b/quickstep/src/com/android/quickstep/util/AppPairsController.java index ff407ea7ee..3015ad8315 100644 --- a/quickstep/src/com/android/quickstep/util/AppPairsController.java +++ b/quickstep/src/com/android/quickstep/util/AppPairsController.java @@ -234,7 +234,7 @@ public class AppPairsController { if (delegate == null) { return; } - if (RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue()) { + if (RecentsWindowFlags.enableLauncherOverviewInWindow) { PerDisplayRepository recentsWindowManagerRepository = RecentsWindowManager.REPOSITORY_INSTANCE.get(mContext.asContext()); recentsWindowManagerRepository.get(gtv.getDisplayId()) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index ae8aff3826..4c3b0ae953 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -142,6 +142,7 @@ import com.android.internal.jank.Cuj; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseActivity.MultiWindowModeChangedListener; import com.android.launcher3.BuildConfig; +import com.android.launcher3.BuildConfigs; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.PagedView; @@ -6711,7 +6712,7 @@ public abstract class RecentsView< */ public void addOnScrollChangedListener(OnScrollChangedListener listener) { if (mScrollListeners.contains(listener)) { - if (BuildConfig.IS_STUDIO_BUILD) { + if (BuildConfigs.IS_STUDIO_BUILD) { throw new IllegalStateException( "Should not add duplicated OnScrollChangedListener"); } else { diff --git a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java index 2a066c20cd..dc5db4bd59 100644 --- a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java +++ b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java @@ -63,7 +63,7 @@ public abstract class AbstractQuickStepTest @Override protected void onLauncherActivityClose(QuickstepLauncher launcher) { super.onLauncherActivityClose(launcher); - if (RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue()) { + if (RecentsWindowFlags.enableLauncherOverviewInWindow) { executeOnRecentsWindowIfPresent(RecentsWindowManager::cleanupRecentsWindow); } RecentsView recentsView = launcher.getOverviewPanel(); @@ -111,7 +111,7 @@ public abstract class AbstractQuickStepTest @Override protected boolean isInState(Supplier state) { if (!TestHelpers.isInLauncherProcess()) return true; - if (!RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue() + if (!RecentsWindowFlags.enableLauncherOverviewInWindow || !hasEquivalentRecentsState(state.get())) { return super.isInState(state); } @@ -124,7 +124,7 @@ public abstract class AbstractQuickStepTest protected void waitForState( boolean forInitialization, String message, Supplier state) { if (!TestHelpers.isInLauncherProcess()) return; - if (!RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue() + if (!RecentsWindowFlags.enableLauncherOverviewInWindow || !hasEquivalentRecentsState(state.get()) || (forInitialization && RecentsWindowManager.getRecentsWindowTracker().getCreatedContext() == null)) { @@ -140,7 +140,7 @@ public abstract class AbstractQuickStepTest @Nullable protected RecentsView getOverviewPanel() { if (!TestHelpers.isInLauncherProcess()) return null; - if (!RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue()) { + if (!RecentsWindowFlags.enableLauncherOverviewInWindow) { return super.getOverviewPanel(); } return getFromRecentsWindowIfPresent(RecentsWindowManager::getOverviewPanel); @@ -149,7 +149,7 @@ public abstract class AbstractQuickStepTest @Override protected boolean useNullOverview() { return super.useNullOverview() - && !RecentsWindowFlags.enableLauncherOverviewInWindow.isTrue(); + && !RecentsWindowFlags.enableLauncherOverviewInWindow; } protected void assertTestActivityIsRunning(int activityNumber, String message) { diff --git a/res/values/id.xml b/res/values/id.xml index 78b8308cc9..1d7ee0d95e 100644 --- a/res/values/id.xml +++ b/res/values/id.xml @@ -101,4 +101,8 @@ + + + + diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java index ca1af70a32..4671d2c3ed 100644 --- a/src/com/android/launcher3/AppWidgetResizeFrame.java +++ b/src/com/android/launcher3/AppWidgetResizeFrame.java @@ -302,7 +302,6 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O LauncherAppWidgetInfo widgetInfoOnView = (LauncherAppWidgetInfo) mWidgetView.getTag(); // Only show resize handles for the directions in which resizing is possible. - InvariantDeviceProfile idp = LauncherAppState.getIDP(cellLayout.getContext()); // on font / display change, the dp/px size of a cell changes, which means, existing spans // may be invalid. User should be able to resize to the correct widget size. diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 0fcd05e1f5..5931295c84 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -51,6 +51,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import androidx.core.content.res.ResourcesCompat; import app.lawnchair.DeviceProfileOverrides.TextFactors; import com.android.launcher3.CellLayout.ContainerType; import com.android.launcher3.DevicePaddings.DevicePadding; @@ -467,8 +468,8 @@ public class DeviceProfile { .firstBlocking(preferenceManager2.getPageIndicatorHeightFactor()); workspacePageIndicatorHeight *= (int) pageIndicatorHeightFactor; - mWorkspacePageIndicatorOverlapWorkspace = res - .getDimensionPixelSize(R.dimen.workspace_page_indicator_overlap_workspace); +// mWorkspacePageIndicatorOverlapWorkspace = res +// .getDimensionPixelSize(R.dimen.workspace_page_indicator_overlap_workspace); if (!mIsResponsiveGrid) { TypedArray cellStyle; @@ -501,11 +502,6 @@ public class DeviceProfile { HotseatMode hotseatMode = PreferenceExtensionsKt.firstBlocking(preferenceManager2.getHotseatMode()); boolean isQsbEnable = hotseatMode.getLayoutResourceId() != R.layout.empty_view; - hotseatQsbHeight = isQsbEnable ? res.getDimensionPixelSize(R.dimen.qsb_widget_height) : 0; - hotseatQsbShadowHeight = res.getDimensionPixelSize(R.dimen.qsb_shadow_height); - hotseatQsbVisualHeight = isQsbEnable ? hotseatQsbHeight - 2 * hotseatQsbShadowHeight : 0; - - numShownHotseatIcons = displayOptionSpec.numShownHotseatIcons; mHotseatColumnSpan = inv.numColumns; @@ -545,7 +541,8 @@ public class DeviceProfile { shouldApplyWidePortraitDimens, isVerticalBarLayout(), mResponsiveHotseatSpec, - workspacePageIndicatorHeight + workspacePageIndicatorHeight, + hotseatMode ); // Whether QSB might be inline in appropriate orientation (e.g. landscape). @@ -1399,7 +1396,7 @@ public class DeviceProfile { } var allAppLeftRightMarginMultiplier = PreferenceExtensionsKt .firstBlocking(preferenceManager2.getDrawerLeftRightMarginFactor()); - var marginMultiplier = allAppLeftRightMarginMultiplier * (!isTablet ? 100 : 2); + var marginMultiplier = allAppLeftRightMarginMultiplier * (!getDeviceProperties().isTablet() ? 100 : 2); allAppsLeftRightMargin = (int) (allAppsLeftRightMargin * marginMultiplier); // todo fix how drawer padding values are calculated in responsive grid type diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index 09b27ee04d..fdae191d48 100644 --- a/src/com/android/launcher3/LauncherRootView.java +++ b/src/com/android/launcher3/LauncherRootView.java @@ -72,8 +72,8 @@ public class LauncherRootView extends InsettableFrameLayout { private void setUpBlur(Context context) { var display = mStatefulContainer.getDeviceProfile(); - int width = display.widthPx; - int height = display.heightPx; + int width = display.getDeviceProperties().getWidthPx(); + int height = display.getDeviceProperties().getHeightPx(); var wallpaper = getScaledWallpaperDrawable(width, height); if (wallpaper == null) { diff --git a/src/com/android/launcher3/MainProcessInitializer.java b/src/com/android/launcher3/MainProcessInitializer.java index 88f4c8ab46..0cad917549 100644 --- a/src/com/android/launcher3/MainProcessInitializer.java +++ b/src/com/android/launcher3/MainProcessInitializer.java @@ -71,7 +71,7 @@ public class MainProcessInitializer implements ResourceBasedOverride { BitmapCreationCheck.startTracking(context); } - if (DEBUG_STRICT_MODE || (BuildConfig.IS_STUDIO_BUILD && enableStrictMode())) { + if (DEBUG_STRICT_MODE || (BuildConfigs.IS_STUDIO_BUILD && enableStrictMode())) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() @@ -87,7 +87,7 @@ public class MainProcessInitializer implements ResourceBasedOverride { .build()); } - if (BuildConfig.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) { + if (BuildConfigs.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) { final String notificationChannelId = "com.android.launcher3.Debug"; final String notificationChannelName = "Debug"; final String notificationTag = "Debug"; diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 451a6bc2d3..a979dfb811 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -171,7 +171,7 @@ public final class Utilities { * @deprecated Use {@link BuildConfig#IS_DEBUG_DEVICE} directly */ @Deprecated - public static final boolean IS_DEBUG_DEVICE = BuildConfig.IS_DEBUG_DEVICE; + public static final boolean IS_DEBUG_DEVICE = BuildConfigs.IS_DEBUG_DEVICE; public static final int TRANSLATE_UP = 0; public static final int TRANSLATE_DOWN = 1; @@ -1101,7 +1101,7 @@ public final class Utilities { *

Debug devices by default include -eng and -userdebug builds, but not -user builds. */ public static void debugLog(String tag, String message) { - if (BuildConfig.IS_DEBUG_DEVICE) { + if (BuildConfigs.IS_DEBUG_DEVICE) { Log.d(tag, message); } } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 5fabf7c35b..43f53af16a 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -656,7 +656,7 @@ public class Workspace extends PagedView * Initializes and binds the first page */ public void bindAndInitFirstWorkspaceScreen() { - if (!BuildConfig.QSB_ON_FIRST_SCREEN) { + if (!BuildConfigs.QSB_ON_FIRST_SCREEN) { mFirstPagePinnedItem = null; return; } @@ -1094,7 +1094,7 @@ public class Workspace extends PagedView int id = mWorkspaceScreens.keyAt(i); CellLayout cl = mWorkspaceScreens.valueAt(i); // FIRST_SCREEN_ID can never be removed. - if ((!BuildConfig.QSB_ON_FIRST_SCREEN || id > FIRST_SCREEN_ID) + if ((!BuildConfigs.QSB_ON_FIRST_SCREEN || id > FIRST_SCREEN_ID) && cl.getShortcutsAndWidgets().getChildCount() == 0) { removeScreens.add(id); } diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 94dbbd9e79..52434f7171 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -412,7 +412,7 @@ public class AlphabeticalAppsList implement position++; } } else { - if (Flags.privateSpaceAppInstallerButton()) { + if (Flags.enablePrivateSpace()) { mPrivateProviderManager.addPrivateSpaceInstallAppButton(mAdapterItems); position++; } diff --git a/src/com/android/launcher3/deviceprofile/HotseatProfile.kt b/src/com/android/launcher3/deviceprofile/HotseatProfile.kt index 0aa574c017..ba828f53cb 100644 --- a/src/com/android/launcher3/deviceprofile/HotseatProfile.kt +++ b/src/com/android/launcher3/deviceprofile/HotseatProfile.kt @@ -16,10 +16,15 @@ package com.android.launcher3.deviceprofile +import android.content.Context import android.content.res.Resources +import androidx.compose.ui.platform.LocalContext +import app.lawnchair.hotseat.HotseatMode +import app.lawnchair.preferences2.PreferenceManager2 import com.android.launcher3.InvariantDeviceProfile import com.android.launcher3.R import com.android.launcher3.responsive.CalculatedHotseatSpec +import com.patrykmichalik.opto.core.firstBlocking // Remaining hotseat properties // int numShownHotseatIcons - updates multiple times @@ -58,6 +63,7 @@ data class HotseatProfile( isVerticalBarLayout: Boolean, responsiveHotseatSpec: CalculatedHotseatSpec?, workspacePageIndicatorHeight: Int, + hotseatMode: HotseatMode, ): HotseatProfile { val areNavButtonsInline = isTaskbarPresent && !deviceProperties.isGestureMode var inlineNavButtonsEndSpacingPx = 0 @@ -76,7 +82,7 @@ data class HotseatProfile( val springLoadedHotseatBarTopMarginPx = if (shouldApplyWidePortraitDimens) res.getDimensionPixelSize( - R.dimen.spring_loaded_hotseat_top_margin_wide_portrait + R.dimen.spring_loaded_hotseat_top_margin_wide_portrait, ) else res.getDimensionPixelSize(R.dimen.spring_loaded_hotseat_top_margin) val hotseatBarEdgePaddingPx = @@ -85,11 +91,16 @@ data class HotseatProfile( responsiveHotseatSpec != null -> responsiveHotseatSpec.edgePadding else -> workspacePageIndicatorHeight } + val isQsbEnable = hotseatMode.layoutResourceId != R.layout.empty_view + val hotseatBarWorkspaceSpacePx = if (responsiveHotseatSpec != null) 0 else res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding) - val hotseatQsbHeight = res.getDimensionPixelSize(R.dimen.qsb_widget_height) + val hotseatQsbHeight = + if (isQsbEnable) res.getDimensionPixelSize(R.dimen.qsb_widget_height) else 0 val hotseatQsbShadowHeight = res.getDimensionPixelSize(R.dimen.qsb_shadow_height) + val hotseatQsbVisualHeight = + if (isQsbEnable) hotseatQsbHeight - 2 * hotseatQsbShadowHeight else 0 return HotseatProfile( areNavButtonsInline = areNavButtonsInline, @@ -101,7 +112,7 @@ data class HotseatProfile( barWorkspaceSpacePx = hotseatBarWorkspaceSpacePx, qsbHeight = hotseatQsbHeight, qsbShadowHeight = hotseatQsbShadowHeight, - qsbVisualHeight = hotseatQsbHeight - 2 * hotseatQsbShadowHeight, + qsbVisualHeight = hotseatQsbVisualHeight, minIconSpacePx = res.getDimensionPixelSize(R.dimen.min_hotseat_icon_space), minQsbWidthPx = res.getDimensionPixelSize(R.dimen.min_hotseat_qsb_width), maxIconSpacePx = diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index c221a1f891..9a89350529 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -210,7 +210,7 @@ public class FolderIcon extends FrameLayout implements FloatingIconViewCompanion icon.mFolderName.setCompoundDrawablePadding(0); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams(); if (folderInfo.container == ItemInfo.NO_ID) { - lp.topMargin = grid.allAppsIconSizePx + grid.allAppsIconDrawablePaddingPx; + lp.topMargin = grid.getAllAppsProfile().getIconSizePx() + grid.getAllAppsProfile().getIconDrawablePaddingPx(); icon.mBackground = new PreviewBackground(activity.getDragLayer().getContext()); } else { lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx; diff --git a/src/com/android/launcher3/graphics/GridCustomizationsProxy.java b/src/com/android/launcher3/graphics/GridCustomizationsProxy.java index 3235dd89f4..6c656147b0 100644 --- a/src/com/android/launcher3/graphics/GridCustomizationsProxy.java +++ b/src/com/android/launcher3/graphics/GridCustomizationsProxy.java @@ -15,7 +15,7 @@ */ package com.android.launcher3.graphics; -import static com.android.launcher3.BuildConfig.IS_DEBUG_DEVICE; +import static com.android.launcher3.BuildConfigs.IS_DEBUG_DEVICE; import static com.android.launcher3.preview.PreviewSurfaceRenderer.KEY_BITMAP_GENERATION_DELAY_MS; import static com.android.launcher3.preview.PreviewSurfaceRenderer.KEY_VIEW_HEIGHT; import static com.android.launcher3.preview.PreviewSurfaceRenderer.KEY_VIEW_WIDTH; diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java index 0e99a4cfd4..a72c375c74 100644 --- a/src/com/android/launcher3/icons/IconCache.java +++ b/src/com/android/launcher3/icons/IconCache.java @@ -50,7 +50,6 @@ import androidx.core.util.Pair; import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.LauncherFiles; import com.android.launcher3.Utilities; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppSingleton; @@ -88,8 +87,6 @@ import java.util.stream.Stream; import javax.inject.Inject; import javax.inject.Named; -import app.lawnchair.icons.LawnchairIconProvider; - /** * Cache of application icons. Icons can be made from any thread. */ @@ -117,20 +114,6 @@ public class IconCache extends BaseIconCache { private int mPendingIconRequestCount = 0; - // Lawnchair: Apply 3p icon pack - public IconCache(Context context, InvariantDeviceProfile idp, LauncherIcons.IconPool iconPool, DaggerSingletonTracker lifecycle) { - this( - context, - idp, - LauncherFiles.APP_ICONS_DB, - UserCache.INSTANCE.get(context), - new LawnchairIconProvider(context), - InstallSessionHelper.INSTANCE.get(context), - iconPool, - lifecycle - ); - } - @Inject public IconCache( @ApplicationContext Context context, @@ -151,7 +134,7 @@ public class IconCache extends BaseIconCache { mInstallSessionHelper = installSessionHelper; mIconPool = iconPool; - mInstantAppResolver = InstantAppResolver.newInstance(context); + mInstantAppResolver = instantAppResolver; mWidgetCategoryBitmapInfos = new SparseArray<>(); mCancelledTask = new CancellableTask(() -> null, MAIN_EXECUTOR, c -> { }); @@ -176,7 +159,7 @@ public class IconCache extends BaseIconCache { mInstallSessionHelper = installSessionHelper; mIconPool = iconPool; - mInstantAppResolver = instantAppResolver; + mInstantAppResolver = InstantAppResolver.newInstance(context); mWidgetCategoryBitmapInfos = new SparseArray<>(); mCancelledTask = new CancellableTask(() -> null, MAIN_EXECUTOR, c -> { }); diff --git a/src/com/android/launcher3/model/DatabaseHelper.java b/src/com/android/launcher3/model/DatabaseHelper.java index 4199016ebc..b39bdaeb56 100644 --- a/src/com/android/launcher3/model/DatabaseHelper.java +++ b/src/com/android/launcher3/model/DatabaseHelper.java @@ -37,6 +37,7 @@ import androidx.annotation.NonNull; import com.android.launcher3.AutoInstallsLayout; import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback; import com.android.launcher3.BuildConfig; +import com.android.launcher3.BuildConfigs; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Utilities; diff --git a/src/com/android/launcher3/model/GridSizeMigrationDBController.java b/src/com/android/launcher3/model/GridSizeMigrationDBController.java index 3d56010a2d..ded47d8e6d 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationDBController.java +++ b/src/com/android/launcher3/model/GridSizeMigrationDBController.java @@ -16,7 +16,7 @@ package com.android.launcher3.model; -import static com.android.launcher3.BuildConfig.QSB_ON_FIRST_SCREEN; +import static com.android.launcher3.BuildConfigs.QSB_ON_FIRST_SCREEN; import static com.android.launcher3.GridType.GRID_TYPE_NON_ONE_GRID; import static com.android.launcher3.GridType.GRID_TYPE_ONE_GRID; import static com.android.launcher3.InvariantDeviceProfile.TYPE_TABLET; diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java index 6eb2229381..4cc31a2d3d 100644 --- a/src/com/android/launcher3/model/LoaderCursor.java +++ b/src/com/android/launcher3/model/LoaderCursor.java @@ -44,6 +44,7 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.BuildConfig; +import com.android.launcher3.BuildConfigs; import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherModel; @@ -645,7 +646,7 @@ public class LoaderCursor extends CursorWrapper { if (!mOccupied.containsKey(item.screenId)) { GridOccupancy screen = new GridOccupancy(countX + 1, countY + 1); - if (item.screenId == Workspace.FIRST_SCREEN_ID && BuildConfig.QSB_ON_FIRST_SCREEN) { + if (item.screenId == Workspace.FIRST_SCREEN_ID && BuildConfigs.QSB_ON_FIRST_SCREEN) { // Mark the first X columns (X is width of the search container) in the first row as // occupied (if the feature is enabled) in order to account for the search // container. diff --git a/src/com/android/launcher3/model/ModelDbController.java b/src/com/android/launcher3/model/ModelDbController.java index 780567131b..227dbdbfe1 100644 --- a/src/com/android/launcher3/model/ModelDbController.java +++ b/src/com/android/launcher3/model/ModelDbController.java @@ -52,13 +52,13 @@ import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.Utilities; -import com.android.launcher3.graphics.LauncherPreviewRenderer; import com.android.launcher3.backuprestore.LauncherRestoreEventLogger; import com.android.launcher3.backuprestore.LauncherRestoreEventLogger.RestoreError; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppSingleton; import com.android.launcher3.logging.FileLog; import com.android.launcher3.pm.UserCache; +import com.android.launcher3.preview.PreviewContext; import com.android.launcher3.provider.LauncherDbUtils; import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction; import com.android.launcher3.provider.RestoreDbTask; @@ -617,7 +617,7 @@ public class ModelDbController { public synchronized void loadDefaultFavoritesIfNecessary() { createDbIfNotExists(); - if (!(mContext instanceof LauncherPreviewRenderer.PreviewContext)) { + if (!(mContext instanceof PreviewContext)) { LawnchairAppKt.getLawnchairApp(mContext).cleanUpDatabases(); } diff --git a/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java b/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java index 4e4f853681..4549c6b7e7 100644 --- a/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java +++ b/src/com/android/launcher3/model/WorkspaceItemSpaceFinder.java @@ -20,6 +20,7 @@ import static com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID; import android.util.LongSparseArray; import com.android.launcher3.BuildConfig; +import com.android.launcher3.BuildConfigs; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherSettings; diff --git a/src/com/android/launcher3/preview/LauncherPreviewRenderer.java b/src/com/android/launcher3/preview/LauncherPreviewRenderer.java index 8257027bf9..b92df26060 100644 --- a/src/com/android/launcher3/preview/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/preview/LauncherPreviewRenderer.java @@ -49,6 +49,7 @@ import androidx.lifecycle.DefaultLifecycleObserver; import androidx.lifecycle.LifecycleOwner; import com.android.launcher3.BuildConfig; +import com.android.launcher3.BuildConfigs; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Hotseat; @@ -326,7 +327,7 @@ public class LauncherPreviewRenderer extends BaseContext populateHotseatPredictions(itemIdMap); // Add first page QSB - if (BuildConfig.QSB_ON_FIRST_SCREEN) { + if (BuildConfigs.QSB_ON_FIRST_SCREEN) { CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID); if (firstScreen != null) { View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false); diff --git a/src/com/android/launcher3/testing/shared/TestProtocol.java b/src/com/android/launcher3/testing/shared/TestProtocol.java index 142171e0eb..daa2e40930 100644 --- a/src/com/android/launcher3/testing/shared/TestProtocol.java +++ b/src/com/android/launcher3/testing/shared/TestProtocol.java @@ -31,7 +31,7 @@ public final class TestProtocol { public static final String SEARCH_RESULT_COMPLETE = "SEARCH_RESULT_COMPLETE"; public static final String LAUNCHER_ACTIVITY_STOPPED_MESSAGE = "TAPL_LAUNCHER_ACTIVITY_STOPPED"; public static final String WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE = - "TAPL_WALLPAPER_OPEN_ANIMATION_FINISHED"; + "TAPL_WALLPAPER_OPEN_ANIMATION_FINISHED"; public static final int NORMAL_STATE_ORDINAL = 0; public static final int SPRING_LOADED_STATE_ORDINAL = 1; public static final int OVERVIEW_STATE_ORDINAL = 2; @@ -81,16 +81,16 @@ public final class TestProtocol { public static final String TEST_INFO_PARAM_CELL_SPAN = "cell-span"; public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT = - "home-to-overview-swipe-height"; + "home-to-overview-swipe-height"; public static final String REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT = - "background-to-overview-swipe-height"; + "background-to-overview-swipe-height"; public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT = - "home-to-all-apps-swipe-height"; + "home-to-all-apps-swipe-height"; public static final String REQUEST_ICON_HEIGHT = - "icon-height"; + "icon-height"; public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized"; public static final String REQUEST_IS_LAUNCHER_LAUNCHER_ACTIVITY_STARTED = - "is-launcher-activity-started"; + "is-launcher-activity-started"; public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list"; public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list"; public static final String REQUEST_ENABLE_BLOCK_TIMEOUT = "enable-block-timeout"; @@ -122,22 +122,22 @@ public final class TestProtocol { public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names"; public static final String REQUEST_IS_TABLET = "is-tablet"; public static final String REQUEST_IS_PREDICTIVE_BACK_SWIPE_ENABLED = - "is-predictive-back-swipe-enabled"; + "is-predictive-back-swipe-enabled"; public static final String REQUEST_ENABLE_TASKBAR_NAVBAR_UNIFICATION = - "enable-taskbar-navbar-unification"; + "enable-taskbar-navbar-unification"; public static final String REQUEST_TASKBAR_SHOWN_ON_HOME = - "taskbar-shown-on-home"; + "taskbar-shown-on-home"; public static final String REQUEST_NUM_ALL_APPS_COLUMNS = "num-all-apps-columns"; public static final String REQUEST_IS_TWO_PANELS = "is-two-panel"; public static final String REQUEST_CELL_LAYOUT_BOARDER_HEIGHT = "cell-layout-boarder-height"; public static final String REQUEST_START_DRAG_THRESHOLD = "start-drag-threshold"; public static final String REQUEST_SHELL_DRAG_READY = "shell-drag-ready"; public static final String REQUEST_GET_ACTIVITIES_CREATED_COUNT = - "get-activities-created-count"; + "get-activities-created-count"; public static final String REQUEST_GET_ACTIVITIES = "get-activities"; public static final String REQUEST_HAS_TIS = "has-touch-interaction-service"; public static final String REQUEST_TASKBAR_ALL_APPS_TOP_PADDING = - "taskbar-all-apps-top-padding"; + "taskbar-all-apps-top-padding"; public static final String REQUEST_ALL_APPS_TOP_PADDING = "all-apps-top-padding"; public static final String REQUEST_ALL_APPS_BOTTOM_PADDING = "all-apps-bottom-padding"; public static final String REQUEST_REFRESH_OVERVIEW_TARGET = "refresh-overview-target"; @@ -147,15 +147,20 @@ public final class TestProtocol { public static final String REQUEST_WORKSPACE_COLUMNS_ROWS = "workspace-columns-rows"; public static final String REQUEST_WORKSPACE_CURRENT_PAGE_INDEX = - "workspace-current-page-index"; + "workspace-current-page-index"; public static final String REQUEST_HOTSEAT_CELL_CENTER = "hotseat-cell-center"; public static final String REQUEST_GET_OVERVIEW_TASK_SIZE = "get-overivew-task-size"; public static final String REQUEST_GET_OVERVIEW_GRID_TASK_SIZE = "get-overivew-grid-task-size"; public static final String REQUEST_GET_OVERVIEW_PAGE_SPACING = "get-overview-page-spacing"; + + public static final String REQUEST_GET_BUBBLE_BAR_DROP_TARGET_SIZE = + "request-get-bubble-bar-drop-target-size"; public static final String REQUEST_GET_OVERVIEW_CURRENT_PAGE_INDEX = - "get-overview-current-page-index"; + "get-overview-current-page-index"; + public static final String REQUEST_GET_OVERVIEW_FIRST_TASKVIEW_INDEX = + "get-overview-first-taskview-index"; public static final String REQUEST_GET_SPLIT_SELECTION_ACTIVE = "get-split-selection-active"; public static final String REQUEST_ENABLE_ROTATION = "enable_rotation"; public static final String REQUEST_MODEL_QUEUE_CLEARED = "model-queue-cleared"; @@ -169,16 +174,26 @@ public final class TestProtocol { public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; public static final String PERMANENT_DIAG_TAG = "TaplTarget"; - public static final String ICON_MISSING = "b/282963545"; public static final String REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW = "enable-grid-only-overview"; public static final String REQUEST_IS_RECENTS_WINDOW_ENABLED = "recents-window-enabled"; public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED = - "unstash-bubble-bar-if-stashed"; + "unstash-bubble-bar-if-stashed"; public static final String REQUEST_INJECT_FAKE_TRACKPAD = "inject-fake-trackpad"; public static final String REQUEST_EJECT_FAKE_TRACKPAD = "eject-fake-trackpad"; + public static final String REQUEST_TASKBAR_PRIMARY_DISPLAY_ID = "taskbar-primary-display-id"; + + public static final String REQUEST_DISMISS_MAGNETIC_DETACH_THRESHOLD = + "dismiss-magnetic-detach-threshold"; + + public static final String REQUEST_TASKBAR_ACTION_CORNER_PADDING = + "taskbar-action-corner-padding"; + + public static final String REQUEST_TASKBAR_UNSTASHED_INPUT_AREA = + "taskbar-unstashed-input-area"; + /** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */ public static void testLogD(String tag, String message) { if (!sDebugTracing) { diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 1e626c3151..7ea2c0795c 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -574,16 +574,10 @@ public abstract class BaseDragLayer mSystemGestureRegion.set(gestureInsets.left, gestureInsets.top, gestureInsets.right, gestureInsets.bottom); if (mContainer.getDeviceProfile().isTaskbarPresent) { - // Ignore taskbar gesture insets to avoid interfering with TouchControllers. + // Ignore taskbar gesture insets to avoid interfering with TouchControllers. mSystemGestureRegion.bottom = ResourceUtils.getNavbarSize( ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources()); } - mSystemGestureRegion.set( - Math.max(gestureInsets.left, imeInset.left), - Math.max(gestureInsets.top, imeInset.top), - Math.max(gestureInsets.right, imeInset.right), - Math.max(gestureInsetBottom, imeInset.bottom) - ); } return super.dispatchApplyWindowInsets(insets); }