diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index 9cb0d1ff2c3f4..a06b0e0355d8e 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -741,35 +741,42 @@ public final class Display { } /** - * Gets the size of the display, in pixels. - * Value returned by this method does not necessarily represent the actual raw size - * (native resolution) of the display. - *

- * 1. The returned size may be adjusted to exclude certain system decor elements - * that are always visible. - *

- * 2. It may be scaled to provide compatibility with older applications that - * were originally designed for smaller displays. - *

- * 3. It can be different depending on the WindowManager to which the display belongs. - *

- * - If requested from non-Activity context (e.g. Application context via - * {@code (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE)}) - * it will report the size of the entire display based on current rotation and with subtracted - * system decoration areas. - *

- * - If requested from activity (either using {@code getWindowManager()} or - * {@code (WindowManager) getSystemService(Context.WINDOW_SERVICE)}) resulting size will - * correspond to current app window size. In this case it can be smaller than physical size in - * multi-window mode. - *

- * Typically for the purposes of layout apps should make a request from activity context - * to obtain size available for the app content. - *

+ * Gets the size of the display in pixels. * - * @param outSize A {@link Point} object to receive the size information. - * @deprecated Use {@link WindowManager#getCurrentWindowMetrics()} to obtain an instance of - * {@link WindowMetrics} and use {@link WindowMetrics#getBounds()} instead. + *

The return value does not necessarily represent the actual size (native resolution) of the + * display. The returned size might be adjusted to exclude certain system decor elements that + * are always visible, or the size might be scaled to provide compatibility with older + * applications that were originally designed for smaller displays. + * + *

The returned size can also be different depending on the WindowManager bound to the + * display: + *

+ * + *

For layout purposes, apps should make a request from an activity context to obtain the + * size of the display area available for app content. + * + * @param outSize A {@link Point} object which receives the display size information. + * + * @deprecated Use {@link WindowMetrics} instead. Obtain a {@code WindowMetrics} instance by + * calling {@link WindowManager#getCurrentWindowMetrics()}, then call + * {@link WindowMetrics#getBounds()} to get the dimensions of the application window. */ @Deprecated public void getSize(Point outSize) { @@ -785,8 +792,9 @@ public final class Display { * Gets the size of the display as a rectangle, in pixels. * * @param outSize A {@link Rect} object to receive the size information. + * * @deprecated Use {@link WindowMetrics#getBounds()} to get the dimensions of the application - * window area. + * window. */ @Deprecated public void getRectSize(Rect outSize) { @@ -1275,32 +1283,39 @@ public final class Display { } /** - * Gets display metrics that describe the size and density of this display. - * The size returned by this method does not necessarily represent the - * actual raw size (native resolution) of the display. - *

- * 1. The returned size may be adjusted to exclude certain system decor elements - * that are always visible. - *

- * 2. It may be scaled to provide compatibility with older applications that - * were originally designed for smaller displays. - *

- * 3. It can be different depending on the WindowManager to which the display belongs. - *

- * - If requested from non-Activity context (e.g. Application context via - * {@code (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE)}) - * metrics will report the size of the entire display based on current rotation and with - * subtracted system decoration areas. - *

- * - If requested from activity (either using {@code getWindowManager()} or - * {@code (WindowManager) getSystemService(Context.WINDOW_SERVICE)}) resulting metrics will - * correspond to current app window metrics. In this case the size can be smaller than physical - * size in multi-window mode. - *

+ * Gets the size and density of this display. + * + *

The size returned does not necessarily represent the actual size (native resolution) of + * the display. The returned size might be adjusted to exclude certain system decor elements + * that are always visible, or the size might be scaled to provide compatibility with older + * applications that were originally designed for smaller displays. + * + *

The returned size can also be different depending on the WindowManager associated with the + * display: + *

+ * + * @param outMetrics A {@link DisplayMetrics} object which receives the display metrics. * - * @param outMetrics A {@link DisplayMetrics} object to receive the metrics. * @deprecated Use {@link WindowMetrics#getBounds()} to get the dimensions of the application - * window area, and {@link Configuration#densityDpi} to get the current density. + * window. Use {@link Configuration#densityDpi} to get the display density. */ @Deprecated public void getMetrics(DisplayMetrics outMetrics) {