Commit Graph

83 Commits

Author SHA1 Message Date
Charlie Anderson
bad2be4944 Add more logs to investigate empty launcher restore
Flag: EXEMPT logs
Test: presubmit
Bug: 377510898
Change-Id: I1c05b90c9e1337663c4c06703ad14b6c0d00aa07
2024-12-06 22:14:19 +00:00
fbaron
8f26e042b2 Remove flags that are no longer necessary
Flag: EXEMPT code cleanup
Test: GridSizeMigrationTest
Bug: b/325286145, b/325285743
Change-Id: I056021c299b56a186b754b94b33509d0b01816e0
2024-11-05 14:22:37 -08:00
fbaron
ebc10c9ecc OneGrid Grid Option Updates
Bug: 330900048
Flag: com.android.launcher3.one_grid_specs
Test: n/a
Change-Id: I919195dbc7ac78c3be42f0f9d7620193a24d7e99
2024-10-30 11:38:09 -07:00
fbaron
b633b9aa2b Fix for bug where we don't use default grid on comet, and migrate normally if not in a B&R case
-The grid migration where we just copy the grid and move everything one row up should only occur in a B&R scenario, so now we add that restriction
-We should default to 4x5 in comet if migrating from a 4x4 grid if the device we're migrating from does not have any other grids saved
-if we have other grids saved, then we'll try using the saved grid if possible. If not possible, we use the default grid for the new device

Bug: 360462379
Test: GridSizeMigrationUtilTest
Flag: EXEMPT bugfix
Change-Id: Ia905081046431c08dc058bd61b2b4ab42dee0506
2024-09-24 16:52:05 -07:00
Charlie Anderson
7cc4302f10 Send additional Extras in first screen broadcasts, to help with app archiving.
- refactor FirstScreenBroadcast.java into FirstScreenBroadcastHelper.kt
	- send Extras to include installed/archived items on first screen
	- send Extras to include installed/archived widgets on all screens.
	- truncate items to limit Broadcast size

Bug: 322314760
Test: unit testing and E2E test of B&R
Flag: launcher_broadcast_installed_apps

Change-Id: I214149ac0c63f177d3d1ca0b6d0cb11be37f4ae0
2024-06-13 21:29:50 +00:00
Sunny Goyal
10fa016352 Fixing MainThreadInitializedObject
> Making SafeCloseable implementation mandatory, to prevent leaks during test and preview
> Removing getNoCreate method and defining executeIfCreated to avoid null pointer exceptions
> Fixing sandbox value leaking into main, by Checking sandbox against App context
> Converting sanbox to an interface instead a class

Bug: 335280439
Test: Presubmit
Flag: None
Change-Id: I951dcde871898e745ff6490a1c4f8fd1512888f5
2024-04-22 17:04:33 -07:00
Sebastián Franco
7afe302bda Merge "If the user only had the default db, then migrate to the new default" into main 2024-04-12 16:55:13 +00:00
Sebastian Franco
12678a536b If the user only had the default db, then migrate to the new default
We also check if the new default is bigger than or equal to the
previous one.

Flag: ACONFIG enable_grid_migration_fix enabled
Flag: ACONFIG enable_narrow_grid_restore enabled
Bug: 325286145
Bug: 325285743
Test: BackupAndRestoreDBSelectionTest.kt
Test: GridMigrationTest.kt
Change-Id: I98315a4e4c112ca96a74200dd76016803dfaf820
2024-04-10 10:28:52 -07:00
Sunny Goyal
11117d9b2a Using resource override instead of code-swap for ApiWrapper
Bug: 330920490
Flag: None
Test: Presubmit
Change-Id: Iac19f32e64d2c76ed5b4f8592943ee4ae7af51b5
2024-04-09 11:14:44 -07:00
Sebastian Franco
df7d2b0861 Set default grid when doing a backup and restore
When restoring from a tablet because phones don't have
the same table some issues can ocure because we setup a
non valid grid, the correct thing is to setup a default.

Bug: 325285743
Fix: 332964986
Flag: ACONFIG narrow_grid_restore enabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I28bf02e83dddf5ae84818d879a5e21600eddf67e
2024-04-05 08:53:32 -07:00
Sunny Goyal
77954bae4e Cleaning up some build configurations
> Removing Launcher3Go-without-quickstep
> Removing src_ui_overrides to src_no_quickstep
> Removing unnecessary code swpa for GO builds

