DeviceProfile refactoring for connected displays
Test: locally tested on Tangor Flag: com.android.launcher3.enable_overview_on_connected_displays Bug: 392858637 Change-Id: I0f45710eb60c7ea3359153c7961461532fec8e97
This commit is contained in:
@@ -413,7 +413,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
mMSDLPlayerWrapper = msdlPlayerWrapper;
|
||||
|
||||
initTransitionEndpoints(mRemoteTargetHandles[0].getTaskViewSimulator()
|
||||
.getOrientationState().getLauncherDeviceProfile());
|
||||
.getOrientationState().getLauncherDeviceProfile(gestureState.getDisplayId()));
|
||||
initStateCallbacks();
|
||||
|
||||
mIsTransientTaskbar = mDp.isTaskbarPresent
|
||||
@@ -991,7 +991,8 @@ public abstract class AbsSwipeUpHandler<
|
||||
// both split and non-split
|
||||
RecentsOrientedState orientationState = mRemoteTargetHandles[0].getTaskViewSimulator()
|
||||
.getOrientationState();
|
||||
DeviceProfile dp = orientationState.getLauncherDeviceProfile();
|
||||
DeviceProfile dp = orientationState.getLauncherDeviceProfile(
|
||||
mGestureState.getDisplayId());
|
||||
if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) {
|
||||
Rect overviewStackBounds = mContainerInterface
|
||||
.getOverviewWindowBounds(targets.minimizedHomeBounds, primaryTaskTarget);
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.quickstep.fallback.window
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.PixelFormat
|
||||
import android.view.Display
|
||||
import android.view.Display.DEFAULT_DISPLAY
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
@@ -53,7 +53,7 @@ abstract class RecentsWindowContext(windowContext: Context, wallpaperColorHints:
|
||||
|
||||
fun initDeviceProfile() {
|
||||
deviceProfile =
|
||||
if (displayId == Display.DEFAULT_DISPLAY)
|
||||
if (displayId == DEFAULT_DISPLAY)
|
||||
InvariantDeviceProfile.INSTANCE[this].getDeviceProfile(this)
|
||||
else InvariantDeviceProfile.INSTANCE[this].createDeviceProfileForSecondaryDisplay(this)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import static android.view.Surface.ROTATION_180;
|
||||
import static android.view.Surface.ROTATION_270;
|
||||
import static android.view.Surface.ROTATION_90;
|
||||
|
||||
import static com.android.launcher3.Flags.enableOverviewOnConnectedDisplays;
|
||||
import static com.android.launcher3.LauncherPrefs.ALLOW_ROTATION;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.SettingsCache.ROTATION_SETTING_URI;
|
||||
@@ -53,6 +54,7 @@ import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.quickstep.BaseContainerInterface;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.quickstep.fallback.window.RecentsDisplayModel;
|
||||
import com.android.quickstep.orientation.RecentsPagedOrientationHandler;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -571,19 +573,25 @@ public class RecentsOrientedState implements LauncherPrefChangeListener {
|
||||
/**
|
||||
* Returns the device profile based on expected launcher rotation
|
||||
*/
|
||||
public DeviceProfile getLauncherDeviceProfile() {
|
||||
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext);
|
||||
Point currentSize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize;
|
||||
|
||||
int width, height;
|
||||
if ((mRecentsActivityRotation == ROTATION_90 || mRecentsActivityRotation == ROTATION_270)) {
|
||||
width = Math.max(currentSize.x, currentSize.y);
|
||||
height = Math.min(currentSize.x, currentSize.y);
|
||||
public DeviceProfile getLauncherDeviceProfile(int displayId) {
|
||||
if (enableOverviewOnConnectedDisplays()) {
|
||||
return RecentsDisplayModel.getINSTANCE().get(mContext).getRecentsWindowManager(
|
||||
displayId).getDeviceProfile();
|
||||
} else {
|
||||
width = Math.min(currentSize.x, currentSize.y);
|
||||
height = Math.max(currentSize.x, currentSize.y);
|
||||
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext);
|
||||
Point currentSize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize;
|
||||
|
||||
int width, height;
|
||||
if ((mRecentsActivityRotation == ROTATION_90
|
||||
|| mRecentsActivityRotation == ROTATION_270)) {
|
||||
width = Math.max(currentSize.x, currentSize.y);
|
||||
height = Math.min(currentSize.x, currentSize.y);
|
||||
} else {
|
||||
width = Math.min(currentSize.x, currentSize.y);
|
||||
height = Math.max(currentSize.x, currentSize.y);
|
||||
}
|
||||
return idp.getBestMatch(width, height, mRecentsActivityRotation);
|
||||
}
|
||||
return idp.getBestMatch(width, height, mRecentsActivityRotation);
|
||||
}
|
||||
|
||||
private static String nameAndAddress(Object obj) {
|
||||
|
||||
Reference in New Issue
Block a user