Commit Graph

23 Commits

Author SHA1 Message Date
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
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
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