From 72823fabdd5a41ba2b11a106b22c86564a084f96 Mon Sep 17 00:00:00 2001 From: aosp-builder Date: Mon, 7 Sep 2026 17:00:29 +0000 Subject: [PATCH 1/2] WMShell: avoid instanceof-pattern syntax protologtool can't parse BubbleStackView.java used `instanceof View view` (Java 16 instanceof pattern matching). javac itself compiles this fine, but the WMShell module's protolog genrules (generate-wm_shell_protolog.json, gen-wmshell.protolog.pb) run protologtool over every source file in :wm_shell-sources looking for ProtoLog.* calls, using its own bundled Java parser -- which doesn't support this syntax and fails the whole module's build with a parse error at this file, even though this file has nothing to do with ProtoLog. Confirmed via grep this was the only instanceof-pattern occurrence in the module. Rewrote as a classic instanceof + explicit cast; behavior is identical. --- .../src/com/android/wm/shell/bubbles/BubbleStackView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index 474430eb44ab6..df01261255df4 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -450,7 +450,11 @@ public void setValue(Object o, float v) { @Override public void onStuckToTarget(@NonNull MagnetizedObject.MagneticTarget target, @NonNull MagnetizedObject draggedObject) { - if (draggedObject.getUnderlyingObject() instanceof View view) { + // Plain instanceof + cast, not instanceof-pattern -- protologtool's + // bundled Java source parser (scans this whole module for ProtoLog + // calls) doesn't support Java 16 instanceof pattern variables. + if (draggedObject.getUnderlyingObject() instanceof View) { + View view = (View) draggedObject.getUnderlyingObject(); animateDismissBubble(view, true); } } From d8849fd2410c91f8cf5d18c28902fd41b805ff81 Mon Sep 17 00:00:00 2001 From: aosp-builder Date: Mon, 7 Sep 2026 17:52:19 +0000 Subject: [PATCH 2/2] WMShell: fix remaining instanceof-pattern occurrences in BubbleStackView Follow-up to 301830f6ac09 -- that fix only addressed the first of three identical `instanceof View view` occurrences in this file (grep -l only reports a filename once per match, which hid the other two). Rewrote onUnstuckFromTarget() and onReleasedInTarget() the same way: classic instanceof + explicit cast, since protologtool's bundled Java parser can't handle Java 16 instanceof pattern variables. Confirmed via a full grep of the file that all remaining instanceof usages are already classic-style -- none left to fix. --- .../src/com/android/wm/shell/bubbles/BubbleStackView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index df01261255df4..2e8a1d76a9648 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -463,7 +463,8 @@ public void onStuckToTarget(@NonNull MagnetizedObject.MagneticTarget target, public void onUnstuckFromTarget(@NonNull MagnetizedObject.MagneticTarget target, @NonNull MagnetizedObject draggedObject, float velX, float velY, boolean wasFlungOut) { - if (draggedObject.getUnderlyingObject() instanceof View view) { + if (draggedObject.getUnderlyingObject() instanceof View) { + View view = (View) draggedObject.getUnderlyingObject(); animateDismissBubble(view, false); if (wasFlungOut) { @@ -478,7 +479,8 @@ public void onUnstuckFromTarget(@NonNull MagnetizedObject.MagneticTarget target, @Override public void onReleasedInTarget(@NonNull MagnetizedObject.MagneticTarget target, @NonNull MagnetizedObject draggedObject) { - if (draggedObject.getUnderlyingObject() instanceof View view) { + if (draggedObject.getUnderlyingObject() instanceof View) { + View view = (View) draggedObject.getUnderlyingObject(); mExpandedAnimationController.dismissDraggedOutBubble( view /* bubble */, mDismissView.getHeight() /* translationYBy */,