Add more logs to investigate empty launcher restore

Flag: EXEMPT logs
Test: presubmit
Bug: 377510898
Change-Id: I1c05b90c9e1337663c4c06703ad14b6c0d00aa07
This commit is contained in:
Charlie Anderson
2024-12-06 16:32:03 -05:00
parent 3f04014298
commit bad2be4944
4 changed files with 35 additions and 2 deletions

View File

@@ -124,11 +124,13 @@ public class RestoreDbTask {
LauncherPrefs.get(context).removeSync(RESTORE_DEVICE);
DeviceGridState deviceGridState = new DeviceGridState(context);
FileLog.d(TAG, "restoreIfNeeded: deviceGridState from context: " + deviceGridState);
String oldPhoneFileName = deviceGridState.getDbFile();
List<String> previousDbs = existingDbs(context);
removeOldDBs(context, oldPhoneFileName);
// The idp before this contains data about the old phone, after this it becomes the idp
// of the current phone.
FileLog.d(TAG, "Resetting IDP to default for restore dest device");
idp.reset(context);
trySettingPreviousGridAsCurrent(context, idp, oldPhoneFileName, previousDbs);
}
@@ -144,17 +146,24 @@ public class RestoreDbTask {
context, oldPhoneDbFileName);
// The grid option could be null if current phone doesn't support the previous db.
if (oldPhoneGridOption != null) {
FileLog.d(TAG, "trySettingPreviousGridAsCurrent:"
+ ", oldPhoneDbFileName: " + oldPhoneDbFileName
+ ", oldPhoneGridOption: " + oldPhoneGridOption
+ ", previousDbs: " + previousDbs);
/* If the user only used the default db on the previous phone and the new default db is
* bigger than or equal to the previous one, then keep the new default db */
if (previousDbs.size() == 1 && oldPhoneGridOption.numColumns <= idp.numColumns
&& oldPhoneGridOption.numRows <= idp.numRows) {
/* Keep the user in default grid */
FileLog.d(TAG, "Keeping default db from restore as current grid");
return;
}
/*
* Here we are setting the previous db as the current one.
*/
FileLog.d(TAG, "Setting grid from old device as current grid: "
+ "oldPhoneGridOption:" + oldPhoneGridOption.name);
idp.setCurrentGrid(context, oldPhoneGridOption.name);
}
}