Commit Graph

50 Commits

Author SHA1 Message Date
Suphon Thanakornpakapong
97209503ff Use custom adaptive icon class 2021-10-13 12:04:04 +07:00
Suphon Thanakornpakapong
2730959ed1 New grid preference screen with preview 2021-10-12 15:25:32 +07:00
Suphon Thanakornpakapong
554e466864 More fixes 2021-10-08 12:16:21 +07:00
Suphon Thanakornpakapong
cc2bd15873 Merge remote-tracking branch 'aosp/android12-release' into 12-dev 2021-10-05 14:13:08 +07:00
Brian Isganitis
dafa5040ef Fix crash from previewing launcher with unknown wallpaper colors.
Test: Open wallpaper app with live wallpaper applied should not crash.
Fix: 195246865
Change-Id: Id64de32b35aa7a553daa752438060d7f6822bec8
2021-08-04 18:31:20 +00:00
Brian Isganitis
b684c1b59b Revert "Merge "Revert "Use wallpaper colors for widgets in wallpaper change preview"" into sc-dev"
This reverts commit 7de95d6767, reversing
changes made to 0a70a5a690.

Lints have been added to fix errorprone.

Test: Widgets should adapt to wallpaper colors in launcher preview.
Bug: 192205054
Merged-In: I3fb76b6036cb909771b789eac15742df78c2c742
Merged-In: I4da9ad1cc88be251f97e86b6c8c9b346ed20f586
Change-Id: I6866f8521ed427d096f27da0a92d8b40e1099187
2021-07-19 21:03:26 -04:00
Jonathan Miranda
f5fee1a7d3 Revert "Use wallpaper colors for widgets in wallpaper change preview"
Revert "Implement generateColorsOverride from LocalColorExtractor"

Revert submission 15331418-colorcp

Reason for revert: Broke the build
Reverted Changes:
Ife80b07f9:Use wallpaper colors for widgets in wallpaper chan...
I1371eb787:Implement generateColorsOverride from LocalColorEx...

Bug: 194138049

// Using original change's merged-in tag to avoid clashing
Merged-In: I3fb76b6036cb909771b789eac15742df78c2c742
Merged-In: I4da9ad1cc88be251f97e86b6c8c9b346ed20f586

Change-Id: I3835dfb8efe745dc0a654712a5b1f68c4946f446
2021-07-20 00:44:42 +00:00
Brian Isganitis
74e6ced362 Use wallpaper colors for widgets in wallpaper change preview
Test: Widgets should adapt to wallpaper colors in launcher preview.
Bug: 192205054
Merged-In: I3fb76b6036cb909771b789eac15742df78c2c742
Merged-In: I4da9ad1cc88be251f97e86b6c8c9b346ed20f586
Change-Id: Ife80b07f99da913d65bff96fba2ccd76b0a2ed48
2021-07-19 16:58:20 -04:00
Brian Isganitis
610e43f90e Intercept touch events for launcher preview root view
This change prevents any accidental touches on any widgets in the
preview.

Test: Tapping on launcher preview in wallpaper app should never activate
a widget.
Fix: 191623924

Change-Id: Iac7eab057ec33ff491365a993af75a0b06a27f7e
Merged-In: I98d462eca699cf368dcd5894f15584f280932ccc
2021-06-29 23:59:03 +00:00
Chihhang Chuang
ccb71776c6 Apply the current system window insets to launcher preview
For wallpaper picker, the position of app icon on the wallpaper preview would match to the launcher after applying the wallpaper.

Wallpaper picker: https://screenshot.googleplex.com/JZazpgZLgzacZMZ.png
Launcher: https://screenshot.googleplex.com/9uTTQwdmcnFZ7Vi.png
Gesture mode: https://screenshot.googleplex.com/3YaKbBerYgtHBFb.png
3-button mode: https://screenshot.googleplex.com/7sA5nE3GmbuKf62.png

