Commit Graph

55 Commits

Author SHA1 Message Date
Sunny Goyal
4df719a1e6 Removing ENABLE_CACHED_WIDGET since we now have always listenign widget
> Also using PendingWidgetView for deferred widget view

Bug: 270395008
Flag: LEGACY ENABLE_CACHED_WIDGET enabled
Test: Exising widgets tests pass.
      Verified UI by forcefully rendering deferred widget

Change-Id: Id34f89d778f9f993c1b7ad13f66e57fda9843417
2024-01-04 09:26:10 -08:00
helencheuk
1b3b67d004 Add radius to widget internal focus to fit new focus outline design
Bug: 310953377
Test: Manual
Flag: ACONFIG com.android.launcher3.enable_focus_outline Development
Change-Id: I9b11e8bf21dbb5045586907f0fc13577e236c8e7
2023-12-19 11:27:04 +00:00
Fengjiang Li
09c3c21472 Remove duplicated widget host view reinflation on screen rotation
Don't reinflate from LauncherAppWidgetHostView#onConfigurat#onConfigurationChanged because Launcher activity will rebind app widgets on configuraiton change. This will reduce lock contention to inflate complex widget views and reduce flicker.

Bug: 285279824
Flag: None
Test: Rotate screen and verify widget are rendered correctly
Change-Id: I69abc7f1fe0ca5704ac887142c73b8d245fead4e
2023-12-12 22:41:03 -08:00
Pinyao Ting
9ce1a90b4a Merge "Disables local color extraction for widgets" into udc-qpr-dev am: ef9125e5cb am: 06dd1ab24d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24777924

Change-Id: I971778514082b4712ca5f4169760279121589b7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-19 23:51:56 +00:00
Pinyao Ting
88f4f2bf96 Disables local color extraction for widgets
As discovered during investigation of system health issues, doing local
color extraction in widgets (for the purpose of making their color
matches the background during a drag) took many CPU cycle during layout
pass, which may have contributed to animation janks in various scenario.
This CL removes the feature in favors of better performance.

Bug: 266941872
Test: manually verified theme are still honored in widgets.
Change-Id: I63b13bc005907779af2322cd4bedbe141b0f3e27
2023-09-16 00:13:20 +00:00
fbaron
30d9e3fb06 Add smartspace custom widget
Flag: SMARTSPACE_AS_A_WIDGET
Test: no test
Bug: 200721106
Change-Id: I4ae4ff72ff7267bab0b5a928f3f78b47f7cfbc1f
2023-09-07 20:27:59 +00:00
Sihua Ma
324d3b0fdc Add widget layout transition when resizing
Also getting rid of part of the logic that updates the frame size in multi-window mode since multi-window is no longer supported

Test: N/A
Bug: 268553314
Flag: ENABLE_WIDGET_TRANSITION_FOR_RESIZING. OFF
Change-Id: I081b11441b562fccec7feb12cec0b28b9a0ea3a2
2023-08-30 22:41:13 +00:00
Sihua Ma
67376462c3 Fix widget foreground disappearing when swiping back
Test: Manual
Bug: 285914177
Change-Id: Ib080f59571b67a720b9d5440cbac17c02fc5c2d4
2023-06-05 18:39:34 +00:00
Sihua Ma
a28182d9c6 Correctly show the widget in the recommendation table
Test: Manual
Bug: 246121954
Change-Id: Ib32a20683b3dc456417549284744642ad451a829
2022-10-25 14:40:02 -07:00
Pinyao Ting
e5dbb75acd Cache and reuses LauncherAppWidgetHostView when launcher resumes
Currently by design when launcher enters the background, it stops
listening to updates in widgets. This eventually causes the dilemma
for launcher when it resumes, before the update can be returned from
the system process via IPC, launcher could do one of the following
to fill the gap:
1. show a deferred widget view -- a placeholder that renders the shape
   of the widget -- to let the user know widget is being reloaded.
2. show whichever widget view that was previously displayed to the
   user that may now contain stale content.

