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

Commit fb9d5b32 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update documentation of Resources#getDisplayMetrics" into rvc-dev am:...

Merge "Update documentation of Resources#getDisplayMetrics" into rvc-dev am: 001fddc0 am: 4e59fde4

Change-Id: I2a94bd5b9e9a623b9c9fc6aada6114922be93e3f
parents aa366bb8 4e59fde4
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.annotation.StringRes;
import android.annotation.StyleRes;
import android.annotation.StyleableRes;
import android.annotation.XmlRes;
import android.app.Application;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo.Config;
@@ -58,9 +59,11 @@ import android.util.Log;
import android.util.LongSparseArray;
import android.util.Pools.SynchronizedPool;
import android.util.TypedValue;
import android.view.Display;
import android.view.DisplayAdjustments;
import android.view.ViewDebug;
import android.view.ViewHierarchyEncoder;
import android.view.WindowManager;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -101,6 +104,12 @@ import java.util.List;
 * (such as for different languages and screen sizes). This is an important aspect of developing
 * Android applications that are compatible on different types of devices.</p>
 *
 * <p>After {@link Build.VERSION_CODES#R}, {@link Resources} must be obtained by
 * {@link android.app.Activity} or {@link android.content.Context} created with
 * {@link android.content.Context#createWindowContext(int, Bundle)}.
 * {@link Application#getResources()} may report wrong values in multi-window or on secondary
 * displays.
 *
 * <p>For more information about using resources, see the documentation about <a
 * href="{@docRoot}guide/topics/resources/index.html">Application Resources</a>.</p>
 */
@@ -2027,6 +2036,16 @@ public class Resources {
     * Return the current display metrics that are in effect for this resource
     * object. The returned object should be treated as read-only.
     *
     * <p>Note that the reported value may be different than the window this application is
     * interested in.</p>
     *
     * <p>Best practices are to obtain metrics from {@link WindowManager#getCurrentWindowMetrics()}
     * for window bounds, {@link Display#getRealMetrics(DisplayMetrics)} for display bounds and
     * obtain density from {@link Configuration#densityDpi}. The value obtained from this API may be
     * wrong if the {@link Resources} is from the context which is different than the window is
     * attached such as {@link Application#getResources()}.
     * <p/>
     *
     * @return The resource's current display metrics.
     */
    public DisplayMetrics getDisplayMetrics() {