diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-03-19 20:51:30 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-03-19 20:51:30 +0000 |
| commit | cff44bd82e45c044982efb7cc2f6b553e1d7d96f (patch) | |
| tree | 7b3b6df15cb1bb7f3a306a88a1d1c0b424d94039 /core/java/android | |
| parent | 24f63edb4180ed3da6a6b945d382ba17ac3f0ea5 (diff) | |
| parent | e39e9b2f6964f644fc19ec9d7065e9e39b9cab2f (diff) | |
Merge "Change createRequestInteractAcrossProfilesIntent to throw Exception" into rvc-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/pm/CrossProfileApps.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/java/android/content/pm/CrossProfileApps.java b/core/java/android/content/pm/CrossProfileApps.java index dc3a02976416..179fc5c661a5 100644 --- a/core/java/android/content/pm/CrossProfileApps.java +++ b/core/java/android/content/pm/CrossProfileApps.java @@ -334,7 +334,7 @@ public class CrossProfileApps { * Returns an {@link Intent} to open the settings page that allows the user to decide whether * the calling app can interact across profiles. * - * <p>Returns {@code null} if {@link #canRequestInteractAcrossProfiles()} is {@code false}. + * <p>The method {@link #canRequestInteractAcrossProfiles()} must be returning {@code true}. * * <p>Note that the user may already have given consent and the app may already be able to * interact across profiles, even if {@link #canRequestInteractAcrossProfiles()} is {@code @@ -345,11 +345,12 @@ public class CrossProfileApps { * the app can interact across profiles * * @throws SecurityException if {@code mContext.getPackageName()} does not belong to the - * calling UID. + * calling UID, or {@link #canRequestInteractAcrossProfiles()} is {@code false}. */ - public @Nullable Intent createRequestInteractAcrossProfilesIntent() { + public @NonNull Intent createRequestInteractAcrossProfilesIntent() { if (!canRequestInteractAcrossProfiles()) { - return null; + throw new SecurityException( + "The calling package can not request to interact across profiles."); } final Intent settingsIntent = new Intent(); settingsIntent.setAction(Settings.ACTION_MANAGE_CROSS_PROFILE_ACCESS); |
