Fix crash from folding/unfolding

This is fundamentally caused by the phone device profile not having task bar related attributes, which crashes in icon alignment animation. We had resolved it by skipping this animation based on isPhoneMode check. However, we passed in launcherDp instead of taskbarDp (from TaskbarActivityContext) which doesn't always have the most up to date information in race conditions (e.g. repetitively fold/unfold)

Fixes: 311431054
Test: repetively fold/unfold, make sure it doesn't crash
Change-Id: I65f600112da4123d337b3f59a2fe6dd13ac7af74
This commit is contained in:
Tracy Zhou
2023-11-22 22:43:52 -08:00
parent f2643521ec
commit 95c4c8d268
20 changed files with 77 additions and 93 deletions
@@ -107,7 +107,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
mControllers = controllers;
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
Resources resources = mActivity.getResources();
if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) {
if (mActivity.isPhoneGestureNavMode()) {
mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_phone_size);
mStashedHandleWidth =
resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen);
@@ -120,7 +120,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin;
mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue(
isPhoneGestureNavMode(deviceProfile) ? 1 : 0);
mActivity.isPhoneGestureNavMode() ? 1 : 0);
mTaskbarStashedHandleHintScale.updateValue(1f);
final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight();
@@ -148,7 +148,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
view.setPivotY(stashedCenterY);
});
initRegionSampler();
if (isPhoneGestureNavMode(deviceProfile)) {
if (mActivity.isPhoneGestureNavMode()) {
onIsStashedChanged(true);
}
}
@@ -184,10 +184,6 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
mRegionSamplingHelper = null;
}
private boolean isPhoneGestureNavMode(DeviceProfile deviceProfile) {
return TaskbarManager.isPhoneMode(deviceProfile) && !mActivity.isThreeButtonNav();
}
public MultiPropertyFactory<View> getStashedHandleAlpha() {
return mTaskbarStashedHandleAlpha;
}