Clear TaskbarDividerPopupView callback upon closing

- Breakout CL part 4
- This is a breakout cl from ag/24272821 to make it more readable and atomic.
- This cl consist of clearing callbacks after calling close once, so that we don't run into scenario where user is able to close popup multiple times leading to crash.

Test: Manual, Visual
Bug: 265170176
Flag: ENABLE_TASKBAR_PINNING
Change-Id: Ie4cd95c69a559a17b7c19a64a71ccf6ac20542d7
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
index e215bc9..b200858 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt
@@ -59,6 +59,7 @@
             return taskMenuViewWithArrow.populateForView(view)
         }
     }
+
     private lateinit var dividerView: View
 
     private val menuWidth =
@@ -178,13 +179,19 @@
 
     override fun closeComplete() {
         onCloseCallback(didPreferenceChange)
+        onCloseCallback = {}
         super.closeComplete()
     }
 
     private fun onClickAlwaysShowTaskbarSwitchOption() {
         didPreferenceChange = true
         changePreference()
+        changePreference = {}
         // Allow switch animation to finish and then close the popup.
-        postDelayed(DIVIDER_POPUP_CLOSING_DELAY) { close(true) }
+        postDelayed(DIVIDER_POPUP_CLOSING_DELAY) {
+            if (isOpen) {
+                close(false)
+            }
+        }
     }
 }