Merge "Add logging for each migration type" into main

This commit is contained in:
Treehugger Robot
2025-03-14 09:31:34 -07:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 0 deletions
@@ -883,6 +883,13 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "Work utility view shrink animation ended")
LAUNCHER_WORK_UTILITY_VIEW_SHRINK_ANIMATION_END(2078),
@UiEvent(doc = "Standard grid migration occurred")
LAUNCHER_STANDARD_GRID_MIGRATION(2200),
@UiEvent(doc = "Row shift grid migration occurred")
LAUNCHER_ROW_SHIFT_GRID_MIGRATION(2201),
// ADD MORE
;
@@ -20,6 +20,8 @@ import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
import static com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE;
import static com.android.launcher3.Utilities.SHOULD_SHOW_FIRST_PAGE_WIDGET;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ROW_SHIFT_GRID_MIGRATION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_STANDARD_GRID_MIGRATION;
import static com.android.launcher3.model.LoaderTask.SMARTSPACE_ON_HOME_SCREEN;
import static com.android.launcher3.provider.LauncherDbUtils.copyTable;
import static com.android.launcher3.provider.LauncherDbUtils.dropTable;
@@ -44,6 +46,7 @@ import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
@@ -127,6 +130,8 @@ public class GridSizeMigrationDBController {
return true;
}
StatsLogManager statsLogManager = StatsLogManager.newInstance(context);
boolean shouldMigrateToStrictlyTallerGrid = (Flags.oneGridSpecs() || isDestNewDb)
&& srcDeviceState.getColumns().equals(destDeviceState.getColumns())
&& srcDeviceState.getRows() < destDeviceState.getRows();
@@ -152,6 +157,7 @@ public class GridSizeMigrationDBController {
// Save current configuration, so that the migration does not run again.
destDeviceState.writeToPrefs(context);
t.commit();
statsLogManager.logger().log(LAUNCHER_ROW_SHIFT_GRID_MIGRATION);
return true;
}
@@ -163,6 +169,7 @@ public class GridSizeMigrationDBController {
destDeviceState.getNumHotseat(), targetSize, srcDeviceState, destDeviceState);
dropTable(t.getDb(), TMP_TABLE);
t.commit();
statsLogManager.logger().log(LAUNCHER_STANDARD_GRID_MIGRATION);
return true;
} catch (Exception e) {
Log.e(TAG, "Error during grid migration", e);
@@ -30,6 +30,9 @@ import com.android.launcher3.LauncherSettings.Favorites.TMP_TABLE
import com.android.launcher3.Utilities
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.logging.FileLog
import com.android.launcher3.logging.StatsLogManager
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ROW_SHIFT_GRID_MIGRATION
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_STANDARD_GRID_MIGRATION
import com.android.launcher3.model.GridSizeMigrationDBController.DbReader
import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction
import com.android.launcher3.provider.LauncherDbUtils.copyTable
@@ -58,6 +61,8 @@ class GridSizeMigrationLogic {
return
}
val statsLogManager: StatsLogManager = StatsLogManager.newInstance(context)
val isAfterRestore = get(context).get(LauncherPrefs.IS_FIRST_LOAD_AFTER_RESTORE)
FileLog.d(
TAG,
@@ -90,6 +95,7 @@ class GridSizeMigrationLogic {
// Save current configuration, so that the migration does not run again.
destDeviceState.writeToPrefs(context)
t.commit()
statsLogManager.logger().log(LAUNCHER_ROW_SHIFT_GRID_MIGRATION)
return
}
@@ -119,6 +125,7 @@ class GridSizeMigrationLogic {
dropTable(t.db, TMP_TABLE)
t.commit()
statsLogManager.logger().log(LAUNCHER_STANDARD_GRID_MIGRATION)
}
} catch (e: Exception) {
FileLog.e(TAG, "Error during grid migration", e)