Merge "Add DisplayGroup ID to DisplayInfo" into sc-dev am: 9fb0bb91c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13418964 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ic5fc457bcb1dd786f5968af760409828046f4c12
This commit is contained in:
@@ -120,6 +120,19 @@ public final class Display {
|
|||||||
*/
|
*/
|
||||||
public static final int INVALID_DISPLAY = -1;
|
public static final int INVALID_DISPLAY = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default display group id, which is the display group id of the primary display assuming
|
||||||
|
* there is one.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int DEFAULT_DISPLAY_GROUP = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalid display group id.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int INVALID_DISPLAY_GROUP = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display flag: Indicates that the display supports compositing content
|
* Display flag: Indicates that the display supports compositing content
|
||||||
* that is stored in protected graphics buffers.
|
* that is stored in protected graphics buffers.
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public int displayId;
|
public int displayId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display Group identifier.
|
||||||
|
*/
|
||||||
|
public int displayGroupId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display address, or null if none.
|
* Display address, or null if none.
|
||||||
* Interpretation varies by display type.
|
* Interpretation varies by display type.
|
||||||
@@ -331,6 +336,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
&& flags == other.flags
|
&& flags == other.flags
|
||||||
&& type == other.type
|
&& type == other.type
|
||||||
&& displayId == other.displayId
|
&& displayId == other.displayId
|
||||||
|
&& displayGroupId == other.displayGroupId
|
||||||
&& Objects.equals(address, other.address)
|
&& Objects.equals(address, other.address)
|
||||||
&& Objects.equals(deviceProductInfo, other.deviceProductInfo)
|
&& Objects.equals(deviceProductInfo, other.deviceProductInfo)
|
||||||
&& Objects.equals(uniqueId, other.uniqueId)
|
&& Objects.equals(uniqueId, other.uniqueId)
|
||||||
@@ -376,6 +382,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
flags = other.flags;
|
flags = other.flags;
|
||||||
type = other.type;
|
type = other.type;
|
||||||
displayId = other.displayId;
|
displayId = other.displayId;
|
||||||
|
displayGroupId = other.displayGroupId;
|
||||||
address = other.address;
|
address = other.address;
|
||||||
deviceProductInfo = other.deviceProductInfo;
|
deviceProductInfo = other.deviceProductInfo;
|
||||||
name = other.name;
|
name = other.name;
|
||||||
@@ -418,6 +425,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
flags = source.readInt();
|
flags = source.readInt();
|
||||||
type = source.readInt();
|
type = source.readInt();
|
||||||
displayId = source.readInt();
|
displayId = source.readInt();
|
||||||
|
displayGroupId = source.readInt();
|
||||||
address = source.readParcelable(null);
|
address = source.readParcelable(null);
|
||||||
deviceProductInfo = source.readParcelable(null);
|
deviceProductInfo = source.readParcelable(null);
|
||||||
name = source.readString8();
|
name = source.readString8();
|
||||||
@@ -468,6 +476,7 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
dest.writeInt(this.flags);
|
dest.writeInt(this.flags);
|
||||||
dest.writeInt(type);
|
dest.writeInt(type);
|
||||||
dest.writeInt(displayId);
|
dest.writeInt(displayId);
|
||||||
|
dest.writeInt(displayGroupId);
|
||||||
dest.writeParcelable(address, flags);
|
dest.writeParcelable(address, flags);
|
||||||
dest.writeParcelable(deviceProductInfo, flags);
|
dest.writeParcelable(deviceProductInfo, flags);
|
||||||
dest.writeString8(name);
|
dest.writeString8(name);
|
||||||
@@ -662,6 +671,8 @@ public final class DisplayInfo implements Parcelable {
|
|||||||
sb.append(name);
|
sb.append(name);
|
||||||
sb.append("\", displayId ");
|
sb.append("\", displayId ");
|
||||||
sb.append(displayId);
|
sb.append(displayId);
|
||||||
|
sb.append("\", displayGroupId ");
|
||||||
|
sb.append(displayGroupId);
|
||||||
sb.append(flagsToString(flags));
|
sb.append(flagsToString(flags));
|
||||||
sb.append(", real ");
|
sb.append(", real ");
|
||||||
sb.append(logicalWidth);
|
sb.append(logicalWidth);
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DisplayGroup {
|
public class DisplayGroup {
|
||||||
|
|
||||||
public static final int DEFAULT = 0;
|
|
||||||
|
|
||||||
private final List<LogicalDisplay> mDisplays = new ArrayList<>();
|
private final List<LogicalDisplay> mDisplays = new ArrayList<>();
|
||||||
private final int mGroupId;
|
private final int mGroupId;
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ final class LogicalDisplay {
|
|||||||
|
|
||||||
private final int mDisplayId;
|
private final int mDisplayId;
|
||||||
private final int mLayerStack;
|
private final int mLayerStack;
|
||||||
|
|
||||||
|
private int mDisplayGroupId = Display.INVALID_DISPLAY_GROUP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override information set by the window manager. Will be reported instead of {@link #mInfo}
|
* Override information set by the window manager. Will be reported instead of {@link #mInfo}
|
||||||
* if not null.
|
* if not null.
|
||||||
@@ -264,6 +267,19 @@ final class LogicalDisplay {
|
|||||||
return mPrimaryDisplayDevice != null;
|
return mPrimaryDisplayDevice != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the {@link DisplayGroup} to which the logical display belongs.
|
||||||
|
*
|
||||||
|
* @param groupId Identifier for the {@link DisplayGroup}.
|
||||||
|
*/
|
||||||
|
public void updateDisplayGroupIdLocked(int groupId) {
|
||||||
|
if (groupId != mDisplayGroupId) {
|
||||||
|
mDisplayGroupId = groupId;
|
||||||
|
mBaseDisplayInfo.displayGroupId = groupId;
|
||||||
|
mInfo.set(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state of the logical display based on the available display devices.
|
* Updates the state of the logical display based on the available display devices.
|
||||||
* The logical display might become invalid if it is attached to a display device
|
* The logical display might become invalid if it is attached to a display device
|
||||||
@@ -365,6 +381,7 @@ final class LogicalDisplay {
|
|||||||
(deviceInfo.flags & DisplayDeviceInfo.FLAG_MASK_DISPLAY_CUTOUT) != 0;
|
(deviceInfo.flags & DisplayDeviceInfo.FLAG_MASK_DISPLAY_CUTOUT) != 0;
|
||||||
mBaseDisplayInfo.displayCutout = maskCutout ? null : deviceInfo.displayCutout;
|
mBaseDisplayInfo.displayCutout = maskCutout ? null : deviceInfo.displayCutout;
|
||||||
mBaseDisplayInfo.displayId = mDisplayId;
|
mBaseDisplayInfo.displayId = mDisplayId;
|
||||||
|
mBaseDisplayInfo.displayGroupId = mDisplayGroupId;
|
||||||
updateFrameRateOverrides(deviceInfo);
|
updateFrameRateOverrides(deviceInfo);
|
||||||
mBaseDisplayInfo.brightnessMinimum = deviceInfo.brightnessMinimum;
|
mBaseDisplayInfo.brightnessMinimum = deviceInfo.brightnessMinimum;
|
||||||
mBaseDisplayInfo.brightnessMaximum = deviceInfo.brightnessMaximum;
|
mBaseDisplayInfo.brightnessMaximum = deviceInfo.brightnessMaximum;
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
private final SparseArray<LogicalDisplay> mLogicalDisplays =
|
private final SparseArray<LogicalDisplay> mLogicalDisplays =
|
||||||
new SparseArray<LogicalDisplay>();
|
new SparseArray<LogicalDisplay>();
|
||||||
private int mNextNonDefaultDisplayId = Display.DEFAULT_DISPLAY + 1;
|
private int mNextNonDefaultDisplayId = Display.DEFAULT_DISPLAY + 1;
|
||||||
private int mNextNonDefaultGroupId = DisplayGroup.DEFAULT + 1;
|
private int mNextNonDefaultGroupId = Display.DEFAULT_DISPLAY_GROUP + 1;
|
||||||
|
|
||||||
/** A mapping from logical display id to display group. */
|
/** A mapping from logical display id to display group. */
|
||||||
private final SparseArray<DisplayGroup> mDisplayGroups = new SparseArray<>();
|
private final SparseArray<DisplayGroup> mDisplayGroups = new SparseArray<>();
|
||||||
@@ -313,7 +313,18 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
final int displayId = assignDisplayIdLocked(isDefault);
|
final int displayId = assignDisplayIdLocked(isDefault);
|
||||||
final int layerStack = assignLayerStackLocked(displayId);
|
final int layerStack = assignLayerStackLocked(displayId);
|
||||||
|
|
||||||
|
final DisplayGroup displayGroup;
|
||||||
|
final boolean addNewDisplayGroup =
|
||||||
|
isDefault || (deviceInfo.flags & DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP) != 0;
|
||||||
|
if (addNewDisplayGroup) {
|
||||||
|
final int groupId = assignDisplayGroupIdLocked(isDefault);
|
||||||
|
displayGroup = new DisplayGroup(groupId);
|
||||||
|
} else {
|
||||||
|
displayGroup = mDisplayGroups.get(Display.DEFAULT_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
LogicalDisplay display = new LogicalDisplay(displayId, layerStack, device);
|
LogicalDisplay display = new LogicalDisplay(displayId, layerStack, device);
|
||||||
|
display.updateDisplayGroupIdLocked(displayGroup.getGroupId());
|
||||||
display.updateLocked(mDisplayDeviceRepo);
|
display.updateLocked(mDisplayDeviceRepo);
|
||||||
if (!display.isValidLocked()) {
|
if (!display.isValidLocked()) {
|
||||||
// This should never happen currently.
|
// This should never happen currently.
|
||||||
@@ -324,13 +335,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
|
|
||||||
mLogicalDisplays.put(displayId, display);
|
mLogicalDisplays.put(displayId, display);
|
||||||
|
|
||||||
final DisplayGroup displayGroup;
|
|
||||||
if (isDefault || (deviceInfo.flags & DisplayDeviceInfo.FLAG_OWN_DISPLAY_GROUP) != 0) {
|
|
||||||
final int groupId = assignDisplayGroupIdLocked(isDefault);
|
|
||||||
displayGroup = new DisplayGroup(groupId);
|
|
||||||
} else {
|
|
||||||
displayGroup = mDisplayGroups.get(Display.DEFAULT_DISPLAY);
|
|
||||||
}
|
|
||||||
displayGroup.addDisplay(display);
|
displayGroup.addDisplay(display);
|
||||||
mDisplayGroups.append(displayId, displayGroup);
|
mDisplayGroups.append(displayId, displayGroup);
|
||||||
|
|
||||||
@@ -369,6 +373,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
final DisplayGroup displayGroup = new DisplayGroup(groupId);
|
final DisplayGroup displayGroup = new DisplayGroup(groupId);
|
||||||
displayGroup.addDisplay(display);
|
displayGroup.addDisplay(display);
|
||||||
mDisplayGroups.append(display.getDisplayIdLocked(), displayGroup);
|
mDisplayGroups.append(display.getDisplayIdLocked(), displayGroup);
|
||||||
|
display.updateDisplayGroupIdLocked(groupId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The display should be a part of the default DisplayGroup.
|
// The display should be a part of the default DisplayGroup.
|
||||||
@@ -377,6 +382,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
displayGroup.removeDisplay(display);
|
displayGroup.removeDisplay(display);
|
||||||
defaultDisplayGroup.addDisplay(display);
|
defaultDisplayGroup.addDisplay(display);
|
||||||
mDisplayGroups.put(displayId, defaultDisplayGroup);
|
mDisplayGroups.put(displayId, defaultDisplayGroup);
|
||||||
|
display.updateDisplayGroupIdLocked(defaultDisplayGroup.getGroupId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +412,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int assignDisplayGroupIdLocked(boolean isDefault) {
|
private int assignDisplayGroupIdLocked(boolean isDefault) {
|
||||||
return isDefault ? DisplayGroup.DEFAULT : mNextNonDefaultGroupId++;
|
return isDefault ? Display.DEFAULT_DISPLAY_GROUP : mNextNonDefaultGroupId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int assignLayerStackLocked(int displayId) {
|
private int assignLayerStackLocked(int displayId) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.util.SparseIntArray;
|
|||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.server.display.DisplayGroup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Responsible for creating {@link DisplayPowerRequest}s and associating them with
|
* Responsible for creating {@link DisplayPowerRequest}s and associating them with
|
||||||
@@ -110,8 +109,8 @@ class DisplayPowerRequestMapper {
|
|||||||
DisplayManagerInternal displayManagerInternal, Handler handler) {
|
DisplayManagerInternal displayManagerInternal, Handler handler) {
|
||||||
mDisplayManagerInternal = displayManagerInternal;
|
mDisplayManagerInternal = displayManagerInternal;
|
||||||
displayManager.registerDisplayListener(mDisplayListener, handler);
|
displayManager.registerDisplayListener(mDisplayListener, handler);
|
||||||
mDisplayPowerRequests.append(DisplayGroup.DEFAULT, new DisplayPowerRequest());
|
mDisplayPowerRequests.append(Display.DEFAULT_DISPLAY_GROUP, new DisplayPowerRequest());
|
||||||
mDisplayGroupIds.append(Display.DEFAULT_DISPLAY, DisplayGroup.DEFAULT);
|
mDisplayGroupIds.append(Display.DEFAULT_DISPLAY, Display.DEFAULT_DISPLAY_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayPowerRequest get(int displayId) {
|
DisplayPowerRequest get(int displayId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user