[automerge] Fix crash when unfolding a device. 2p: 9af4098658

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17667413

Bug: 218980376
Change-Id: I0d19083ef761fa14a4c5085c1c84f69df7164f10
This commit is contained in:
Presubmit Automerger Backend
2022-04-09 03:18:28 +00:00

View File

@@ -200,12 +200,23 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
rotateRectToDisplayRotation(displayId, featureRect);
transformToWindowSpaceRect(activity, featureRect);
features.add(new FoldingFeature(featureRect, baseFeature.getType(), state));
if (!isRectZero(featureRect)) {
// TODO(b/228641877) Remove guarding if when fixed.
features.add(new FoldingFeature(featureRect, baseFeature.getType(), state));
}
}
}
return features;
}
/**
* Returns {@link true} if a {@link Rect} has zero width and zero height,
* {@code false} otherwise.
*/
private boolean isRectZero(Rect rect) {
return rect.width() == 0 && rect.height() == 0;
}
private final class NotifyOnConfigurationChanged extends EmptyLifecycleCallbacksAdapter {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {