Commit Graph

316 Commits

Author SHA1 Message Date
Andy Wickham
075c50e0c6 Merge "Doesn't scale PagedView snap speed during tests." into sc-v2-dev 2021-07-26 19:42:38 +00:00
Andy Wickham
da5a89b130 Doesn't scale PagedView snap speed during tests.
Settings.Global.getFloat causes a Binder
transaction which breaks BinderTests.java
when running it from Android Studio.

Test: BinderTests.java
Bug: 187428578
Change-Id: I07ce2fe256dba0bfa98a5dade538d68e7ce357ff
2021-07-23 23:08:46 +00:00
Thales Lima
e445774ab5 launcher: correct page spacing for multiple panels
This fixes 2 things:
- adding the correct space between pages as insets (eg camera) were
being discarded
- adding the space between pages instead of between panels as was before

This solution should work with more panels and don't create problems for
phones, where panels = 1.

Fixes 193194192
Test: manual testing in unfolded state in portrait and landscape, both
rotations

Change-Id: Ia3b148ceb773c6d5b6f8848ced07d7f9c1459e92
2021-07-22 09:41:43 +00:00
Andras Kloczl
77b3eb0acb Fix two panel accessibility issues
When two panel home was enabled in Launcher the items on
the left panel weren't able to get selected while on Talkback
because of an incorrect calculation in getScrollProgress.
Also the user was unable to jump to other workspaces by doing
simple one finger swipes because the page jump count was
only 1.

Test: manual
Bug: 174464170
Change-Id: I6cfe39b5059e8e7e7a32c9b0d372c658e796c3e8
2021-07-16 10:39:51 +02:00
Alex Chau
ba61b98fca Snap to relative position to snappd task when dismissing
- Calculate the diff to snapped page scroll and apply in onLayout, so tasks won't jump after dismiss when not in snapped position
- In grid, always keep the relateive snapped page unchanged to avoid jump

Bug: 188793333
Test: manual
Change-Id: Id11c2d700dc55440de39cc7409d06a712cedc9bc
2021-06-29 19:54:21 +01:00
Andras Kloczl
dbf577af46 Add left widget panel to Launcher home when unfolded
Test: manual
Bug: 175939730
Change-Id: I9831e7fa95084db12953ec7cb2eb725e7549e01d
2021-06-14 12:22:05 +02:00
Alex Chau
822acf4d25 Make quick switch track finger 1:1
- When calculating motion delta, it should consider the scale of pagedView
- Adjust significant threshold of tablet quick switch to 15% of page width (roughly 100dp)

Fixes: 188786242
Test: manual on quick switch
Change-Id: Idaa6c5b721decb573e97158c5fbcd67fa224f9d1
2021-06-03 18:07:52 +01:00
TreeHugger Robot
da91a85359 Merge "Revert "Add haptic feedback to Launcher recent apps scrolling"" into sc-dev am: f5af5ce11f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14793398

Change-Id: Ic5a7e1fc9f5ac07f84b10496b1f3ece2bf8e8b8f
2021-06-01 23:41:10 +00:00
TreeHugger Robot
f5af5ce11f Merge "Revert "Add haptic feedback to Launcher recent apps scrolling"" into sc-dev 2021-06-01 23:39:39 +00:00
Wale Ogunwale
0e25d2eba8 Revert "Add haptic feedback to Launcher recent apps scrolling"
This reverts commit b1ef5e5c55.

Reason for revert: b/182382085#comment4

Change-Id: I001944da64dc05324b14cc9dd3db5921faf8806c
Bug: 182382085
2021-06-01 22:10:18 +00:00
TreeHugger Robot
c3629c8e9c Merge "Cleanup state properly when interacting during gesture nav transition" into sc-dev am: b13200c6b1
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14735875

Change-Id: Icea54a23541cdd1791d9adc1c5dde67bbd6583c9
2021-06-01 21:31:25 +00:00
TreeHugger Robot
b13200c6b1 Merge "Cleanup state properly when interacting during gesture nav transition" into sc-dev 2021-06-01 21:02:29 +00:00
Tony Wickham
f8d731a808 Cleanup state properly when interacting during gesture nav transition
When the transition is canceled (e.g. when touching the nav bar during the transition), do the following:
- Abort the RecentsView scroll including the edge effects to ensure we get onSettledOnEndTarget() immediately.
- Jump to the current gesture end target state instead of the default rest state.

