Fix getSettingsSliceUri API review issues
1. Permissions for wallpaper settings Slice.
2. Return value must be marked either @NonNull or @Nullable.
Solution:
1. Add more explanation for settingsSliceUri API usage in javadoc.
2. Follow the public API annotation rule.
Bug: 119118548
Bug: 126699851
Test: atest tests/Internal/src/android/app/WallpaperInfoTest.java
Change-Id: I5db88ce35ba11b018abe42f2192afed44a19fea5
diff --git a/api/current.txt b/api/current.txt
index 1b805dc..5c66899 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6419,7 +6419,7 @@
method public android.content.pm.ServiceInfo getServiceInfo();
method public String getServiceName();
method public String getSettingsActivity();
- method public android.net.Uri getSettingsSliceUri();
+ method @Nullable public android.net.Uri getSettingsSliceUri();
method public boolean getShowMetadataInPreview();
method public CharSequence loadAuthor(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
method public CharSequence loadContextDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
diff --git a/core/java/android/app/WallpaperInfo.java b/core/java/android/app/WallpaperInfo.java
index c2be4b0..e9b0175 100644
--- a/core/java/android/app/WallpaperInfo.java
+++ b/core/java/android/app/WallpaperInfo.java
@@ -16,6 +16,7 @@
package android.app;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.slice.Slice;
import android.content.ComponentName;
@@ -354,12 +355,17 @@
/**
* Returns an URI that provides a settings {@link Slice} for this wallpaper.
+ * The wallpaper should implement a SliceProvider associated with this URI.
+ * The system will display the Slice in the customization section while previewing the live
+ * wallpaper. Because this URI is accessible to other apps, it is recommended to protect it
+ * with the android.permission.BIND_WALLPAPER permission.
*
* <p>{@code null} will be returned if there is no settings Slice URI associated
* with the wallpaper.
*
* @return The URI.
*/
+ @Nullable
public Uri getSettingsSliceUri() {
if (mSettingsSliceUri == null) {
return null;