Reparse all grids for secondary displays for DP
- This is required to show a half width all apps sheet on external monitor connected to the phone. Without this the apps sheet covers the full width of the external monitor in projected mode. - Create a new class to hold all the properties that need to be overridden. Set this class as part of DP buider. - Override all props that are overridden for isTwoPanels. - Update isTwoPanels to override using the new class in DP constructor. Flag: com.android.window.flags.enable_taskbar_connected_displays Bug: 414342881 Test: m Change-Id: Ia035620c96c5a8912b99314014d4b19a125c7c5c
This commit is contained in:
@@ -857,6 +857,7 @@ public class InvariantDeviceProfile {
|
||||
.setWindowBounds(mWMProxy.getRealBounds(
|
||||
displayContext, mWMProxy.getDisplayInfo(displayContext)))
|
||||
.setTransposeLayoutWithOrientation(false)
|
||||
.setSecondaryDisplayOptionSpec()
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -932,6 +933,70 @@ public class InvariantDeviceProfile {
|
||||
void onIdpChanged(boolean modelPropertiesChanged);
|
||||
}
|
||||
|
||||
/** Returns {@link DisplayOptionSpec} for the provided displayInfo. */
|
||||
static DisplayOptionSpec createDisplayOptionSpec(Context context, Info displayInfo,
|
||||
boolean isLandscape) {
|
||||
// Get predefined profiles for provided displayInfo without using any main device's pref.
|
||||
List<DisplayOption> allOptions = getPredefinedDeviceProfiles(context,
|
||||
/* gridName= */ null, displayInfo, /* allowDisabledGrid= */ false,
|
||||
/* isFixedLandscapeMode= */ false);
|
||||
|
||||
return new DisplayOptionSpec(
|
||||
invDistWeightedInterpolate(displayInfo, new ArrayList<>(allOptions),
|
||||
displayInfo.getDeviceType()), isLandscape);
|
||||
}
|
||||
|
||||
/** Class to expose properties required for external displays to {@link DeviceProfile} */
|
||||
public static final class DisplayOptionSpec {
|
||||
public final int typeIndex;
|
||||
public final int numShownHotseatIcons;
|
||||
public final int numAllAppsColumns;
|
||||
@XmlRes public final int hotseatSpecsId;
|
||||
@XmlRes public final int workspaceCellSpecsId;
|
||||
@XmlRes public final int workspaceSpecsId;
|
||||
@XmlRes public final int allAppsSpecsId;
|
||||
@XmlRes public final int folderSpecsId;
|
||||
@XmlRes public final int allAppsCellSpecsId;
|
||||
|
||||
DisplayOptionSpec(DisplayOption displayOption, boolean isLandscape) {
|
||||
typeIndex = isLandscape ? INDEX_LANDSCAPE : INDEX_DEFAULT;
|
||||
numShownHotseatIcons = displayOption.grid.numHotseatIcons;
|
||||
numAllAppsColumns = displayOption.grid.numAllAppsColumns;
|
||||
hotseatSpecsId = displayOption.grid.mHotseatSpecsId;
|
||||
workspaceCellSpecsId = displayOption.grid.mWorkspaceCellSpecsId;
|
||||
workspaceSpecsId = displayOption.grid.mWorkspaceSpecsId;
|
||||
allAppsSpecsId = displayOption.grid.mAllAppsSpecsId;
|
||||
folderSpecsId = displayOption.grid.mFolderSpecsId;
|
||||
allAppsCellSpecsId = displayOption.grid.mAllAppsCellSpecsId;
|
||||
}
|
||||
|
||||
DisplayOptionSpec(InvariantDeviceProfile inv, boolean isTwoPanels, boolean isLandscape) {
|
||||
if (isTwoPanels) {
|
||||
if (isLandscape) {
|
||||
typeIndex = INDEX_TWO_PANEL_LANDSCAPE;
|
||||
} else {
|
||||
typeIndex = INDEX_TWO_PANEL_PORTRAIT;
|
||||
}
|
||||
} else {
|
||||
if (isLandscape) {
|
||||
typeIndex = INDEX_LANDSCAPE;
|
||||
} else {
|
||||
typeIndex = INDEX_DEFAULT;
|
||||
}
|
||||
}
|
||||
numShownHotseatIcons =
|
||||
isTwoPanels ? inv.numDatabaseHotseatIcons : inv.numShownHotseatIcons;
|
||||
numAllAppsColumns = isTwoPanels ? inv.numDatabaseAllAppsColumns : inv.numAllAppsColumns;
|
||||
hotseatSpecsId = isTwoPanels ? inv.hotseatSpecsTwoPanelId : inv.hotseatSpecsId;
|
||||
workspaceCellSpecsId = isTwoPanels ? inv.workspaceCellSpecsTwoPanelId
|
||||
: inv.workspaceCellSpecsId;
|
||||
workspaceSpecsId = isTwoPanels ? inv.workspaceSpecsTwoPanelId : inv.workspaceSpecsId;
|
||||
allAppsSpecsId = isTwoPanels ? inv.allAppsSpecsTwoPanelId : inv.allAppsSpecsId;
|
||||
folderSpecsId = isTwoPanels ? inv.folderSpecsTwoPanelId : inv.folderSpecsId;
|
||||
allAppsCellSpecsId =
|
||||
isTwoPanels ? inv.allAppsCellSpecsTwoPanelId : inv.allAppsCellSpecsId;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class GridOption {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user