Test: Swipe up and to the left and hold to go to overview from an app, then swipe up to home during the transition; ensure that the touch down goes to overview rather than home, and subsequently that the swipe is respected and goes to home
Fixes: 189142339
Change-Id: Ie1d7dd05f45ab48968df7fdfd69fa1e1dda36d06
2021-05-26 15:28:38 -07:00
TreeHugger Robot
4daf838704 Merge "Add haptic feedback to Launcher recent apps scrolling" into sc-dev am: b1858afaf2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14678275

Change-Id: I99c4b7a85069a187db77d8dc51c6dee532a0681b
2021-05-26 18:21:58 +00:00
Lais Andrade
b1ef5e5c55 Add haptic feedback to Launcher recent apps scrolling
Add light LOW_TICK effects when the scrolling on RecentsView
snaps to a page, and a stronger TICK effect when the edges
absorb the scroll (by scrolling fast towards one of the edges).

Fix: 182382085
Test: manual
Change-Id: Ifb917ae499f73607707773f9870eb39cd6fe16ef
2021-05-26 13:37:30 +01:00
Andras Kloczl
55edfe55f7 Add two panel home support for page binding logic
There's a logic which prioritizes the binding for the
current page and defers the other pages' binding.
If two panel home is enabled, we want to bind both pages
together. LauncherPageRestoreHelper has been created to
contain the logic for persisting restoring and calculating
which pages to load immediately.

Test: manual + run LauncherPageRestoreHelperTest robo test
Bug: 174464691
Change-Id: I57ac3f7150303b95b272e922f44bda26f9d5ce2a
2021-05-24 23:22:06 +02:00
Winson Chung
76e27f6d5d Merge "End scroller if it has already reached the final position" into sc-dev 2021-05-11 21:52:45 +00:00
Winson Chung
8542541b2b End scroller if it has already reached the final position
- The system overscroller seems to take a long time to settle even
  after the final position has been reached, so if that has already
  happened and there is no edge effect, then just end the scroller.
- Remove unused code related to SmoothPageView

Bug: 184983443
Test: Quickswitch and ensure we finish the recents animation after it settles
Change-Id: I9fa72ddd6b6e0d38b6f622c776a2ac5f5b055760
2021-05-11 12:59:14 -07:00
András Klöczl
45e72a1ed3 Merge "Fix launcher navigation issue when using a controller" into sc-dev 2021-05-11 10:01:43 +00:00
Andras Kloczl
359d1aedae Fix launcher navigation issue when using a controller
When navigating in Launcher home using a controller,
the mCurrentPage variable isn't updated properly which
results in out of order navigation.

Test: manual
Before: http://shortn/_c8A8mKiplN
After: http://shortn/_ctxIaweqZY
Bug: 187205980
Change-Id: I9ff4019b608e999749c4d0835cc3ceb35be93a3f
2021-05-11 09:52:24 +02:00
Sunny Goyal
5996937798 Removing Launcher dependency from Folders
This allows opening/closing folders without a Launcher context

Bug: 187353581
Test: Manual
Change-Id: Id73a40445a23004eb554f0422d286aa0ff6b3c41
2021-05-10 14:01:43 -07:00
Sunny Goyal
b745a2a9fd Fixing transition end not getting called if pagedView is not drawing
Bug: 186822776
Test: Manual
Change-Id: I60e9028d17f39a4ad95f9aa79f8b4be695b4ae65
2021-04-30 13:38:59 -07:00
Sunny Goyal
05b59c080f Calling pageTransisionEnd only after edgeEffect finishes
Bug: 186605795
Test: Presubmit
Change-Id: I2b46d0b0a47c68038f300e71ab89bd7e5a5e3895
2021-04-29 13:56:08 -07:00
Sunny Goyal
c39db7321f New spring overscroll in pagedView
> Using EdgeEffect in PagedView for overscroll
> Keeping RecentsView overscroll similar to S, by created a custom EdgeEffect

Bug: 183966408
Test: Manual
Change-Id: Ia547cf14ea315468b12a4ff5f389ac2d2beceafa
2021-04-22 16:28:30 -07:00
Andras Kloczl
7a1ca0b299 Launcher home currentpage refactoring
Calling cancelLongPress on all the visible pages when needed
and enabling hardware acceleration on them when a folder
animation is in progress.

Test: manual
Bug: 174464691
Change-Id: Ib11265abfd184fed41acc9a6347a32aec12895f2
2021-04-09 11:22:14 +02:00
Alex Chau
b5c4d1108f Changes page alignment in PagedView calcualtion
- Align pages to right (instead of left) in RTL, to make scroll calculation for grid overview easier for out of orientation tasks
- Changed TaskView pivot direction to be consistent with page alignment
- Add scroll offset for ClearAllButton to align to left in RTL
- Fixed Workspace scroll issues in RTL, and removed needs to use panelCount when calculating page scroll

