From 2f8ce896dbac5b9d839a5a9874b87bb726deb62f Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Thu, 18 May 2023 10:52:37 -0700 Subject: [PATCH] Don't show user education if it's hiding If we get an onWindowInsets change while the user education is showing (and the user is interacting with it so it's 'going away') we can end up in a state where we trigger the user education to show again when it shouldn't. I've found this pretty tough to repro, I think this is the issue and should fix it. Bug: 282618534 Test: manual - adb shell pm clear com.android.systemui - adb shell am restart - add a bubble, tap / drag slightly on it to show the user education - tap again, user education goes away - repeat this a whole bunch Change-Id: I05dcfed7466527e26bdce6af5988f5c178203602 --- .../src/com/android/wm/shell/bubbles/BubbleStackView.java | 2 +- .../src/com/android/wm/shell/bubbles/StackEducationView.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 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 8e9fc1131e4aa..e4a915780d0d4 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 @@ -1338,7 +1338,7 @@ public class BubbleStackView extends FrameLayout // Recreates & shows the education views. Call when a theme/config change happens. private void updateUserEdu() { - if (isStackEduVisible()) { + if (isStackEduVisible() && !mStackEduView.isHiding()) { removeView(mStackEduView); mStackEduView = new StackEducationView(mContext, mPositioner, mBubbleController); addView(mStackEduView); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt index 627273f093f33..d0598cd285828 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/StackEducationView.kt @@ -37,8 +37,7 @@ class StackEducationView constructor( context: Context, positioner: BubblePositioner, controller: BubbleController -) - : LinearLayout(context) { +) : LinearLayout(context) { private val TAG = if (BubbleDebugConfig.TAG_WITH_CLASS_NAME) "BubbleStackEducationView" else BubbleDebugConfig.TAG_BUBBLES @@ -53,7 +52,8 @@ class StackEducationView constructor( private val titleTextView by lazy { findViewById(R.id.stack_education_title) } private val descTextView by lazy { findViewById(R.id.stack_education_description) } - private var isHiding = false + var isHiding = false + private set init { LayoutInflater.from(context).inflate(R.layout.bubble_stack_user_education, this)