1. Instead of debouncing launcher restore when new install session
(triggered by Play Service due to restore) is created, it is now
throttled at once every 30 seconds. (i.e. Launcher restore is triggered
immediately, but cannot be triggered again within 30 seconds)
2. Removes the backup table when all items are restored. (i.e. no item
were removed as a result of sanitize db due to user didn't sign in to
their work profile)
Bug: 153648870
Change-Id: I32df371f8b47c60a72515876217fd83ac1e56f0a
Test: manually verified with deferred restore
- Init KEY_MIGRATION_SRC_WORKSPACE_SIZE and KEY_MIGRATION_SRC_HOTSEAT_COUNT
- Load default workspace only when default db is created, not when peeking into dbs of other grid options during grid preview / migration
Fixes: 154184711
Test: run grid preview and migration right after a cleared cache Pixel Launcher
Change-Id: I86c7072b8c4a9da76e289c55ab440071f192fc38
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
go/grid-migration-v2
When changing grid from option 1 to option 2, we calculate the diff and add the icons that are in option 1 but not option 2, to option 2's workspace, according to the reading order.
Test: manual and unit tests
Fixes: 144052802
Change-Id: Id01f69e90ce656a9b7c9051fed499807ee9ac0f7
The flag is only set when building from Android Studio... and is never
used for dogfood.
Test: local
Change-Id: I898d585f4558c2437f0152ef102bea59c351f80b
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
1. Create feature flag for new backup & restore flow.
2. For each restore session (install reason is restore),
if its creation time is newer than the one we have in
SharedPreference, we update the entry and restores
favorite table from backup.
3. The restore operation is debounced so that when
multiple restore session is created within a small
amount of time, only the last invocation will get
executed.
Bug: 141472083
Change-Id: I7b5b63ec28741ba2b02ccfd13f591c961362ba36
Test:
1. apply on master, build & flash on physical device.
2. factory reset the device.
3. go through SuW, perform restore, exit without
adding work profile.
4. settings -> account -> add work profile account.
5. finish work profile setup, verify work profiles
is restored as well.
(see go/play-launcher-plan-launcher-implementation)
1. When Launcher launches for the first time, creates a backup
of the workspace before sanitizing db entries.
2. Creates a new path in LauncherProvider that triggers workspace
restore using last stable db entry of the same grid size.
3. When restore from backup created this way, the table will be
sanitized afterward.
Test:
1. apply on master, build & refresh on physical device
2. factory reset, go through SuW and perform restore
3. exit SuW without signing into Work Profile
4. run following commands in console
adb root
adb remount
adb pull
/data/data/com.google.android.apps.nexuslauncher/databases/launcher.db
sqlite3 ./launcher.db
.tables
SELECT * FROM favorites_bakup;
Bug: 141472083
Change-Id: I8032866a97eb333946d4f62352595d180364126b
> Changing the lifecycle to follow other static objects in Launcher
> Removing compat interface and inlining everything to helpers
Bug: 141376165
Change-Id: I82bd5db1969101de9a7eac77f32728d70195bb35
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
The autority of the provider should be set in secure settings:
launcher3.layout.provider
Bug: 127987071
Change-Id: Iccf2960aa6c0a5a8ff9621b13d8963d9daecb993
Favorites table is copied as a separate table name during the first grid migration.
On subsequent migrations this backup table is used if it exists, otherwise new
backup is created. The backup table is also removed if there is any insert or
delete operation on the db (outside of the migration operation itself).
Bug: 111850268
Bug: 121048571
Change-Id: I6f02f4a355c369ee99d89430971be258f7516f6e
Removing a separate table for workspace screens. List of screens are
automatically parsed using the items in the favorites DB. Order of the
screen based on the screen id and rearranging screens is no longer
supported. In case the screens need to be rearranged, all the items
in the favorites db will need to be updated with new screen ids.
This makes backing up the DB (in the same database) easier as only
one table needs to be duplicates.
Change-Id: I8ba947a898f637d780e2f49925e78604263126e8
> Items ids were already being typecasted to int when being bound on the UI
> Using a consistent type allow better use of platform data-structures
> Adding IntArray and IntSet as a replacement for various Collection classes
Change-Id: Id3c650ed2420c2bfca3bd7671d2b705b56112371
This is the first step in adding a flag toggler UI to launcher.
The change migrates a single flag (QSB_ON_FIRST_SCREEN) from a
boolean constant to a boolean method. In future, that will allow
us to return different values at runtime.
Bug: 117223984
Change-Id: I1e62c91dd941b8145166021bc0aa157733e62ea0
With the new Folder permutation logic, we change the position of the items
when they are added to a Folder. This means that existing Folders will
now appear in a different order than the user arranged them in.
This change makes sure that when a user upgrades, their existing Folders
will appear untouched.
Note: We decided to priotize restoring the original layout of the Folder,
as opposed to making sure the preview items remain the same. This
is less destructive of users' data (we're changing the window into
the Folder, but not the location of items when the Folder is open).
Bug: 63115141
Bug: 35064148
Change-Id: Ib0a28b4b50be089878ffc3e40bced89832e125bc
Adding a schema file for handling DB downgrade. This schema file is part of
the backup/restore set, and hence is available on a device with lower app version.
Bug: 37257575
Change-Id: I69c8ef5f28d5209be6e6679412c7459d4eeda5d0
During restore, the data can be in inconsistant state, as the
system is yet to give us the widget map. Deleting the widget during
open would cause the AppWidgetRestoredReceiver to store the widget id
after it has been deleted.
Bug: 37935101
Bug: 38029633
Change-Id: Id3b8766229718239ae784794e848dcfbc74658ac
> Adding SQLiteTransaction to make it easier to manage DB transactions
> Using try-with resource for better resource handling
> Defining utility method for iterating over cursor
Change-Id: I20b1a62d61798342825ecfeb971e1a0c63c9b6d7
> A one-time DB update for removing any existing ghost widgets
> Handling widget cleanup when we bulk delete workspace items during loader
> Simplifying external delete
Bug: 35634653
Change-Id: Id0c520f57aee6d75d9c0e7bcd5786a464bf9f39f