Bug: 175939487
Test: Test carousel/grid overveiw, Workspace, Folder scroll view for normal/RTL
Change-Id: Ic0ba88e5d58638e1149d97a68a978d80fbf26774
2021-03-30 12:05:16 +01:00
Alex Chau
dedbc8ac36 Remove grid scaling in Overveiw
- Grid scaling has problem that scales task icon and menu, which makes it hard to control icon size and text size in the manula
- Replaced the whole concept with dedicated Task size calculation in grid layout
- Support different icon size in TaskView in grid and removed task_thumbnail_top_margin
- Removed grid progress in TaskViewSimulator as well
- Refactored how ClearAllButton scroll and translations are calcualted to align clear all properly in grid
- Make page center calculation aware of PagedView pivot and scaling

Bug: 174464863
Test: Manual on two screens
Change-Id: I47b13ef6e55c6e16c52ea04225f5bde02ed82fc2
2021-03-24 18:46:32 +00:00
Andras Kloczl
a4cb0f02de Fix staggered animation on right panel home screen
Recently we have added support for multiple panels
on the home screen but the current StaggeredWorkspaceAnim
logic only supports animation for the leftmost panel.

Test: manual
Bug: 183032642
Change-Id: I539e1c1a26292b75801eb3070e22f0fbde1ebc7e
2021-03-24 12:37:22 +01:00
Andras Kloczl
2bb5134413 Fix widget scrolling issue on right panel
Since we added support for multiple panels on the home screen,
we need to call cancelLongPress on all the visible pages not
just on the leftmost visible page.

Test: manual
Bug: 178582378
Change-Id: I88ded543a16b1bbf2a53a627e5725f68b42e742b
2021-03-22 17:39:06 +01:00
Andras Kloczl
8e57cce4ee Two panel & two page swipe & currentPage fixes
- Pagespacing set to 0 to have similar design to figma
- Added padding to left side of left panel and right side of right panel to match figma
- getPageScrolls changed to support two page scrolling
- validateNewPage changed so that only even indexed pages can be switched to
- getPageWidthSize added for measurements, it returns half screen width when two panel is active
- onMeasure changed to use getPageWidthSize
- panelCount has been increased from 1 to 2 when two panel is active
- add feature flag for two panel home
- shouldConsumeTouch changed so not only currentpage is checked but currentpage+1 screen as well
- add one more extra check for setDropLayoutForDragObject for currentpage + 2, next to right panel
- using new grid option for two panel home screen

Test: manual
Bug: 174464115
Change-Id: I1bad7eecc67f65fb833608744a5aa5aca65373b4
2021-03-17 12:19:02 +01:00
Steven Ng
ae6b34811b WidgetCell & LiveWidgetPreview cleanup
The fixes are:
1. For widgets shown in TableRow, aligns them center vertically.
   This is useful when widgets of different height are shown in
   the same row.
2. Remove background color from WidgetCell
3. Re-enable swipe in FullWidgetsSheet
4. Use the WidgetCell image as the single & long press area because
   1. Previews are now scaled to their default size. The touch area
      should already be larger for widgets that are bigger than 2.4
      cells
   2. WidgetCells also render description. If the user long press the
      description area, the drag view will not align in the middle of
      the user touch / drag area.

Test: Drag-n-drop widgets from FullWidgetsSheet, BottomWidgetsSheet
      and pin widget flow.
      In FullWidgetsSheet, swipe left and right to switch work /
      personal tab.

Video: https://drive.google.com/file/d/1Ur7PwF1a7iwGGRTZczfc0BSVu-Ta6-Vm/view?usp=sharing

Bug: 179797520
Change-Id: I6fe4bc88d1e1b35b1819d8d7f046105f5ed27043
2021-03-08 21:22:08 +00:00
Alex Chau
b794ea64c7 Show TaskView as grid in large screens
- Introduced gridProgress to RecentsView/TaskView ofr animating into grid
- Introduced gridProgress dependant translation and scale properties in TaskView
- Animate running task into grid with TaskViewSimulator
- Remove overview actions (for now) but keep clear all button in large screens
- Adjust ClearAllButton translation to acoomodate for grid
- Use screen width +-50% to calculate task visibility
- Use the position where TaskView is on screenEnd as pageScroll
- TODO: Handle separate recents activity

Doc: go/foldables-launcher-overview
Video: http://dr/file/d/107Aydii1LoFCwP63nWG3Twr2PBDE5ZgD/view?resourcekey=0-aUjdnx8ezimS9tmAgao9ag
Test: Test Launchering overview and launching overview from apps with folloiwng combination:
- large / small screen sizes
- portrait / landscape
- thumbnails from different screen sizes / orientations
Bug: 174464863
Fixes: 181509346

