Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 997e632f authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Added unique id to display devices and their settings." into lmp-mr1-dev

parents 089f95f4 361ca21a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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.
@@ -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
@@ -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;
@@ -348,6 +354,7 @@ public final class DisplayInfo implements Parcelable {
        state = source.readInt();
        ownerUid = source.readInt();
        ownerPackageName = source.readString();
        uniqueId = source.readString();
    }

    @Override
@@ -380,6 +387,7 @@ public final class DisplayInfo implements Parcelable {
        dest.writeInt(state);
        dest.writeInt(ownerUid);
        dest.writeString(ownerPackageName);
        dest.writeString(uniqueId);
    }

    @Override
@@ -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 ");
+11 −1
Original line number Diff line number Diff line
@@ -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.
@@ -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;
    }

    /**
@@ -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.
     *
@@ -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);
+11 −3
Original line number Diff line number Diff line
@@ -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.
@@ -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
@@ -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;
@@ -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);
+4 −1
Original line number Diff line number Diff line
@@ -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,
@@ -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]);
@@ -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.
+2 −0
Original line number Diff line number Diff line
@@ -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);
@@ -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