From df7bb7966c32ccc679726976e195dd768f39e63f Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 7 Mar 2025 16:50:05 +0000 Subject: [PATCH] Check before casting to TaskMenuView on rotation - Added a instanceof check to avoid ClassCastException Fix: 400957867 Flag: EXEMPT BUG_FIX Test: manual testing rotation on phone and tablet Change-Id: I2b094fdca4f380128b50d5086548cbac3ef09bf4 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 2c84e52614..4aea4f7e96 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2905,10 +2905,10 @@ public abstract class RecentsView< if (!shouldRotateMenuForFakeRotation) { return; } - TaskMenuView tv = (TaskMenuView) getTopOpenViewWithType(mContainer, TYPE_TASK_MENU); - if (tv != null) { + AbstractFloatingView floatingView = getTopOpenViewWithType(mContainer, TYPE_TASK_MENU); + if (floatingView instanceof TaskMenuView taskMenuView) { // Rotation is supported on phone (details at b/254198019#comment4) - tv.onRotationChanged(); + taskMenuView.onRotationChanged(); } }