PiP: Double-tap to maximum, again to go back to last resized size.

When double tapping, it now maximizes PiP to the biggest size possible,
but doesn't save the maximized bounds as a user resize. Instead, save
the current bounds before maximizing, and then restore that if user
double taps again.

Bug: 178881304
Test: Double-tap on PiP
Change-Id: Ib1dfb07e1ee1134759309213089504bb1eb97279
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
index 2b8b53c..4fd90d5 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
@@ -30,7 +30,6 @@
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.graphics.Rect;
-import android.os.Handler;
 import android.provider.DeviceConfig;
 import android.util.Size;
 import android.view.InputEvent;
@@ -846,11 +845,11 @@
                             && mPipBoundsState.getBounds().height()
                             < mPipBoundsState.getMaxSize().y;
                     if (toExpand) {
+                        mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
                         animateToMaximizedState(null);
                     } else {
-                        animateToMinimizedState();
+                        animateToUnexpandedState(getUserResizeBounds());
                     }
-                    mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
                 } else {
                     // Expand to fullscreen if this is a double tap
                     // the PiP should be frozen until the transition ends