Commit Graph

117 Commits

Author SHA1 Message Date
Jonathan Miranda
9fcb45f872 Revert "Remove widgets that no longer fit the workspace in their current spans."
This reverts commit bf6e8ffbf0.

Reason for revert: broken tests
Bug: 141313472
Change-Id: I1e93e21e2c6618dea6cd099a46c9b9d2ab3ab81c
2020-09-29 02:08:43 +00:00
Jon Miranda
bf6e8ffbf0 Remove widgets that no longer fit the workspace in their current spans.
This can happen when display size changes.
We compare span sizes of widget in the db to the min sizes of the widget
in the current display size. If the widget can no longer fit in its existing
spans, we remove it.

Bug: 168818961
Change-Id: I6b095d2eeaeda95bfa91baec89cb54660695b60b
2020-09-23 12:15:43 -07: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
d4d2a73b67 Removing MultiHashMap and using java-streams instead
This makes it easier to choose different collection
implementations

Change-Id: Ic44e128b7478fcbbb1b546027685e058945af3f9
2020-08-27 15:26:18 -07:00
Sunny Goyal
0fc3d1275a Moving hotseat predictions to ModelDelegate
Bug: 160748731

Change-Id: I8db7856a17e0b6ca45b4d5ec3513f788f22db11a
2020-08-17 08:43:07 -07:00
Sunny Goyal
762d06136c Caching last predictions and loading it with model
Adding support for persisting itemInfos on disk. This uses
a separate xml file. Unlike prefs, it does not keep the items
in memory and is just a wraper over reading/writing a file.

Bug: 160748731
Change-Id: Iaccab9928ab8f30127fb3c2d630ca8ca83f0bd05
2020-08-11 13:23:29 -07:00
Sunny Goyal
77ca1e4c40 Moving data sanitization to the end, as it need not block
the loading

Change-Id: If1a966e546127efafd0afd7e3ca771f63a1fa544
2020-08-04 17:29:16 -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
28f5075eb0 Adding support for storing container based item list in the model
These items get updated automatically during various model tasks.
Also simplifying the pinned shortcut state, by calculating the
list of ppined shortcut on demand, instead of storing a refCount.

Bug: 160748731
Change-Id: I3169d293552b05b4f4d6c529397fbc761887a282
2020-07-23 15:27:50 -07: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
Jayaprakash Sundararaj
1d96ba03ab Refactor FolderNameInfos.
Bug: 159508969

Change-Id: I984e7a4fc321392d06157c705392c1ba5672f348
2020-06-19 23:12:22 -07:00
Sunny Goyal
28daf4a76f Removing multiple system RPCs to packageMAnager and userManager from UI thread
Bug: 158427348
Change-Id: Ibb1837fe932000b69cf5683bb01727fc32abca91
2020-06-08 17:56:36 -07:00
Samuel Fufa
d12d6ab98a Switch to new protocol for hybrid hotseat
- create predictor from items in bgModel instead of scanning views
- Launcher no longer checks for duplicates before sending pin/unpin events
- sending cached items from last prediction to reduce UI shuffle
- Switch to using UserCache to persist and read ComponentKey

Bug: 148814143
Bug: 156413231
Bug: 156200931
Change-Id: Ide6330bed8eb7f0c6fbec1d1ac21e7f67a9b2be2
2020-05-14 17:27:34 -07:00
Samuel Fufa
b549819676 Resolve Test flakes
-> Synchronize calls in LoaderTask.java
issue 156041043

-> Remove non system users on setup
If a work test crashes before getting to run its teardown - we might end up with a user profile that could throw off subsequent tests.
issue 156022161

Test: Manual
Change-Id: Ife708a3de01572f7cb2187078d592d8d570dd951
2020-05-10 13:51:41 -07:00
Samuel Fufa
385e93249e Improve Hybird hotseat cache support
Loads list of cached apps and shows predicted app icons with the rest of workspace items.

-> Extracted prediction caching logic into a model layer

Bug: 155029837
Test: Manual

