Fixing launcher UI not reapplied properly when IDP changed as a result of display changes
> Removing unnecessary check when binding model data as its safe to bind old data,
we should just not persist it (that check is already there in model writer)
> Adding additional check in model bind to skip old bind if there are multiple binds
Bug: 126259547
Bug: 118441555
Change-Id: Ic250d2af13797d3e70c6e1fc70da65ebe6ab8d70
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index d820448..8d029e7 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -378,14 +378,7 @@
}
if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) {
- mUserEventDispatcher = null;
- initDeviceProfile(mDeviceProfile.inv);
- dispatchDeviceProfileChanged();
- reapplyUi();
- mDragLayer.recreateControllers();
-
- // TODO: We can probably avoid rebind when only screen size changed.
- rebindModel();
+ onIdpChanged(mDeviceProfile.inv);
}
mOldConfig.setTo(newConfig);
@@ -410,8 +403,19 @@
@Override
public void onIdpChanged(int changeFlags, InvariantDeviceProfile idp) {
+ onIdpChanged(idp);
+ }
+
+ private void onIdpChanged(InvariantDeviceProfile idp) {
+ mUserEventDispatcher = null;
+
initDeviceProfile(idp);
- getRootView().dispatchInsets();
+ dispatchDeviceProfileChanged();
+ reapplyUi();
+ mDragLayer.recreateControllers();
+
+ // TODO: We can probably avoid rebind when only screen size changed.
+ rebindModel();
}
private void initDeviceProfile(InvariantDeviceProfile idp) {