Commit Graph

16 Commits

Author SHA1 Message Date
Jordan Silva
2de6a277b7 Update responsive grid spec cell size remainderSpace logic
Refactoring the cellSize spec of responsive grid to divide the remainder space in code instead of dividing by cols/rows in the spec definition. For example, instead of using 0.2 in the spec for 5x5 grid (1 / number of rows), it is going to use 1 (100% of the remainder space) and divide the percentage by the number of cols or rows in code.

Fix: 313621277
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: NexusLauncherImageTests
Test: CalculatedWorkspaceSpecTest
Test: DeviceProfileDumpTest
Test: DeviceProfileAlternativeDisplaysDumpTest
Change-Id: Ifaec838ac9751562ecedc1fe39b966ee3d092de3
2024-01-08 19:40:01 -03:00
Jordan Silva
ce396d8abf Fix crash when restoring data from phone to tablet with responsive grid
This issue happens when restoring the data from a phone to a tablet or vice-versa. When Launcher is restoring the data, it allows the device to load a disabled or invalid grid temporarly for the migration. This leads to a crash when the responsive grid is enabled.
The hotseat spec has only WIDTH or HEIGHT specs in a certain posture. When the user restores the data from a phone to a tablet, the Launcher loads a handheld spec that doesn't have HEIGHT specs for the hotseat in landscape (spec_handheld_hotseat_[grid].xml). However, the tablet, in landscape, tries to retrieve the hotseat HEIGHT spec.

It also prevent crash when responsive grid is used with multi window mode. isVerticalBarLayout becomes false. Then, the responsive grid tries to load a hotseat spec that doesn't exist (using DimensionType.HEIGHT). Phones have hotseat specs only for DimensionType.WIDTH.

Bug: 315548992
Fix: 315069300
Fix: 315377544
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: v2/android-crystalball-eng/health/microbench/systemui/main/systemui-notification-3-jank-suite
Test: atest CtsWindowManagerDeviceDisplay:android.server.wm.display.MultiDisplaySystemDecorationTests#testSendPrimaryHomeIntentActivityOnDisplayWithDecorations -- --abi x86_64
Change-Id: Ibd6537e0528868da9a1b7672c43b5455fa6a8184
2023-12-12 10:46:22 +00:00
Jordan Silva
4c09958671 Validate responsive specs using more than 100% of remainder space
Fix: 313463517
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: ResponsiveSpecsProviderTest
Change-Id: Ic80846d27dabd8d57f43b35581174bd2f2f3611b
2023-11-28 15:11:27 +00:00
Jordan Silva
999dd2a06f Extract cell size information to responsive grid structure
Bug: 287975993
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: ResponsiveCellSpecsProviderTest
Test: DeviceProfileDumpTest
Test: DeviceProfileResponsiveDumpTest
Change-Id: I26a87d9b690fdfcff1599d862c09e97fe9f9f930
2023-11-24 12:39:36 +00:00
Jordan Silva
8f7986abae Responsive grid cleanup
This CL renames some of the variables to keep it consistent across the code. It removes workarounds that were made to facilitate easy code reviews without breaking the tests.
It is a cleanup of the responsive grid feature.

Bug: 299889733
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: CalculatedAllAppsSpecTest
Test: CalculatedFolderSpecTest
Test: CalculatedHotseatSpecTest
Test: CalculatedWorkspaceSpecTest
Test: AllAppsSpecsTest
Test: FolderSpecTest
Test: HotseatSpecsTest
Test: WorkspaceSpecsTest
Change-Id: I198fadfbcfc0d1b32a62a3076949b42ee1fbcf33
2023-11-09 22:06:03 +00:00
Jordan Silva
376036a36e Resize icon and text size for AllApps when it doesn't fit the cell
Bug: 287975993
Fix: 309489796
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: DeviceProfileDumpTest
Test: DeviceProfileResponsiveDumpTest
Test: ResponsiveHomeScreenImageTest
Test: ResponsiveFolderImageTest
Test: ResponsiveAllAppsImageTest
Change-Id: I1dda073b558a7f4540d5fe5c438fa796a70b6ddd
2023-11-08 18:05:59 +00:00
Jordan Silva
f2402e25f1 Refactoring Responsive Grid XML specs for more flexibility
It merges portrait and landscape XML specs for responsive grid. This update allows the responsive grid to rely on other properties like aspect ratio and not solely the orientation from resource qualifiers.

Bug: 299889733
Flag: ACONFIG com.android.launcher3.enable_responsive_workspace TEAMFOOD
Test: CalculatedAllAppsSpecTest
Test: CalculatedFolderSpecTest
Test: CalculatedHotseatSpecTest
Test: CalculatedWorkspaceSpecTest
Test: AllAppsSpecsTest
Test: FolderSpecTest
Test: HotseatSpecsTest
Test: WorkspaceSpecsTest
Change-Id: I39ee54d49c9d2a54fcbe91c8a1327a21a8126032
2023-11-07 11:51:28 +00:00
Jordan Silva
e4d7aaa6fd Fix to prevent unsorted breakpoints returning wrong spec
It orders the breakpoint list to guarantee that the smallest breakpoint is always returned for a given availableWidth or availableHeight.

