Fix entry bounds for 3 button nav
The fix uses the similar approach to shelf height to ensure that the
keep clear area is being updated as soon as possible for quickstep.
Without this, the entry animation finishes before the actual keep
clear area from the view is registered, which causes the PiP to enter
lower right corner and then move up, which was the regression.
Bug: 260779127
Test: manually
Test: http://recall/-/g8x7ZkgdfbqscttAA9wzl9/72aNHwWH5wihwN4gf3mfj
Change-Id: Ide11a903558d7e6cb9e477abe12b81129a7f7afc
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index a53f08a..21c8e95 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -80,7 +80,6 @@
import android.view.HapticFeedbackConstants;
import android.view.RemoteAnimationTarget;
import android.view.View;
-import android.view.WindowManagerGlobal;
import android.window.BackEvent;
import android.window.OnBackAnimationCallback;
import android.window.OnBackInvokedDispatcher;
@@ -408,15 +407,18 @@
*/
private void onStateOrResumeChanging(boolean inTransition) {
LauncherState state = getStateManager().getState();
- if (!ENABLE_PIP_KEEP_CLEAR_ALGORITHM) {
- boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
- if (started) {
- DeviceProfile profile = getDeviceProfile();
- boolean willUserBeActive =
- (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
- boolean visible = (state == NORMAL || state == OVERVIEW)
- && (willUserBeActive || isUserActive())
- && !profile.isVerticalBarLayout();
+ boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
+ if (started) {
+ DeviceProfile profile = getDeviceProfile();
+ boolean willUserBeActive =
+ (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
+ boolean visible = (state == NORMAL || state == OVERVIEW)
+ && (willUserBeActive || isUserActive())
+ && !profile.isVerticalBarLayout();
+ if (ENABLE_PIP_KEEP_CLEAR_ALGORITHM) {
+ SystemUiProxy.INSTANCE.get(this)
+ .setLauncherKeepClearAreaHeight(visible, profile.hotseatBarSizePx);
+ } else {
SystemUiProxy.INSTANCE.get(this).setShelfHeight(visible, profile.hotseatBarSizePx);
}
}
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 86b02aa..7c09805 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -87,6 +87,7 @@
new MainThreadInitializedObject<>(SystemUiProxy::new);
private static final int MSG_SET_SHELF_HEIGHT = 1;
+ private static final int MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT = 2;
private ISystemUiProxy mSystemUiProxy;
private IPip mPip;
@@ -121,6 +122,10 @@
private int mLastShelfHeight;
private boolean mLastShelfVisible;
+ // Used to dedupe calls to SystemUI
+ private int mLastLauncherKeepClearAreaHeight;
+ private boolean mLastLauncherKeepClearAreaHeightVisible;
+
private final Context mContext;
private final Handler mAsyncHandler;
@@ -454,6 +459,33 @@
}
/**
+ * Sets the height of the keep clear area that is going to be reported by
+ * the Launcher for the Hotseat.
+ */
+ public void setLauncherKeepClearAreaHeight(boolean visible, int height) {
+ Message.obtain(mAsyncHandler, MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT,
+ visible ? 1 : 0 , height).sendToTarget();
+ }
+
+ @WorkerThread
+ private void setLauncherKeepClearAreaHeight(int visibleInt, int height) {
+ boolean visible = visibleInt != 0;
+ boolean changed = visible != mLastLauncherKeepClearAreaHeightVisible
+ || height != mLastLauncherKeepClearAreaHeight;
+ IPip pip = mPip;
+ if (pip != null && changed) {
+ mLastLauncherKeepClearAreaHeightVisible = visible;
+ mLastLauncherKeepClearAreaHeight = height;
+ try {
+ pip.setLauncherKeepClearAreaHeight(visible, height);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed call setLauncherKeepClearAreaHeight visible: " + visible
+ + " height: " + height, e);
+ }
+ }
+ }
+
+ /**
* Sets listener to get pip animation callbacks.
*/
public void setPipAnimationListener(IPipAnimationListener listener) {
@@ -945,6 +977,9 @@
case MSG_SET_SHELF_HEIGHT:
setShelfHeightAsync(msg.arg1, msg.arg2);
return true;
+ case MSG_SET_LAUNCHER_KEEP_CLEAR_AREA_HEIGHT:
+ setLauncherKeepClearAreaHeight(msg.arg1, msg.arg2);
+ return true;
}
return false;