diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java index 25b84c5c01b00..65f45d8950277 100644 --- a/core/java/android/hardware/display/DisplayManager.java +++ b/core/java/android/hardware/display/DisplayManager.java @@ -80,7 +80,7 @@ public final class DisplayManager { * Display category: Presentation displays. *
* This category can be used to identify secondary displays that are suitable for - * use as presentation displays such as HDMI or Wireless displays. Applications + * use as presentation displays such as external or wireless displays. Applications * may automatically project their content to presentation displays to provide * richer second screen experiences. *
@@ -100,7 +100,7 @@ public final class DisplayManager { * When this flag is set, the virtual display is public. ** A public virtual display behaves just like most any other display that is connected - * to the system such as an HDMI or Wireless display. Applications can open + * to the system such as an external or wireless display. Applications can open * windows on the display and the system may mirror the contents of other displays * onto it. *
@@ -364,7 +364,7 @@ public final class DisplayManager { addAllDisplaysLocked(mTempDisplays, displayIds); } else if (category.equals(DISPLAY_CATEGORY_PRESENTATION)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); - addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_HDMI); + addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL); } diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index f61217d606867..d1edf58715e13 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -67,7 +67,7 @@ import java.util.List; * *
* A logical display does not necessarily represent a particular physical display device - * such as the built-in screen or an external monitor. The contents of a logical + * such as the internal display or an external display. The contents of a logical * display may be presented on one or more physical displays according to the devices * that are currently attached and whether mirroring has been enabled. *
@@ -104,8 +104,7 @@ public final class Display { private int mCachedAppHeightCompat; /** - * The default Display id, which is the id of the built-in primary display - * assuming there is one. + * The default Display id, which is the id of the primary display assuming there is one. */ public static final int DEFAULT_DISPLAY = 0; @@ -188,7 +187,7 @@ public final class Display { * Display flag: Indicates that the display is a presentation display. ** This flag identifies secondary displays that are suitable for - * use as presentation displays such as HDMI or Wireless displays. Applications + * use as presentation displays such as external or wireless displays. Applications * may automatically project their content to presentation displays to provide * richer second screen experiences. *
@@ -257,17 +256,17 @@ public final class Display { public static final int TYPE_UNKNOWN = 0; /** - * Display type: Built-in display. + * Display type: Physical display connected through an internal port. * @hide */ - public static final int TYPE_BUILT_IN = 1; + public static final int TYPE_INTERNAL = 1; /** - * Display type: HDMI display. + * Display type: Physical display connected through an external port. * @hide */ @UnsupportedAppUsage - public static final int TYPE_HDMI = 2; + public static final int TYPE_EXTERNAL = 2; /** * Display type: WiFi display. @@ -562,8 +561,8 @@ public final class Display { * @return The display type. * * @see #TYPE_UNKNOWN - * @see #TYPE_BUILT_IN - * @see #TYPE_HDMI + * @see #TYPE_INTERNAL + * @see #TYPE_EXTERNAL * @see #TYPE_WIFI * @see #TYPE_OVERLAY * @see #TYPE_VIRTUAL @@ -1251,10 +1250,10 @@ public final class Display { switch (type) { case TYPE_UNKNOWN: return "UNKNOWN"; - case TYPE_BUILT_IN: - return "BUILT_IN"; - case TYPE_HDMI: - return "HDMI"; + case TYPE_INTERNAL: + return "INTERNAL"; + case TYPE_EXTERNAL: + return "EXTERNAL"; case TYPE_WIFI: return "WIFI"; case TYPE_OVERLAY: diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index fe9e36e53cd8e..c98ea03b53fc5 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -1285,12 +1285,15 @@ public final class SurfaceControl implements Parcelable { * @hide */ public static final class DisplayInfo { + public boolean isInternal; public float density; public boolean secure; @Override public String toString() { - return "DisplayInfo{density=" + density + ", secure=" + secure + "}"; + return "DisplayInfo{isInternal=" + isInternal + + ", density=" + density + + ", secure=" + secure + "}"; } } diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index f564d75588328..ce9a048f8006c 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -65,6 +65,7 @@ static const char* const OutOfResourcesException = static struct { jclass clazz; jmethodID ctor; + jfieldID isInternal; jfieldID density; jfieldID secure; } gDisplayInfoClassInfo; @@ -781,6 +782,8 @@ static jobject nativeGetDisplayInfo(JNIEnv* env, jclass clazz, jobject tokenObj) } jobject object = env->NewObject(gDisplayInfoClassInfo.clazz, gDisplayInfoClassInfo.ctor); + env->SetBooleanField(object, gDisplayInfoClassInfo.isInternal, + info.connectionType == DisplayConnectionType::Internal); env->SetFloatField(object, gDisplayInfoClassInfo.density, info.density); env->SetBooleanField(object, gDisplayInfoClassInfo.secure, info.secure); return object; @@ -1528,6 +1531,7 @@ int register_android_view_SurfaceControl(JNIEnv* env) jclass infoClazz = FindClassOrDie(env, "android/view/SurfaceControl$DisplayInfo"); gDisplayInfoClassInfo.clazz = MakeGlobalRefOrDie(env, infoClazz); gDisplayInfoClassInfo.ctor = GetMethodIDOrDie(env, infoClazz, "@@ -231,7 +231,7 @@ public final class DisplayManagerService extends SystemService { private int mGlobalDisplayState = Display.STATE_ON; // The overall display brightness. - // For now, this only applies to the built-in display but we may split it up eventually. + // For now, this only applies to the default display but we may split it up eventually. private float mGlobalDisplayBrightness; // Set to true when there are pending display changes that have yet to be applied diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index 2b225e5f3ec64..4ebbddabd6dbf 100644 --- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java @@ -35,7 +35,6 @@ import android.view.Display; import android.view.DisplayAddress; import android.view.DisplayCutout; import android.view.DisplayEventReceiver; -import android.view.Surface; import android.view.SurfaceControl; import com.android.internal.BrightnessSynchronizer; @@ -53,7 +52,7 @@ import java.util.List; import java.util.Objects; /** - * A display adapter for the local displays managed by Surface Flinger. + * A display adapter for the local displays managed by SurfaceFlinger. *
* Display adapters are guarded by the {@link DisplayManagerService.SyncRoot} lock. *
@@ -129,10 +128,10 @@ final class LocalDisplayAdapter extends DisplayAdapter { LocalDisplayDevice device = mDevices.get(physicalDisplayId); if (device == null) { // Display was added. - final boolean isInternal = mDevices.size() == 0; + final boolean isDefaultDisplay = mDevices.size() == 0; device = new LocalDisplayDevice(displayToken, physicalDisplayId, info, configs, activeConfig, configSpecs, colorModes, activeColorMode, - hdrCapabilities, isInternal); + hdrCapabilities, isDefaultDisplay); mDevices.put(physicalDisplayId, device); sendDisplayDeviceEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED); } else if (device.updateDisplayProperties(configs, activeConfig, @@ -175,7 +174,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { private final LogicalLight mBacklight; private final SparseArray