Change-Id: I6981594a910f5fe4e8e8cf8fe39db0cb856e7acd
2020-05-06 14:14:08 -07:00
Sunny Goyal
e396abf502 Moving model data structures to a separate file
Change-Id: I77ad7a5219e72d2e0d6c1803de2ac3ed6a65a8f7
2020-04-09 13:20:39 -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
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
Hyunyoung Song
356a9f05c4 Fix folder UI open regression when tapping edit text / Fix NPE
Bug: 149835166
Bug: 149839789



Change-Id: I295cc72e4228249794eae11f177226179f2a175f
2020-02-19 11:15:12 -08:00
Hyunyoung Song
6e3120cf06 Merge "Introduce FolderNameInfo class." into ub-launcher3-master 2020-02-12 18:26:56 +00:00
jayaprakashs
e534d3b5f9 Introduce FolderNameInfo class.
* Introduce FolderNameInfo class for passing down the folder name
suggestions from FolderNameProvider.
* Use FolderNameInfo for storing the serialized suggested names for
Folders. It is parsed and used in FolderEdit.

Bug: 148417030
Bug: 148916551
Bug: 148432151

Change-Id: Idaa81e203cc42889be15d0845230b4508521041c
2020-02-11 11:36:28 -08:00
vadimt
2e1e0d6bff Removing tracing for "Launcher didn't initialize" flake
The flake had disappeared, perhaps because of this logging, or,
hopefully, for some other reason.

Bug: 148313079
Change-Id: I636783d5fc71474dd443c143289c3ff74651835e
2020-02-10 12:47:42 -08:00
Tracy Zhou
d880f0bc09 Merge "Setup infrastructure (multi-db support) for the new grid migration algorithm" into ub-launcher3-master 2020-02-07 00:00:26 +00:00
Sunny Goyal
18204e4eea Various icon cache fixes
> Multiple instances of LauncherIcon created when
    LauncherIcons refers IconCache which in turn creates new LauncherIcons
> Widget icons are never cached as they were using low res icons
> Shortcut drag icons are not loaded synchronously
    when using PinItemRequest flow
> Wrong lastUpdatedTime is used in iconCache for shortcuts
> IconUpdateHandler does not ignore managedUser promise icons

Change-Id: Ie7eed68a30fad11d1861b6c70c380953a15ae1cf
2020-02-06 14:16:34 -08:00
Tracy Zhou
7df93d28d4 Setup infrastructure (multi-db support) for the new grid migration algorithm
We'll have a db for each grid option and a db for back up / restore.

TODO(pinyaoting): support back up / restore using the new infrastructure, particularly calls to GridBackupTable should use different DBs when the feature flag (NEW_GRID_MIGRATION_ALGORITHM) is on.

Bug: 144052802
Test: N/A

Change-Id: I644a3e70148bd78204a747a337446a3c038f616f
2020-02-05 19:55:05 -08:00
TreeHugger Robot
89321dde65 Merge "Tracing for another "Launcher didn't initialize" failure" into ub-launcher3-master 2020-01-29 18:38:49 +00:00
Hyunyoung Song
1ae42423ca Load folder names during LoaderTask
Bug: 147359653

Change-Id: I4d1b53c3a72d0773d4bc8819ee8118fc719944ad
2020-01-28 22:06:05 -08:00
vadimt
c8b09709ff Tracing for another "Launcher didn't initialize" failure
This simply restored logging used for one of earlier investigations

Bug: 148313079
Change-Id: Idafed13208dc5610d577986fc487d1d44bc0ef5e
2020-01-27 17:48:49 -08:00
Sunny Goyal
fa39536570 Removing static reference of deep shortcut manager
Bug: 141376165
Change-Id: Ie60b82be63a8926825598c681d8b2a1b2ace6413
2020-01-02 20:13:12 +00:00
Sunny Goyal
73b5a27b14 Updating some non-final static objects
Updating various static objects to use a standard pattern so that
it is easier to track and cleanup those objects

Bug: 141376165
Change-Id: Ia539cbfa338d544dddad771c5027b6748762768b
2019-12-11 13:22:58 -08:00
TreeHugger Robot
4f37a5e268 Merge "Removing static instances of UserManagerCompat and AppWidgetManager" into ub-launcher3-master 2019-12-11 18:41:04 +00: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
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
4b5b0eb60d Moving some tests to robolectric
> Adding support for simulating model load

