Commit Graph

308 Commits

Author SHA1 Message Date
Sunny Goyal
277ef4868c Removing disabled color extractor from Widgets
Bug: 266941872
Flag: None
Test: Presubmit (removed dead code)
Change-Id: Ie45cf08c694652266af6c95dab0eac5b9dd138f6
2024-04-26 15:46:04 -07:00
Sunny Goyal
638a687fc8 Converting IconShape to mainThreadInitializedObject instead of
keeping it a process static

Bug: 297950111
Flag: None
Test: Presubmit
Change-Id: Id66100e0cb300659c6017c287eb38ab04290477b
2024-04-25 15:56:30 -07:00
Charlie Anderson
79b8ed0b9e Do not set click listener for CellLayout during accessible drag, to prevent double tap to activate message.
This is because there is no click action for CellLayout during accessible drag, as only the individual cells need to be clickable.

Bug: 318312177
Test: locally
Flag: N/A
Change-Id: I26f18a948b77a0ee889dfafa626b9176d8481aeb
2024-02-22 12:27:52 -05:00
Sebastian Franco
2986e0b4d1 Removing the Worskapce as a dependency of CellLayout
This will make it easier to test CellLayout, also we should avoid
circular dependencies as much as poisble.

This also allows the CellLayout to be created in other containers
that are not workspace.

Bug: 318417510
Test: creating HotseatReorderUnitTest in follow up cl
Test: TaplReorderWidgets
Test: ReorderAlgorithmUnitTest
Flag: NA
Change-Id: Ic45029a244cb11f8d6775c50b90af9c56f01eaa3
2024-01-26 09:28:57 -08:00
Sebastian Franco
f7654252b1 Moving ReorderPreviewAnimation into it's own file and rewrite to Kotlin.
This will make it easier to write unit testing.

Fix: 294473336
Test: manual testing
Flag: NA
Change-Id: I2d6cfd8110c5c2ef09c49150a0bd071bc948995c
2024-01-24 14:04:48 -08:00
Sebastian Franco
e2910d84ee Making sure the reorder animation goes back to the initial position.
The animation ReorderPreviewAnimation handles two animations, one when
the mode is MODE_HINT and the other MODE_PREVIEW. The animation is
basically the same but MODE_PREVIEW ocilates to finalDelta and back
to initDelta. MODE_HINT stays in finalDelta. When finish, we have to
go back to the initial position.

This behaviour is currently done using logic, making sure the view stays
in finalDelta no matter the value of the animation, the bug is in this
logic. I think is better to do this with the current animation API by
setting setRepeatCount to 0 on the HINT case and reverting the animation
when finish so it goes back to the initial position.

This seems to have been there for a long time, at least since the
creating of git_main, but it became more aparent now. In a follow up cl
I will move this class to it's own file and into kotlin to help if there
are issues here again.

Fix: 294473336
Test: manual testing
Flag: NA
Change-Id: I4ac5de3ce8a8170944a072c6ce41c65d0963a780
2024-01-23 15:33:49 -08:00
Charlie Anderson
4612239a61 Fixes bug where app suggestions incorrectly calculate available space when bottom row is full
Bug: 318417510
Flag: N/A
Test: manually tested toggling app suggestions with the bottom row filled / not filled
Change-Id: I25461aefa8db93a1c2548604c0ea15c9a12ae688
2024-01-19 13:07:11 -05:00
Sebastian Franco
25f8e406a7 Adding ReorderParameters to ReorderAlgorithm
No logic change made.

Flag: NA
Bug: 229292911
Test: ReorderAlgorithmUnitTest
Change-Id: Iababd2fba688a482cffe6d2243c987b0c022c6a5
2023-12-03 22:39:50 -06:00
Sebastian Franco
dcf6bf2311 Moving the remainder of reorder logic to ReorderAlgorithm
This is a no-op thoroughly tested by ReorderAlgorithmUnitTest.

Flag: NA
Bug: 229292911
Test: ReorderAlgorithmUnitTest
Change-Id: I7203444df289cd3b67794fc570a2cd46e64549a2
2023-12-01 12:50:13 -06:00
Sebastian Franco
a7ff1558c9 Move logic only used on the reorder from the cellLayout to ReorderAlgorithm
This is a no-op thoroughly tested by ReorderAlgorithmUnitTest.

Flag: NA
Bug: 229292911
Test: ReorderAlgorithmUnitTest
Change-Id: I9909477274aadbbf928c9fdeb4157d697c4c7175
2023-11-30 11:14:57 -06:00
Sebastián Franco
61fbd18e5d Revert^2 "Moving rearrangementExists to ReorderLogic since it's only used there"
This reverts commit 484a7ea4f3.

Reason for revert: Fixing build error 

Change-Id: I00dcbb831dc40a90d43ada7315969251413bb88b
2023-11-29 21:54:51 +00:00
Greg Kaiser
484a7ea4f3 Revert "Moving rearrangementExists to ReorderLogic since it's only used there"
This reverts commit 6890893a24.

Reason for revert: Many build breaks, like https://android-build.corp.google.com/artifact/submitted/11157014/mokey_go32-trunk_staging-userdebug/latest/view/logs%2Fbuild_error.log , seem related to this.

Change-Id: I049c94fbd1e089c65fd4e0abb4ac2c165f228c92
2023-11-29 20:26:47 +00:00
Sebastian Franco
6890893a24 Moving rearrangementExists to ReorderLogic since it's only used there
Also, simplify copyCurrentStateToSolution since it always gets false
as the second parameter.

Flag: NA
Bug: 229292911
Test: ReorderAlgorithmUnitTest
Change-Id: I025566897246fa59ca513cb7de9a12465054498f
2023-11-27 16:36:44 -06:00
Sebastian Franco
5f0af4f633 Moving classes inside of CellLayout to their own file
This is a no-op change ensure this we have ReorderAlgorithmUnitTest.

Flag: NA
Bug: 229292911
Test: ReorderAlgorithmUnitTest
Change-Id: I6ffe2a1260f869a4686a9f1e652dd1ab6d406269
2023-11-23 23:13:56 +00:00
Sebastian Franco
5c8f86815c Modify getViewsIntersectingRegion to returns rects instead of view since we don't use the views after only the rects.
Intermidiate step for b/270395274

Bug: 270395275
Flag: NA
Test: ReorderAlgorithmUnitTest
Test: atest ReorderWidgets
Change-Id: I505372ccd61e954de19852427abe0b54fc06aa57
2023-11-16 10:32:51 -06:00
Sebastian Franco
9ea36d429c Adding animation so the CellLayout is properly spaced on Foldables
Flag: LEGACY FOLDABLE_SINGLE_PAGE DISABLED
Fix: 294841331
Test: atest HomeScreenEditStateImageTest
Change-Id: I5dc94b63ca322748b952ce4bd55b6951d51d190f
2023-10-20 13:59:40 -07:00
Sebastian Franco
0dd5db84e4 Cleaning up some and removing unused calculations code in CellLayout
Using cellToRect and removing some calculation that where unnecesary
because the variable are later overwritten.

Fix: 194414754
Bug: 294841331
Test: ImageTest
Change-Id: I31e0527cbbea463a32a36a172185a41985ed0d57
2023-10-13 18:24:41 +00:00
Pat Manning
d0f729d13c Do not clip scaled Launcher icons on hover.
Include change for setting the hover state flag programatically, as FastBitmapDrawable does not currently support DeviceConfig flags.

Fix: 243191650
Test: FastBitmapDrawableTest. Screenshot tests in another cl.
Flag: ENABLE_CURSOR_HOVER_STATES
Change-Id: I0eb796ae62e571a3287132bfcb99c4fca1e2fbe4
2023-08-23 08:45:43 +00:00
Schneider Victor-tulias
750c5af2da Fix flaky RuntimeException in CellLayout.
Changing the grid while a previous loader is running (more likely to happen in test) can cause a saved item info to have a cell position outside the bounds of the new grid. This should just be handled the same way as other item infos being loaded in an occupied space.

