Using correct window bounds in multi-window for fallback activity
Also fixing a bug where insets were not updated when recreating deviceprofile
Bug: 77875376
Change-Id: I7806cf949da415ef171ccf2f4ab3e8f2b7606220
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index f44def2..0ea729f 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -46,6 +46,7 @@
import com.android.quickstep.views.LauncherLayoutListener;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import java.util.function.BiPredicate;
@@ -92,6 +93,10 @@
@UiThread
boolean switchToRecentsIfVisible();
+ Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target);
+
+ boolean shouldMinimizeSplitScreen();
+
/**
* @return {@code true} if recents activity should be started immediately on touchDown,
* {@code false} if it should deferred until some threshold is crossed.
@@ -260,6 +265,16 @@
public boolean deferStartingActivity(int downHitTarget) {
return downHitTarget == HIT_TARGET_BACK;
}
+
+ @Override
+ public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
+ return homeBounds;
+ }
+
+ @Override
+ public boolean shouldMinimizeSplitScreen() {
+ return true;
+ }
}
class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
@@ -377,6 +392,18 @@
// Always defer starting the activity when using fallback
return true;
}
+
+ @Override
+ public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
+ // TODO: Remove this once b/77875376 is fixed
+ return target.sourceContainerBounds;
+ }
+
+ @Override
+ public boolean shouldMinimizeSplitScreen() {
+ // TODO: Remove this once b/77875376 is fixed
+ return false;
+ }
}
interface LayoutListener {
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 0c49f16..820875c 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -98,7 +98,6 @@
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
- mOldConfig.setTo(newConfig);
onHandleConfigChanged();
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
}
@@ -129,7 +128,8 @@
InvariantDeviceProfile idp = appState == null
? new InvariantDeviceProfile(this) : appState.getInvariantDeviceProfile();
DeviceProfile dp = idp.getDeviceProfile(this);
- mDeviceProfile = dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize());
+ mDeviceProfile = mRecentsRootView == null ? dp.copy(this)
+ : dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize());
} else {
// If we are reusing the Invariant device profile, make a copy.
mDeviceProfile = appState == null
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 06e6556..1255a02 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -459,7 +459,10 @@
// TODO: This logic is spartanic!
boolean passedThreshold = shift > 0.12f;
mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold);
- mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold);
+ if (mActivityControlHelper.shouldMinimizeSplitScreen()) {
+ mRecentsAnimationWrapper
+ .setSplitScreenMinimizedForTransaction(passedThreshold);
+ }
}
};
if (Looper.getMainLooper() == Looper.myLooper()) {
@@ -478,15 +481,16 @@
for (RemoteAnimationTargetCompat target : apps) {
if (target.mode == MODE_CLOSING) {
DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext);
- final Rect homeStackBounds;
+ final Rect overviewStackBounds;
if (minimizedHomeBounds != null) {
- homeStackBounds = minimizedHomeBounds;
+ overviewStackBounds = mActivityControlHelper
+ .getOverviewWindowBounds(minimizedHomeBounds, target);
dp = dp.getMultiWindowProfile(mContext,
new Point(minimizedHomeBounds.width(), minimizedHomeBounds.height()));
dp.updateInsets(homeContentInsets);
} else {
- homeStackBounds = new Rect(0, 0, dp.widthPx, dp.heightPx);
+ overviewStackBounds = new Rect(0, 0, dp.widthPx, dp.heightPx);
// TODO: Workaround for an existing issue where the home content insets are
// not valid immediately after rotation, just use the stable insets for now
Rect insets = new Rect();
@@ -495,7 +499,7 @@
dp.updateInsets(insets);
}
- mClipAnimationHelper.updateSource(homeStackBounds, target);
+ mClipAnimationHelper.updateSource(overviewStackBounds, target);
initTransitionEndpoints(dp);
}
}
diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java b/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
index ad7d19a..878a593 100644
--- a/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
+++ b/quickstep/src/com/android/quickstep/fallback/RecentsRootView.java
@@ -84,6 +84,7 @@
}
public void dispatchInsets() {
+ mActivity.getDeviceProfile().updateInsets(mInsets);
super.setInsets(mInsets);
}
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index b1273b6..f204c16 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -100,6 +100,7 @@
}
public void dispatchInsets() {
+ mLauncher.getDeviceProfile().updateInsets(mInsets);
super.setInsets(mInsets);
}