Fixes: 188539072
Test: Manually
Change-Id: I553000e6ae646207eb94fa33e97d00a3990043c8
2021-05-21 14:41:37 +08:00
Sunny Goyal
df4241ca4e Fixing Launcher preview leaking surface and memory
> Closing existing preview if a new request comes for same host token
> Closing in-memory icon db when closing preview
> Removing unnecessary wait blocks on UI thread and rendering
  view asynchronously
> Fixing preview loading failing on LauncherAppState access

Bug: 186712316
Bug: 187140897
Test: Manual
Change-Id: I045930b007e5dc015320224a197eee20a8354d17
2021-05-20 21:37:28 +00:00
Kshitij Gupta
9affffe0ff Add option to hide At a Glance widget (#2141)
Co-authored-by: Patryk Michalik <contact@patrykmichalik.com>
2021-05-06 09:48:21 +02:00
Sunny Goyal
c52c0782a7 Merge "Adding support for determining split layout for launcher." into sc-dev 2021-05-04 22:33:38 +00:00
Sunny Goyal
9ab43772ab Adding support for using themed icons on workspace
Bug: 183641907
Test: Manual

Change-Id: Ieda7e73b3ae4dfe3009e3f23754aff5f8826a967
2021-05-03 20:00:38 -07: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
Patryk Michalik
aab6b80fa0 Relicense to and fix compliance with Apache 2.0
[skip ci]
2021-04-24 09:48:35 +02:00
Tony Wickham
b87f3cdc1c Add support for having more hotseat icons in the DB than we show
Split InvariantDeviceProfile#numHotseatIcons into two variables:
numDatabaseHotseatIcons and numShownHotseatIcons. These are generally
the same, but different DisplayOptions within the same GridOption
can choose to show different numbers of hotseat icons while sharing
the same database.

numDatabaseHotseatIcons is used for all reading/writing/migrating
purposes, while numShownHotseatIcons determines how many Hotseat
icons to show in the UI.

Test: Existing tests pass, added two new migration tests
Bug: 184789479
Bug: 171917176

Change-Id: I54583504f61a47a4444b6a637ebb7e3ab31528b7
2021-04-12 16:08:15 -07:00
Danny Lin
c6f8d713bd Launcher3: Fix launcher preview rendering
Launcher preview rendering fails on AOSP Launcher3 because the search
bar (AppsSearchContainerLayout) tries to find BaseDraggingActivity
during inflation, which doesn't exist in the preview hierarchy.

Remove the search bar from the launcher preview layout entirely to fix
the issue. This is actually more consistent with our real launcher
appearance because it doesn't have a search bar to begin with.

Change-Id: Ic549fd9d592bc702e0c12285fb016b908e49d514
2021-03-18 18:16:26 +01: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
e733e79946 Fixing preview rendering in device search mode
When the flag is disabled, search box may not show in preview

Bug: 177500166
Test: Presubmit
Change-Id: I064ba6ca22e71030056a4ceafea27e6ef0517d01
2021-01-14 14:17:13 -08:00
Sunny Goyal
cfcefb0c47 Synchronizing model data access
Test: Presubmit
Bug: 173328873
Change-Id: Ifc1724e17ebfa2ee5f21bb3f272986b8a14fdbc1
2020-12-10 16:24:19 -08:00
Winson Chung
f99351888c Revert "Revert "Merge commit '8d14dbe041199d611839140f1c9285fd4174e9f4' ...""
This reverts commit 087a9e39b6.

Change-Id: I05b17a6e4aaaef6de3c2fa26aad45a39eb2833f9
2020-10-23 09:27:48 -07:00
Alistair Delva
087a9e39b6 Revert "Merge commit '8d14dbe041199d611839140f1c9285fd4174e9f4' ..."
Revert "Merging from ub-launcher3-master @ build 6877130"

Revert "Merging from ub-launcher3-master @ build 6877130"

Revert "Merging from ub-launcher3-master @ build 6877130"

Revert submission 12738409-merge_ub-launcher3-master_6877130

Reason for revert: Introduced crashes to global presubmit

Reverted Changes:
I624658ce6:Merge commit '8d14dbe041199d611839140f1c9285fd4174...
Iccd2f1e3a:Merging from ub-launcher3-master @ build 6877130
I791d64951:Merging from ub-launcher3-master @ build 6877130
Icdd32ab01:Merging from ub-launcher3-master @ build 6877130

Bug: 169963211
Change-Id: I77a4ae59e823147beae8dd7cb9b54ccdace2c7f4
2020-10-05 14:46:26 +00:00
Andy Wickham
9e754b008d Adds ability to use LauncherPreviewRenderer in Sandbox.
This is mostly a proof-of-concept for future use and
tweaks as desired by UX.

The idea is to better replicate the actual UI.

Screenshot: https://drive.google.com/file/d/1EGDgcrSH2QZuSh6P3zWLBl6L8Xd-gtFY/view?usp=sharing

Bug: 148542211
Change-Id: Ibed4b8118346ef72599463c9fd6a2f71166993fd
2020-09-16 19:35:18 -07:00
Tracy Zhou
e209b03a7f Only load the first page in grid preview
Bug: 160662425
Test: manual (verified correctness)
Merged-In: I9dc3b7d7b84924ffb588470d4b6b20431a62b6cd
Change-Id: I9dc3b7d7b84924ffb588470d4b6b20431a62b6cd
(cherry picked from commit 312cf43863)
2020-09-10 23:53:21 +00:00
Tracy Zhou
ef9596d4c1 Only load the first page in grid preview
Bug: 160662425
Test: manual (verified correctness)
Change-Id: I9dc3b7d7b84924ffb588470d4b6b20431a62b6cd
2020-09-10 14:10:41 -07:00
Sunny Goyal
0fc3d1275a Moving hotseat predictions to ModelDelegate
Bug: 160748731

Change-Id: I8db7856a17e0b6ca45b4d5ec3513f788f22db11a
2020-08-17 08:43:07 -07:00
Andy Wickham
a310e9c035 Refactors LauncherPreviewRenderer to better support subclassing.
Basically this removes the inner class MainThreadRenderer, which
was only created and used for its populate() method in the parent's
getRenderedView() method. All methods and members of that subclass
are merged into the parent LauncherPreviewRenderer class, and
getRenderedView() simply inlines the previous populate() code.

Other smaller changes:
 - Extracted out shouldShowQsb() and shouldShowRealLauncherPreview()
 - Disables search view and its children to prevent interaction

Change-Id: I7d0cce73efbe022c16661a0ad66eefe5cb285641
2020-08-12 20:02:27 -07:00
Hyunyoung Song
45c0918f47 Merging ub-launcher3-rvc-qpr-dev to rvc-qpr-dev
Bug: 162366734
Test: system image builds

Change-Id: I6675431b180976798afacc7a99251ae36764a50a
Merged-In: Ibff46b3ef7ff89accb459db323f31179adb4ef21
2020-07-30 00:26:39 -07:00
Sunny Goyal
8b74cc761b Moving all-apps predictions to Launcher model
Predictions are loaded and managed by Launcher model and follow
the model lifecycle. They are then bound to the callback which
handles the UI

Bug: 160748731
Change-Id: I4a3ea0698d80fafe94afb4ce66ffa7f4a6a91c68
2020-07-29 13:07:52 -07:00
Hyunyoung Song
0a4a4d920e Revert "Merging from ub-launcher3-rvc-qpr-dev @ build 6690853"
Revert "Merging from ub-launcher3-rvc-qpr-dev @ build 6690853"

Revert "Merging from ub-launcher3-rvc-qpr-dev @ build 6690853"

Revert submission 12190253-merge_ub-launcher3-rvc-qpr-dev_6690853

Reason for revert: Build ID picked from ub-launcher3-master and not ub-launcher3-rvc-qpr-dev

Reverted Changes:
I9e658ece0:Merging from ub-launcher3-rvc-qpr-dev @ build 6690...
I2a47fe180:Merging from ub-launcher3-rvc-qpr-dev @ build 6690...
Ie86b0a2e0:Merging from ub-launcher3-rvc-qpr-dev @ build 6690...
Id3ca76da6:Merging from ub-launcher3-rvc-qpr-dev @ build 6690...
Ib6a63da0f:Merging from ub-launcher3-rvc-qpr-dev @ build 6690...
Bug: 162366734


Change-Id: Ie81853a34c9a48d5b3fd922c65483a9ff639e0ce
Merged-In: Ibff46b3ef7ff89accb459db323f31179adb4ef21
2020-07-28 23:43:43 +00:00
Sunny Goyal
5d09b2e358 Updating some comments and variables
Change-Id: Ib3223c66e9ce187cebc6ce26a46b228f95787778
2020-07-17 18:58:49 +00:00
Tracy Zhou
b023873bc3 Improve grid preview performance
After breaking down the time we spend in rendering preview under a different grid setting, I found out that we spend a huge amount of time loading the workspace. It takes a long time in non preview case (launcher workspace init), so to optimize we should try to cut down things that are not necessary for preview. Widget model loading (widget and shortcut updates) takes half of the time, and can be optimized with minimal risks / code changes.

Bug: 160662425
Test: Manual

Change-Id: I89029d0ddf6e2517077a0ba3fbbcfdcd60b268d9
2020-07-14 23:30:03 +00:00
Tracy Zhou
f957ff9123 Do preview grid migration in a worker thread
Also remove USE_SURFACE_VIEW_FOR_PREVIEW flag

Fixes: 159755324
Test: manual
Change-Id: I6517c34911e217a69063226b01e4583194902f9c
(cherry picked from commit 633a4bdf57)
2020-06-25 21:04:25 +00:00
Tracy Zhou
bc305fc7fe Support predicted icons in preview
Fixes: 152789575
Test: https://screenshot.googleplex.com/r3AtHp3TAh0
Change-Id: I22f7ee2a69f2df12ade16f50bf455651dbfce597
2020-05-29 09:58:01 -07:00
Sunny Goyal
e396abf502 Moving model data structures to a separate file
Change-Id: I77ad7a5219e72d2e0d6c1803de2ac3ed6a65a8f7
2020-04-09 13:20:39 -07:00
Tracy Zhou
c0000450b5 Support grid preview with v2 migration algorithm
The focus of ag/10346770 is around the actual algorithm, while in the meantime our preview logic has changed during the code review of ag/10100264.

GridSizeMigrationTaskV2 addresses both cases, the difference being preview passes in constructed IDP while actual migration uses IDP from the current Context.

When doing actual migration, we call METHOD_UPDATE_CURRENT_OPEN_HELPER to update the current db helper and copy the favorites table from the previous db into the current db in favorites_tmp table. Then we do migration from there.

When calculating preview, I added METHOD_PREP_FOR_PREVIEW in this change to copy the favorites table from the intended grid setting to the current grid setting in favorites_preview table. Then we calculate migration from the current favorites table to favorites_preview table and save into favorites_preview table.

Bug: 144052802
Fixes: 144052839

Test: Manual

Change-Id: I64a8b61a4e0bf8399c0ae1af4ef9d2bde0f1ee2f
2020-03-25 21:58:19 -07:00
Tracy Zhou
85f0c3b841 Use SurfaceView to render grid preview
Demo: https://drive.google.com/open?id=1wQ8dT5bfTxSh-NRQpNBwTCkKOtOOUMPj

Bug: 150224413
Test: Manual
Change-Id: I44e7baed1bcd15351e03dcbeb2b525bc1b325478
2020-03-12 23:06:36 -07:00
Tracy Zhou
bd22546683 Render user's actual workspace in ThemePicker preview (Part 6)
Didn't test out widgets in Part 5. So in this change,
- Added some widget classes to the PreviewContext WHITELIST
- Manually update widget model after loading workspace since we do not attach widget listeners to the LauncherAppModel for preview.

Change-Id: I0a555b2319b2e91432dbd58289ddb66aca1384df
2020-03-02 00:44:55 -08:00
Tracy Zhou
be13d109b7 Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview

With this change, we can see actual grid migration in wallpaper preview.

The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace.

UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why
1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below).
2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood.
3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded.