Flag: not needed
Fixes: 233989158
Test: changed grid sizes multiple times
Change-Id: Ibba337c224e7a08533331a87b1369ebf96e3c9a3
2023-07-26 10:20:24 -07: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
Kateryna Ivanova
7120373bbc Migrate Interpolators from Launcher3 to the public animation library
Test: atest
Bug: 271850966
Change-Id: Iba999f2e753764a37d35e508e707df02388432e9
2023-05-30 07:20:38 +00:00
Treehugger Robot
7b01dbd811 Merge "Add seam space for performReorder in MultipageCellLayout" into udc-dev 2023-05-18 23:20:40 +00:00
Sebastian Franco
96c46e7fba Add seam space for performReorder in MultipageCellLayout
In the other method createAreaForResize we add 1 to the cellX
to account for the seam in the Multipace CellLayout but we don't
account for that on performReorder and we need to add a cellWidth

Also, some methods are not running when the seam is added so their
result are wrong. Now all methods are being accounted for.

Fix: 277709417
Test: atest ReorderAlgorithm
Test: atest MulticellReorderAlgorithm
Change-Id: I7a4ca55f7b9cd7cf94481c880fe152e0a3bb3cf3
2023-05-18 14:47:47 -07:00
Charlie Anderson
438d405aab Adding a new Edit Mode LauncherState
- Edit Mode doesn't close after dragging / dropping an app
	- Edit Mode can be entered through options popup menu, Spring Loaded still entered by dragging items
	- Adds new onLeavingState call to launcher states to cleanup changes

Bug: 279590398
Flag: MULTI_SELECT_EDIT_MODE
Test: manually tested the new state with flag on/off

Change-Id: If4550037f9659dcb8cd8b1943388d1ec5d55fa29
2023-05-12 14:54:45 -04:00
Sebastian Franco
45b39b50e5 Adding unit test to ReorderAlgorithm
Adding 100 different test cases for the ReorderAlgorithm.
The test cases are randomly generated using generateRandomTestCase()
the boards are generated once and then written in the file
reorder_algorithm_test_cases. I will leave the code to generate
the boards in the Test even though is not used anymore in case
we need to generate more boards later on.

Also, I found that the ReorderAlgorithm was not deterministic,
meaning that it could generate two different results with the same
inputs (views positions and view being drag positions), because
it was traversing a map whose has was the object id which is
random. So I sort the views before traversing them.

Bug: 229292911
Test: atest ReorderAlgorithmUnitTestCase

Change-Id: I196eb8f1dafcb57d5259969268c458129ae4f46b
2023-05-03 11:22:09 -06:00
fbaron
e74256bba8 Remove unused code for old mult select design
We previously made a few CL's guarded under flags for the multi select feature. We ended up having to halt progress on this, and now that we're starting again, the design is different and we are using a new flag. Here we get rid of the unused code and flags

Bug: 277617038
Test: Verify everything still works normally, everything was guarded under flags that were off so there shouldn't be any changes
Change-Id: I2f57d1f67aa2a8cf83287f6f3df9fa6c46dbf0ab
2023-04-10 14:55:41 -07:00
Sebastián Franco
2a40823a78 Merge "Fixing test that fail when FOLDABLE_SINGLE_PAGE is set to true" into udc-dev 2023-03-21 22:32:42 +00:00
Sebastian Franco
25423867af Fixing test that fail when FOLDABLE_SINGLE_PAGE is set to true
We need to change the result of REQUEST_IS_TWO_PANELS when the
flag is on because now we don't have two panels only 1.

Another of the issues is a rounding error when calling
getUnusedHorizontalSpace().

And lastly updating workspaceToBoards so that it maps the coordinate
of workspace items to their right position.

