Add home/lock screen argument to remaining methods that require one

After merge into master, @hide annotations will be removed and CTS tests
added.

Bug: 253481667
Test: will be added in master
Change-Id: Ia8bb930c72113c510ed7c4eb70738083c0662151
This commit is contained in:
Chris Poultney
2022-11-30 03:23:51 +00:00
parent e354477990
commit 61152bc812
2 changed files with 86 additions and 4 deletions

View File

@@ -7216,8 +7216,8 @@ package android.app {
method public android.content.Intent getCropAndSetWallpaperIntent(android.net.Uri);
method public int getDesiredMinimumHeight();
method public int getDesiredMinimumWidth();
method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getDrawable();
method @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 getDrawable();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getFastDrawable();
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);
@@ -7226,8 +7226,8 @@ package android.app {
method public boolean hasResourceWallpaper(@RawRes int);
method public boolean isSetWallpaperAllowed();
method public boolean isWallpaperSupported();
method public android.graphics.drawable.Drawable peekDrawable();
method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable peekFastDrawable();
method @Nullable public android.graphics.drawable.Drawable peekDrawable();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable peekFastDrawable();
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;

View File

@@ -786,6 +786,7 @@ public class WallpaperManager {
* is not able to access the wallpaper.
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getDrawable() {
final ColorManagementProxy cmProxy = getColorManagementProxy();
Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, FLAG_SYSTEM, cmProxy);
@@ -797,6 +798,29 @@ public class WallpaperManager {
return null;
}
/**
* Retrieve the requested wallpaper; if
* no wallpaper is set, the requested built-in static wallpaper is returned.
* This is returned as an
* abstract Drawable that you can install in a View to display whatever
* wallpaper the user has currently set.
* <p>
* This method can return null if the requested wallpaper is not available, if
* wallpapers are not supported in the current user, or if the calling app is not
* permitted to access the requested wallpaper.
*
* @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 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();
}
/**
* Obtain a drawable for the built-in static system wallpaper.
*/
@@ -1018,6 +1042,7 @@ public class WallpaperManager {
* @return Returns a Drawable object that will draw the wallpaper or a
* null pointer if these is none.
*/
@Nullable
public Drawable peekDrawable() {
final ColorManagementProxy cmProxy = getColorManagementProxy();
Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, FLAG_SYSTEM, cmProxy);
@@ -1029,6 +1054,23 @@ public class WallpaperManager {
return null;
}
/**
* Retrieve the requested wallpaper; if there is no wallpaper set,
* a null pointer is returned. This is returned as an
* abstract Drawable that you can install in a View to display whatever
* wallpaper the user has currently set.
*
* @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
*/
@Nullable
public Drawable peekDrawable(@SetWallpaperFlags int which) {
return peekDrawable();
}
/**
* Like {@link #getDrawable()}, but the returned Drawable has a number
* of limitations to reduce its overhead as much as possible. It will
@@ -1043,6 +1085,7 @@ public class WallpaperManager {
* @return Returns a Drawable object that will draw the wallpaper.
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable getFastDrawable() {
final ColorManagementProxy cmProxy = getColorManagementProxy();
Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, true, FLAG_SYSTEM, cmProxy);
@@ -1052,6 +1095,28 @@ public class WallpaperManager {
return null;
}
/**
* Like {@link #getFastDrawable(int)}, but the returned Drawable has a number
* of limitations to reduce its overhead as much as possible. It will
* never scale the wallpaper (only centering it if the requested bounds
* do match the bitmap bounds, which should not be typical), doesn't
* allow setting an alpha, color filter, or other attributes, etc. The
* bounds of the returned drawable will be initialized to the same bounds
* as the wallpaper, so normally you will not need to touch it. The
* drawable also assumes that it will be used in a context running in
* the same density as the screen (not in density compatibility mode).
*
* @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();
}
/**
* Like {@link #getFastDrawable()}, but if there is no wallpaper set,
* a null pointer is returned.
@@ -1060,6 +1125,7 @@ public class WallpaperManager {
* wallpaper or a null pointer if these is none.
*/
@RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
@Nullable
public Drawable peekFastDrawable() {
final ColorManagementProxy cmProxy = getColorManagementProxy();
Bitmap bm = sGlobals.peekWallpaperBitmap(mContext, false, FLAG_SYSTEM, cmProxy);
@@ -1069,6 +1135,22 @@ public class WallpaperManager {
return null;
}
/**
* Like {@link #getFastDrawable()}, but if there is no wallpaper set,
* a null pointer is returned.
*
* @param which The {@code FLAG_*} identifier of a valid wallpaper type. Throws
* 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();
}
/**
* Whether the wallpaper supports Wide Color Gamut or not.
* @param which The wallpaper whose image file is to be retrieved. Must be a single