Commit Graph

61 Commits

Author SHA1 Message Date
MrSluffy
c41eb8ac8f Fixed app shortcut widget
- closes : #5101
- closes : #5056
- closes : #5055
2024-12-26 10:48:38 +08:00
Shamali P
7a183e4051 Adjust previews in a row to align with each other and remove whitespace.
- Introduces a WidgetTableRow that identifies preview height for all of
its children while keeping them aligned with minimum whitespace
- The fullSheet's move / change animations can conflict with the resize
so, we wait for them before performing resize of the row.

Bug: 335715046
Test: Manual
Flag: NONE BUGFIX
Change-Id: Id843430c7adfc228c219ba54d504baddba792df0
2024-06-03 18:07:30 +00:00
Winson Chung
bb32b7e0de Migrate PackageManagerHelper to MainThreadInitializedObject
- This is in preparation for other things that can be loaded with
  PMH initialization and prevents duplicate temporary helpers from
  loading this many times.
- Most calls in PMH can use the app context, but one call requires
  starting activities/showing toasts so that one needs to take the
  context and can be made static instead.

Bug: 323112914
Test: atest NexusLauncherTests
Change-Id: Id11c780955880cf49c022cbf2744c41e1b696355
2024-04-22 12:35:03 +00:00
Shamali Patwa
7e5ed568b9 Revert "When getting a widget provider by name, check all categories"
This reverts commit 1f69351310.

Reason for revert: Testing odd behavior between google app and pixel weather and duplicate items issue

Change-Id: If181aa3e86969e8821b7e1cc765c3801f04489d2
2024-04-18 18:16:38 +00:00
Sebastian Franco
1f69351310 When getting a widget provider by name, check all categories
Some widgets have different categories for special cases for Pixel
widgets and because of that, some times we can't find the provider,
so we need to go through all of the categories.

