From 2b0cdbbc87fed02456d3cadeeba484cd48ec3d3d Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Wed, 4 Dec 2024 17:21:56 -0800 Subject: [PATCH] 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 --- src/com/android/launcher3/InvariantDeviceProfile.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index dfbcf5c439..4d8cf20d29 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -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; }