Change-Id: I4b691cde774f2e37532b68ba83c6eed399f2332e
2021-03-02 17:10:45 +00:00
Steven Ng
391404fcb7 Add personal / work tabs for work profile widgets
Video: https://drive.google.com/file/d/1TORRNcvVM7fIvNd_WZaajLbI7D9z4VFA/view?usp=sharing


Test: Main profile only: run AddConfigWidgetTest.
      With work profile: manually launch the full widgets sheet.
      Go to the personal tab: only personal widgets are shown.
      Go to the work tab: only work widgets are shown
      Successfully add personal / work widgets from the full widgets
      sheet.

Bug: 179797520

Change-Id: Iad8b90c2af35e0580319d7a05510ec88e4f8b86c
2021-02-22 16:10:09 +00:00
Alex Chau
7944ee5c79 Enable variable size thumbnail for large screen
- Introduced a feature flag
- Refresh TaskView size when thumbnail is refreshed or Recents resizes
- Disable edge scale down in large screens
- Added temp method to get task width/height ratio
- In fullscreen, scale down TaskThumbnailView and disable TaskView elevation
- Task boxing mechanism: http://screen/3NkePthAVUVH2Rv.png

Bug: 174464656
Test: Manually test overview and quickswitch for folded and unfolded, including with RTL.
Change-Id: I2ce24d588a246cc6a2408039a37d884021aa0800
2021-02-08 19:40:49 +00:00
Sunny Goyal
eaf7a95546 Changing minimum supported Launcher version to 26
Change-Id: I49fcf874430ac53c3246371e179fbd828e14e4da
2020-07-29 17:30:19 -07:00
Tony Wickham
7383d4e6d2 Fix adjacent task offset distance
Instead of calculating an overall distance for tasks to translate
based on RecentsView width, calculate the distance for the tasks
to the left and right of the midpoint based on how far the first
adjacent tasks in those directions are from being offscreen.

Changes made to make "distance to offscreen" calculations possible:
- Update TaskView curve scale to reach final scale as soon as it is
  completely offscreen. Before, it would reach its final scale just
  shy of that point (calculations were off).
- As we update RecentsView scale, calculate how much the new scale
  will push out tasks that are just offscreen.
- With both above, we can calculate the scale and position of a
  TaskView such that it is just offscreen, and interpolate
  between its current position and that position.

Tests:
- Task comes in immediately when quick switching from home, and
  doesn't shift as you swipe directly upwards.
- When swiping far up from an app, tasks come in from all the way
  offscreen, and cover distance appropriately (e.g. if you're
  scrolled a bit to the right when you pause, the left adjacent
  app will move faster to cover the farther distance).
- Task modalness: entering Select mode now animates adjacent tasks
  at the same rate as the scaling up, because they move only the
  distance needed to get offscreen (before they moved way too far
  and thus seemed to be much faster than the rest of the animation).

Bug: 149934536
Change-Id: Ie3fffe0e5c304cb16e7637f058f5ce72cee40aeb
2020-07-29 20:05:29 +00:00
Winson Chung
4941f65d52 Tweak quickswitch thresholds
- Reduce slop for gestural mode (and apply multiplier to slop
  at checktime)
- When quickswitch threshold is passed, reduce the total movement
  check and reduce the velocity needed to fling to the next page
  to accommodate short swipes
- Use touch slop to determine scrolling in paged view, and only
  use paging slop to determine flinging to the next page (when
  easy flings are disabled (which is the default))

Bug: 157165240
Test: Ensure the flings in normal overview/paged views don't change,
      check short flings from quickswitching
Change-Id: Idd04ce23f53c06759e84ac8ad73cf2cc6dff6975
2020-06-20 19:41:32 -07:00
Vinit Nayak
93bf1fe1f0 Validate pointer index in PagedView#onMotionEvent
Fixes: 157400422
Change-Id: I556e2e05323ec7f0a47a8a8e3321b8196ee77bcc
2020-05-26 17:22:13 -07:00
Tony Wickham
eb885026ed Fix spring overscroll when there's a min scroll
Test: clear app recent apps, open Calculator, open Clock,
quick switch to Calculator and see no jump