Flag: NA
Test: Manaul testing =(
Test: All widgets in widget_section.xml with alsoKeepInApp set to false will previously dissapear on the preview.
Fix: 331628371
Change-Id: Iffbb788cbb27c79a215d06d21c9d623462d6f7e6
2024-04-15 19:21:21 -07:00
Sunny Goyal
11117d9b2a Using resource override instead of code-swap for ApiWrapper
Bug: 330920490
Flag: None
Test: Presubmit
Change-Id: Iac19f32e64d2c76ed5b4f8592943ee4ae7af51b5
2024-04-09 11:14:44 -07:00
Schneider Victor-tulias
18821d1c1f Add debug logs to ActivityTracker
Flag: N/A
Bug: 274280837
Test: checked logs during gestures and 3-button, and dumped Launcher logs
Change-Id: Icbb1edb0e59fa9cce9364e39823a664cda4ebf1b
2024-03-25 13:48:44 -04:00
Sunny Goyal
c1d1e68a82 Removing some unused overrides in Launcher
> Changing AddItemActivity to use RemoteAnimation directly
  to avoidTransitionManager override

Bug: 273828110
Test: Manual
Flag: N/A
Change-Id: I49777e7eeba00319476b0a239bc1cdac37833457
2023-08-11 12:31:49 -07:00
Sunny Goyal
2185f6f420 Loading widget description on the background thread
Bug: 281074741
Test: Varified on device
Flag: N/A
Change-Id: I6b9b13e712534bdc582b98dbfb7bdfcc40d2f19d
2023-05-05 23:15:41 +00:00
Sihua Ma
04c89fe38e Merge "Add QuickstepWidgetHolder for widget handling" into tm-qpr-dev 2022-12-19 18:22:38 +00:00
Sihua Ma
1db8bc2467 Add QuickstepWidgetHolder for widget handling
Fix: 235358918
Test: Manual
1. Rebooted the device and verified that widgets are still updating properly
2. Changed the theme from dark to daylight, then from daylight back to dark and verified that widgets are working
3. Kept the device on for several days and verified that widgets are still updating
4. Turn on auto-rotate for the launcher, open any app then exit, verified that widgets will not vanish and reappear
5. Add & remove widgets from the screen, added widgets are still updating

Change-Id: I98ee902f7d16b47bd77626201a4fefc897ba17a0
2022-12-16 11:56:36 -08:00
Sihua Ma
8820a2181b Replace title of system services with more specific ones
Before: https://screenshot.googleplex.com/8f5tGuw8c8zi6nX
Now: https://screenshot.googleplex.com/4SXGMoiZmYJ3auF

Fix: 258307358
Test: Manual
Change-Id: I549cbdbb99f0168c87cc1c122cad9aceb3231591
2022-12-01 14:37:47 -08:00
Sihua Ma
8bbfcb6581 Move LauncherWidgetHolder to widget package
Making LauncherAppWidgetHost package-private as well

Bug: 235358918
Test: N/A
Change-Id: If022ec8d429579a972991872b2dc11db76719341
2022-11-16 14:31:14 -08:00
Sihua Ma
aa2b872d1c Move most of the functions in LauncherAppWidgetHost to LauncherWidgetHolder
Test: N/A
Bug: 235358918
Change-Id: I343419376491203a195154f2766b12e5def38879
2022-11-16 14:30:08 -08:00
Sunny Goyal
bb5ebb7f2d Updating the title of the Add to homescreen prompt to the requesting app
instead of the Launcher name

Bug: 239055068
Test: Verified on device
Change-Id: I1494d911565ddf3a598f9fbf372b8d784a4276e4
2022-09-16 15:54:53 -07:00
Sunny Goyal
ed2a55f413 Removing widget preview caching
> All previews are generated on demand when the corresponding
  header expands
> Using ItemAnimator to animate layout changes when preview loads

Bug: 196238313
Test: Manual
Change-Id: I0cb859c8443c2c536399e4063f58baecfc7416ad
2021-08-17 17:50:30 -07:00
Steven Ng
2b90d043f6 Fix scaling on widget previews that have width / height set to
wrap_content

If the widget preview has width / height set to wrap_content, we should
set the layout param width / height to the exact dimension after
measurement. Otherwise, we will end up clipping the previews.

Test: manual
Fix: 193144010
Change-Id: I101f7c6d3dbd264fee448b85c54029d5650d6630
2021-07-22 11:19:25 +01:00
Steven Ng
2b123833ad Scale RemoteViews from requestPinAppWidget shown in AddItemActivity
Test: manual
Bug: 193144010

Change-Id: Ia2b64c32f92a43a8d71ee82f164543e1e624814a
2021-07-15 17:59:45 +01:00
Steven Ng
372e85106d Merge "Fix shortcut size calcuation" into sc-dev 2021-07-13 13:59:41 +00:00
Steven Ng
6fe115b2ae Fix shortcut size calcuation
Shortcut size should be the size of all apps icon + padding

Test: Check shortcuts and widgets are shown without crash in the
      following surfaces with display & font set to largest and
      display cutout enabled. Repeat the same test with normal
      display setting and no cutout.
      1. Full widgets picker
      2. Bottom widgets picker
      3. Pin widget dialog
Fix: 193422438
Change-Id: Ibfebf94e92eed5e9cd1dd4196d98823b0e4dda6b
2021-07-13 12:46:31 +01:00
Alina Zaidi
dfa2752d28 Add accessibility announcement when user clicks on 'Add automatically to
home screen' button

Test: Tested manually with talkback on
Bug: 192808036
Bug: 192811245
Change-Id: I1c02738e0e4755b3bbdde12dad96ac2ed1996e6c
2021-07-12 15:37:13 +01:00
Yogisha Dixit
658c5dafd4 Log widgets source.
Test: manual
(1) Upgrading to new DB version is successful (no errors thrown in logcat)
(2) Widgets that were added with the old DB version have CONTAINER_UNKNOWN as their source container
(3) Widgets that are added with the new DB version still log source container after reboot
Bug: 185778648
Change-Id: Iaa38f0be6bc4cb0d29842f9a2ea0d08de000c930
2021-06-30 17:48:14 +00:00
Winson Chung
1b369c4763 Merge "Don't rely on intent to call back from activity tracker" into sc-dev 2021-06-15 18:04:52 +00:00
Alina Zaidi
dfa6aa828c Update bottom widget picker and pin widget dialog layout in landscape mode.
Bug: 189726613
Test: Manually tested
Change-Id: I048740f949571423ab53bbb01e7128d9981b1ce7
2021-06-15 14:27:57 +01:00
Winson Chung
1c2d522d1b Don't rely on intent to call back from activity tracker
- The intent is not updated in certain cases which means that the
  callback may not be made if Launcher gets recreated. Instead
  have the tracker manage the set of registered callbacks.
- This change allows AbsSwipeUpHandler to continue to receive
  onActivityInit calls even if Launcher restarts, and also to
  handle a case where restarting while waiting for a page-settling
  callback will continue to finish the gesture.

Bug: 183962705
Test: Force recreate at various points in the gesture

Change-Id: Ib5ead8c868e798e26e56776f57bd715c79d087cd
2021-06-14 20:57:40 -07:00
Alina Zaidi
8796707172 Update scrim in widget pickers.
Also adjust padding in pin widget bottom sheet.

Test: Tested manually
Bug: 189802334
Change-Id: Ic25547ab1519139afdbf07aaefeb9168cf3501ff
2021-06-02 20:39:28 +01:00
Alina Zaidi
d80cec62b4 Modify pin widget dialog open-close animation.
Pin widget sheet should open from bottom up and close on drag down.
Behaviour with navigation bar is similar to that of widgets bottom sheet.

Add a drag layer and reuse AbstractSlideInView for open-close
animation.

Test: Tested manually- opening, closing through dragging/ cancel button/
back button. Adding widget to screen by dragging/ add to home screen
button.
Bug: 186124244

Change-Id: I4b77d5bdd4ed1689b651847dfed69d19cafa7456
2021-05-14 17:59:50 +01:00
Sunny Goyal
19ff728b92 Adding support for determining split layout for launcher.
> Simulating the windo wmanager API to get available device
  profiles until final API
> When a device has multiple internal displays, and with both
  tablet and phone possibilities, it uses a split workspace layout

Bug: 186160341
Bug: 175782275
Test: Manual
Change-Id: Ieff2329acac7cdd6b9abe6f96cd459cd45bd0efe
2021-05-03 14:48:28 -07:00
Steven Ng
e973d6f31f Render RemoteViews in LauncherAppWidgetHostView
Test: Pin a conversation widget from a notification. RemoteViews are
      rendered with the default size. Drag-n-drop from the pin widget
      dialog works fine.
Bug: 185934141

Change-Id: Idb76cce2807e55e7b42e2e044712519857beb202
2021-04-21 15:43:51 +01:00
Steven Ng
ca24216cc1 Fix drag-n-drop from the pin widget flow
Bug: 185011050
Test: Add a shortcut from Google drive app.

Change-Id: Iec5911a60cbb3ffa96228707539222cc1a5fda90
2021-04-13 15:42:12 +01:00
Alina Zaidi
6d97d893e0 Update Pin widget dialog UI according to mocks.
Test: Tested manually and RequestPinItemTest passed
Bug: 182982143
Bug: 182994819
Bug: 182929673
Change-Id: I905ea0c1860d28ee9fbb456ddf6abd728b65bac4
2021-03-23 13:36:48 +00:00
Steven Ng
0226d1ad79 Replace DragView bitmap with drawable
This is a preliminary work for local color extraction. In order to
apply local colors extracted from wallpaper to AppWidgetHostView
during drag, we need to hold a reference of the dragging
AppWidgetHostView.

In this CL, the following changes are made:
1. Instead of using bitmap image directly for icons, folders, shortcuts,
   legacy widget drawable preview, a BitmapDrawable wrapper is
    introduced.
2. Introduce a WidgetHostViewDraggableDrawable which draws
   LauncherAppWidgetHostView directly to canvas. No more bitmap
   generation overhead.
3. Remove drag outline from the drag logic because this will be replaced
   by a new grid color hint UI: https://screenshot.googleplex.com/7jBEVeuxFecFKKT.png

Test: Add: add widgets, shortcuts from widgets tray.
           add icons from all apps.
           create folder.
      Drag: drag existing widgets, shortcuts, folders and icons around

Bug: 182282587
Change-Id: Ia45ff756ea5bb80cf0761f0727a9453d50c204c0
2021-03-16 00:02:38 +00: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
Yogisha Dixit
741fae9ea2 Move widget files into widget folder + add tests.
I will use the newly created LauncherAppWidgetProviderInfoTest in a follow-up CL to add tests for the newly added widget sizing APIs.

Test: Automatic: Ran all robolectric tests in launcher3,
      Manual: Added a widget, edited the widget, removed the widget
Bug: 179807199
Change-Id: I540b2dbe284c6eb5aa2466a1d13a9581ee59425b
2021-03-01 13:59:52 +00:00
Sunny Goyal
58804ac525 Adding stats log for add item flow
Bug: 169385783
Bug: 168167693
Change-Id: I37395f1b118727f67e0f14c02f945b8213b165c8
2020-10-02 10:47:31 -07:00
Hyunyoung Song
95786e077d Good riddance UserEventDispatcher
Bug: 165675920
Bug: 161381246

TL;DR;;
- nano -> lite proto
- add all the missing logs to WW
- pin item related logging fix
- Removed logging for assistant

sgrep "com.android.launcher3.userevent.nano." | cut -f1 -d: | xargs sed -i -e 's/userevent\.nano\./userevent\./g'

Change-Id: Ie2a49fdd891cacbd7ef40a1dc9e41ff0574c7517
2020-09-27 13:41:49 -07:00
Sunny Goyal
60e68c91e9 Removing static state management from the install shortcut queue
Change-Id: I0b74a843b2081ee314e0840d5ea8ab8ddabde32b
2020-08-12 14:37:15 -07:00
Tony Wickham
73ff6ddeac Remove mPendingCallback from ActivityTracker
Instead, all callers should use EXTRA_SCHEDULER_CALLBACK, set via
addToIntent(), to provide a callback for the next handleIntent().
The updated runCallbackWhenActivityExists() will do that for the
caller if the activity doesn't already exist (otherwise it will
run the callback synchronously as before).

