Loading core/java/android/view/DisplayInfo.java +11 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public final class DisplayInfo implements Parcelable { */ public String name; /** * Unique identifier for the display. Shouldn't be displayed to the user. */ public String uniqueId; /** * The width of the portion of the display that is available to applications, in pixels. * Represents the size of the display minus any system decorations. Loading Loading @@ -257,7 +262,7 @@ public final class DisplayInfo implements Parcelable { && flags == other.flags && type == other.type && Objects.equal(address, other.address) && Objects.equal(name, other.name) && Objects.equal(uniqueId, other.uniqueId) && appWidth == other.appWidth && appHeight == other.appHeight && smallestNominalAppWidth == other.smallestNominalAppWidth Loading Loading @@ -293,6 +298,7 @@ public final class DisplayInfo implements Parcelable { type = other.type; address = other.address; name = other.name; uniqueId = other.uniqueId; appWidth = other.appWidth; appHeight = other.appHeight; smallestNominalAppWidth = other.smallestNominalAppWidth; Loading Loading @@ -348,6 +354,7 @@ public final class DisplayInfo implements Parcelable { state = source.readInt(); ownerUid = source.readInt(); ownerPackageName = source.readString(); uniqueId = source.readString(); } @Override Loading Loading @@ -380,6 +387,7 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(state); dest.writeInt(ownerUid); dest.writeString(ownerPackageName); dest.writeString(uniqueId); } @Override Loading Loading @@ -445,6 +453,8 @@ public final class DisplayInfo implements Parcelable { StringBuilder sb = new StringBuilder(); sb.append("DisplayInfo{\""); sb.append(name); sb.append("\", uniqueId \""); sb.append(uniqueId); sb.append("\", app "); sb.append(appWidth); sb.append(" x "); Loading services/core/java/com/android/server/display/DisplayDevice.java +11 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import java.io.PrintWriter; abstract class DisplayDevice { private final DisplayAdapter mDisplayAdapter; private final IBinder mDisplayToken; private final String mUniqueId; // The display device does not manage these properties itself, they are set by // the display manager service. The display device shouldn't really be looking at these. Loading @@ -46,9 +47,10 @@ abstract class DisplayDevice { // within a transaction from performTraversalInTransactionLocked. private Surface mCurrentSurface; public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken) { public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId) { mDisplayAdapter = displayAdapter; mDisplayToken = displayToken; mUniqueId = uniqueId; } /** Loading Loading @@ -79,6 +81,13 @@ abstract class DisplayDevice { return getDisplayDeviceInfoLocked().name; } /** * Returns the unique id of the display device. */ public final String getUniqueId() { return mUniqueId; } /** * Gets information about the display device. * Loading Loading @@ -208,6 +217,7 @@ abstract class DisplayDevice { */ public void dumpLocked(PrintWriter pw) { pw.println("mAdapter=" + mDisplayAdapter.getName()); pw.println("mUniqueId=" + mUniqueId); pw.println("mDisplayToken=" + mDisplayToken); pw.println("mCurrentLayerStack=" + mCurrentLayerStack); pw.println("mCurrentOrientation=" + mCurrentOrientation); Loading services/core/java/com/android/server/display/DisplayDeviceInfo.java +11 −3 Original line number Diff line number Diff line Loading @@ -104,11 +104,16 @@ final class DisplayDeviceInfo { public static final int TOUCH_EXTERNAL = 2; /** * Gets the name of the display device, which may be derived from * EDID or other sources. The name may be displayed to the user. * Gets the name of the display device, which may be derived from EDID or * other sources. The name may be localized and displayed to the user. */ public String name; /** * Unique Id of display device. */ public String uniqueId; /** * The width of the display in its natural orientation, in pixels. * This value is not affected by display rotation. Loading Loading @@ -235,6 +240,7 @@ final class DisplayDeviceInfo { public boolean equals(DisplayDeviceInfo other) { return other != null && Objects.equal(name, other.name) && Objects.equal(uniqueId, other.uniqueId) && width == other.width && height == other.height && refreshRate == other.refreshRate Loading @@ -261,6 +267,7 @@ final class DisplayDeviceInfo { public void copyFrom(DisplayDeviceInfo other) { name = other.name; uniqueId = other.uniqueId; width = other.width; height = other.height; refreshRate = other.refreshRate; Loading @@ -285,7 +292,8 @@ final class DisplayDeviceInfo { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("DisplayDeviceInfo{\""); sb.append(name).append("\": ").append(width).append(" x ").append(height); sb.append(name).append("\": uniqueId=\"").append(uniqueId).append("\", "); sb.append(width).append(" x ").append(height); sb.append(", ").append(refreshRate).append(" fps"); sb.append(", supportedRefreshRates ").append(Arrays.toString(supportedRefreshRates)); sb.append(", density ").append(densityDpi); Loading services/core/java/com/android/server/display/LocalDisplayAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ import java.util.Arrays; final class LocalDisplayAdapter extends DisplayAdapter { private static final String TAG = "LocalDisplayAdapter"; private static final String UNIQUE_ID_PREFIX = "local:"; private static final int[] BUILT_IN_DISPLAY_IDS_TO_SCAN = new int[] { SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN, SurfaceControl.BUILT_IN_DISPLAY_ID_HDMI, Loading Loading @@ -140,7 +142,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { public LocalDisplayDevice(IBinder displayToken, int builtInDisplayId, SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo) { super(LocalDisplayAdapter.this, displayToken); super(LocalDisplayAdapter.this, displayToken, UNIQUE_ID_PREFIX + builtInDisplayId); mBuiltInDisplayId = builtInDisplayId; mPhys = new SurfaceControl.PhysicalDisplayInfo( physicalDisplayInfos[activeDisplayInfo]); Loading Loading @@ -179,6 +181,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { mInfo.appVsyncOffsetNanos = mPhys.appVsyncOffsetNanos; mInfo.presentationDeadlineNanos = mPhys.presentationDeadlineNanos; mInfo.state = mState; mInfo.uniqueId = getUniqueId(); // Assume that all built-in displays that have secure output (eg. HDCP) also // support compositing from gralloc protected buffers. Loading services/core/java/com/android/server/display/LogicalDisplay.java +2 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ final class LogicalDisplay { mInfo.copyFrom(mOverrideDisplayInfo); mInfo.layerStack = mBaseDisplayInfo.layerStack; mInfo.name = mBaseDisplayInfo.name; mInfo.uniqueId = mBaseDisplayInfo.uniqueId; mInfo.state = mBaseDisplayInfo.state; } else { mInfo.copyFrom(mBaseDisplayInfo); Loading Loading @@ -208,6 +209,7 @@ final class LogicalDisplay { mBaseDisplayInfo.type = deviceInfo.type; mBaseDisplayInfo.address = deviceInfo.address; mBaseDisplayInfo.name = deviceInfo.name; mBaseDisplayInfo.uniqueId = deviceInfo.uniqueId; mBaseDisplayInfo.appWidth = deviceInfo.width; mBaseDisplayInfo.appHeight = deviceInfo.height; mBaseDisplayInfo.logicalWidth = deviceInfo.width; Loading Loading
core/java/android/view/DisplayInfo.java +11 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,11 @@ public final class DisplayInfo implements Parcelable { */ public String name; /** * Unique identifier for the display. Shouldn't be displayed to the user. */ public String uniqueId; /** * The width of the portion of the display that is available to applications, in pixels. * Represents the size of the display minus any system decorations. Loading Loading @@ -257,7 +262,7 @@ public final class DisplayInfo implements Parcelable { && flags == other.flags && type == other.type && Objects.equal(address, other.address) && Objects.equal(name, other.name) && Objects.equal(uniqueId, other.uniqueId) && appWidth == other.appWidth && appHeight == other.appHeight && smallestNominalAppWidth == other.smallestNominalAppWidth Loading Loading @@ -293,6 +298,7 @@ public final class DisplayInfo implements Parcelable { type = other.type; address = other.address; name = other.name; uniqueId = other.uniqueId; appWidth = other.appWidth; appHeight = other.appHeight; smallestNominalAppWidth = other.smallestNominalAppWidth; Loading Loading @@ -348,6 +354,7 @@ public final class DisplayInfo implements Parcelable { state = source.readInt(); ownerUid = source.readInt(); ownerPackageName = source.readString(); uniqueId = source.readString(); } @Override Loading Loading @@ -380,6 +387,7 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(state); dest.writeInt(ownerUid); dest.writeString(ownerPackageName); dest.writeString(uniqueId); } @Override Loading Loading @@ -445,6 +453,8 @@ public final class DisplayInfo implements Parcelable { StringBuilder sb = new StringBuilder(); sb.append("DisplayInfo{\""); sb.append(name); sb.append("\", uniqueId \""); sb.append(uniqueId); sb.append("\", app "); sb.append(appWidth); sb.append(" x "); Loading
services/core/java/com/android/server/display/DisplayDevice.java +11 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import java.io.PrintWriter; abstract class DisplayDevice { private final DisplayAdapter mDisplayAdapter; private final IBinder mDisplayToken; private final String mUniqueId; // The display device does not manage these properties itself, they are set by // the display manager service. The display device shouldn't really be looking at these. Loading @@ -46,9 +47,10 @@ abstract class DisplayDevice { // within a transaction from performTraversalInTransactionLocked. private Surface mCurrentSurface; public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken) { public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId) { mDisplayAdapter = displayAdapter; mDisplayToken = displayToken; mUniqueId = uniqueId; } /** Loading Loading @@ -79,6 +81,13 @@ abstract class DisplayDevice { return getDisplayDeviceInfoLocked().name; } /** * Returns the unique id of the display device. */ public final String getUniqueId() { return mUniqueId; } /** * Gets information about the display device. * Loading Loading @@ -208,6 +217,7 @@ abstract class DisplayDevice { */ public void dumpLocked(PrintWriter pw) { pw.println("mAdapter=" + mDisplayAdapter.getName()); pw.println("mUniqueId=" + mUniqueId); pw.println("mDisplayToken=" + mDisplayToken); pw.println("mCurrentLayerStack=" + mCurrentLayerStack); pw.println("mCurrentOrientation=" + mCurrentOrientation); Loading
services/core/java/com/android/server/display/DisplayDeviceInfo.java +11 −3 Original line number Diff line number Diff line Loading @@ -104,11 +104,16 @@ final class DisplayDeviceInfo { public static final int TOUCH_EXTERNAL = 2; /** * Gets the name of the display device, which may be derived from * EDID or other sources. The name may be displayed to the user. * Gets the name of the display device, which may be derived from EDID or * other sources. The name may be localized and displayed to the user. */ public String name; /** * Unique Id of display device. */ public String uniqueId; /** * The width of the display in its natural orientation, in pixels. * This value is not affected by display rotation. Loading Loading @@ -235,6 +240,7 @@ final class DisplayDeviceInfo { public boolean equals(DisplayDeviceInfo other) { return other != null && Objects.equal(name, other.name) && Objects.equal(uniqueId, other.uniqueId) && width == other.width && height == other.height && refreshRate == other.refreshRate Loading @@ -261,6 +267,7 @@ final class DisplayDeviceInfo { public void copyFrom(DisplayDeviceInfo other) { name = other.name; uniqueId = other.uniqueId; width = other.width; height = other.height; refreshRate = other.refreshRate; Loading @@ -285,7 +292,8 @@ final class DisplayDeviceInfo { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("DisplayDeviceInfo{\""); sb.append(name).append("\": ").append(width).append(" x ").append(height); sb.append(name).append("\": uniqueId=\"").append(uniqueId).append("\", "); sb.append(width).append(" x ").append(height); sb.append(", ").append(refreshRate).append(" fps"); sb.append(", supportedRefreshRates ").append(Arrays.toString(supportedRefreshRates)); sb.append(", density ").append(densityDpi); Loading
services/core/java/com/android/server/display/LocalDisplayAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ import java.util.Arrays; final class LocalDisplayAdapter extends DisplayAdapter { private static final String TAG = "LocalDisplayAdapter"; private static final String UNIQUE_ID_PREFIX = "local:"; private static final int[] BUILT_IN_DISPLAY_IDS_TO_SCAN = new int[] { SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN, SurfaceControl.BUILT_IN_DISPLAY_ID_HDMI, Loading Loading @@ -140,7 +142,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { public LocalDisplayDevice(IBinder displayToken, int builtInDisplayId, SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo) { super(LocalDisplayAdapter.this, displayToken); super(LocalDisplayAdapter.this, displayToken, UNIQUE_ID_PREFIX + builtInDisplayId); mBuiltInDisplayId = builtInDisplayId; mPhys = new SurfaceControl.PhysicalDisplayInfo( physicalDisplayInfos[activeDisplayInfo]); Loading Loading @@ -179,6 +181,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { mInfo.appVsyncOffsetNanos = mPhys.appVsyncOffsetNanos; mInfo.presentationDeadlineNanos = mPhys.presentationDeadlineNanos; mInfo.state = mState; mInfo.uniqueId = getUniqueId(); // Assume that all built-in displays that have secure output (eg. HDCP) also // support compositing from gralloc protected buffers. Loading
services/core/java/com/android/server/display/LogicalDisplay.java +2 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ final class LogicalDisplay { mInfo.copyFrom(mOverrideDisplayInfo); mInfo.layerStack = mBaseDisplayInfo.layerStack; mInfo.name = mBaseDisplayInfo.name; mInfo.uniqueId = mBaseDisplayInfo.uniqueId; mInfo.state = mBaseDisplayInfo.state; } else { mInfo.copyFrom(mBaseDisplayInfo); Loading Loading @@ -208,6 +209,7 @@ final class LogicalDisplay { mBaseDisplayInfo.type = deviceInfo.type; mBaseDisplayInfo.address = deviceInfo.address; mBaseDisplayInfo.name = deviceInfo.name; mBaseDisplayInfo.uniqueId = deviceInfo.uniqueId; mBaseDisplayInfo.appWidth = deviceInfo.width; mBaseDisplayInfo.appHeight = deviceInfo.height; mBaseDisplayInfo.logicalWidth = deviceInfo.width; Loading