Search in sources :

Example 11 with GridBackupTable

use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Trebuchet by LineageOS.

the class RestoreDbTask method restoreWorkspace.

private void restoreWorkspace(@NonNull Context context, @NonNull SQLiteDatabase db, @NonNull DatabaseHelper helper, @NonNull BackupManager backupManager) throws Exception {
    final InvariantDeviceProfile idp = LauncherAppState.getIDP(context);
    GridBackupTable backupTable = new GridBackupTable(context, db, idp.numHotseatIcons, idp.numColumns, idp.numRows);
    if (backupTable.restoreFromRawBackupIfAvailable(getDefaultProfileId(db))) {
        int itemsDeleted = sanitizeDB(helper, db, backupManager);
        LauncherAppState.getInstance(context).getModel().forceReload();
        restoreAppWidgetIdsIfExists(context);
        if (itemsDeleted == 0) {
            // all the items are restored, we no longer need the backup table
            dropTable(db, Favorites.BACKUP_TABLE_NAME);
        }
    }
}
Also used : GridBackupTable(com.android.launcher3.model.GridBackupTable) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile)

Aggregations

InvariantDeviceProfile (com.android.launcher3.InvariantDeviceProfile)9 GridBackupTable (com.android.launcher3.model.GridBackupTable)8 LauncherDbUtils (com.android.launcher3.provider.LauncherDbUtils)4 SharedPreferences (android.content.SharedPreferences)3 Cursor (android.database.Cursor)3 Point (android.graphics.Point)3 Utilities.getPointString (com.android.launcher3.Utilities.getPointString)3 Utilities.parsePoint (com.android.launcher3.Utilities.parsePoint)3 SQLiteTransaction (com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction)3