Merge "Fixing quickswitch window not properly aligned in split-screen" into sc-dev am: c3f56d7628
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15331678 Change-Id: I271a668f967485a2cc23f7c68c6de325d0e4643a
This commit is contained in:
@@ -266,20 +266,32 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||||||
Gravity.apply(Gravity.CENTER, outWidth, outHeight, potentialTaskRect, outRect);
|
Gravity.apply(Gravity.CENTER, outWidth, outHeight, potentialTaskRect, outRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PointF getTaskDimension(Context context, DeviceProfile dp) {
|
private static PointF getTaskDimension(Context context, DeviceProfile dp) {
|
||||||
PointF dimension = new PointF();
|
PointF dimension = new PointF();
|
||||||
|
getTaskDimension(context, dp, dimension);
|
||||||
|
return dimension;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dimension of the task in the current system state.
|
||||||
|
*/
|
||||||
|
public static void getTaskDimension(Context context, DeviceProfile dp, PointF out) {
|
||||||
if (dp.isMultiWindowMode) {
|
if (dp.isMultiWindowMode) {
|
||||||
WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(context);
|
WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(context);
|
||||||
dimension.x = bounds.availableSize.x;
|
if (TaskView.CLIP_STATUS_AND_NAV_BARS) {
|
||||||
dimension.y = bounds.availableSize.y;
|
out.x = bounds.availableSize.x;
|
||||||
|
out.y = bounds.availableSize.y;
|
||||||
|
} else {
|
||||||
|
out.x = bounds.availableSize.x + bounds.insets.left + bounds.insets.right;
|
||||||
|
out.y = bounds.availableSize.y + bounds.insets.top + bounds.insets.bottom;
|
||||||
|
}
|
||||||
} else if (TaskView.CLIP_STATUS_AND_NAV_BARS) {
|
} else if (TaskView.CLIP_STATUS_AND_NAV_BARS) {
|
||||||
dimension.x = dp.availableWidthPx;
|
out.x = dp.availableWidthPx;
|
||||||
dimension.y = dp.availableHeightPx;
|
out.y = dp.availableHeightPx;
|
||||||
} else {
|
} else {
|
||||||
dimension.x = dp.widthPx;
|
out.x = dp.widthPx;
|
||||||
dimension.y = dp.heightPx;
|
out.y = dp.heightPx;
|
||||||
}
|
}
|
||||||
return dimension;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import static android.view.Surface.ROTATION_90;
|
|||||||
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
||||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||||
import static com.android.launcher3.util.SettingsCache.ROTATION_SETTING_URI;
|
import static com.android.launcher3.util.SettingsCache.ROTATION_SETTING_URI;
|
||||||
|
import static com.android.quickstep.BaseActivityInterface.getTaskDimension;
|
||||||
|
|
||||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||||
|
|
||||||
@@ -49,7 +50,6 @@ import com.android.launcher3.testing.TestProtocol;
|
|||||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||||
import com.android.launcher3.util.DisplayController;
|
import com.android.launcher3.util.DisplayController;
|
||||||
import com.android.launcher3.util.SettingsCache;
|
import com.android.launcher3.util.SettingsCache;
|
||||||
import com.android.launcher3.util.WindowBounds;
|
|
||||||
import com.android.quickstep.BaseActivityInterface;
|
import com.android.quickstep.BaseActivityInterface;
|
||||||
import com.android.quickstep.SystemUiProxy;
|
import com.android.quickstep.SystemUiProxy;
|
||||||
import com.android.quickstep.views.TaskView;
|
import com.android.quickstep.views.TaskView;
|
||||||
@@ -401,12 +401,7 @@ public class RecentsOrientedState implements
|
|||||||
fullHeight -= insets.top + insets.bottom;
|
fullHeight -= insets.top + insets.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dp.isMultiWindowMode) {
|
getTaskDimension(mContext, dp, outPivot);
|
||||||
WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(mContext);
|
|
||||||
outPivot.set(bounds.availableSize.x, bounds.availableSize.y);
|
|
||||||
} else {
|
|
||||||
outPivot.set(fullWidth, fullHeight);
|
|
||||||
}
|
|
||||||
float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height());
|
float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height());
|
||||||
// We also scale the preview as part of fullScreenParams, so account for that as well.
|
// We also scale the preview as part of fullScreenParams, so account for that as well.
|
||||||
if (fullWidth > 0) {
|
if (fullWidth > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user