Bug: 151389129
Change-Id: Idbec264354fd6de166ff3bae98249230078d5674
2020-04-15 18:48:39 -05:00
Sunny Goyal
337c81f664 Removing static instances of UserManagerCompat and AppWidgetManager
> Changing the lifecycle to follow other static objects in Launcher
> Removing compat interface and inlining everything to helpers

Bug: 141376165
Change-Id: I82bd5db1969101de9a7eac77f32728d70195bb35
2019-12-11 10:03:19 -08:00
Sunny Goyal
e7b00128c7 Removing static instance of LauncherAppsCompat and unnecessary wrapper classes
Bug: 141376165
Change-Id: I8c1f1ab7d83ec50fe9c7bf39960ef9c360025ec7
2019-10-02 16:20:22 -07:00
Sunny Goyal
e84c5b82be Unifying activity tracker callback
> Using a common class for both Launcher and RecentsActivity
> Removing static refenrece to LauncherModel and using a common pattern for
  tracking activities

Bug: 141376165
Bug: 137568159
Change-Id: Ic1897abe6913ec78e25725118eedf5b468d5ec70
2019-10-01 13:54:26 -07:00
Sunny Goyal
6fe3eec95c Moving various common executors to a single location
Change-Id: I44bca49b8adb6fa22c3b48d10f674e42c28d792c
2019-08-20 14:36:17 -07:00
Sunny Goyal
9eb96c5811 Fixing multi-window DnD getting cancelled when starting a new activity in the middle
Bug: 133472746
Change-Id: I868f2bc5f1db4a7fa22df212122317bfef27a282
2019-07-29 11:27:56 -07:00
Sunny Goyal
6bbf6004f8 Removing ShortcutInfoCompat and directly using ShortcutInfo
Change-Id: I2842689e192a206c0d31558c8126eae1c7904598
2019-04-22 15:39:40 -07:00
Sunny Goyal
8c48d8bea6 Changing min sdk to 25
Change-Id: I0d28069967854357ca755bf25dec19d4979bdecf
2019-01-29 11:29:52 -08:00
Sunny Goyal
fe8e4a90be Moving some methods from various activities to the base interface
This allows creating some custom views in the absence of
activity context