Bug: 144052839
Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
2020-02-21 15:49:00 -08:00
Tracy Zhou
10a285dc24 Render user's actual workspace in ThemePicker preview (Part 5)
This change takes care of rendering widgets using widget provider's layout info.

Test: manual
Bug: 144052839

Change-Id: I7002d8bf653513cdd317736d550a47f61f0ee474
2020-02-19 16:46:25 -08:00
Sunny Goyal
a7a5bf3101 Adding support for multiple Model clients
Bug: 137568159
Change-Id: Ia4db800b19cc80c695fcb9ea28e07709dfd08c6a
2020-01-10 12:23:27 -08:00
Tracy Zhou
4d7b244f3f Render user's actual workspace in ThemePicker preview (Part 2)
With this change, we can also render folders in preview. It's built on top of part 1.

Test: Go to grid options, choose a different grid option, and see user's workspace rendered in the preview
Bug: 144052839
Change-Id: Iaf6d8af6b909ece4147ea250d95dec3d2c0019d3
2020-01-08 15:42:58 -08:00
Tracy Zhou
44fa2940cd Render user's actual workspace in ThemePicker preview (Part 1)
This change takes care of icon rendering. Further work still needs to be done for folders and widgets.

Test: Go to grid options, choose a different grid option, and see user's workspace rendered in the preview
Bug: 144052839
Change-Id: I696153dec1d1f08c5ac82d0c75be5740325c0fc4
2019-12-09 14:06:38 -08:00
Sunny Goyal
3808a69a6c Storing BitmapInfo instead of icon and color directly in itemInfo
This will allow subclassing BitmapInfo to support custom icon/dynamic
icons which can be loaded on the background thread instead of going
through IconFactory which runs on UiThread