There is a descrepancy here since in some edge cases we are showing the
former while in most other cases we are showing the later. This CL added
a short-term fix to address the descrepancy and favors the later where
possible.

Bug: 218067434
Test: manual
Change-Id: I6cd2cd704186267227e2ec47f2581843fd526fa0
2022-06-15 13:23:31 -07:00
Pinyao Ting
6a41d56b50 Log the reason why a WorkspaceItemInfo was removed
In the past we've seen a WorkspaceItem disappeared from the workspace
but wasn't able to determine why it was removed. This CL includes the
reason why it was removed in the error log, which hopefully would help
us debugging similar issues in the future.

Bug: 231239260
Test: make
Change-Id: Iba3d57568c9b3e011a6b65b26f0d4170d42fe1a5
2022-05-16 20:17:47 +00:00
Schneider Victor-tulias
b707aa2464 Add tracking for widget creation
Bug: 216416777
Test: checked logs
Change-Id: Ic30b9e24561b1b09c8d247bf0d7acd9791eb82ca
2022-01-28 10:53:21 -08:00
Sunny Goyal
031418c6e1 Simplifying color extraction registration logic
> Calulating correct location irrespective of transient
  state (scale/translation)
> Removing extraction pause/resume logic
> Simplifying location calculation and registration (only use one location instead of a list)

Bug: 194732483
Test: Manual
Change-Id: I255d83761bff5e09c9fb0a5e398d0be0c1d0956f
2021-07-28 22:42:55 +00: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
Cyrus Boadway
270a9c734f Merge "Use nullable field and boolean rather than optional" into sc-dev am: 048a858575
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15171711

Change-Id: I6b6b6bf2ecb367f81fdb82321c7e7bb3cd8a228a
2021-07-01 17:15:38 +00:00
Cyrus Boadway
551b4297ed Use nullable field and boolean rather than optional
Optional won't hold null parameters, so use a boolean flag and
colorschange fields to represent the value and whether changes are
present.

Bug: 190818220
Test: manual
Change-Id: I794507340345864e73f04039f12a035c8053fd96
2021-07-01 15:05:43 +00:00
Pierre Barbier de Reuille
41f78f1e13 resolve merge conflicts of 25e37a85ae to sc-v2-dev
Change-Id: I78062d68d051a5f3c369214929f569b17c5a3471
Fix: 192532604
Bug: 192354264
Test: Manual
Merged-In: If573641e4bb5a98ed6b5008e00f70f4bbe492c24
2021-07-01 09:47:10 +00:00
Pierre Barbier de Reuille
43e17301c4 Correct color extraction on App Widget drop.
Disable color extraction on drop until the workspace is back to its
normal size, then re-enable it and force re-coloring. This needs to
happen if the drop is on the workspace, but also if the drop is on the
secondary target.

Fix: 192354264
Test: Manual, see bug for details.
Change-Id: I79203f68843d59384503aa76f4813d886e98afa3
Merged-In: If573641e4bb5a98ed6b5008e00f70f4bbe492c24
2021-06-30 18:50:41 +01:00
Cyrus Boadway
f5f23ba119 Merge "Defer onColorsChanged updates during widget-to-home animation" into sc-dev am: 1edaed8790
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15147896

Change-Id: I93c3c42dc173182c7625dea719bbc540a544234a
2021-06-30 17:24:57 +00:00
Cyrus Boadway
0d96baec13 Defer onColorsChanged updates during widget-to-home animation
Color change updates recreate the view, which can interfere with the
widget-to-home return animation, specifically the GhostView's use of the
AppWidgetHostView's render node.

Deferring the application of color changes until the end of the
animation allows the widget to settle and remove the GhostView before a
color change might recreate the widget's view.