Bug: 270395274
Test: atest ReorderWidgets
Change-Id: I2620e5bf1ba132f984e00d2a6c21081953d259fd
2023-03-20 17:06:20 +00:00
Tony Wickham
ec6fd6ffb5 Update folder leave-behind color for taskbar
Test: open folder in light theme and dark theme
Fixes: 265828742
Change-Id: Ib544ab85dad16c203917ae02f924650e8a5bbc6f
2023-03-16 18:13:20 +00:00
Sebastián Franco
90ff89e2b9 Merge "Decoupling the reorder logic from the CellLayout view" into tm-qpr-dev 2023-03-07 00:24:33 +00:00
Sebastian Franco
e4c0345747 Decoupling the reorder logic from the CellLayout view
ReorderAlgorithm will now handle all the logic associated with the
reorder. Basically all the logic associated with a reorder in CellLayout
was copy and pasted into ReorderAlgorithm.java.

Test: atest TestReorderAlgorithm
Bug: 229292911
Change-Id: Ie096abc346bf705414e47452a42d1dec5be0a041
2023-03-03 16:57:02 -08:00
Sunny Goyal
82dfc15037 Simplifying code around multiple translation components
Bug: 270759683
Test: Verified on device
Change-Id: I6c758c715828ae25e0e3c60b793cf85d70cb2487
2023-03-02 12:22:03 -08:00
Sebastian Franco
09589326db Simulating a split screen CellLayout using one CellLayout
Test: atest ReorderWidget
Fix: 188081026
Change-Id: I8eda5f77c11dc2625ae1f028d07539c28018fb55
2023-02-07 17:03:22 -08:00
Sunny Goyal
669b71f5b3 Introducing CellPosMapper which allows mapping between UI position
and model position

Test: atest CellPosMapperTest
Bug: 188081026
Change-Id: If5c6b3df5ad240317bb535c675f6ead94084238e
2023-01-30 12:17:09 -08:00
Sebastian Franco
877088e6c3 Change the access of cellX/Y of CellLayoutLayoutParams to private
Bug: 188081026
Test: no op change, should compile
Test: ReorderWidgets
Change-Id: I20367974e5a4cead406e18eb66dafd4d59651b2a
Merged-In: I20367974e5a4cead406e18eb66dafd4d59651b2a
2023-01-13 18:25:10 +00:00
Sebastian Franco
5aa71cee20 Clean mPreviousSolution on change of CellLayout target
The previous reorder solution is not peropperly cleaned and
that leads to wrong solution being used. For example when
longpressing an icon, it triggers a drag but the drag never
finishes.

Fix: 261122618
Test: You can no longer overlap a shortcut in the same app icon (see attached bug)
Test: atest ReorderWidget

Change-Id: Iff8651926cc4179561761c7ce0ac5007f13fc9af
2022-12-14 15:20:50 -06:00
Sebastian Franco
2ceb3b5088 Adding screen ID parameter in CellLayoutLayoutParams
Bug: 188081026
Test: launcher compiles, this test doesn't change existing logic only the model
Change-Id: I7bcf6452d5ecb9b50914defc311ad06839220c92
2022-12-02 13:40:34 -08:00
TreeHugger Robot
691c6e511f Merge changes from topic "revert-20479526-revert-20427045-258023561-BPDASTWITO-FBDWZBDEFC" into tm-qpr-dev
* changes:
  Fixing the revert by not continuing the reorder if the solution is null.
  Revert "Revert "Reorder widgets no longer overlaps when no space..."
2022-11-22 21:18:42 +00:00
Sebastian Franco
9c74327e13 Fixing the revert by not continuing the reorder if the solution is null.
Fix: 258023561
Bug: 259234533
Test: atest testAddDeleteShortcutOnHotseat
Change-Id: I63a2abf8a80e16fb45f4bbb3b2de413ef77b5e0c
2022-11-15 15:13:23 -08:00
Sebastián Franco
f9a6ac241a Revert "Revert "Reorder widgets no longer overlaps when no space..."
Revert "Revert "Reorder widgets no longer overlaps when no space..."

Revert submission 20479526-revert-20427045-258023561-BPDASTWITO