Bug: 330920490
Flag: None
Test: Presubmit, everything builds
Change-Id: I5746dbc7c5a37c1d99d78b55bf2a6adce1a711c9
2024-03-26 17:16:52 +00:00
Charlie Anderson
7779852bbe add more logging for failure to load Widgets
Bug: 294386159
Test: locally
Flag: N/A
Change-Id: Ib1fc2c28d1f20142658077047bbe6bc2eabe49d4
2024-03-22 10:43:49 -04:00
Sebastian Franco
5ea61960ab Making 2 flags read only since they are used on backup and restore
The flags are narrow_grid_restore and grid_migration_fix.

Flag: ACONFIG enable_grid_migration_fix enabled
Flag: ACONFIG enable_narrow_grid_restore enabled
Bug: 325286145
Bug: 325285743
Test: BackupAndRestoreDBSelectionTest.kt
Test: GridMigrationTest.kt
Change-Id: Ia6a439553c3c5098115144eae532342ce73be4f2
2024-03-14 17:16:51 +00:00
Sebastián Franco
ad46eb75f4 Revert^4 "Removing all restored backups except one so we don't have old backups"
To prevent the error I introduce the method restorePreviousState().

This reverts commit 1234090589.

Reason for revert: Fixing presubmit breaks

Bug: 325285743
Flag:  ACONFIG narrow_grid_restore disabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I63666c29eb91dada4243af019ab0538c40bc0f78
2024-03-12 11:01:26 -07:00
Sebastián Franco
1234090589 Revert^3 "Removing all restored backups except one so we don't have old backups"
This reverts commit 4b960d1f11.

Reason for revert: Breaking presubmit, no bug number yet 

Change-Id: I0bafad8bf63fae1d9408b65c6c18c79ab5d40d05
2024-03-11 20:15:24 +00:00
Sebastián Franco
4b960d1f11 Revert^2 "Removing all restored backups except one so we don't have old backups"
This reverts commit 3306fa5325.

Reason for revert: Fixing issue that caused b/328782012

Change-Id: Ib6a1bbfeedf608f5f77ac6be500271e811320f32
2024-03-08 18:53:57 +00:00
Sebastián Franco
3306fa5325 Revert "Removing all restored backups except one so we don't have old backups"
This reverts commit bd43b9344f.

Reason for revert: b/328782012

Change-Id: I1666fbd63d82da06ed8c3d9ce58b5ed6b298618b
2024-03-08 18:42:30 +00:00
Sebastian Franco
bd43b9344f Removing all restored backups except one so we don't have old backups
Adding test to make sure this is the case.

Bug: 325285743
Flag:  ACONFIG narrow_grid_restore disabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I84c3a92f40598137d5c5c52d34af7583b384122c
2024-03-07 11:23:55 -06:00
Andy Wickham
b922dccbf5 Cleanup API checks for P, Q, and R.
Test: Build with gradle
Flag: NA
Change-Id: I3ef17090741d14bebd76cf09cf3dc5ac4f11e686
2024-01-24 14:58:08 -08:00
Sunny Goyal
d24d33925a Using WidgetInflater in loader task
This removes duplicate logic for widget inflation.
Since the widget inflation can now happen during loader,
the restore logging can also be moved completely to the loader

Bug: 318539160
Test: atest TaplBinderTests
Flag: None
Change-Id: If9f336e7bf49ee7df121d7d9852b674d98124895
2024-01-14 00:56:51 -08:00
Charlie Anderson
da3138cd91 Replace ENABLE_LAUNCHER_BR_METRICS flags with fixed aconfig flag.
This is necessary because the value of the read-write flag will not be updated in time for backup/restore.

Bug: 307527314
Test: compiles
Flag: ACONFIG ENABLE_LAUNCHER_BR_METRICS_FIXED TEAMFOOD
Change-Id: I67a1a820734d8881b3ed5be4a1f2f1556e6e4704
2024-01-12 14:33:29 -05:00
Charlie Anderson
a4240c72c0 Adds a legacy flag to enable Launcher BR metrics.
This is necessary because the aconfig flag requires reboot to enable, however backup/restore happens on the first load so the flag will not be ready.

