Commit Graph

288 Commits

Author SHA1 Message Date
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
Zak Cohen
3eeb41de9a Rename flag IS_DOGFOOD to IS_STUDIO.
The flag is only set when building from Android Studio... and is never
used for dogfood.

Test: local
Change-Id: I898d585f4558c2437f0152ef102bea59c351f80b
2020-02-14 14:19:59 -08:00
Tony Wickham
619daaf82a Give current TaskView accessibility focus
Send TYPE_VIEW_FOCUSED in the following places:
- When page transition ends on a task
- When finishing state transition to overview
- When un-hiding the current running task view

Bug: 145647019
Change-Id: I7bb357ea60e1dea79daf2ad50efa51071e064da8
2020-02-07 12:38:34 -08:00
Sreyas
e3e7e63902 OverviewActions: Fix action buttons in place
Forcing OverviewActions buttons to appear as if it is shown only once in overview screen by overlapping all instances in the same spot.

Change-Id: I195d5455d5eb9f12a19c352169bc995849e59281
2020-02-04 14:25:14 -08:00
Sunny Goyal
a7a5bf3101 Adding support for multiple Model clients
Bug: 137568159
Change-Id: Ia4db800b19cc80c695fcb9ea28e07709dfd08c6a
2020-01-10 12:23:27 -08:00
Tony Wickham
af33f2c9d4 Fix quickswitch flickers/ignored swipes
- Don't set current page to running task when applying load plan,
  if we are already settling on a new task to launch.
- When starting a new task, finish to the running app if that's
  the task being started (should not happen with above change)
- When disabling free scroll mode, don't snap to a page if we're
  already on it. This was setting mNextPage so the first check
  was falsing.

Bug: 142068081
Change-Id: I5b392d9726a81c51718d2f94eee6cd4f78b61f69
2019-10-07 21:08:04 +00:00
Pinyao Ting
ea38c25854 removed extra test protocol for unit test
Bug: 140406263
Test: run TaplTestsLauncher3
Change-Id: I73b3098bd3aa92fed41d22a94cb58fd07263d26a
2019-09-30 18:34:49 +00:00
Pinyao Ting
7752023c08 fix test for a11y change in supporting -1 page
Bug: 140406263
Change-Id: I0a39db135a5e5b0fe570ace55a368a7f4b6cb453
Test: run TaplTestLauncher3 locally
2019-09-23 13:06:36 -07:00
Pinyao Ting
af6daa2873 Revert "Revert "support scroll backward to minus one screen via voice/switch access""
This reverts commit 3ad4ace203.

Reason for revert: roll forward and bugfixes

Change-Id: Icd56cdeddb3baf9819700cc567c04af0905825ef
2019-09-23 12:56:11 -07:00
Tony Wickham
c9c88ee0f1 Update mIsBeingDragged in onTouchEvent(ACTION_DOWN)
am: a0aee21fcd

Change-Id: I4e0b6c7e057421d7501f84f8c8e3544eab2b15de
2019-09-18 12:22:12 -07:00
Tony Wickham
a0aee21fcd Update mIsBeingDragged in onTouchEvent(ACTION_DOWN)
The logic to keep mIsBeingDragged when touching down during a scroll
animation was in onInterceptTouchEvent(), which we were bypassing by
using onTouchEvent() directly. Now we update mIsBeingDragged on touch
down in both onInterceptTouchEvent() and in onTouchEvent().

Bug: 141024521
Change-Id: I77abd4c36f3ccee27e160c817dadb3923e6cfc06
2019-09-18 11:04:37 -07:00
Pinyao Ting
3ad4ace203 Revert "support scroll backward to minus one screen via voice/switch access"
This reverts commit d5af944f41.

Reason for revert: Test failure on master that might be related to this code change.

Change-Id: I269bf5b0a6505da291e1ff4ed181a851268d6ed8
2019-09-17 16:58:07 +00:00
Pinyao Ting
d5af944f41 support scroll backward to minus one screen via voice/switch access
Bug: 140406263
Test: Manual
Change-Id: I604b12f8ba8706cbabc28acafd6c151166832f22
2019-09-16 14:21:49 -07:00
Samuel Fufa
9fd21056c7 App shortcut overlapping app icon when selecting the app using USB mouse
Test: Manual
Bug:113287687
Change-Id: Ib02c736a312937a9b71d5168d965446b6fc5b7b7
2019-08-28 17:58:14 -07:00
Samuel Fufa
59cba191c3 Mouse wheel scroll apps with work profile enabled instead of switching tabs
Test: Manual
Bug:79164903
Change-Id: I4b382034ea5b91b24dcc158bd9fa46d64f54cc7a
2019-08-23 11:20:29 -07:00
yingleiw
02cc848896 Add directional accessibility page actions to PagedView
For PagedView, when isPageOrderFlipped is true, it means the LTR mode is
flipped. For the "recents" in launcher, isPageOrderFlipped is true.
However, this doesn't affect the directional page operations since
scrollLeft()/Right() already has correct Rtl considerations. See
b/78788182 for more information on the LTR mode.

Test: Tested with the "recents" in launcher. Verified that page left
action always move pages to the right (so that the next page from the
left side shows), and page right actions always move pages to the left
(so that the next page from the right side shows). Also tested with the
home screen 1/2, 2/2 paging.
Bug: 136277517