Bug: 190818220
Test: manual
Change-Id: I6552e583ebb0e4810077d4e70fe9ecb07fd5d01a
2021-06-30 13:10:02 +00:00
Brian Isganitis
c79d577f18 Load widgets in wallpaper app launcher preview
Test: Widgets in wallpaper app launcher preview rendered
Bug: 185306338
Change-Id: I38569d2ff0b64ba55eb188afa42fba4100aae7ff
2021-06-18 15:47:56 -04:00
Steven Ng
058308098b Use relative bounds for app widget color extraction
Fix 2 bugs in this CL
1. Before this CL, getBoundsForViewInDragLayer returns absolute bounds
   for widgets. What we want is the bounds of a widget when it is
   visible in the drag layer. ViewGroupFocusHelper#viewToRect has
   taken PagedView into account. This makes it a prefect candidate to
   calculate relative bounds of a widget.
2. requestLayout at the end of endDrag is problematic due to the drop
   animation. If the drop animation is still in progress when onLayout
   is called, the bounds of the widget isn't final. Since the color of
   app widget right before is already the final color. We don't really
   need to update the color extraction.

Test: Set the wallpaper and clock widget according to the bug. Then,
      reboot the device. The clock widget color shown right after
      reboot is the expected color. Long pressing the widget doesn't
      cause a color change.
Fix: 191114337
Change-Id: I466c8102dba0e5b207b3768e0935472cbd523235
2021-06-17 23:25:57 +01:00
Steven Ng
0062822976 Merge "Fix preview layout crash upon screen rotation" into sc-dev 2021-06-07 20:38:39 +00:00
Steven Ng
db4ec8ac1a Fix preview layout crash upon screen rotation
Preview layouts are rendered via LauncherAppWidgetHostView. These
layouts are not yet added to the launcher. And thus, there is no
LauncherAppWidgetInfo.

Test: When a preview layout is shown in the recommended widget section,
      rotate the screen. No crash is observed.
Bug: 190395009
Change-Id: Ib1d080a106681fbfe3a4293f9f51f9576ef9414b
2021-06-07 18:55:47 +01:00
Pierre Barbier de Reuille
7fca870571 Improve local color extraction handling.
Local color extraction doesn't happen if the wallpaper is not currently
visible, so we don't need to add/remove the locations when the widget is
visible/hidden.

Also now compare the locations with some approximate measure, to account
for possibly slightly different calculations during drag vs drop.

