From 09c1f3fab3e030e254d74edf219779bbd5573dc6 Mon Sep 17 00:00:00 2001 From: atrost Date: Mon, 3 Feb 2020 14:38:36 +0000 Subject: [PATCH] Add description to THROW_SECURITY_EXCEPTIONS Having a change id without a description will fail m offline-sdk-docs once https://android-review.googlesource.com/q/topic:%22compatdocs%22 is merged. The description is based on the comment on rethrowSecurityException. Test: m offline-sdk-docs Bug: 144927670 Change-Id: I49af09b92432f823b10967b02b81f5d8e0ffd593 --- core/java/android/content/om/OverlayManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/content/om/OverlayManager.java b/core/java/android/content/om/OverlayManager.java index 33d17763fb24f..dbe39547b0cac 100644 --- a/core/java/android/content/om/OverlayManager.java +++ b/core/java/android/content/om/OverlayManager.java @@ -44,6 +44,16 @@ public class OverlayManager { private final IOverlayManager mService; private final Context mContext; + /** + * Pre R a {@link java.lang.SecurityException} would only be thrown by setEnabled APIs (e + * .g. {@link #setEnabled(String, boolean, UserHandle)}) for a permission error. + * Since R this no longer holds true, and {@link java.lang.SecurityException} can be + * thrown for any number of reasons, none of which are exposed to the caller. + * + *

To maintain existing API behavior, if a legacy permission failure or actor enforcement + * failure occurs for an app not yet targeting R, coerce it into an {@link + * java.lang.IllegalStateException}, which existed in the source prior to R. + */ @ChangeId @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q) private static final long THROW_SECURITY_EXCEPTIONS = 147340954;