FileDocCategorySizeDatePackage
DisplayInfo.javaAPI DocAndroid 5.1 API18660Thu Mar 12 22:22:10 GMT 2015android.view

DisplayInfo

public final class DisplayInfo extends Object implements android.os.Parcelable
Describes the characteristics of a particular logical display.
hide

Fields Summary
public int
layerStack
The surface flinger layer stack associated with this logical display.
public int
flags
Display flags.
public int
type
Display type.
public String
address
Display address, or null if none. Interpretation varies by display type.
public String
name
The human-readable name of the display.
public String
uniqueId
Unique identifier for the display. Shouldn't be displayed to the user.
public int
appWidth
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.
public int
appHeight
The height of the portion of the display that is available to applications, in pixels. Represents the size of the display minus any system decorations.
public int
smallestNominalAppWidth
The smallest value of {@link #appWidth} that an application is likely to encounter, in pixels, excepting cases where the width may be even smaller due to the presence of a soft keyboard, for example.
public int
smallestNominalAppHeight
The smallest value of {@link #appHeight} that an application is likely to encounter, in pixels, excepting cases where the height may be even smaller due to the presence of a soft keyboard, for example.
public int
largestNominalAppWidth
The largest value of {@link #appWidth} that an application is likely to encounter, in pixels, excepting cases where the width may be even larger due to system decorations such as the status bar being hidden, for example.
public int
largestNominalAppHeight
The largest value of {@link #appHeight} that an application is likely to encounter, in pixels, excepting cases where the height may be even larger due to system decorations such as the status bar being hidden, for example.
public int
logicalWidth
The logical width of the display, in pixels. Represents the usable size of the display which may be smaller than the physical size when the system is emulating a smaller display.
public int
logicalHeight
The logical height of the display, in pixels. Represents the usable size of the display which may be smaller than the physical size when the system is emulating a smaller display.
public int
overscanLeft
public int
overscanTop
public int
overscanRight
public int
overscanBottom
public int
rotation
The rotation of the display relative to its natural orientation. May be one of {@link android.view.Surface#ROTATION_0}, {@link android.view.Surface#ROTATION_90}, {@link android.view.Surface#ROTATION_180}, {@link android.view.Surface#ROTATION_270}.

The value of this field is indeterminate if the logical display is presented on more than one physical display.

public float
refreshRate
The refresh rate of this display in frames per second.

The value of this field is indeterminate if the logical display is presented on more than one physical display.

public float[]
supportedRefreshRates
The supported refresh rates of this display at the current resolution in frames per second.
public int
logicalDensityDpi
The logical display density which is the basis for density-independent pixels.
public float
physicalXDpi
The exact physical pixels per inch of the screen in the X dimension.

The value of this field is indeterminate if the logical display is presented on more than one physical display.

public float
physicalYDpi
The exact physical pixels per inch of the screen in the Y dimension.

The value of this field is indeterminate if the logical display is presented on more than one physical display.

public long
appVsyncOffsetNanos
This is a positive value indicating the phase offset of the VSYNC events provided by Choreographer relative to the display refresh. For example, if Choreographer reports that the refresh occurred at time N, it actually occurred at (N - appVsyncOffsetNanos).
public long
presentationDeadlineNanos
This is how far in advance a buffer must be queued for presentation at a given time. If you want a buffer to appear on the screen at time N, you must submit the buffer before (N - bufferDeadlineNanos).
public int
state
The state of the display, such as {@link android.view.Display#STATE_ON}.
public int
ownerUid
The UID of the application that owns this display, or zero if it is owned by the system.

If the display is private, then only the owner can use it.

public String
ownerPackageName
The package name of the application that owns this display, or null if it is owned by the system.

If the display is private, then only the owner can use it.

public static final Creator
CREATOR
Constructors Summary
public DisplayInfo()


      
    
public DisplayInfo(DisplayInfo other)

        copyFrom(other);
    
private DisplayInfo(android.os.Parcel source)

        readFromParcel(source);
    
Methods Summary
public voidcopyFrom(android.view.DisplayInfo other)

        layerStack = other.layerStack;
        flags = other.flags;
        type = other.type;
        address = other.address;
        name = other.name;
        uniqueId = other.uniqueId;
        appWidth = other.appWidth;
        appHeight = other.appHeight;
        smallestNominalAppWidth = other.smallestNominalAppWidth;
        smallestNominalAppHeight = other.smallestNominalAppHeight;
        largestNominalAppWidth = other.largestNominalAppWidth;
        largestNominalAppHeight = other.largestNominalAppHeight;
        logicalWidth = other.logicalWidth;
        logicalHeight = other.logicalHeight;
        overscanLeft = other.overscanLeft;
        overscanTop = other.overscanTop;
        overscanRight = other.overscanRight;
        overscanBottom = other.overscanBottom;
        rotation = other.rotation;
        refreshRate = other.refreshRate;
        supportedRefreshRates = Arrays.copyOf(
                other.supportedRefreshRates, other.supportedRefreshRates.length);
        logicalDensityDpi = other.logicalDensityDpi;
        physicalXDpi = other.physicalXDpi;
        physicalYDpi = other.physicalYDpi;
        appVsyncOffsetNanos = other.appVsyncOffsetNanos;
        presentationDeadlineNanos = other.presentationDeadlineNanos;
        state = other.state;
        ownerUid = other.ownerUid;
        ownerPackageName = other.ownerPackageName;
    
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object o)

        return o instanceof DisplayInfo && equals((DisplayInfo)o);
    
public booleanequals(android.view.DisplayInfo other)

        return other != null
                && layerStack == other.layerStack
                && flags == other.flags
                && type == other.type
                && Objects.equal(address, other.address)
                && Objects.equal(uniqueId, other.uniqueId)
                && appWidth == other.appWidth
                && appHeight == other.appHeight
                && smallestNominalAppWidth == other.smallestNominalAppWidth
                && smallestNominalAppHeight == other.smallestNominalAppHeight
                && largestNominalAppWidth == other.largestNominalAppWidth
                && largestNominalAppHeight == other.largestNominalAppHeight
                && logicalWidth == other.logicalWidth
                && logicalHeight == other.logicalHeight
                && overscanLeft == other.overscanLeft
                && overscanTop == other.overscanTop
                && overscanRight == other.overscanRight
                && overscanBottom == other.overscanBottom
                && rotation == other.rotation
                && refreshRate == other.refreshRate
                && logicalDensityDpi == other.logicalDensityDpi
                && physicalXDpi == other.physicalXDpi
                && physicalYDpi == other.physicalYDpi
                && appVsyncOffsetNanos == other.appVsyncOffsetNanos
                && presentationDeadlineNanos == other.presentationDeadlineNanos
                && state == other.state
                && ownerUid == other.ownerUid
                && Objects.equal(ownerPackageName, other.ownerPackageName);
    
private static java.lang.StringflagsToString(int flags)

        StringBuilder result = new StringBuilder();
        if ((flags & Display.FLAG_SECURE) != 0) {
            result.append(", FLAG_SECURE");
        }
        if ((flags & Display.FLAG_SUPPORTS_PROTECTED_BUFFERS) != 0) {
            result.append(", FLAG_SUPPORTS_PROTECTED_BUFFERS");
        }
        if ((flags & Display.FLAG_PRIVATE) != 0) {
            result.append(", FLAG_PRIVATE");
        }
        if ((flags & Display.FLAG_PRESENTATION) != 0) {
            result.append(", FLAG_PRESENTATION");
        }
        return result.toString();
    
public voidgetAppMetrics(android.util.DisplayMetrics outMetrics)

        getAppMetrics(outMetrics, CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null);
    
public voidgetAppMetrics(android.util.DisplayMetrics outMetrics, DisplayAdjustments displayAdjustments)

        getMetricsWithSize(outMetrics, displayAdjustments.getCompatibilityInfo(),
                displayAdjustments.getActivityToken(), appWidth, appHeight);
    
public voidgetAppMetrics(android.util.DisplayMetrics outMetrics, android.content.res.CompatibilityInfo ci, android.os.IBinder token)

        getMetricsWithSize(outMetrics, ci, token, appWidth, appHeight);
    
public voidgetLogicalMetrics(android.util.DisplayMetrics outMetrics, android.content.res.CompatibilityInfo compatInfo, android.os.IBinder token)

        getMetricsWithSize(outMetrics, compatInfo, token, logicalWidth, logicalHeight);
    
private voidgetMetricsWithSize(android.util.DisplayMetrics outMetrics, android.content.res.CompatibilityInfo compatInfo, android.os.IBinder token, int width, int height)

        outMetrics.densityDpi = outMetrics.noncompatDensityDpi = logicalDensityDpi;
        outMetrics.noncompatWidthPixels  = outMetrics.widthPixels = width;
        outMetrics.noncompatHeightPixels = outMetrics.heightPixels = height;

        outMetrics.density = outMetrics.noncompatDensity =
                logicalDensityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE;
        outMetrics.scaledDensity = outMetrics.noncompatScaledDensity = outMetrics.density;
        outMetrics.xdpi = outMetrics.noncompatXdpi = physicalXDpi;
        outMetrics.ydpi = outMetrics.noncompatYdpi = physicalYDpi;

        if (!compatInfo.equals(CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO)) {
            compatInfo.applyToDisplayMetrics(outMetrics);
        }
    
public intgetNaturalHeight()

        return rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180 ?
                logicalHeight : logicalWidth;
    
public intgetNaturalWidth()

        return rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180 ?
                logicalWidth : logicalHeight;
    
public booleanhasAccess(int uid)
Returns true if the specified UID has access to this display.

        return Display.hasAccess(uid, flags, ownerUid);
    
public inthashCode()

        return 0; // don't care
    
public voidreadFromParcel(android.os.Parcel source)

        layerStack = source.readInt();
        flags = source.readInt();
        type = source.readInt();
        address = source.readString();
        name = source.readString();
        appWidth = source.readInt();
        appHeight = source.readInt();
        smallestNominalAppWidth = source.readInt();
        smallestNominalAppHeight = source.readInt();
        largestNominalAppWidth = source.readInt();
        largestNominalAppHeight = source.readInt();
        logicalWidth = source.readInt();
        logicalHeight = source.readInt();
        overscanLeft = source.readInt();
        overscanTop = source.readInt();
        overscanRight = source.readInt();
        overscanBottom = source.readInt();
        rotation = source.readInt();
        refreshRate = source.readFloat();
        supportedRefreshRates = source.createFloatArray();
        logicalDensityDpi = source.readInt();
        physicalXDpi = source.readFloat();
        physicalYDpi = source.readFloat();
        appVsyncOffsetNanos = source.readLong();
        presentationDeadlineNanos = source.readLong();
        state = source.readInt();
        ownerUid = source.readInt();
        ownerPackageName = source.readString();
        uniqueId = source.readString();
    
public java.lang.StringtoString()

        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 ");
        sb.append(appHeight);
        sb.append(", real ");
        sb.append(logicalWidth);
        sb.append(" x ");
        sb.append(logicalHeight);
        if (overscanLeft != 0 || overscanTop != 0 || overscanRight != 0 || overscanBottom != 0) {
            sb.append(", overscan (");
            sb.append(overscanLeft);
            sb.append(",");
            sb.append(overscanTop);
            sb.append(",");
            sb.append(overscanRight);
            sb.append(",");
            sb.append(overscanBottom);
            sb.append(")");
        }
        sb.append(", largest app ");
        sb.append(largestNominalAppWidth);
        sb.append(" x ");
        sb.append(largestNominalAppHeight);
        sb.append(", smallest app ");
        sb.append(smallestNominalAppWidth);
        sb.append(" x ");
        sb.append(smallestNominalAppHeight);
        sb.append(", ");
        sb.append(refreshRate);
        sb.append(" fps, supportedRefreshRates ");
        sb.append(Arrays.toString(supportedRefreshRates));
        sb.append(", rotation ");
        sb.append(rotation);
        sb.append(", density ");
        sb.append(logicalDensityDpi);
        sb.append(" (");
        sb.append(physicalXDpi);
        sb.append(" x ");
        sb.append(physicalYDpi);
        sb.append(") dpi, layerStack ");
        sb.append(layerStack);
        sb.append(", appVsyncOff ");
        sb.append(appVsyncOffsetNanos);
        sb.append(", presDeadline ");
        sb.append(presentationDeadlineNanos);
        sb.append(", type ");
        sb.append(Display.typeToString(type));
        if (address != null) {
            sb.append(", address ").append(address);
        }
        sb.append(", state ");
        sb.append(Display.stateToString(state));
        if (ownerUid != 0 || ownerPackageName != null) {
            sb.append(", owner ").append(ownerPackageName);
            sb.append(" (uid ").append(ownerUid).append(")");
        }
        sb.append(flagsToString(flags));
        sb.append("}");
        return sb.toString();
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeInt(layerStack);
        dest.writeInt(this.flags);
        dest.writeInt(type);
        dest.writeString(address);
        dest.writeString(name);
        dest.writeInt(appWidth);
        dest.writeInt(appHeight);
        dest.writeInt(smallestNominalAppWidth);
        dest.writeInt(smallestNominalAppHeight);
        dest.writeInt(largestNominalAppWidth);
        dest.writeInt(largestNominalAppHeight);
        dest.writeInt(logicalWidth);
        dest.writeInt(logicalHeight);
        dest.writeInt(overscanLeft);
        dest.writeInt(overscanTop);
        dest.writeInt(overscanRight);
        dest.writeInt(overscanBottom);
        dest.writeInt(rotation);
        dest.writeFloat(refreshRate);
        dest.writeFloatArray(supportedRefreshRates);
        dest.writeInt(logicalDensityDpi);
        dest.writeFloat(physicalXDpi);
        dest.writeFloat(physicalYDpi);
        dest.writeLong(appVsyncOffsetNanos);
        dest.writeLong(presentationDeadlineNanos);
        dest.writeInt(state);
        dest.writeInt(ownerUid);
        dest.writeString(ownerPackageName);
        dest.writeString(uniqueId);