From 0f1fe9722fb5bfa996736ca28ef4a899fad0303d Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Thu, 14 Mar 2024 13:48:37 -0700 Subject: [PATCH 1/5] Ignoring the failing test. LauncherIntentTest#testAllAppsIntent is a newly added TAPL test that seems to be breaking on a few devices. Disabling it until the root issue is fixed. Bug: 329152799 Test: Manual Flag: NA Change-Id: I3c1d145a444d4d2a85b3f5d2a968d120eee7cca0 --- tests/src/com/android/launcher3/LauncherIntentTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/com/android/launcher3/LauncherIntentTest.java b/tests/src/com/android/launcher3/LauncherIntentTest.java index e2971e8731..e8822c3712 100644 --- a/tests/src/com/android/launcher3/LauncherIntentTest.java +++ b/tests/src/com/android/launcher3/LauncherIntentTest.java @@ -29,6 +29,7 @@ import com.android.launcher3.allapps.ActivityAllAppsContainerView; import com.android.launcher3.allapps.SearchRecyclerView; import com.android.launcher3.ui.AbstractLauncherUiTest; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,6 +40,7 @@ public class LauncherIntentTest extends AbstractLauncherUiTest { public final Intent allAppsIntent = new Intent(Intent.ACTION_ALL_APPS); @Test + @Ignore("b/329152799") public void testAllAppsIntent() { // setup by moving to home mLauncher.goHome(); From 02a75fc9247c5401c8833188e5658d10ab67040b Mon Sep 17 00:00:00 2001 From: Shamali P Date: Thu, 14 Mar 2024 13:33:25 +0000 Subject: [PATCH 2/5] Distribute the padding between search&rec container and tabs/applist When there are no recommendations (pre-V as well), the margins/paddings between search container & apps list / tabs was 8dp extra. Additionally, cleaning up - 1. requestLayout call on page switch is now not needed after limiting the table space for recommendations in two pane picker. 2. After preview container sizes, TOP alignment actually looks a bit better - and widget preview itself is automatically center aligned as we club only same preview container sizes in a row now. * http://screen/6e6YzjqXJrdZ7Bt * http://screen/AVLpzoYSGpyr2rs * http://screen/7xnmrtLvBMPX5iX * http://screencast/cast/NjYyNzM4NDY3MjM4NzA3Mnw2NDY0MmU4ZC0xMw (phone) * http://screencast/cast/NTYwMzE1NDI1ODI5NjgzMnw2NmM1MjRkZS0zNA (fold) * http://screencast/cast/NTIzODk3NTM5MTMzNDQwMHxlYmE2NDEwNS0xZg (tablet) Bug: 319152349 Flag: N/A Test: Screenshot and manual Change-Id: I164419624d02fb47e80ea844eea0ee2a869ad4df --- res/layout/widgets_full_sheet_paged_view.xml | 3 ++- res/layout/widgets_full_sheet_recyclerview.xml | 3 ++- src/com/android/launcher3/widget/WidgetsBottomSheet.java | 4 +--- .../launcher3/widget/picker/WidgetRecommendationsView.java | 1 - .../widget/picker/WidgetsListTableViewHolderBinder.java | 4 +--- .../widget/picker/WidgetsRecommendationTableLayout.java | 4 +--- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/res/layout/widgets_full_sheet_paged_view.xml b/res/layout/widgets_full_sheet_paged_view.xml index 1d370435bf..8dc785af66 100644 --- a/res/layout/widgets_full_sheet_paged_view.xml +++ b/res/layout/widgets_full_sheet_paged_view.xml @@ -79,6 +79,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" android:background="@drawable/widgets_surface_background" android:orientation="vertical" android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin" @@ -92,7 +93,7 @@ android:layout_height="64dp" android:gravity="center_horizontal" android:orientation="horizontal" - android:paddingVertical="8dp" + android:paddingBottom="8dp" android:paddingHorizontal="@dimen/widget_list_horizontal_margin" android:background="?attr/widgetPickerPrimarySurfaceColor" style="@style/TextHeadline" diff --git a/res/layout/widgets_full_sheet_recyclerview.xml b/res/layout/widgets_full_sheet_recyclerview.xml index dca08ff572..5427732c4d 100644 --- a/res/layout/widgets_full_sheet_recyclerview.xml +++ b/res/layout/widgets_full_sheet_recyclerview.xml @@ -29,7 +29,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/collapse_handle" - android:paddingBottom="16dp" + android:paddingBottom="8dp" android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin" android:clipToOutline="true" android:orientation="vertical"> @@ -62,6 +62,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" android:background="@drawable/widgets_surface_background" android:orientation="vertical" android:visibility="gone"> diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java index ab1ad70c24..c347939d0a 100644 --- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java +++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java @@ -187,9 +187,7 @@ public class WidgetsBottomSheet extends BaseWidgetSheet { mWidgetCellHorizontalPadding) .forEach(row -> { TableRow tableRow = new TableRow(getContext()); - // Vertically center align items, so that even if they don't fill bounds, - // they can look organized when placed together in a row. - tableRow.setGravity(Gravity.CENTER_VERTICAL); + tableRow.setGravity(Gravity.TOP); row.forEach(widgetItem -> { WidgetCell widget = addItemCell(tableRow); widget.applyFromCellItem(widgetItem); diff --git a/src/com/android/launcher3/widget/picker/WidgetRecommendationsView.java b/src/com/android/launcher3/widget/picker/WidgetRecommendationsView.java index 811759dd85..3b661d0e11 100644 --- a/src/com/android/launcher3/widget/picker/WidgetRecommendationsView.java +++ b/src/com/android/launcher3/widget/picker/WidgetRecommendationsView.java @@ -182,7 +182,6 @@ public final class WidgetRecommendationsView extends PagedView widgetItems.size()) { diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java index 76b8401b7f..7a2b4efe5a 100644 --- a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java +++ b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java @@ -104,9 +104,7 @@ public final class WidgetsRecommendationTableLayout extends TableLayout { for (int i = 0; i < recommendationTable.size(); i++) { List widgetItems = recommendationTable.get(i); TableRow tableRow = new TableRow(getContext()); - // Vertically center align items, so that even if they don't fill bounds, they can - // look organized when placed together in a row. - tableRow.setGravity(Gravity.CENTER_VERTICAL); + tableRow.setGravity(Gravity.TOP); for (WidgetItem widgetItem : widgetItems) { WidgetCell widgetCell = addItemCell(tableRow); widgetCell.applyFromCellItem(widgetItem); From b41c826c6ac18dc66a5bdcb76d43e68a87474d11 Mon Sep 17 00:00:00 2001 From: fbaron Date: Wed, 13 Mar 2024 12:14:25 -0700 Subject: [PATCH 3/5] Fix bug where folder with 1 icon can exist Fix: 329357132 Flag: NONE Test: TaplDragTest Change-Id: If381ff56e051c89e9f6162f8a44f8df9e2ae5060 (cherry picked from commit 5645c3ec558e2b0b6d6ae1c51dbaf93803cd51cf) --- src/com/android/launcher3/folder/Folder.java | 3 +++ .../android/launcher3/dragging/TaplDragTest.java | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index ec9c27dfab..ecb5c8f186 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -1039,6 +1039,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo public void onDropCompleted(final View target, final DragObject d, final boolean success) { if (success) { + if (getItemCount() <= 1) { + mDeleteFolderOnDropCompleted = true; + } if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) { replaceFolderWithFinalItem(); } diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java index d1227d8693..bf1ba39fef 100644 --- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java +++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java @@ -96,6 +96,21 @@ public class TaplDragTest extends AbstractLauncherUiTest { MAPS_APP_NAME); } + /** + * Adds two icons to the Workspace and combines them into a folder, then makes sure we are able + * to remove an icon from the folder and that the folder ceases to exist since it only has one + * icon left. + */ + @Test + public void testDragOutOfFolder() { + final HomeAppIcon playStoreIcon = createShortcutIfNotExist(STORE_APP_NAME, 0, 1); + final HomeAppIcon photosIcon = createShortcutInCenterIfNotExist(PHOTOS_APP_NAME); + FolderIcon folderIcon = photosIcon.dragToIcon(playStoreIcon); + Folder folder = folderIcon.open(); + folder.getAppIcon(STORE_APP_NAME).internalDragToWorkspace(false, false); + assertNotNull(mLauncher.getWorkspace().tryGetWorkspaceAppIcon(STORE_APP_NAME)); + assertNotNull(mLauncher.getWorkspace().tryGetWorkspaceAppIcon(PHOTOS_APP_NAME)); + } /** Drags a shortcut from a long press menu into the workspace. * 1. Open all apps and wait for load complete. From d51f91a7d0243895606bf52e1cc6e8ec23da71ea Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 15 Mar 2024 10:15:29 -0700 Subject: [PATCH 4/5] Fixing PendingWidgets getting attached to real host Bug: 318539160 Flag: aconfig enable_workspace_inflation DISABLED Test: TaplBindWidgetTest#testPendingWidget_notRestored_activeInstall Change-Id: I013811e83b90ea32221904a27790dd677dd63b4b --- .../android/launcher3/widget/LauncherWidgetHolder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/widget/LauncherWidgetHolder.java b/src/com/android/launcher3/widget/LauncherWidgetHolder.java index 2fcf8c5d54..0fb4e097be 100644 --- a/src/com/android/launcher3/widget/LauncherWidgetHolder.java +++ b/src/com/android/launcher3/widget/LauncherWidgetHolder.java @@ -349,7 +349,13 @@ public class LauncherWidgetHolder { @NonNull public final AppWidgetHostView attachViewToHostAndGetAttachedView( @NonNull LauncherAppWidgetHostView view) { - if (mViews.get(view.getAppWidgetId()) != view) { + + // Binder can also inflate placeholder widgets in case of backup-restore. Skip + // attaching such widgets + boolean isRealWidget = ((view instanceof PendingAppWidgetHostView pw) + ? pw.isDeferredWidget() : true) + && view.getAppWidgetInfo() != null; + if (isRealWidget && mViews.get(view.getAppWidgetId()) != view) { view = recycleExistingView(view); mViews.put(view.getAppWidgetId(), view); } From cdc26951ff271d951a34d2cccbc0b7bda352606f Mon Sep 17 00:00:00 2001 From: Willie Koomson Date: Thu, 8 Feb 2024 19:16:07 +0000 Subject: [PATCH 5/5] Add tap-to-add button to widget picker This change introduces an "Add" button that appears when a widget preview is clicked in the widget picker. This button disappears when the preview is clicked again, or another preview is clicked. When the button is pressed, it adds that widget to the picker. The add button is available in the app-specific widget sheet as well. Bug: 323886237 Test: Manual Flag: ACONFIG com.android.launcher3.enable_widget_tap_to_add DEVELOPMENT Change-Id: I86a8a4c22119960c54a885fd2efeb91916b4f9a0 --- aconfig/launcher.aconfig | 7 ++ res/drawable/ic_plus.xml | 24 +++++ .../widget_cell_add_button_background.xml | 28 ++++++ res/layout/widget_cell_content.xml | 98 ++++++++++++------- res/values-night-v31/colors.xml | 4 + res/values-v31/colors.xml | 4 + res/values/attrs.xml | 2 + res/values/colors.xml | 4 + res/values/dimens.xml | 4 + res/values/strings.xml | 12 +++ res/values/styles.xml | 8 ++ .../launcher3/logging/StatsLogManager.java | 3 + .../launcher3/widget/BaseWidgetSheet.java | 47 ++++++++- .../android/launcher3/widget/WidgetCell.java | 87 +++++++++++++++- .../launcher3/widget/GeneratedPreviewTest.kt | 10 +- .../WidgetsListTableViewHolderBinderTest.java | 4 +- 16 files changed, 303 insertions(+), 43 deletions(-) create mode 100644 res/drawable/ic_plus.xml create mode 100644 res/drawable/widget_cell_add_button_background.xml diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index 4de1c960de..a724602e7b 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -215,3 +215,10 @@ flag { description: "Enables the Home gesture animation" bug: "308801666" } + +flag { + name: "enable_widget_tap_to_add" + namespace: "launcher" + description: "Enables an add button in the widget picker" + bug: "323886237" +} diff --git a/res/drawable/ic_plus.xml b/res/drawable/ic_plus.xml new file mode 100644 index 0000000000..3ab926aade --- /dev/null +++ b/res/drawable/ic_plus.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/res/drawable/widget_cell_add_button_background.xml b/res/drawable/widget_cell_add_button_background.xml new file mode 100644 index 0000000000..860d1cdd02 --- /dev/null +++ b/res/drawable/widget_cell_add_button_background.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/widget_cell_content.xml b/res/layout/widget_cell_content.xml index 0c606f6f8f..106c5b7d56 100644 --- a/res/layout/widget_cell_content.xml +++ b/res/layout/widget_cell_content.xml @@ -45,40 +45,70 @@ android:layout_margin="@dimen/profile_badge_margin"/> - - - - - + android:layout_height="wrap_content"> + + + - + + - \ No newline at end of file + + + +