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
This commit is contained in:
@@ -46,6 +46,7 @@ import com.android.quickstep.util.RemoteAnimationProvider;
|
||||
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 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
@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 interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
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 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
// 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 {
|
||||
|
||||
@@ -98,7 +98,6 @@ public class RecentsActivity extends BaseDraggingActivity {
|
||||
|
||||
@Override
|
||||
public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
|
||||
mOldConfig.setTo(newConfig);
|
||||
onHandleConfigChanged();
|
||||
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
|
||||
}
|
||||
@@ -129,7 +128,8 @@ public class RecentsActivity extends BaseDraggingActivity {
|
||||
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
|
||||
|
||||
@@ -459,7 +459,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
// 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 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
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 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
dp.updateInsets(insets);
|
||||
}
|
||||
|
||||
mClipAnimationHelper.updateSource(homeStackBounds, target);
|
||||
mClipAnimationHelper.updateSource(overviewStackBounds, target);
|
||||
initTransitionEndpoints(dp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public class RecentsRootView extends BaseDragLayer<RecentsActivity> {
|
||||
}
|
||||
|
||||
public void dispatchInsets() {
|
||||
mActivity.getDeviceProfile().updateInsets(mInsets);
|
||||
super.setInsets(mInsets);
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
}
|
||||
|
||||
public void dispatchInsets() {
|
||||
mLauncher.getDeviceProfile().updateInsets(mInsets);
|
||||
super.setInsets(mInsets);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user