Make sure GRID_NAME is updated every time it changes.

Bore it was only updated when the device was innitialized,
but other changes to the IDP would not udpate the GRID_NAME pref.

Fix: 380954618
Test: NA
Flag: com.android.launcher3.one_grid_specs
Change-Id: I4fa73a4b838c0d0c7c1c88ea91c62ac8ae6676b7
This commit is contained in:
Sebastian Franco
2024-12-04 17:21:56 -08:00
committed by Sebastián Franco
parent d0b6a849ad
commit 2b0cdbbc87

View File

@@ -240,10 +240,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
@TargetApi(23)
private InvariantDeviceProfile(Context context) {
String gridName = getCurrentGridName(context);
String newGridName = initGrid(context, gridName);
if (!newGridName.equals(gridName)) {
LauncherPrefs.get(context).put(GRID_NAME, newGridName);
}
initGrid(context, gridName);
DisplayController.INSTANCE.get(context).setPriorityListener(
(displayContext, info, flags) -> {
@@ -367,6 +364,11 @@ public class InvariantDeviceProfile implements SafeCloseable {
? new ArrayList<>(allOptions)
: new ArrayList<>(allOptionsFilteredByColCount),
displayInfo.getDeviceType());
if (!displayOption.grid.name.equals(gridName)) {
LauncherPrefs.get(context).put(GRID_NAME, displayOption.grid.name);
}
initGrid(context, displayInfo, displayOption);
return displayOption.grid.name;
}