summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorHongwei Wang <hwwang@google.com>2019-09-15 02:11:50 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-09-15 02:11:50 +0000
commitb77ae52cbca0395adffd99691a8bbe24f31c31a7 (patch)
tree52843188e9b57d7910e0bedea20da3c1c9556320 /core/java
parente513d5488b95c41674deeb155fc4d510a7aeee84 (diff)
parente3ff139062e6aac658ac54f5e11b9d22e540d600 (diff)
Merge "Move bounds calculation and snap fraction to SysUI"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/IPinnedStackController.aidl18
-rw-r--r--core/java/android/view/IPinnedStackListener.aidl62
2 files changed, 62 insertions, 18 deletions
diff --git a/core/java/android/view/IPinnedStackController.aidl b/core/java/android/view/IPinnedStackController.aidl
index d2dcb568ef6c..f1d152ba29af 100644
--- a/core/java/android/view/IPinnedStackController.aidl
+++ b/core/java/android/view/IPinnedStackController.aidl
@@ -16,6 +16,8 @@
package android.view;
+import android.graphics.Rect;
+
/**
* An interface to the PinnedStackController to update it of state changes, and to query
* information based on the current state.
@@ -30,15 +32,17 @@ interface IPinnedStackController {
oneway void setIsMinimized(boolean isMinimized);
/**
- * Notifies the controller of the current min edge size, this is needed to allow the system to
- * properly calculate the aspect ratio of the expanded PIP. The given {@param minEdgeSize} is
- * always bounded to be larger than the default minEdgeSize, so the caller can call this method
- * with 0 to reset to the default size.
+ * @return what WM considers to be the current device rotation.
*/
- oneway void setMinEdgeSize(int minEdgeSize);
+ int getDisplayRotation();
/**
- * @return what WM considers to be the current device rotation.
+ * Notifies the controller to actually start the PiP animation.
+ * The bounds would be calculated based on the last save reentry fraction internally.
+ * {@param destinationBounds} is the stack bounds of the final PiP window
+ * and {@param sourceRectHint} is the source bounds hint used when entering picture-in-picture,
+ * expect the same bound passed via IPinnedStackListener#onPrepareAnimation.
+ * {@param animationDuration} suggests the animation duration transitioning to PiP window.
*/
- int getDisplayRotation();
+ void startAnimation(in Rect destinationBounds, in Rect sourceRectHint, int animationDuration);
}
diff --git a/core/java/android/view/IPinnedStackListener.aidl b/core/java/android/view/IPinnedStackListener.aidl
index 2da353b1f0ee..806d81e39cca 100644
--- a/core/java/android/view/IPinnedStackListener.aidl
+++ b/core/java/android/view/IPinnedStackListener.aidl
@@ -16,8 +16,10 @@
package android.view;
+import android.content.ComponentName;
import android.content.pm.ParceledListSlice;
import android.graphics.Rect;
+import android.view.DisplayInfo;
import android.view.IPinnedStackController;
/**
@@ -36,18 +38,13 @@ oneway interface IPinnedStackListener {
/**
* Called when the window manager has detected a change that would cause the movement bounds
* to be changed (ie. after configuration change, aspect ratio change, etc). It then provides
- * the components that allow the listener to calculate the movement bounds itself. The
- * {@param normalBounds} are also the default bounds that the PiP would be entered in its
- * current state with the aspect ratio applied. The {@param animatingBounds} are provided
- * to indicate the current target bounds of the pinned stack (the final bounds if animating,
- * the current bounds if not), which may be helpful in calculating dependent animation bounds.
- *
- * The {@param displayRotation} is provided so that the client can verify when making certain
- * calls that it will not provide stale information based on an old display rotation (ie. if
- * the WM has changed in the mean time but the client has not received onMovementBoundsChanged).
+ * the components that allow the listener to calculate the movement bounds itself.
+ * The {@param animatingBounds} are provided to indicate the current target bounds of the
+ * pinned stack (the final bounds if animating, the current bounds if not),
+ * which may be helpful in calculating dependent animation bounds.
*/
- void onMovementBoundsChanged(in Rect insetBounds, in Rect normalBounds, in Rect animatingBounds,
- boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation);
+ void onMovementBoundsChanged(in Rect animatingBounds, boolean fromImeAdjustment,
+ boolean fromShelfAdjustment);
/**
* Called when window manager decides to adjust the pinned stack bounds because of the IME, or
@@ -76,4 +73,47 @@ oneway interface IPinnedStackListener {
* is first registered to allow the listener to synchronized its state with the controller.
*/
void onActionsChanged(in ParceledListSlice actions);
+
+ /**
+ * Called by the window manager to notify the listener to save the reentry fraction,
+ * typically when an Activity leaves PiP (picture-in-picture) mode to fullscreen.
+ * {@param componentName} represents the application component of PiP window
+ * while {@param bounds} is the current PiP bounds used to calculate the
+ * reentry snap fraction.
+ */
+ void onSaveReentrySnapFraction(in ComponentName componentName, in Rect bounds);
+
+ /**
+ * Called by the window manager to notify the listener to reset saved reentry fraction,
+ * typically when an Activity enters PiP (picture-in-picture) mode from fullscreen.
+ * {@param componentName} represents the application component of PiP window.
+ */
+ void onResetReentrySnapFraction(in ComponentName componentName);
+
+ /**
+ * Called when the window manager has detected change on DisplayInfo, or
+ * when the listener is first registered to allow the listener to synchronized its state with
+ * the controller.
+ */
+ void onDisplayInfoChanged(in DisplayInfo displayInfo);
+
+ /**
+ * Called by the window manager at the beginning of a configuration update cascade
+ * since the metrics from these resources are used for bounds calculations.
+ */
+ void onConfigurationChanged();
+
+ /**
+ * Called by the window manager when the aspect ratio is reset.
+ */
+ void onAspectRatioChanged(float aspectRatio);
+
+ /**
+ * Called by the window manager to notify the listener to prepare for PiP animation.
+ * Internally, the target bounds would be calculated from the given {@param aspectRatio}
+ * and {@param bounds}, the saved reentry snap fraction also contributes.
+ * Caller would wait for a IPinnedStackController#startAnimation callback to actually
+ * start the animation, see details in IPinnedStackController.
+ */
+ void onPrepareAnimation(in Rect sourceRectHint, float aspectRatio, in Rect bounds);
}