Refresh DisplayContext to prevent getting stale DisplayMetrics
Bug: 176656141
Test: Change font size or display size, it should reflect on home screen icon/text sizes.
Change-Id: I39bb9d11d246c7ccea1ea4d5af37fba3ce0001be
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 83a7d77..9992fde 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -648,8 +648,13 @@
public boolean updateIsSeascape(Context context) {
if (isVerticalBarLayout()) {
// Check an up-to-date info.
- boolean isSeascape = DisplayController.getDefaultDisplay(context)
- .createInfoForContext(context).rotation == Surface.ROTATION_270;
+ DisplayController.Info displayInfo = DisplayController.getDefaultDisplay(context)
+ .createInfoForContext(context);
+ if (displayInfo == null) {
+ return false;
+ }
+
+ boolean isSeascape = displayInfo.rotation == Surface.ROTATION_270;
if (mIsSeascape != isSeascape) {
mIsSeascape = isSeascape;
return true;