summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Poultney <poultney@google.com> 2022-11-30 03:23:51 +0000
committer Chris Poultney <poultney@google.com> 2022-12-09 14:51:20 +0000
commit6203ea26e33b3ff6d83f3aa556c3cc567de773ed (patch)
tree8f478a53c59bf9dc0348139f694baccde9dfa45d
parentfc65cabd47bff336a8015b3cc070b74d49b97a5b (diff)
Add home/lock screen argument to remaining methods
Fixes: 253481667 Test: CTS tests in same topic Change-Id: Ibdc00fdea65a248c81d5757028922b94a51cef41
-rw-r--r--core/api/current.txt4
-rw-r--r--core/java/android/app/WallpaperManager.java75
2 files changed, 40 insertions, 39 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 9a2c75fe490a..6a8ea2ce6d59 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -7284,7 +7284,9 @@ package android.app {
method public int getDesiredMinimumHeight();
method public int getDesiredMinimumWidth();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getDrawable();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getDrawable(int);
method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getFastDrawable();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getFastDrawable(int);
method public static android.app.WallpaperManager getInstance(android.content.Context);
method @Nullable public android.app.WallpaperColors getWallpaperColors(int);
method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.os.ParcelFileDescriptor getWallpaperFile(int);
@@ -7295,7 +7297,9 @@ package android.app {
method public boolean isSetWallpaperAllowed();
method public boolean isWallpaperSupported();
method @Nullable public android.graphics.drawable.Drawable peekDrawable();
+ method @Nullable public android.graphics.drawable.Drawable peekDrawable(int);
method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable peekFastDrawable();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable peekFastDrawable(int);
method public void removeOnColorsChangedListener(@NonNull android.app.WallpaperManager.OnColorsChangedListener);
method public void sendWallpaperCommand(android.os.IBinder, String, int, int, int, android.os.Bundle);
method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void setBitmap(android.graphics.Bitmap) throws java.io.IOException;
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index e8804328ef9d..84b404de9860 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -809,14 +809,7 @@ public class WallpaperManager {
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getDrawable() {
- final ColorManagementProxy cmProxy = getColorManagementProxy();
- Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, FLAG_SYSTEM, cmProxy);
- if (bm != null) {
- Drawable dr = new BitmapDrawable(mContext.getResources(), bm);
- dr.setDither(false);
- return dr;
- }
- return null;
+ return getDrawable(FLAG_SYSTEM);
}
/**
@@ -835,13 +828,20 @@ public class WallpaperManager {
* @return Returns a Drawable object that will draw the requested wallpaper,
* or {@code null} if the requested wallpaper does not exist or if the calling application
* is not able to access the wallpaper.
- * @hide
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getDrawable(@SetWallpaperFlags int which) {
- return getDrawable();
+ final ColorManagementProxy cmProxy = getColorManagementProxy();
+ Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, which, cmProxy);
+ if (bm != null) {
+ Drawable dr = new BitmapDrawable(mContext.getResources(), bm);
+ dr.setDither(false);
+ return dr;
+ }
+ return null;
}
+
/**
* Obtain a drawable for the built-in static system wallpaper.
*/
@@ -1059,18 +1059,11 @@ public class WallpaperManager {
* wallpaper the user has currently set.
*
* @return Returns a Drawable object that will draw the wallpaper or a
- * null pointer if these is none.
+ * null pointer if wallpaper is unset.
*/
@Nullable
public Drawable peekDrawable() {
- final ColorManagementProxy cmProxy = getColorManagementProxy();
- Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, FLAG_SYSTEM, cmProxy);
- if (bm != null) {
- Drawable dr = new BitmapDrawable(mContext.getResources(), bm);
- dr.setDither(false);
- return dr;
- }
- return null;
+ return peekDrawable(FLAG_SYSTEM);
}
/**
@@ -1081,13 +1074,19 @@ public class WallpaperManager {
*
* @param which The {@code FLAG_*} identifier of a valid wallpaper type. Throws
* IllegalArgumentException if an invalid wallpaper is requested.
- * @return Returns a Drawable object that will draw the wallpaper or a null pointer if these
- * is none.
- * @hide
+ * @return Returns a Drawable object that will draw the wallpaper or a null pointer if
+ * wallpaper is unset.
*/
@Nullable
public Drawable peekDrawable(@SetWallpaperFlags int which) {
- return peekDrawable();
+ final ColorManagementProxy cmProxy = getColorManagementProxy();
+ Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, which, cmProxy);
+ if (bm != null) {
+ Drawable dr = new BitmapDrawable(mContext.getResources(), bm);
+ dr.setDither(false);
+ return dr;
+ }
+ return null;
}
/**
@@ -1106,12 +1105,7 @@ public class WallpaperManager {
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getFastDrawable() {
- final ColorManagementProxy cmProxy = getColorManagementProxy();
- Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, FLAG_SYSTEM, cmProxy);
- if (bm != null) {
- return new FastBitmapDrawable(bm);
- }
- return null;
+ return getFastDrawable(FLAG_SYSTEM);
}
/**
@@ -1128,12 +1122,16 @@ public class WallpaperManager {
* @param which The {@code FLAG_*} identifier of a valid wallpaper type. Throws
* IllegalArgumentException if an invalid wallpaper is requested.
* @return Returns a Drawable object that will draw the wallpaper.
- * @hide
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getFastDrawable(@SetWallpaperFlags int which) {
- return getFastDrawable();
+ final ColorManagementProxy cmProxy = getColorManagementProxy();
+ Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, which, cmProxy);
+ if (bm != null) {
+ return new FastBitmapDrawable(bm);
+ }
+ return null;
}
/**
@@ -1146,12 +1144,7 @@ public class WallpaperManager {
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable peekFastDrawable() {
- final ColorManagementProxy cmProxy = getColorManagementProxy();
- Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, FLAG_SYSTEM, cmProxy);
- if (bm != null) {
- return new FastBitmapDrawable(bm);
- }
- return null;
+ return peekFastDrawable(FLAG_SYSTEM);
}
/**
@@ -1162,12 +1155,16 @@ public class WallpaperManager {
* IllegalArgumentException if an invalid wallpaper is requested.
* @return Returns an optimized Drawable object that will draw the
* wallpaper or a null pointer if these is none.
- * @hide
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable peekFastDrawable(@SetWallpaperFlags int which) {
- return peekFastDrawable();
+ final ColorManagementProxy cmProxy = getColorManagementProxy();
+ Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, which, cmProxy);
+ if (bm != null) {
+ return new FastBitmapDrawable(bm);
+ }
+ return null;
}
/**