Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6ee377e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent NullPointerException from long tap on destroyed window decoration." into main

parents 2b2e994b 95b7e269
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1702,6 +1702,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        mExclusionRegionListener.onExclusionRegionDismissed(mTaskInfo.taskId);
        disposeResizeVeil();
        disposeStatusBarInputLayer();
        mWindowDecorViewHolder.close();
        mWindowDecorViewHolder = null;
        if (canEnterDesktopMode(mContext) && isEducationEnabled()) {
            notifyNoCaptionHandle();
+2 −0
Original line number Diff line number Diff line
@@ -274,4 +274,6 @@ internal class AppHandleViewHolder(
            }
        animator.start()
    }

    override fun close() {}
}
+5 −0
Original line number Diff line number Diff line
@@ -725,6 +725,11 @@ class AppHeaderViewHolder(
                Configuration.UI_MODE_NIGHT_YES
    }

    override fun close() {
        // Should not fire long press events after closing the window decoration.
        maximizeWindowButton.cancelLongPress()
    }

    companion object {
        private const val TAG = "DesktopModeAppControlsWindowDecorationViewHolder"

+4 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import com.android.wm.shell.windowdecor.viewholder.WindowDecorationViewHolder.Da
 * Encapsulates the root [View] of a window decoration and its children to facilitate looking up
 * children (via findViewById) and updating to the latest data from [RunningTaskInfo].
 */
abstract class WindowDecorationViewHolder<T : Data>(rootView: View) {
abstract class WindowDecorationViewHolder<T : Data>(rootView: View) : AutoCloseable {
  val context: Context = rootView.context

  /**
@@ -39,6 +39,9 @@ abstract class WindowDecorationViewHolder<T : Data>(rootView: View) {
  /** Callback when the handle menu is closed. */
  abstract fun onHandleMenuClosed()

  /** Callback when the window decoration is destroyed. */
  abstract override fun close()

  /** Data clas that contains the information needed to update the view holder. */
  abstract class Data
}