Bug: 118758696
Change-Id: I23999290e972a2a8cbd725a521a4e0c7c2e5023e
2018-11-19 13:04:35 -08:00
Sunny Goyal
ac8154a23d Caching widget labels in icon cache to avoid lookup at startup
Change-Id: Ie026ee47905454bd70e774d422cd7fe142aec7e2
2018-09-28 16:36:33 -07:00
Mario Bertschler
d2e3c5de56 Adding WEB_APP item type for logging.
Set in LoggerUtils.newItemTarget if instant app

Bug:67049361
Change-Id: I8e99e5c60bf1a2083f898e8978d403138f803276
2018-04-03 21:18:38 +02:00
Sunny Goyal
623eddd7e8 Updating Launcher rotation logic
When auto-rotate is on, launcher allways allows rotation. This allows uses to use
locked rotation feature is available on the device
When auto-rotate is off, workspace does not allow rotation, but overview in quickstep
will allow rotation

Bug: 73872056
Change-Id: Ie12365c268fd5e4958634ed97b5a33dcadc691e2
2018-03-03 00:41:09 -08:00
Sunny Goyal
d3864fa630 Fixing double state changes when using an InternalStateHandler
> Removing duplicate state handling on onCreate and onNewInetnt when InternalStateHandler is active
> Changing PinItemDragListener to use IntenalStateHandler

Change-Id: I42dcf82d1180c49430c6cf0b85d47072c4498ecc
2017-11-15 10:24:10 -08:00