Bug: 154815348
Change-Id: I6289d43efe5d850cb2fd807d15115c5ce38c16dd
2020-04-30 23:27:39 -05:00
Sreyas
63dd9e0b33 Removing old unused code from PageView
Change-Id: I12da53189ddbb2484149d384d5ef20a4aa0535e5
2020-04-27 14:08:56 -07:00
Jon Miranda
57dab6fa29 Let spring take over the overscroll amount when swiping to first/last page.
Bug: 153747836
Change-Id: I8a883f648587b0cb4008df3b8176c9341162b8d1
2020-04-11 10:25:28 -07:00
Jon Miranda
f52af437b2 Fix bug where it is hard to swipe to work profile tab.
Bug: 151739025
Change-Id: I1ba731b4c5ce3a8d88fb14cc4dea2e2410538e6f
2020-04-10 17:25:57 -07:00
Sunny Goyal
acd17dfc18 Removing some new object creation during touch handling
> Motion various transformation methods to Orientation Handler
> Moving orientation handler to quickstep package

Bug: 150300347
Bug: 151269990
Bug: 149610456
Change-Id: I28434c1d1f62a3b85f3583740f0a8f827513fab3
2020-04-07 00:27:16 -07:00
Sunny Goyal
8b37c57804 Fixing widget sheet not scrolled using external mouse
> Fixing crash when some properties are not initialized if draw is not called
> Adding robolectic support for UI testing
> Adding robo tests to verify workspace, all-apps, widgets and folder scrolling

Bug: 147312357
Change-Id: Id7756e07f06396359e441cdff2e4f992bdcb97bb
2020-03-31 12:17:09 -07:00
Tony Wickham
62117d7b8c Don't start task from quickswitch until scrolling finishes
Before, we did this by extending the window/launcher animation to
match the scroller duration. But now that we are using springs to
control the scroller, that duration is not really accurate. So
instead, we now let the window/launcher move at its own pace, and
wait for both that animation and the scroller to finish before
calling onSettledOnEndTarget().

Bug: 147302669
Change-Id: I37a9dd3eea17ebe663c33c3a4478b1b53a63dcc2
2020-03-27 20:56:25 -07:00
Vinit Nayak
b9ec9319c5 Add fixed_rotation_transform to home settings
This sets the feature flag on launcher side
and also updates the setting in Settings.Global
Launcher DOES NOT listen to the Settings.Global
change from adb anymore. This should take
preference over setting it from command line.

Also fix a related swipe to home animation bug
that happened w/ merge conflict.

Fixes: 150260456
Test: Set and unset, visually verified behavior.
Tested w/ autorotate on and off.
Checked Settings.Global value correctly updated
via "adb shell settings get global
fixed_rotation_transform"
TODO: Update tests to reflect this new
default-on fixed rotation behavior.

Change-Id: Id95f006eb1e92a59e24b05567298fd21b1409b13
2020-03-11 19:38:33 -07:00
Jon Miranda
9e19866ed8 Only allow horizontal spring if page will change.
Bug: 150876921
Change-Id: I88db4c28ec3f8213c583e8a0dcd1cce2b1fee322
2020-03-11 14:53:42 -07:00
Vinit Nayak
5fcf061cb9 Set default launcher orientation to portrait
Also stop OrientationTouchTransformer from
spamming logs
b/150214193 should track properly handling
this in the future

Fixes: 146176182
Test: New vertical layout showed up when
swiping to Overview w/ landscape app.
Works for both autorotate on and off.

Change-Id: I3707cf7b5693be0fcf4d63491901f4ec00793f4f
2020-03-03 16:54:08 -08:00
Vinit Nayak
a406f727ad Add vertical layout support for Overview in portrait
WM is making changes which allows apps to maintain
their orientation independent of the orientation of
the foreground app. This allows recents to always start
in portrait even when the app currently running is in
landscape. This means we have to give the illusion of
a landscape oriented overview when user swipes up in
gesterual nav when launcher is started in portrait
configuration.

PagedOrientationHandler abstracts all coordinate specific
logic from Paged/RecentsView primarily, but also all
other dynamic calculations throughout launcher.
PagedViewOrientationState is the single point of exposure
to other classes that depend on those changes. The goal
is to also minimize holding state to allow for default
implementations of PagedOrientationHandler for all the
3p/Fallback classes. PagedViewOrientationState also
holds other data around rotation that isn't
specifically tied to view logic.

The fake landscape overview can be toggled with:
adb shell settings put global forced_rotation [0/1]

Fixes: 146176182
Change-Id: I65d8d4e9f92b93931cbe0053ccaf0cda8d2ffd6c
2020-03-02 18:02:35 -08:00
TreeHugger Robot
6e82910a45 Merge "Give current TaskView accessibility focus" into ub-launcher3-master 2020-02-20 01:16:42 +00:00