From 47ed9eec7670d4e045dda71695a26bfc0a887f99 Mon Sep 17 00:00:00 2001 From: Sumir Kataria Date: Wed, 6 Feb 2019 13:34:28 -0800 Subject: [PATCH] Restrict reflection of default DisplayInfo constructor to P and lower. There doesn't appear to be a valid use to create this object yourself; you can retrieve DisplayInfos of the attached displays using various other APIs, such as through WindowManager. The copy constructor is also available. This method is only used by one app. One possible usage is to get the display cutout information; this is something that is now available as an official API in Q. Test: N/A Change-Id: I632b337e5dfdcddd494b03fd1403f73d2c46a475 Fixes: 123769467 --- core/java/android/view/DisplayInfo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java index 43de1f89649cc..ff4ee9ce7ded0 100644 --- a/core/java/android/view/DisplayInfo.java +++ b/core/java/android/view/DisplayInfo.java @@ -27,6 +27,7 @@ import android.annotation.UnsupportedAppUsage; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Rect; +import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; @@ -281,7 +282,7 @@ public final class DisplayInfo implements Parcelable { } }; - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123769467) public DisplayInfo() { }