Flag: LEGACY ENABLE_LAUNCHER_BR_METRICS TEAMFOOD
Test: compilation / presubmit
Bug: 305984208
Change-Id: Ida90b1bd485fb037ebf3dde7ad17bf4e462661e6
2024-01-04 17:40:51 -05:00
Charlie Anderson
f0b1ddc038 Merge "Adds restore metrics to RestoreDbTask.java" into main 2024-01-04 22:25:09 +00:00
Charlie Anderson
1fcf8da4e5 Adds restore metrics to RestoreDbTask.java
Bug: 307527314
Flag: ACONFIG enable_launcher_br_metrics TEAMFOOD
Test: locally verified
Change-Id: I105b17276cf7e2c270c819854a8fbc269b7c81b4
2024-01-03 22:06:44 +00:00
Charlie Anderson
d6fc23f230 Adding extensions for backup restore test
Bug: 294386159
Test: presubmit
Flag: N/A
Change-Id: I4acc48c0bdd967d3c5463c85acd275a57d4a28ba
2024-01-02 16:19:32 -05:00
Charlie Anderson
511421c12f Adds logging for Launcher restore metrics in Launcher and LoaderTask
- Adds flag for indicating when we are loading after a restore, separate from the pending restore flag
- Adds many success/failure scenario metrics when loading and binding items

Flag: ACONFIG enable_launcher_br_metrics DEVELOPMENT
Test: locally verified
Bug: 307527314
Change-Id: I9d2660f6d9d7cd5813072201e96b1a64aec4ea4b
2023-12-18 19:32:02 +00:00
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
Charlie Anderson
c9d11e8208 add logging for Launcher backup and restore events
Test: Manually verify logs
Bug: 294386159
Change-Id: Ic3a77f4a09556e0d769837129e0bd094f1e91b6b
2023-08-16 13:24:22 -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
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
Sunny Goyal
ba2795827b Moving DatabaseHelper to it's own class outside of Launcher provider
Bug: 277345535
Test: Presubmit
Flag: N/A
Change-Id: Ib8c94ceb954172dc27e357be2face06d50d399dd
2023-04-10 09:15:18 -07:00
Sihua Ma
6741e0d9ad Merge "Use app widget host instead of holder to get rid of deleteHost" into tm-qpr-dev am: 713931ec38 am: 7560a917d9
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21408002

Change-Id: I4aca6e225b37223c39cc3990649f7c70c4c95e40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-09 23:48:29 +00: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
Nicolas Sleiman
31e9fa4ba2 Replace the launcher telephony apps with the default work profile one
when using AutoInstalls or when restoring, and when work telephony is
enabled.

Test: atest RestoreDbTaskTest
Bug: 258631628
Change-Id: I3e699e5c34c09daf60e29724eda04282493673e7
2023-03-02 16:02:07 +00:00
Stefan Andonian
d1b33b311c Expanded LauncherPrefs APIs to Replace Direct Shared Preference Usage.
LauncherPrefs will contain Launcher's shared preference functionality.
It controls optimizations and classifications such as restorable vs
non-restorable data, bootaware vs non-bootaware data, and configurations
such as default values  so the calling code doesn't need to and our code
base can have a single source of truth for items that are used in
multiple places.

The old APIs remain in place, but are deprecated and will be removed
after all Shared Preference usage has been gated by LauncherPrefs in
future CLs.

Bug: 261635315
Test: Manually tested themed icon, Workspace configuration, and app
install functionality.

Change-Id: I29fd516468bc93fda393062e95be26b6d55c816e
2023-01-14 00:54:15 +00:00
Sihua Ma
1db8bc2467 Add QuickstepWidgetHolder for widget handling
Fix: 235358918
Test: Manual
1. Rebooted the device and verified that widgets are still updating properly
2. Changed the theme from dark to daylight, then from daylight back to dark and verified that widgets are working
3. Kept the device on for several days and verified that widgets are still updating
4. Turn on auto-rotate for the launcher, open any app then exit, verified that widgets will not vanish and reappear
5. Add & remove widgets from the screen, added widgets are still updating

Change-Id: I98ee902f7d16b47bd77626201a4fefc897ba17a0
2022-12-16 11:56:36 -08:00
Stefan Andonian
146701ca3e Move SharedPreferences code to its own class.
Bug: 251502424
Test: Code compiled correctly.
Change-Id: Iea0d6ab2999504117546ee0f7adc0c7b8b45c065
2022-11-17 17:22:47 +00: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