From 4ba27796a679190aa1ce09a3d3b6d497161fc0cd Mon Sep 17 00:00:00 2001 From: Jakub Gielzak Date: Tue, 5 Feb 2019 18:20:21 +0000 Subject: [PATCH] Restrict reflection access to View methods Restricted reflection access to: - dispatchAttachedToWindow - dispatchDetachedFromWindow Those should not be used directly as it violates internal code guarantees. Instead Views need to be actually attached to the window. Bug: 123769352, 123769370 Test: n/a Change-Id: I0006bc99a2d10747e931e944caee21932c4642dd --- core/java/android/view/View.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 992b996170644..4b127bd246fc6 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -19413,7 +19413,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param info the {@link android.view.View.AttachInfo} to associated with * this view */ - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) void dispatchAttachedToWindow(AttachInfo info, int visibility) { mAttachInfo = info; if (mOverlay != null) { @@ -19479,7 +19479,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, notifyAppearedOrDisappearedForContentCaptureIfNeeded(true); } - @UnsupportedAppUsage + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) void dispatchDetachedFromWindow() { AttachInfo info = mAttachInfo; if (info != null) {