Change-Id: I965d651c37d258eaa8ea347d1ad6f698f9b590bf
2019-08-14 18:05:08 +00:00
Tony Wickham
b6841ac630 Revert the changes that prevented touch on RecentsView during animation
The original bug that was solving seems to be fixed by other changes,
and this allows users to scroll, dismiss, etc on recent tasks before
fully reaching overview from an app.

Bug: 137487381
Change-Id: I28a708811bba3ce739ce261f19eb29558d8f0e7d
2019-07-22 12:39:59 -07:00
vadimt
4d93df51a3 Switching flinging gestures injection to model time
This is a right thing to do in any case.

Change-Id: I34eeecac6d9eb13130eb1015f9a9a5e2a32974ec
2019-07-10 17:38:26 -07:00
Adam Cohen
ab6be31746 Fix issue where can't interact with Workspace while App => Home is running
=> Regression from recent CL ag/8074890
=> Fix which scopes the change down to the RecentsView, but not all PagedViews

Bug 136733573

Change-Id: I0abaa61b2b132d8086dc3b2cb3e3e9c1f181b5f5
2019-07-06 04:27:49 +00:00
Sunny Goyal
c4bb3739b1 Cleaning up some animation states:
> When running one-off animations during quickstep, cancelling prevoisly
  running animations.
> Cancelling such one-off animations when state is reset
> Preventing touch proxied from recent transition to affect quickswitch
  (by affecting pagedView)

Bug: 135686388
Bug: 135571566
Change-Id: Id647015a583761d8fd46a02e3e2d88027e282a79
2019-06-21 12:47:56 -07:00
Tony Wickham
312209b01a Set mNextPage after springBack when overscrolling
Bug: 134609899
Change-Id: I74294655689c4ccd66896550b74e205d1c3df543
2019-06-18 15:55:21 -07:00
Winson Chung
0e44900863 Continue gestures on interaction after recents animation finishes
- Detect when start of the next task is interrupted with another gesture
  (after finishing the recents animation but before the next task is
  launched), and ensure that the next gesture is continued with another
  other activity input consumer (but without actual remote animation
  targets)

Bug: 128376812
Test: Introduce artificial delay in recents animation finish, try to quick
      switch quickly

Change-Id: I057a0b2c4b7e8636467e37f5bbc8800b46c24345
2019-05-06 10:17:49 -07:00
Sunny Goyal
2acea9f872 Enabling quick-switch gesture in landscape mode (2 button UI)
Bug: 130689544
Change-Id: I6b424be4d80b3bf8263f456a024a81c63100030e
2019-04-29 14:33:56 -07:00
Tony Wickham
03f27013bf Log undo button click
Also fix a bug where we logged workspace swipe upon clicking undo, since
rebinding the pages causes us to reset mCurrentPage = 0 followed by
setCurrentPage(pageBoundFirst). Since the page isn't actually visibly
changing, we shouldn't log in that case.

Bug: 118758133
Change-Id: Ie87164a8c7c278680f67dee75657210bd33408a4
2019-04-25 14:22:54 -07:00
Tony Wickham
66d1c2fada Hide Clear all button during quick switch
- Add support for mMinScrollX to PagedView
- Add RECENTS_CLEAR_ALL_BUTTON as a state-specified visible element
- In BackgroundAppState, set Clear all invisible and bound RecentsView
  scroll to the last task

Test:
- Open an app, quick switch until reaching the end, ensure Clear all
  does not show up and an overscroll effect is performed
- Enter overview, scroll to the end and ensure Clear all shows up
- Same tests in RTL and 3rd party launcher

Bug: 130160876
Change-Id: I5fb958744d0055b83ced1f8b0d7face0e06a0cc5
2019-04-24 17:09:34 -07:00
Tony Wickham
44a58888c7 Remove PagedView#isTouchPointInViewportWithBuffer()
It's no longer necessary, and causes issues when trying to scroll
a PagedView that only takes up the bottom half of the screen (e.g.
RecentsView in split screen mode).

Bug: 126606858
Change-Id: I117dfe9416cdeef1247d6e783390cf5c391e8254
2019-04-09 14:27:51 -07:00
Winson Chung
1942d5a54a Fix issue with flashing on overscroll
- Apply the bounded current scroll to the overscroll instead of assuming
  the max scroll (on the last tick, the overscroll amount can be zero,
  causing us to shift to the max scroll until the next draw)

Bug: 126767319
Change-Id: Ia60ecb0c3f18e68d0c91620aa79b21df72c213cf
2019-03-01 13:32:32 -08:00
Winson Chung
1de3c5078c Fix small issue with overscroll not being dampened on the left edge.
Change-Id: I113425e6bae2ff6f6f143526a7e06363fb8d4320
2019-02-25 18:56:21 +00:00
Sunny Goyal
4bb8b06ef3 Passing all events to RecentsView instead of passing the calculated velocity
Velocity tracker is able to calculate the velocity using cached copy of motionEvent
as long as the event as correct timeStamp

Change-Id: I2b0f612e010fdfcf144d5bed928c5a96b36f3ac7
2019-02-20 13:45:27 -08:00