Fix: 301396419
Flag: ENABLE_RESPONSIVE_WORKSPACE
Test: CalculatedWorkspaceSpecTest
Change-Id: Ia545e84150027bd8daa8d0dde58ff6fc579c3b6a
2023-09-21 11:44:56 +01:00
Thales Lima
8e11d531e8 Add new attribute to hotseat specs
Edge padding is used as the space between hotseat and the edge of the screen. In most cases it is used in a height spec, but for vertical bar, i.e. when a handheld is in landscape, it is used a width spec.

Fix: 292204436
Test: CalculatedHotseatSpecTest
Test: HotseatSpecsTest
Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest
Test: DeviceProfileResponsiveDumpTest
Flag: ENABLE_RESPONSIVE_WORKSPACE
Change-Id: Ib75ffcdd33925ee9ef156dcb70eefd133c9b458b
2023-09-05 16:31:06 +01:00
Thales Lima
f8bfb036ba Create specs for hotseat
Some attributes of hotseat change depending on the size of the device. In the future more attributes could be moved to the spec, e.g. hotseat icons.

Fix: 292204436
Test: CalculatedHotseatSpecTest
Test: HotseatSpecsTest
Test: SizeSpecTest
Test: DeviceProfileResponsiveDumpTest
Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest
Flag: ENABLE_RESPONSIVE_WORKSPACE
Change-Id: I6a4e05d75af819dbf1444a5ca45c2080f55dc203
2023-08-10 10:23:23 +00:00
Jordan Silva
8bd7af2b3f Improving responsive grid xml parser
Refactors AllAppsSpecs, FolderSpecs and WorkspaceSpecs initialization to use the same code to parse the xml with different map function. This CL improves the readability of the code and remove code duplication.

Fix: 286538013
Flag: ENABLE_RESPONSIVE_WORKSPACE
Test: AllAppsSpecsTes
Test: CalculatedAllAppsSpecTest
Test: CalculatedFolderSpecsTest
Test: CalculatedWorkspaceSpecTest
Test: FolderSpecsTest
Test: WorkspaceSpecsTest
Test: DeviceProfileResponsiveDumpTest
Test: DeviceProfileResponsiveAlternativeDisplaysDumpTest
Change-Id: Iec5863619399efd2e80f3db46b75c4d785e1656f
2023-07-18 18:03:16 +01:00
Jordan Silva
637f4eb2f3 Update DeviceProfile to calculate responsive grid for folders
It uses the new responsive folder calculations and specs when responsive grid is enabled. The grid has to have folderSpecsId defined to use the new specifications, otherwise it will use the current scalable grid implementation.

Fix: 284155638
Test: DeviceProfileDumpTest
Test: ResponsiveHomeScreenFolderImageTest
Test: HomeScreenFolderImageTest
Flag: ENABLE_RESPONSIVE_WORKSPACE
Change-Id: I535cff4bb00e969f782447a898230fe2b2c05cc9
2023-06-21 12:18:58 +01:00
Thales Lima
196e44baec Create AllApps responsive spec
Copy the parser from WorkspaceSpec and modify to use AllApps attributes.

Bug: 284152932
Test: AllAppsSpecsTest
Test: CalculatedAllAppsSpecTest
Flag: ENABLE_RESPONSIVE_WORKSPACE
Change-Id: I9362e126c64cb1a1abdef61894b003f14701b8e3
2023-06-14 15:02:58 +01:00
Jordan Silva
1b336110a4 Update SizeSpec attributes to accept max size threshold
Add maxSize attribute to SizeSpec to limit the cell size up to a max size when matchWorkspace is true. The same validation was added when using fixedSize, ofAvailableSpace and ofRemainderSpace, so they could have a maxSize as a threshold.

Bug: 284155638
Flag: ENABLE_RESPONSIVE_WORKSPACE
Test: SizeSpecTest
Test: WorkspaceSpecsTest
Change-Id: I113657c241e6618eb3e501243412d8c5626fc3d5
2023-06-13 18:09:37 +01:00
Jordan Silva
7ae9e3a6f5 Add FolderSpec for responsive grid support
Adds responsive grid implementation for folders. It follows the same concept as WorkspaceSpecs, so we have a parser similar to WorkspaceSpecs for FolderSpecs.

Bug: 284155638
Flag: ENABLE_RESPONSIVE_WORKSPACE
Test: FolderSpecsTest
Test: CalculatedFolderSpecsTest
Change-Id: Iea6d7d88ef42d1273aed7cf2ed5b397035518a52
2023-06-13 15:01:39 +01:00
Jordan Silva
2b8556ce1a Adding match workspace to SizeSpec for responsive grid support
Added matchWorkspace property to support responsive grid implementation for AllApps and Folders. This property indicates whether the attribute value will be used from the workspace instead of defining a fixed value in the AllApps and Folders XML. The class was updated to be a data class and added a auxiliar constructor new make it more flexible for testing and to add other initializers to support AllApps and Folders.

Bug: 284155638
Flag: ENABLE_RESPONSIVE_WORKSPACE
Test: WorkspaceSpecsTest
Test: SizeSpecTest
Change-Id: I65b71e66be7b8236a1dee62b56a487b87881d991
2023-06-09 17:05:22 +00:00