Commit Graph

22 Commits

Author SHA1 Message Date
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
Pinyao Ting
7aaaa35501 fix the issue widget id wasn't being migrated in backup
After SuW the favorite table is copied into backup table, but the widget
id in the backup table hasn't been migrated. This introduces general
unstabality and can sometimes leads to the disappearance of widgets
after a restore.

Bug: 171774227
Test: run Backup Restore flows and verified database status with arbitrary
logging

Change-Id: If275a6b5395504d6de90e26c3998f759e797f6e1
2020-11-20 18:18:52 -08:00
Pinyao Ting
f39f351a0d fix the issue widget id can be wrong after restore
Bug: 171774227
Test: manual testing
1. randomly add/remove widgets to workspace
2. create a backup (Settings > System > Backup)
3. reset the device
4. restore from the backup
5. verify all of the widgets are restored properly

Change-Id: Id65e474dd9349aca715d7e6b88f8d58bc63066ae
2020-10-28 22:04:35 -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
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
3e3d759db2 Removing flag overrides. All flags should be defined as togglable flags instead.
Change-Id: Ia7b9ff84413096cd5b0c4a9a81a232019f2522d2
2019-09-12 10:17:14 -07:00
Jon Miranda
3e90b4c7ae Fix bug where work profile widgets are restored with main profile provider.
* Platform bug causes work profile widgets to be restored with main profile
  provider.
* If we skip restore the widgets under the work profile during restore, then
  launcher will re-create the widget but with the correct profile provider.
* Needs to be fixed in platform, but this launcher side change will work for
  now.

Bug: 135926478
Change-Id: I80300c83e82cea9da84fdcdf7ad03188769b6cac
2019-07-30 09:03:12 -07:00
Jon Miranda
c7206caf6e Ensure app widget ids are restored after database is sanitized.
Previously, it was possible for AppWidgetsRestoredReceiver to
start the restore process before work profile has finished restoring which
resulted in the work profile items being removed from the workspace.

Bug: 131315856
Change-Id: I2f295a1ca91f1996522bcc8052aa139979526e3b
2019-05-14 17:30:04 +00:00
Sunny Goyal
d230307a95 Migrating to android-x
Change-Id: I9a774152d13a541e8496dd84f2469bfed407f86d
2018-08-14 15:22:12 -07:00
Sunny Goyal
64a75aa305 Adding A feature flag to disable widgets and a corresponding build
target Launcher3Go without widgets support

Bug: 62353159
Change-Id: Ia03d2235a9bcf75f9ef191924f81630e63a2c684
2017-07-21 14:10:13 -07:00
Sunny Goyal
f5b4b80972 Fixing widget id restore broadcast.
Ignoring thw broadcast if its not for the main widget host, or if
the Launcher DB is already in use. Launcher already handles missing
widget-Id map broadcast, by binding a new widgetId at runtime.

Bug: 63389280
Change-Id: Iaa9774d6d7adde3711cba9615328020e2b2e66aa
2017-07-12 12:14:29 -07:00
Sunny Goyal
b434fde427 Moving LoaderTask to a separate class file
Bug: 34112546
Change-Id: I86d93cfb5d3903bfd3878564cbe8b67b64fd8423
2017-06-06 10:47:23 -07:00
Sunny Goyal
dd96a5e4fd Simplifying Model data load state management
Instead of maintaining 3 different states, each tied to a subset of data,
maintaing a single state that represents all the data. Individual subset
data is invalidated in rare cases and these invalidates are tightly tied
to the UI. This also allows us to add new data to the model, without worring
about classifying the data into a subset.

Bug: 34112546
Change-Id: Id9cb273de35b79e84a2ef8d6556fcf1e72fb4b75
2017-02-22 15:45:14 -08:00
Sunny Goyal
2eb9cc48a6 Fixing AppWidgetsRestoredReceiver updating model on UI thread
Bug: 34203314
Change-Id: If2c149f353109350e45e581a654956bec78bce96
2017-01-11 14:15:42 -08:00
Sunny Goyal
aaf86fe9a0 Refactoring some loadWorkspace logic in a separate class
Bug: 34112546
Change-Id: I8a43ed1646056aa1957ac3d6ea82018691df6386
2017-01-10 13:53:50 -08:00
Sunny Goyal
047317735c Deleting the unrestored widget id synchronously
> We are making the DB call (IO) on the UI thread which is costlier than
the AppWidgetHost call.
> The process can get killed after the broadcast receiver returns, which
can prevent these ids from getting deleted.

Change-Id: I47746cf03d0eae573b6baa25cde9e573fd1f1a60
2016-03-18 16:29:08 -07:00
Sunny Goyal
8ac727b2c6 Using custom threadpool executor instead of the one defined in AsyncTask
Change-Id: I8fe95d932c5de14c74f0576bfc3d1f641d12b448
2015-09-23 15:39:14 -07:00
Sunny Goyal
84b4adc3fb Disabling auto restore of widgets.
> Always show "Setup" button for a widget which has a config activity.

Bug: 23155863
Change-Id: I60683889e76be830a76ac1245e079574aaf0ad10
2015-08-14 11:42:01 -07:00
Sunny Goyal
1d4a2df091 Removing ContentObserver from LauncherModel, and calling reload
whereever necessary

Change-Id: Ia4a8abdfe2be9703f3217a60527d3a1220b33bdc
2015-04-01 10:20:18 -07:00
Sunny Goyal
ff57227711 Adding support to restore widgets even for jelly beans.
> Show 'widget-not-ready' until the widget app is installed
> Once the app is installed, bind a new widget id (not required on L if
  id-remap was received).
  **Remove the widget if bind failed
> If the widget has no configuration screen, show the widget, otherwise
  show 'setup-widget'.
> Clicking 'setup-widget' shows the config screen, and updates the
  widget on RESULT_OK.

issue: 10779035

Change-Id: I2f8b06d09dd6acbc498cdd93edc59c26e5ce17af
2014-08-08 14:29:02 -07:00
Sameer Padala
513edaebce Modify code so it compiles on google3
The diamond operator isn't supported on google3 Android projects.

Change-Id: Ie7298b051330bb2cd32426d4c537882faa2f8ebd
2014-07-29 16:17:08 -07:00
Sunny Goyal
651077bdd6 Adding app widget restore support in Launcher3 for android L
When the app is restored, it displays placeholders for all pending widgets.
These placeholders can be moved and removed similar to a widget (size is fixed
to what defined in backup). Once the system notifies the launcher of the new
widget ids, the place holders are replaced with actual widgets.

issue: 10779035

Change-Id: I68cbe4da01e9ca2978cb4471a7c645d2aa592055
2014-07-21 10:34:21 -07:00