Commit Graph

41 Commits

Author SHA1 Message Date
Charlie Anderson
c61288e271 Adds more in depth logging of Launcher restore functionality
Test: locally
Flag: N/A
Bug: 294386159
Change-Id: I810239047480090911c54dbe65a4aad8515f640c
2023-12-12 11:04:52 -05:00
Charlie Anderson
65f1fc806c Adds unit tests for AppWidgetsRestoredReceiver
- Makes slight adjustments (no behavior changes) to RestoreDbTask and its tests for proper separation

Test: ran unit tests
Bug: 294386159
Flag: none

Change-Id: I3d882f5edcb6a0161a203ef46a5258e9c4ffe18e
2023-10-23 14:21:50 -04:00
Charlie Anderson
8c1cf2db26 Make sure to set Launcher restore pending as false after setting in RestoreDbTaskTest to not affect state of Launcher in tests.
See tearDown method in RestoreDbTaskTest for fix.

This reverts commit 2d86f3337a.

Reason for revert: fixing the issues for revert b/298077774
Test: running presubmit and affected test suite on CL

Change-Id: I94c643f38259c4e920869c231f706229390c7c2a
2023-09-20 18:43:35 +00:00
Alex Chau
2d86f3337a Revert "Move AppWidgetsRestoredReceiver methods to enable adding tests for restoring widget Ids"
This reverts commit 5f263a7ae1.

Bug: 294386159
Reason for revert: b/298077774

Change-Id: Idcfb721e980d4242330e4bd9a2f9ad0f1cc5a1b5
2023-09-13 12:36:48 +00:00
Charlie Anderson
5f263a7ae1 Move AppWidgetsRestoredReceiver methods to enable adding tests for restoring widget Ids
Bug: 294386159
Test: Ran unit tests locally
Change-Id: Ib9657e6a0faa876197e0106b8729dcc606562d09
2023-08-28 11:08:12 -04:00
Sihua Ma
59077254cd Add additional logs for widget restoration
Test: N/A
Bug: 234700507
Change-Id: I693d6f5f239502c1bea191806c8c0ea18141f8f9
2023-05-23 10:44:09 -07:00
Sunny Goyal
7bc6cdee56 Revert "Revert "Revert "Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly""""""
This reverts commit 09905cfa90.

Reason for revert: Fixed the crashing issue

Change-Id: Ibcfc28a89356d262e67e8842d6bae37e230a70f5
2023-05-13 01:59:19 -07:00
Sihua Ma
eab9f00745 Add logs for deleting widget during restoration
Test: N/A
Bug: 234700507
Change-Id: I4161ddd91675950f5f93a62b3c6b388643ec692f
2023-05-12 15:29:56 -07:00
Sunny Goyal
09905cfa90 Revert "Revert "Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly"""""
This reverts commit bca4e694f0.

Reason for revert: post submit broken

Change-Id: I8afc63b5aa67ee14127f79e2245ef543bff8cf31
2023-05-11 22:22:16 +00:00
Sunny Goyal
bca4e694f0 Revert "Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly""""
This reverts commit 3772b246c2.

Reason for revert: Fixed the test failure

Change-Id: Ibdc9e184fcb32c7caa4ab25d8753a46fa322b703
2023-05-10 17:49:16 +00:00
Sunny Goyal
3772b246c2 Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly"""
This reverts commit 8d9e468dbb.

Reason for revert: b/281179368

Change-Id: Ibfc5329f72cdbcb37d01a8bf3dac2ba0724b9faf
2023-05-06 18:18:07 +00:00
Sunny Goyal
8d9e468dbb Revert "Revert "Changing GridMigrationTask to use ModelDbController directly""
This reverts commit 30bb3a247a.

Reason for revert: Fixed original issue

Change-Id: I02d85d604631795d96f0379eb94b7b6789102ea9
2023-05-05 16:00:49 +00:00
Charlie Anderson
30bb3a247a Revert "Changing GridMigrationTask to use ModelDbController directly"
This reverts commit 9ef41413e0.

Reason for revert: This was the only launcher CL during the time  b/280669657 and 280680602 occurred

Change-Id: Id7107f0935f84908ca87e1ae4c62ab05efe41a24
2023-05-04 15:19:58 +00:00
Sunny Goyal
9ef41413e0 Changing GridMigrationTask to use ModelDbController directly
instead of using content uris

Bug: 277345535
Test: Updated tests
Flag: Presubmit
Change-Id: Ib62db3334c01d9e7d27ae7b02ea703d046e2bcaa
2023-05-03 08:54:14 -07:00
Sunny Goyal
ce953a36ec Moving ModelDbController from LauncehrProvider to LauncherModel
Migrating some of the class to use the controller directly, will
update the remaining calls in follow up cls

Bug: 277345535
Test: Presubmit
Change-Id: I8edc7c43665f94702ac64bd92932d6c94cb544a4
2023-04-14 14:13:17 -07:00
Sunny Goyal
eb27546cc3 Removing remaining code around ENABLE_DATABASE_RESTORE
ENABLE_DATABASE_RESTORE feature is already removed
Also migrating some tests from BackupRestoreTest to RestoreDbTaskTest

Bug: 270392706
Test: Presubmit
Flag: N/A
Change-Id: I71822bbc2232008b3d2b4b9fbed0db5d889591e4
2023-04-12 15:52:35 -07:00
Sihua Ma
cdb3c0af1a Use app widget host instead of holder to get rid of deleteHost
Also putting the calls to destroy() in try-finally blocks.

Test: N/A
Fix: 272535886
Change-Id: I57ecd90e412b3b8b59b4ed755a5d4191b05fd9b3
2023-03-09 11:19:18 -08:00
Sihua Ma
8bbfcb6581 Move LauncherWidgetHolder to widget package
Making LauncherAppWidgetHost package-private as well

Bug: 235358918
Test: N/A
Change-Id: If022ec8d429579a972991872b2dc11db76719341
2022-11-16 14:31:14 -08:00
Sihua Ma
aa2b872d1c Move most of the functions in LauncherAppWidgetHost to LauncherWidgetHolder
Test: N/A
Bug: 235358918
Change-Id: I343419376491203a195154f2766b12e5def38879
2022-11-16 14:30:08 -08: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
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