Bug: 130562632
Change-Id: I1de8c0abe2e74d4e7e47e18914316c339920609a
2019-12-09 11:17:12 -08:00
Pinyao Ting
c1a1ced33a Add IconCache support for deep shortcuts, loads deepshortcut on
background thread.  Added a feature flag to toggle on/off this
feature.

Bug: 140242324
Test:
  1. (Custom Shortcut) Long click on google maps -> widgets -> drag
     driving mode to workspace.

  2. Open chrome -> add to home screen -> add -> add automatically.

  3. InstallShortcutReceiver
     In Launcher.completeAddShortcut, commend out the code that
     calls PinRequestHelper.createWorkspaceItemFromPinItemRequest,
     then open chrome -> add to home screen -> add -> add
     automatically.

  4. ShortcutDragPreviewProvider
     qdb -> long press on suggested app that has deep shortcut
     -> drag to workspace.

Change-Id: If7babe4eddf5434909bf686b4e9bde15e444d9fd
2019-11-05 11:27:28 -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
vadimt
23c8341096 Removing tracing and @Stability for a fixed bug
Bug: 142514365
Change-Id: I147850db274c465fb964eca30b97b3ebaaa2ccf6
2019-10-25 11:21:33 -07:00
Pinyao Ting
7242db1a7c Revert "Revert "Revert "Revert "Revert "cache shourtcut image"""""
This reverts commit 28dc8de660.

Reason for revert: the code change introduces significant delay when saving deep shortcut icons in cache.

Change-Id: I5d67ac0c4c867a40e882b7a46be446f8f7f63ac7
2019-10-16 14:52:28 -07:00
Winson Chung
5cc62c7d0b Fix a couple trace issues
- Adding trace tokens since we can be starting/ending traces out of order
- Fixing issue with draw hitting twice causing the trace stack to be
  popped twice
- Fix issue with endFlagOverrides not removing from the stack

Bug: 142803200

Change-Id: I8649b94249910a352f00f2f2c2459c355d2bab00
2019-10-16 12:34:58 -07:00
vadimt
6c484bc9bf More logging for a lab-only bug
Bug: 142514365
Change-Id: I9936415fc4f3bfd4676d607f2dfff44070409c0c
2019-10-15 10:55:58 -07:00
Pinyao Ting
28dc8de660 Revert "Revert "Revert "Revert "cache shourtcut image""""
This reverts commit 52908c9adc.

Reason for revert: roll-forward and fixes the crash due to access icon cache on main thread

Bug: 141568904
Change-Id: I1274db349c4f508d9cf59735b5f15180bb0ec033
2019-10-15 09:54:09 -07:00
vadimt
54e0c9e49c Tracing to determine why the model doesn't load
Bug: 142514365
Change-Id: I30ecaec5a5d0868db10157c61a2a8d7dd12872ca
2019-10-14 18:39:10 -07:00
Sunny Goyal
17c72fbb60 Unifying various tracing calls
Change-Id: Iedf6662ad1d7281b850bdc43b3a1e373ce535ac6
2019-10-14 14:23:19 -07: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
1456522cab Merge "Removing static listeners from PackageInstallerCompat" into ub-launcher3-master 2019-10-02 18:27:45 +00:00
Pinyao Ting
44151960bf Revert "Revert "Revert "cache shourtcut image"""
am: 52908c9adc

Change-Id: I597a9e3a314887b668f482e74a4d2f548cca1da9
2019-10-01 10:09:11 -07:00
Pinyao Ting
52908c9adc Revert "Revert "Revert "cache shourtcut image"""
This reverts commit d13f0c5c45.

Reason for revert: app crashes when adding widgets automatically b/141568904

Change-Id: I5b97f440716c93b1bd93c899e3e1d40e8bbd2885
2019-10-01 09:44:11 -07:00
Sunny Goyal
045b4fab76 Removing static listeners from PackageInstallerCompat
Bug: 141376165
Change-Id: I2b49d53a05a04c622ed5a7b723109a6cc230d230
2019-09-30 23:17:15 -07:00
Pinyao Ting
977726f7a1 Exclude shortcuts in popup from IconCache.
am: ddd0ff44ba

Change-Id: I47f58f3bcaf5ae7b738e13763a55d41e52869a87
2019-09-20 10:05:07 -07:00