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

Commit cdfc56a3 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Add preliminary API for reporting display capabilities." into jb-mr1-dev

parents 1f1f5970 c5df37c2
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -78,6 +78,40 @@ public final class Display {
     */
    public static final int DEFAULT_DISPLAY = 0;

    /**
     * Display flag: Indicates that the display supports secure video output.
     * <p>
     * This flag is used to indicate that the display supports content protection
     * mechanisms for secure video output at the display interface, such as HDCP.
     * These mechanisms may be used to protect secure content as it leaves the device.
     * </p><p>
     * While mirroring content to multiple displays, it can happen that certain
     * display devices support secure video output while other display devices do not.
     * The secure content will be shown only on the display devices that support
     * secure video output and will be blanked on other display devices that do
     * not support secure video output.
     * </p><p>
     * This flag mainly applies to external display devices such as HDMI or
     * Wifi display.  Built-in display devices are usually considered secure.
     * </p>
     *
     * @hide pending review
     */
    public static final int FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT = 1 << 0;

    /**
     * Display flag: Indicates that the display supports secure in-memory video buffers.
     * <p>
     * This flag is used to indicate that the display supports content protection
     * mechanisms for decrypted in-memory video buffers, such as secure memory areas.
     * These mechanisms may be used to protect secure video buffers in memory from
     * the video decoder to the display compositor and the video interface.
     * </p>
     *
     * @hide pending review
     */
    public static final int FLAG_SUPPORTS_SECURE_VIDEO_BUFFERS = 1 << 1;

    /**
     * Internal method to create a display.
     * Applications should use {@link android.view.WindowManager#getDefaultDisplay()}
@@ -157,6 +191,20 @@ public final class Display {
        return mLayerStack;
    }

    /**
     * Returns a combination of flags that describe the capabilities of the display.
     *
     * @return The display flags.
     *
     * @hide pending review
     */
    public int getFlags() {
        synchronized (this) {
            updateDisplayInfoLocked();
            return mDisplayInfo.flags;
        }
    }

    /**
     * Gets the compatibility info used by this display instance.
     *
+20 −1
Original line number Diff line number Diff line
@@ -33,6 +33,11 @@ public final class DisplayInfo implements Parcelable {
     */
    public int layerStack;

    /**
     * Display flags.
     */
    public int flags;

    /**
     * The human-readable name of the display.
     */
@@ -189,6 +194,7 @@ public final class DisplayInfo implements Parcelable {

    public void copyFrom(DisplayInfo other) {
        layerStack = other.layerStack;
        flags = other.flags;
        name = other.name;
        appWidth = other.appWidth;
        appHeight = other.appHeight;
@@ -207,6 +213,7 @@ public final class DisplayInfo implements Parcelable {

    public void readFromParcel(Parcel source) {
        layerStack = source.readInt();
        flags = source.readInt();
        name = source.readString();
        appWidth = source.readInt();
        appHeight = source.readInt();
@@ -226,6 +233,7 @@ public final class DisplayInfo implements Parcelable {
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(layerStack);
        dest.writeInt(flags);
        dest.writeString(name);
        dest.writeInt(appWidth);
        dest.writeInt(appHeight);
@@ -286,6 +294,17 @@ public final class DisplayInfo implements Parcelable {
                + ", rotation " + rotation
                + ", density " + logicalDensityDpi
                + ", " + physicalXDpi + " x " + physicalYDpi + " dpi"
                + ", layerStack " + layerStack + "}";
                + ", layerStack " + layerStack + flagsToString(flags) + "}";
    }

    private static String flagsToString(int flags) {
        StringBuilder result = new StringBuilder();
        if ((flags & Display.FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT) != 0) {
            result.append(", FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT");
        }
        if ((flags & Display.FLAG_SUPPORTS_SECURE_VIDEO_BUFFERS) != 0) {
            result.append(", FLAG_SUPPORTS_SECURE_VIDEO_BUFFERS");
        }
        return result.toString();
    }
}
+11 −8
Original line number Diff line number Diff line
@@ -30,17 +30,17 @@ final class DisplayDeviceInfo {
     */
    public static final int FLAG_DEFAULT_DISPLAY = 1 << 0;

    /**
     * Flag: Indicates that this display device can show secure surfaces.
     */
    public static final int FLAG_SECURE = 1 << 1;

    /**
     * Flag: Indicates that this display device can rotate to show contents in a
     * different orientation.  Otherwise the rotation is assumed to be fixed in the
     * natural orientation and the display manager should transform the content to fit.
     */
    public static final int FLAG_SUPPORTS_ROTATION = 1 << 2;
    public static final int FLAG_SUPPORTS_ROTATION = 1 << 1;

    /**
     * Flag: Indicates that this display device can show secure surfaces.
     */
    public static final int FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT = 1 << 2;

    /**
     * Touch attachment: Display does not receive touch.
@@ -179,8 +179,11 @@ final class DisplayDeviceInfo {
        if ((flags & FLAG_DEFAULT_DISPLAY) != 0) {
            msg.append(", FLAG_DEFAULT_DISPLAY");
        }
        if ((flags & FLAG_SECURE) != 0) {
            msg.append(", FLAG_SECURE");
        if ((flags & FLAG_SUPPORTS_ROTATION) != 0) {
            msg.append(", FLAG_DEFAULT_DISPLAY");
        }
        if ((flags & FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT) != 0) {
            msg.append(", FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT");
        }
        return msg.toString();
    }
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ final class HeadlessDisplayAdapter extends DisplayAdapter {
                mInfo.xDpi = 160;
                mInfo.yDpi = 160;
                mInfo.flags = DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
                        | DisplayDeviceInfo.FLAG_SECURE;
                        | DisplayDeviceInfo.FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT;
                mInfo.touch = DisplayDeviceInfo.TOUCH_NONE;
            }
            return mInfo;
+2 −2
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                    mInfo.name = getContext().getResources().getString(
                            com.android.internal.R.string.display_manager_built_in_display_name);
                    mInfo.flags = DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
                            | DisplayDeviceInfo.FLAG_SECURE
                            | DisplayDeviceInfo.FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT
                            | DisplayDeviceInfo.FLAG_SUPPORTS_ROTATION;
                    mInfo.densityDpi = (int)(mPhys.density * 160 + 0.5f);
                    mInfo.xDpi = mPhys.xDpi;
@@ -133,7 +133,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                } else {
                    mInfo.name = getContext().getResources().getString(
                            com.android.internal.R.string.display_manager_hdmi_display_name);
                    mInfo.flags = DisplayDeviceInfo.FLAG_SECURE;
                    mInfo.flags = DisplayDeviceInfo.FLAG_SUPPORTS_SECURE_VIDEO_OUTPUT;
                    mInfo.touch = DisplayDeviceInfo.TOUCH_EXTERNAL;
                    mInfo.setAssumedDensityForExternalDisplay(mPhys.width, mPhys.height);
                }
Loading