Merge "Fixing incorrect taskView size in multiwindow-landscape" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-29 20:00:31 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 13 deletions
@@ -51,6 +51,7 @@ import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.util.WindowBounds;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener;
import com.android.quickstep.util.ActiveGestureLog;
@@ -282,7 +283,8 @@ public abstract class BaseSwipeUpHandler<T extends StatefulActivity<?>, Q extend
if (targets.minimizedHomeBounds != null && runningTaskTarget != null) {
Rect overviewStackBounds = mActivityInterface
.getOverviewWindowBounds(targets.minimizedHomeBounds, runningTaskTarget);
dp = dp.getMultiWindowProfile(mContext, overviewStackBounds);
dp = dp.getMultiWindowProfile(mContext,
new WindowBounds(overviewStackBounds, targets.homeContentInsets));
} else {
// If we are not in multi-window mode, home insets should be same as system insets.
dp = dp.copy(mContext);
@@ -24,6 +24,7 @@ import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.LauncherApps;
import android.content.res.Configuration;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
@@ -35,6 +36,8 @@ import android.view.ActionMode;
import android.view.Display;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowInsets.Type;
import android.view.WindowMetrics;
import android.widget.Toast;
import androidx.annotation.Nullable;
@@ -51,6 +54,7 @@ import com.android.launcher3.util.DefaultDisplay.Info;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.Themes;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.util.WindowBounds;
/**
* Extension of BaseActivity allowing support for drag-n-drop
@@ -272,15 +276,19 @@ public abstract class BaseDraggingActivity extends BaseActivity
protected abstract void reapplyUi();
protected Rect getMultiWindowDisplaySize() {
protected WindowBounds getMultiWindowDisplaySize() {
if (Utilities.ATLEAST_R) {
return new Rect(getWindowManager().getCurrentWindowMetrics().getBounds());
WindowMetrics wm = getWindowManager().getCurrentWindowMetrics();
Insets insets = wm.getWindowInsets().getInsets(Type.systemBars());
return new WindowBounds(wm.getBounds(),
new Rect(insets.left, insets.top, insets.right, insets.bottom));
}
// Note: Calls to getSize() can't rely on our cached DefaultDisplay since it can return
// the app window size
Display display = getWindowManager().getDefaultDisplay();
Point mwSize = new Point();
display.getSize(mwSize);
return new Rect(0, 0, mwSize.x, mwSize.y);
return new WindowBounds(new Rect(0, 0, mwSize.x, mwSize.y), new Rect());
}
}
+7 -9
View File
@@ -29,6 +29,7 @@ import com.android.launcher3.graphics.IconShape;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
import com.android.launcher3.util.DefaultDisplay;
import com.android.launcher3.util.WindowBounds;
public class DeviceProfile {
@@ -265,19 +266,16 @@ public class DeviceProfile {
/**
* TODO: Move this to the builder as part of setMultiWindowMode
*/
public DeviceProfile getMultiWindowProfile(Context context, Rect windowPosition) {
public DeviceProfile getMultiWindowProfile(Context context, WindowBounds windowBounds) {
// We take the minimum sizes of this profile and it's multi-window variant to ensure that
// the system decor is always excluded.
Point mwSize = new Point(Math.min(availableWidthPx, windowPosition.width()),
Math.min(availableHeightPx, windowPosition.height()));
Point mwSize = new Point(Math.min(availableWidthPx, windowBounds.availableSize.x),
Math.min(availableHeightPx, windowBounds.availableSize.y));
// In multi-window mode, we can have widthPx = availableWidthPx
// and heightPx = availableHeightPx because Launcher uses the InvariantDeviceProfiles'
// widthPx and heightPx values where it's needed.
DeviceProfile profile = toBuilder(context)
.setSizeRange(mwSize, mwSize)
.setSize(mwSize.x, mwSize.y)
.setWindowPosition(windowPosition.left, windowPosition.top)
.setSize(windowBounds.bounds.width(), windowBounds.bounds.height())
.setWindowPosition(windowBounds.bounds.left, windowBounds.bounds.top)
.setMultiWindowMode(true)
.build();
@@ -299,7 +297,7 @@ public class DeviceProfile {
}
/**
* Inverse of {@link #getMultiWindowProfile(Context, Rect)}
* Inverse of {@link #getMultiWindowProfile(Context, WindowBounds)}
* @return device profile corresponding to the current orientation in non multi-window mode.
*/
public DeviceProfile getFullScreenProfile() {