From 358d6d9708d387609e43e40b0bdde1ce24949ee6 Mon Sep 17 00:00:00 2001 From: Aurélien Pomini Date: Thu, 18 Jan 2024 10:37:33 +0000 Subject: Fix getWallpaperInfo javadoc (again!) A mistakes was made in ag/24905907: the mention "before Android U" was accidentally added to the overload that was added in U. Also fix a couple typos. Bug: 285731765 Test: NA, javadoc change Flag: NA Change-Id: Ie927639822a247a19aa0e051b430bfe12b25d52b --- core/api/current.txt | 2 +- core/java/android/app/WallpaperManager.java | 30 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index d4cec2d5ba08..5d9f3075c7e0 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -7698,7 +7698,7 @@ package android.app { method @Nullable public android.app.WallpaperColors getWallpaperColors(int); method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.os.ParcelFileDescriptor getWallpaperFile(int); method public int getWallpaperId(int); - method public android.app.WallpaperInfo getWallpaperInfo(); + method @RequiresPermission(value="QUERY_ALL_PACKAGES", conditional=true) public android.app.WallpaperInfo getWallpaperInfo(); method @Nullable public android.app.WallpaperInfo getWallpaperInfo(int); method public boolean hasResourceWallpaper(@RawRes int); method public boolean isSetWallpaperAllowed(); diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 62db90f79091..c6eca80c9f0f 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -1727,15 +1727,22 @@ public class WallpaperManager { /** * Returns the information about the home screen wallpaper if its current wallpaper is a live - * wallpaper component. Otherwise, if the wallpaper is a static image, this returns null. + * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, or if the + * caller doesn't have the appropriate permissions, this returns {@code null}. * *

- * In order to use this, apps should declare a {@code } tag with the action - * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, + * Before Android U, this method requires the + * {@link android.Manifest.permission#QUERY_ALL_PACKAGES} permission. + *

+ * + *

+ * Starting from Android U, in order to use this, apps should declare a {@code } tag + * with the action {@code "android.service.wallpaper.WallpaperService"}. Otherwise, * this method will return {@code null} if the caller doesn't otherwise have * visibility of the wallpaper package. *

*/ + @RequiresPermission(value = "QUERY_ALL_PACKAGES", conditional = true) public WallpaperInfo getWallpaperInfo() { return getWallpaperInfoForUser(mContext.getUserId()); } @@ -1752,19 +1759,14 @@ public class WallpaperManager { } /** - * Returns the information about the home screen wallpaper if its current wallpaper is a live - * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, or if the + * Returns the information about the designated wallpaper if its current wallpaper is a live + * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, or if * the caller doesn't have the appropriate permissions, this returns {@code null}. * *

- * Before Android U, this method requires the - * {@link android.Manifest.permission#QUERY_ALL_PACKAGES} permission. - *

- * - *

- * Starting from Android U, In order to use this, apps should declare a {@code } tag - * with the action {@code "android.service.wallpaper.WallpaperService"}. Otherwise, - * this method will return {@code null} if the caller doesn't otherwise have + * In order to use this, apps should declare a {@code } tag with the action + * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, this method will return + * {@code null} if the caller doesn't otherwise have * visibility of the wallpaper package. *

* @@ -1780,7 +1782,7 @@ public class WallpaperManager { /** * Returns the information about the designated wallpaper if its current wallpaper is a live * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, or if the - * the caller doesn't have the appropriate permissions, this returns {@code null}. + * caller doesn't have the appropriate permissions, this returns {@code null}. * *

* In order to use this, apps should declare a {@code } tag -- cgit v1.2.3-59-g8ed1b