Merge "Fix close and back buttons in caption proto 1." into tm-qpr-dev am: 16ac8f216e am: 54639353d6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21486865

Change-Id: I81d72d5fc92521e01b820e0c7e0c6a47c42a231d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
index 245cc8d..0779f1d 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
@@ -213,6 +213,12 @@
         final View handle = caption.findViewById(R.id.caption_handle);
         handle.setOnTouchListener(mOnCaptionTouchListener);
         handle.setOnClickListener(mOnCaptionButtonClickListener);
+        if (DesktopModeStatus.isProto1Enabled()) {
+            final View back = caption.findViewById(R.id.back_button);
+            back.setOnClickListener(mOnCaptionButtonClickListener);
+            final View close = caption.findViewById(R.id.close_window);
+            close.setOnClickListener(mOnCaptionButtonClickListener);
+        }
         updateButtonVisibility();
     }
 
@@ -319,6 +325,14 @@
         final View handle = caption.findViewById(R.id.caption_handle);
         final Drawable handleBackground = handle.getBackground();
         handleBackground.setTintList(buttonTintColor);
+        if (DesktopModeStatus.isProto1Enabled()) {
+            final View back = caption.findViewById(R.id.back_button);
+            final Drawable backBackground = back.getBackground();
+            backBackground.setTintList(buttonTintColor);
+            final View close = caption.findViewById(R.id.close_window);
+            final Drawable closeBackground = close.getBackground();
+            closeBackground.setTintList(buttonTintColor);
+        }
     }
 
     private void closeDragResizeListener() {