Set default value of gridName to current grid name in GridOptionsProvider

With grid preview, a grid name is passed in when requesting preview under different grid setting. With wallpaper preview, no such grid name will be passed in, and it should be set to the current.

Bug: 145242344
Test: N/A
Change-Id: I282cb5341b7f3756d41c4abd8d97f986abaa6d27
This commit is contained in:
Tracy Zhou committed 2020-03-18 16:52:28 -07:00
1 parent 24b449d557
commit 42255d22a7
2 files changed
+11 -4

No files matched your search

@@ -162,9 +162,7 @@ public class InvariantDeviceProfile {
"PreviewContext is passed into this IDP constructor");
}
String gridName = Utilities.getPrefs(context).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)
? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null)
: null;
String gridName = getCurrentGridName(context);
initGrid(context, gridName);
mConfigMonitor = new ConfigMonitor(context,
APPLY_CONFIG_AT_RUNTIME.get() ? this::onConfigChanged : this::killProcess);
@@ -188,6 +186,12 @@ public class InvariantDeviceProfile {
initGrid(context, null, new Info(display));
}
public static String getCurrentGridName(Context context) {
return Utilities.getPrefs(context).getBoolean(GRID_OPTIONS_PREFERENCE_KEY, false)
? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null)
: null;
}
/**
* Retrieve system defined or RRO overriden icon shape.
*/