Loading core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,19 @@ public final class Display { */ 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 * that is stored in protected graphics buffers. Loading core/java/android/view/DisplayInfo.java +11 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,11 @@ public final class DisplayInfo implements Parcelable { */ public int displayId; /** * Display Group identifier. */ public int displayGroupId; /** * Display address, or null if none. * Interpretation varies by display type. Loading Loading @@ -331,6 +336,7 @@ public final class DisplayInfo implements Parcelable { && flags == other.flags && type == other.type && displayId == other.displayId && displayGroupId == other.displayGroupId && Objects.equals(address, other.address) && Objects.equals(deviceProductInfo, other.deviceProductInfo) && Objects.equals(uniqueId, other.uniqueId) Loading Loading @@ -376,6 +382,7 @@ public final class DisplayInfo implements Parcelable { flags = other.flags; type = other.type; displayId = other.displayId; displayGroupId = other.displayGroupId; address = other.address; deviceProductInfo = other.deviceProductInfo; name = other.name; Loading Loading @@ -418,6 +425,7 @@ public final class DisplayInfo implements Parcelable { flags = source.readInt(); type = source.readInt(); displayId = source.readInt(); displayGroupId = source.readInt(); address = source.readParcelable(null); deviceProductInfo = source.readParcelable(null); name = source.readString8(); Loading Loading @@ -468,6 +476,7 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(this.flags); dest.writeInt(type); dest.writeInt(displayId); dest.writeInt(displayGroupId); dest.writeParcelable(address, flags); dest.writeParcelable(deviceProductInfo, flags); dest.writeString8(name); Loading Loading @@ -662,6 +671,8 @@ public final class DisplayInfo implements Parcelable { sb.append(name); sb.append("\", displayId "); sb.append(displayId); sb.append("\", displayGroupId "); sb.append(displayGroupId); sb.append(flagsToString(flags)); sb.append(", real "); sb.append(logicalWidth); Loading services/core/java/com/android/server/display/DisplayGroup.java +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ import java.util.List; */ public class DisplayGroup { public static final int DEFAULT = 0; private final List<LogicalDisplay> mDisplays = new ArrayList<>(); private final int mGroupId; Loading services/core/java/com/android/server/display/LogicalDisplay.java +17 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ final class LogicalDisplay { private final int mDisplayId; 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} * if not null. Loading Loading @@ -264,6 +267,19 @@ final class LogicalDisplay { 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. * The logical display might become invalid if it is attached to a display device Loading Loading @@ -365,6 +381,7 @@ final class LogicalDisplay { (deviceInfo.flags & DisplayDeviceInfo.FLAG_MASK_DISPLAY_CUTOUT) != 0; mBaseDisplayInfo.displayCutout = maskCutout ? null : deviceInfo.displayCutout; mBaseDisplayInfo.displayId = mDisplayId; mBaseDisplayInfo.displayGroupId = mDisplayGroupId; updateFrameRateOverrides(deviceInfo); mBaseDisplayInfo.brightnessMinimum = deviceInfo.brightnessMinimum; mBaseDisplayInfo.brightnessMaximum = deviceInfo.brightnessMaximum; Loading services/core/java/com/android/server/display/LogicalDisplayMapper.java +15 −9 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { private final SparseArray<LogicalDisplay> mLogicalDisplays = new SparseArray<LogicalDisplay>(); 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. */ private final SparseArray<DisplayGroup> mDisplayGroups = new SparseArray<>(); Loading Loading @@ -313,7 +313,18 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { final int displayId = assignDisplayIdLocked(isDefault); 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); display.updateDisplayGroupIdLocked(displayGroup.getGroupId()); display.updateLocked(mDisplayDeviceRepo); if (!display.isValidLocked()) { // This should never happen currently. Loading @@ -324,13 +335,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { 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); mDisplayGroups.append(displayId, displayGroup); Loading Loading @@ -369,6 +373,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { final DisplayGroup displayGroup = new DisplayGroup(groupId); displayGroup.addDisplay(display); mDisplayGroups.append(display.getDisplayIdLocked(), displayGroup); display.updateDisplayGroupIdLocked(groupId); } } else { // The display should be a part of the default DisplayGroup. Loading @@ -377,6 +382,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { displayGroup.removeDisplay(display); defaultDisplayGroup.addDisplay(display); mDisplayGroups.put(displayId, defaultDisplayGroup); display.updateDisplayGroupIdLocked(defaultDisplayGroup.getGroupId()); } } Loading Loading @@ -406,7 +412,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } private int assignDisplayGroupIdLocked(boolean isDefault) { return isDefault ? DisplayGroup.DEFAULT : mNextNonDefaultGroupId++; return isDefault ? Display.DEFAULT_DISPLAY_GROUP : mNextNonDefaultGroupId++; } private int assignLayerStackLocked(int displayId) { Loading Loading
core/java/android/view/Display.java +13 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,19 @@ public final class Display { */ 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 * that is stored in protected graphics buffers. Loading
core/java/android/view/DisplayInfo.java +11 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,11 @@ public final class DisplayInfo implements Parcelable { */ public int displayId; /** * Display Group identifier. */ public int displayGroupId; /** * Display address, or null if none. * Interpretation varies by display type. Loading Loading @@ -331,6 +336,7 @@ public final class DisplayInfo implements Parcelable { && flags == other.flags && type == other.type && displayId == other.displayId && displayGroupId == other.displayGroupId && Objects.equals(address, other.address) && Objects.equals(deviceProductInfo, other.deviceProductInfo) && Objects.equals(uniqueId, other.uniqueId) Loading Loading @@ -376,6 +382,7 @@ public final class DisplayInfo implements Parcelable { flags = other.flags; type = other.type; displayId = other.displayId; displayGroupId = other.displayGroupId; address = other.address; deviceProductInfo = other.deviceProductInfo; name = other.name; Loading Loading @@ -418,6 +425,7 @@ public final class DisplayInfo implements Parcelable { flags = source.readInt(); type = source.readInt(); displayId = source.readInt(); displayGroupId = source.readInt(); address = source.readParcelable(null); deviceProductInfo = source.readParcelable(null); name = source.readString8(); Loading Loading @@ -468,6 +476,7 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(this.flags); dest.writeInt(type); dest.writeInt(displayId); dest.writeInt(displayGroupId); dest.writeParcelable(address, flags); dest.writeParcelable(deviceProductInfo, flags); dest.writeString8(name); Loading Loading @@ -662,6 +671,8 @@ public final class DisplayInfo implements Parcelable { sb.append(name); sb.append("\", displayId "); sb.append(displayId); sb.append("\", displayGroupId "); sb.append(displayGroupId); sb.append(flagsToString(flags)); sb.append(", real "); sb.append(logicalWidth); Loading
services/core/java/com/android/server/display/DisplayGroup.java +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ import java.util.List; */ public class DisplayGroup { public static final int DEFAULT = 0; private final List<LogicalDisplay> mDisplays = new ArrayList<>(); private final int mGroupId; Loading
services/core/java/com/android/server/display/LogicalDisplay.java +17 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ final class LogicalDisplay { private final int mDisplayId; 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} * if not null. Loading Loading @@ -264,6 +267,19 @@ final class LogicalDisplay { 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. * The logical display might become invalid if it is attached to a display device Loading Loading @@ -365,6 +381,7 @@ final class LogicalDisplay { (deviceInfo.flags & DisplayDeviceInfo.FLAG_MASK_DISPLAY_CUTOUT) != 0; mBaseDisplayInfo.displayCutout = maskCutout ? null : deviceInfo.displayCutout; mBaseDisplayInfo.displayId = mDisplayId; mBaseDisplayInfo.displayGroupId = mDisplayGroupId; updateFrameRateOverrides(deviceInfo); mBaseDisplayInfo.brightnessMinimum = deviceInfo.brightnessMinimum; mBaseDisplayInfo.brightnessMaximum = deviceInfo.brightnessMaximum; Loading
services/core/java/com/android/server/display/LogicalDisplayMapper.java +15 −9 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { private final SparseArray<LogicalDisplay> mLogicalDisplays = new SparseArray<LogicalDisplay>(); 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. */ private final SparseArray<DisplayGroup> mDisplayGroups = new SparseArray<>(); Loading Loading @@ -313,7 +313,18 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { final int displayId = assignDisplayIdLocked(isDefault); 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); display.updateDisplayGroupIdLocked(displayGroup.getGroupId()); display.updateLocked(mDisplayDeviceRepo); if (!display.isValidLocked()) { // This should never happen currently. Loading @@ -324,13 +335,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { 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); mDisplayGroups.append(displayId, displayGroup); Loading Loading @@ -369,6 +373,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { final DisplayGroup displayGroup = new DisplayGroup(groupId); displayGroup.addDisplay(display); mDisplayGroups.append(display.getDisplayIdLocked(), displayGroup); display.updateDisplayGroupIdLocked(groupId); } } else { // The display should be a part of the default DisplayGroup. Loading @@ -377,6 +382,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { displayGroup.removeDisplay(display); defaultDisplayGroup.addDisplay(display); mDisplayGroups.put(displayId, defaultDisplayGroup); display.updateDisplayGroupIdLocked(defaultDisplayGroup.getGroupId()); } } Loading Loading @@ -406,7 +412,7 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { } private int assignDisplayGroupIdLocked(boolean isDefault) { return isDefault ? DisplayGroup.DEFAULT : mNextNonDefaultGroupId++; return isDefault ? Display.DEFAULT_DISPLAY_GROUP : mNextNonDefaultGroupId++; } private int assignLayerStackLocked(int displayId) { Loading