Fix: 189827568
Test: Install Clock or test widgets and try to move them: the color are applied correcly.
Change-Id: Ib2a08bb0552c75bd351868e4fd5b5df8b8b732b2
2021-06-07 13:01:28 +01:00
Pierre Barbier de Reuille
1b8bbb6c40 Correct size of AppWidget for color extraction.
Correct the size of the App Widget: first, compute the size when the
widget is positioned (it wasn't done), then do not apply the
transformation when computing the size of the widget when drawn.

Note: Somehow, there is a shift by 1 on the position on the x axis, both
in landscape and portrait. So I added a +1 to get the exact same values.
If not, we have a risk of getting different colors.

Fix: 188759989
Bug: 187907544
Test: Added logs and moved a widget by hand, check the actual
coordinates with hsv.

Change-Id: Ia3bd5b3e3ea9a3ef75f8cdf466a9800786646a94
2021-05-20 21:02:30 +01:00
Jon Miranda
88b7f6a0d5 Move color extraction utils to extractor class so each instance can
have its own set of temp variables.

- Pass in float[] param to not create new obj in each frame
  for dragging widget case.

Bug: 175329686
Bug: 187019711
Test: manual, verify
Change-Id: I4350fb7e66a80c73def5659fb41abc14d357e667
2021-05-04 09:00:01 -07:00
Jonathan Miranda
21930da9a2 Revert "Revert "Use color extraction for arrow popup.""
This reverts commit 17fda29bf3.

Reason for revert: Fixing the memory leak

Leak was detected in caused launcher tapl tests to fail.
For instructions on how to debug leaks, see go/launcher-testing.
Using AS memory profiler, the color extractor class is holding
onto a reference to launcher that has already been destroyed.
The fix is to set the listener to null when view is closed.

Bug: 175329686
Test: run profiler in AS, open and close popups, and verify no leaks

Change-Id: I2d4a87f0481cbc88f3587dce91278e85ca113545
2021-05-04 08:53:58 -07:00
Vadim Tryshev
17fda29bf3 Revert "Use color extraction for arrow popup."
This reverts commit 242c805f82.

Reason for revert: Introduces a leak. I haven't seen a bug for it yet, but this CL is the only in the culprit list; the leak can block multiple teams presubmits, and the leak is via ArrowPopup. Enough evidence.
https://fusion2.corp.google.com/invocations/4b50db71-d598-4e52-9076-e91d42b65014/targets

Change-Id: I1700a9eea8705983598aee43c0a63e67c1d9cf71
Bug: 187075409
2021-05-03 18:27:41 +00:00
Jon Miranda
242c805f82 Use color extraction for arrow popup.
- Updated logic to accept any view that is a a child of draglayer
  (from being workspace dependent)
- Move color extraction logic from widget class to utility class.
- Initial CL, future CL will interpolate between colors
  and expand color extraction to other abstract floating views.

Bug: 175329686
Test: long press on colorful wallpaper and test colors are extracted
      test in multiwindow mode
Change-Id: I18a6bb5013de4eea7e9b45810401f5b9b3cd7302
2021-04-30 15:54:17 -07:00
Cyrus Boadway
c986767124 Add a mechanism to temporarily defer App Widget updates
Provides a mechanism to temporarily block app widget updates to a
particular app widget for a limited time.

Bug: 169042867
Test: manual
Change-Id: I35bf9cb4bfe99b2f371ae8fc3db09e6fcc773752
2021-04-23 15:16:50 +00:00
Pierre Barbier de Reuille
ca6f2475f1 Correct landscape mode color extraction rectangle
I had inverted the width and height of the screen,

Bug: 185887938
Test: Manual
Change-Id: I03889bf5e3f257414b90e992583307d61a960fe6
2021-04-20 14:59:22 +01:00
Steven Ng
f089f741ad Fix app widget preview layout drag-n-drop & rendering
1. Before this CL, preview layouts are not rendered in both the
   BottomWidgetSheet and SearchPopupSheet because the preview
   width & height are not set correctly.
2. Also applies the right padding to preview layouts.

Bug: 185374336
Test: Drag-n-drop preview layout from the full widgets picker,
      the bottom widgets picker and the search widgets picker.

Change-Id: I2b6303bfe4eb86a4935a5569f6107e9d46448902
2021-04-16 10:41:33 +01:00
Pierre Barbier de Reuille
a750f8cdca Correct RoundedCorner enforcements.
The feature status will not, in the end, depend on the widget, so
removed the argument.

Bug: 183097166
Test: Manual test

Change-Id: I977e775072cf1724f3e31b848d3ac4c862d23e00
2021-03-25 11:10:08 +00:00
Pierre Barbier de Reuille
452df2d5bb Update the resize frame to use the forced radius.
When forcing the rounded corners, the radius may be smaller than the
default one. When this happens, we should change how the frame is drawn
to only use that reduced radius, or this looks weird.

Bug: 183097166
Test: Manual tests with top 1P App Widgets
Change-Id: I6ce232515ce14059e1168e16735719ea2370132c
2021-03-23 20:57:33 +00:00
Pierre Barbier de Reuille
298526e812 Enforce rounded corners on App Widgets.
The feature is controlled by the ENABLE_ENFORCED_ROUNDED_CORNERS flag
(currently set to false).

If does not yet handle P/H flags to control its behavior.

Bug: 183097166
Test: Manual tests with top 1P App Widgets (See bug for results)
Change-Id: I56fca1b717f37ad518588115409f2144a71d4b98
2021-03-23 20:57:33 +00:00
Steven Ng
6f98e1ebd0 Notify WidgetHostView drag content change only at onDraw
Reapply RemoteViews can happen asynchronously. RemoteViews may
not finish reinflation right after setColorResource. Let's call
it onDraw.

Test: Manual

Bug: 182282587

Change-Id: I3653b4c64a5897637181f61096464b75945ab5f5
2021-03-18 22:01:18 +00:00
Steven Ng
30dd1d65f6 Apply local color extraction during drag-n-drop
Test: Drag a test widget around and observe local extract color
      is applied.

Bug: b/182282587, b/182816217
Change-Id: If63a9d91ceb2102d5d913bca85997b8be07b1adf
2021-03-17 18:10:51 +00:00
Pierre Barbier de Reuille
ab33b76dce Launcher changes to support dynamic coloring on static widgets.
Bug: 179783721
Test: By hand using the AppWidgetDynamicColors widget
Change-Id: I27863cac31f2f6c29f5a717ff8d4492325f936fb
2021-03-10 22:04:35 +00:00
Pierre Barbier de Reuille
18d159a250 Correct Launcher3 for new sizes in App Widgets.
This follow recommendations from the API council review.

Also removes two public functions introduced recently by
http://ag/13473552 and are not needed anymore.

Bug: 181611658
Test: Manual testing with local widget.
Change-Id: I8d0c90a80a0d45981bd5d16e69cd86639d5ec7d8
2021-03-05 11:44:11 +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
Pierre Barbier de Reuille
b2526feb24 Launcher changes for go/widget-size-specification
Makes sure the launcher:

1 - Send the list of actual sizes the widget in all situations.
2 - Gives the current size to the framework on inflation.

Also needed to guard the new border changes introduced in
http://ag/13532637 with the corresponding flag.

Change-Id: I2a33e9501b921f2fc393684e8ce91ee077626bf7
Test: By hand using a local widget.
Bug: 179025145
2021-02-24 20:40:41 +00:00
Sunny Goyal
eaf7a95546 Changing minimum supported Launcher version to 26
Change-Id: I49fcf874430ac53c3246371e179fbd828e14e4da
2020-07-29 17:30:19 -07:00
Adam Cohen
d916206271 Decouple the scaling / translation of widget views necessary in split-screen
=> We pull apart the scale and translation that are set in a fairly
   static way due to split-screen vs. the general translation and scale
   properties that might be used more dynamically, in this case
   for re-order animations
=> This allows removal of some code that breaks reorder animations
   due to the accrual of translations / scales in certain edge cases.
=> TODO in future CL: address other translation cases and make the throw
   case for calling base setTranslationX/Y for Workspace Items unconditional

issue 149438360

test: manual
Change-Id: Ic3fde172f669e215cd25db0fcd4e1c3c873d314f
2020-04-17 15:36:44 -07:00
Sunny Goyal
e396abf502 Moving model data structures to a separate file
Change-Id: I77ad7a5219e72d2e0d6c1803de2ac3ed6a65a8f7
2020-04-09 13:20:39 -07:00
Adam Cohen
370164c4f7 Fix drag and drop regression when dragging a scaled widget
Missed this case in ag/10736229; the symptom was that if you picked up a widget when it was scaled due to split-screen, the widget would disappear

Test: manual

Change-Id: I26810fcf820f7053b6445989dce6598e1df55a8e
2020-04-08 18:00:35 -07:00
Sunny Goyal
17feee8995 Merging stylus click logic in longpress helper for better state-management
Bug: 150825081
Change-Id: I7c507c41e67c09bff5a4ad3abc7a7a62fecf910e
2020-03-27 19:53:20 +00:00
Adam Cohen
650869973a Refactor / Cleanup / Simplify a bunch of dnd related rendering / animation
Addresses:
=> Fix folder icon drop location mapping (was very far off)
=> Fix BubbleTextView drop animation shifted by a few pixels
=> Get rid multiple unnecessary calls to setDragMode(none), was breaking
   some of the reorder flow; still some issues to address here.
=> Fix folder icon parallax (didn't work when the folder had a dot)

Test: manual

Change-Id: I5959cf341996f75d30212353ec096ed25bf40ea5
2020-03-21 01:26:09 +00: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
df7abe1040 Notifying widgets to use dark text when rendered on light wallpaper
Bug: 109954539
Change-Id: Ifab21626a070c35b351ea99ea3f09f3bf2230d19
2019-06-13 15:07:20 -07:00