Loading core/java/android/hardware/display/DisplayManager.java +37 −11 Original line number Diff line number Diff line Loading @@ -114,6 +114,23 @@ public final class DisplayManager { public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; /** * Display category: Rear displays. * <p> * This category can be used to identify complementary internal displays that are facing away * from the user. * Certain applications may present to this display. * Similar to presentation displays. * </p> * * @see android.app.Presentation * @see Display#FLAG_PRESENTATION * @see #getDisplays(String) * @hide */ public static final String DISPLAY_CATEGORY_REAR = "android.hardware.display.category.REAR"; /** * Display category: All displays, including disabled displays. * <p> Loading Loading @@ -619,11 +636,19 @@ public final class DisplayManager { synchronized (mLock) { try { if (DISPLAY_CATEGORY_PRESENTATION.equals(category)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL, Display.FLAG_PRESENTATION); } else if (DISPLAY_CATEGORY_REAR.equals(category)) { addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL, Display.FLAG_REAR); } else if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); Loading @@ -644,15 +669,16 @@ public final class DisplayManager { } } private void addPresentationDisplaysLocked( ArrayList<Display> displays, int[] displayIds, int matchType) { for (int i = 0; i < displayIds.length; i++) { if (displayIds[i] == DEFAULT_DISPLAY) { private void addDisplaysLocked( ArrayList<Display> displays, int[] displayIds, int matchType, int flagMask) { for (int displayId : displayIds) { if (displayId == DEFAULT_DISPLAY) { continue; } Display display = getOrCreateDisplayLocked(displayIds[i], true /*assumeValid*/); Display display = getOrCreateDisplayLocked(displayId, /* assumeValid= */ true); if (display != null && (display.getFlags() & Display.FLAG_PRESENTATION) != 0 && (display.getFlags() & flagMask) == flagMask && display.getType() == matchType) { displays.add(display); } Loading core/java/android/view/Display.java +11 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,17 @@ public final class Display { */ public static final int FLAG_STEAL_TOP_FOCUS_DISABLED = 1 << 12; /** * Display flag: Indicates that the display is a rear display. * <p> * This flag identifies complementary displays that are facing away from the user. * </p> * * @hide * @see #getFlags() */ public static final int FLAG_REAR = 1 << 13; /** * Display flag: Indicates that the contents of the display should not be scaled * to fit the physical screen dimensions. Used for development only to emulate Loading core/java/android/view/DisplayInfo.java +3 −0 Original line number Diff line number Diff line Loading @@ -906,6 +906,9 @@ public final class DisplayInfo implements Parcelable { if ((flags & Display.FLAG_TOUCH_FEEDBACK_DISABLED) != 0) { result.append(", FLAG_TOUCH_FEEDBACK_DISABLED"); } if ((flags & Display.FLAG_REAR) != 0) { result.append(", FLAG_REAR_DISPLAY"); } return result.toString(); } } services/core/java/com/android/server/display/DeviceStateToLayoutMap.java +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class DeviceStateToLayoutMap { final int state = l.getState().intValue(); final Layout layout = createLayout(state); for (com.android.server.display.config.layout.Display d: l.getDisplay()) { assert layout != null; Layout.Display display = layout.createDisplayLocked( DisplayAddress.fromPhysicalDisplayId(d.getAddress().longValue()), d.isDefaultDisplay(), Loading services/core/java/com/android/server/display/LogicalDisplay.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.view.DisplayInfo; import android.view.Surface; import android.view.SurfaceControl; import com.android.server.display.layout.Layout; import com.android.server.wm.utils.InsetUtils; import java.io.PrintWriter; Loading Loading @@ -152,6 +153,10 @@ final class LogicalDisplay { // the {@link mIsEnabled} is changing, or the underlying mPrimiaryDisplayDevice is changing. private boolean mIsInTransition; // Indicates the position of the display, POSITION_UNKNOWN could mean it hasn't been specified, // or this is a virtual display etc. private int mPosition = Layout.Display.POSITION_UNKNOWN; /** * The ID of the brightness throttling data that should be used. This can change e.g. in * concurrent displays mode in which a stricter brightness throttling policy might need to be Loading @@ -170,6 +175,13 @@ final class LogicalDisplay { mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID; } public void setPositionLocked(int position) { mPosition = position; } public int getPositionLocked() { return mPosition; } /** * Gets the logical display id of this logical display. * Loading Loading @@ -424,6 +436,11 @@ final class LogicalDisplay { mBaseDisplayInfo.roundedCorners = deviceInfo.roundedCorners; mBaseDisplayInfo.installOrientation = deviceInfo.installOrientation; mBaseDisplayInfo.displayShape = deviceInfo.displayShape; if (mPosition == Layout.Display.POSITION_REAR) { mBaseDisplayInfo.flags |= Display.FLAG_REAR; } mPrimaryDisplayDeviceInfo = deviceInfo; mInfo.set(null); } Loading Loading @@ -814,6 +831,7 @@ final class LogicalDisplay { pw.println("mIsEnabled=" + mIsEnabled); pw.println("mIsInTransition=" + mIsInTransition); pw.println("mLayerStack=" + mLayerStack); pw.println("mPosition=" + mPosition); pw.println("mHasContent=" + mHasContent); pw.println("mDesiredDisplayModeSpecs={" + mDesiredDisplayModeSpecs + "}"); pw.println("mRequestedColorMode=" + mRequestedColorMode); Loading Loading
core/java/android/hardware/display/DisplayManager.java +37 −11 Original line number Diff line number Diff line Loading @@ -114,6 +114,23 @@ public final class DisplayManager { public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; /** * Display category: Rear displays. * <p> * This category can be used to identify complementary internal displays that are facing away * from the user. * Certain applications may present to this display. * Similar to presentation displays. * </p> * * @see android.app.Presentation * @see Display#FLAG_PRESENTATION * @see #getDisplays(String) * @hide */ public static final String DISPLAY_CATEGORY_REAR = "android.hardware.display.category.REAR"; /** * Display category: All displays, including disabled displays. * <p> Loading Loading @@ -619,11 +636,19 @@ public final class DisplayManager { synchronized (mLock) { try { if (DISPLAY_CATEGORY_PRESENTATION.equals(category)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL, Display.FLAG_PRESENTATION); addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL, Display.FLAG_PRESENTATION); } else if (DISPLAY_CATEGORY_REAR.equals(category)) { addDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL, Display.FLAG_REAR); } else if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); Loading @@ -644,15 +669,16 @@ public final class DisplayManager { } } private void addPresentationDisplaysLocked( ArrayList<Display> displays, int[] displayIds, int matchType) { for (int i = 0; i < displayIds.length; i++) { if (displayIds[i] == DEFAULT_DISPLAY) { private void addDisplaysLocked( ArrayList<Display> displays, int[] displayIds, int matchType, int flagMask) { for (int displayId : displayIds) { if (displayId == DEFAULT_DISPLAY) { continue; } Display display = getOrCreateDisplayLocked(displayIds[i], true /*assumeValid*/); Display display = getOrCreateDisplayLocked(displayId, /* assumeValid= */ true); if (display != null && (display.getFlags() & Display.FLAG_PRESENTATION) != 0 && (display.getFlags() & flagMask) == flagMask && display.getType() == matchType) { displays.add(display); } Loading
core/java/android/view/Display.java +11 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,17 @@ public final class Display { */ public static final int FLAG_STEAL_TOP_FOCUS_DISABLED = 1 << 12; /** * Display flag: Indicates that the display is a rear display. * <p> * This flag identifies complementary displays that are facing away from the user. * </p> * * @hide * @see #getFlags() */ public static final int FLAG_REAR = 1 << 13; /** * Display flag: Indicates that the contents of the display should not be scaled * to fit the physical screen dimensions. Used for development only to emulate Loading
core/java/android/view/DisplayInfo.java +3 −0 Original line number Diff line number Diff line Loading @@ -906,6 +906,9 @@ public final class DisplayInfo implements Parcelable { if ((flags & Display.FLAG_TOUCH_FEEDBACK_DISABLED) != 0) { result.append(", FLAG_TOUCH_FEEDBACK_DISABLED"); } if ((flags & Display.FLAG_REAR) != 0) { result.append(", FLAG_REAR_DISPLAY"); } return result.toString(); } }
services/core/java/com/android/server/display/DeviceStateToLayoutMap.java +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class DeviceStateToLayoutMap { final int state = l.getState().intValue(); final Layout layout = createLayout(state); for (com.android.server.display.config.layout.Display d: l.getDisplay()) { assert layout != null; Layout.Display display = layout.createDisplayLocked( DisplayAddress.fromPhysicalDisplayId(d.getAddress().longValue()), d.isDefaultDisplay(), Loading
services/core/java/com/android/server/display/LogicalDisplay.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.view.DisplayInfo; import android.view.Surface; import android.view.SurfaceControl; import com.android.server.display.layout.Layout; import com.android.server.wm.utils.InsetUtils; import java.io.PrintWriter; Loading Loading @@ -152,6 +153,10 @@ final class LogicalDisplay { // the {@link mIsEnabled} is changing, or the underlying mPrimiaryDisplayDevice is changing. private boolean mIsInTransition; // Indicates the position of the display, POSITION_UNKNOWN could mean it hasn't been specified, // or this is a virtual display etc. private int mPosition = Layout.Display.POSITION_UNKNOWN; /** * The ID of the brightness throttling data that should be used. This can change e.g. in * concurrent displays mode in which a stricter brightness throttling policy might need to be Loading @@ -170,6 +175,13 @@ final class LogicalDisplay { mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID; } public void setPositionLocked(int position) { mPosition = position; } public int getPositionLocked() { return mPosition; } /** * Gets the logical display id of this logical display. * Loading Loading @@ -424,6 +436,11 @@ final class LogicalDisplay { mBaseDisplayInfo.roundedCorners = deviceInfo.roundedCorners; mBaseDisplayInfo.installOrientation = deviceInfo.installOrientation; mBaseDisplayInfo.displayShape = deviceInfo.displayShape; if (mPosition == Layout.Display.POSITION_REAR) { mBaseDisplayInfo.flags |= Display.FLAG_REAR; } mPrimaryDisplayDeviceInfo = deviceInfo; mInfo.set(null); } Loading Loading @@ -814,6 +831,7 @@ final class LogicalDisplay { pw.println("mIsEnabled=" + mIsEnabled); pw.println("mIsInTransition=" + mIsInTransition); pw.println("mLayerStack=" + mLayerStack); pw.println("mPosition=" + mPosition); pw.println("mHasContent=" + mHasContent); pw.println("mDesiredDisplayModeSpecs={" + mDesiredDisplayModeSpecs + "}"); pw.println("mRequestedColorMode=" + mRequestedColorMode); Loading