Reason for revert: Fix the issue that caused the first revert.
Reverted Changes:
Icecfd1d34:Revert "Reorder widgets no longer overlaps when no...
I4cc552588:Revert "Reorder widgets no longer overlaps when no...

Change-Id: I47c4cde42c19f50e2834660d843a8e2ae571c03c
2022-11-15 22:56:41 +00:00
Sam Dubey
3d24f6735a Merge "Revert "Reorder widgets no longer overlaps when no space is avai..."" into tm-qpr-dev 2022-11-15 14:28:11 +00:00
Sam Dubey
3dad4fec9f Revert "Reorder widgets no longer overlaps when no space is avai..."
Revert "Reorder widgets no longer overlaps when no space is avai..."

Revert submission 20427045-258023561

Reason for revert: Likely causing NPE while running launcher shortcut tests (Part of DM+Platinum monitor rotation. The revert won't be submitted if proven otherwise)

Bug: 259234533
Reverted Changes:
Ie599f7cb7:Reorder widgets no longer overlaps when no space i...
I04b262ecc:Reorder widgets no longer overlaps when no space i...

Change-Id: I4cc552588c8099356bc3f05c4c63d17a524f2a24
2022-11-15 13:24:19 +00:00
TreeHugger Robot
e2334d76fe Merge "Reorder widgets no longer overlaps when no space is available" into tm-qpr-dev 2022-11-15 09:53:02 +00:00
Sebastian Franco
893615f241 Reorder widgets no longer overlaps when no space is available
In the previous refactor I got confused between findNearestVacantArea
and findNearestArea thinking the later did the former. So it ignored the occupied spaces and treat it as a solution.

Changed the names to prevent further confusion.

Fix: 258023561
Test: manual, need to add this case to ReorderWidgets
Change-Id: I04b262ecce168d5c93a9d66ef62d5b0e148e38b6
2022-11-08 19:02:15 +00:00
Alex Chau
1feadf7d81 Merge "Improve spaces for folders" into tm-qpr-dev 2022-11-08 16:51:50 +00:00
Thales Lima
b35faed6e7 Improve spaces for folders
Bug: 214582832
Test: DeviceProfileTest
Change-Id: I7c5cae0792d51baf111d0aec46be302ac6ca9994
2022-11-07 18:23:48 +00:00
Sebastián Franco
fda1f3c379 Merge "Making code more readable by removing global variable used for optimizations" into tm-qpr-dev 2022-11-04 17:46:22 +00:00
Sebastián Franco
c3cefebab4 Merge "Ensure that the reorder preview and what gets submited uses the same solution." into tm-qpr-dev 2022-11-04 17:45:28 +00:00
Sebastian Franco
5d990eedfd Ensure that the reorder preview and what gets submited uses the same solution.
Design doc: https://docs.google.com/document/d/1RsId9OFGgkcImkkmDwWZBBvITWnGlxKVqniE3cimkqY/edit#heading=h.xzptrog8pyxf

As can be seen in the diagram in b/256770363 on every reorder the
first call in the process is MODE_SHOW_REORDER_HINT so if we make
sure that only then a solution is calculated and we reuse that
solution in the rest of the calls in the same reorder then we would
have more consistency and the animation will always be the same and
the logic state.

Fix: 256770363
Bug: 188081026
Test: atest ReorderWidgets
Change-Id: I93a1d09f5b8cbfbc461043ee3fc41b1cab294fed
2022-11-03 14:11:01 -07:00
Sebastian Franco
4a92267d1d Making code more readable by removing global variable used for optimizations
Using the stack was more efficient because it prevented the creation
of new rectangles but it makes the code harder to read and prone to
bugs if the global state of the stack of rectangles gets corrupted
in any way.

When this optimization was written in 2008 it was necessary but now I
don't think it would have a big impact. The stack size is on average
of 30 and the rectangles are only created when doing the reorder which
runs about once per second if the user moves the finger too quickly.

Bug: 188081026
Test: atest ReorderWidgets
Change-Id: I35d8ee8d92f01035e72fe5763a7de47f4b6a73de
2022-11-02 22:10:14 +00:00