Change-Id: Ieced6e91330bdff1b505826d097a8df711dfe967
2019-10-28 11:12:47 -07:00
Sunny Goyal
9589916418 ShortcutInfo renamed to WorkspaceItemInfo
Will get rid of ShortcutInfoCompat in a follow up cl

Change-Id: I7d7d9c938635f59b216290ba28bea9d0e0721a7d
2019-04-16 00:08:24 -07:00
Jon Miranda
7143ba6fec Make QSB_ON_FIRST_SCREEN a boolean.
Bug: 118140522
Change-Id: Ic8e47e71f538b0b0caff6f630566665d05a65522
2019-03-15 09:11:54 -07:00
Santiago Etchebehere
3fc41e760a Don't render background in PreviewRenderer
ThemePicker will add the current wallpaper as background instead.

Bug: 122262084
Change-Id: Ib0781abd09afc98a56649888c59074888af1740e
2019-01-17 13:25:59 -08:00
Sunny Goyal
eff44f331c Adding content provider for exposing launcher grid settings
Bug: 122262084
Change-Id: I3e89e0a9400fb3e81f932af3606eb49c36d34894
2019-01-09 17:47:24 -08:00
Sunny Goyal
ef92b82778 Adding support for launcher preview generation
Creating a utility class which generates a launcher preview
for a provided InvariantDeviceProfile

Bug: 118758696
Change-Id: I0aebeb6eed37f72edd1cc305e58eece305aae3ff
2018-12-04 20:19:14 -08:00