Merge "Regularize some wallpaper APIs" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-27 21:50:31 +00:00
committed by Android (Google) Code Review
4 changed files with 19 additions and 15 deletions

View File

@@ -6261,6 +6261,7 @@ package android.app {
method public void addOnColorsChangedListener(android.app.WallpaperManager.OnColorsChangedListener, android.os.Handler);
method public void clear() throws java.io.IOException;
method public void clear(int) throws java.io.IOException;
method public void clearWallpaper();
method public void clearWallpaperOffsets(android.os.IBinder);
method public void forgetLoadedWallpaper();
method public android.graphics.drawable.Drawable getBuiltInDrawable();
@@ -6287,6 +6288,7 @@ package android.app {
method public void setBitmap(android.graphics.Bitmap) throws java.io.IOException;
method public int setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean) throws java.io.IOException;
method public int setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean, int) throws java.io.IOException;
method public void setDisplayPadding(android.graphics.Rect);
method public void setResource(int) throws java.io.IOException;
method public int setResource(int, int) throws java.io.IOException;
method public void setStream(java.io.InputStream) throws java.io.IOException;

View File

@@ -400,10 +400,8 @@ package android.app {
}
public class WallpaperManager {
method public void clearWallpaper();
method public void clearWallpaper(int, int);
method public void setDisplayOffset(android.os.IBinder, int, int);
method public void setDisplayPadding(android.graphics.Rect);
method public boolean setWallpaperComponent(android.content.ComponentName);
}

View File

@@ -57,10 +57,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.service.wallpaper.WallpaperService;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -915,9 +912,14 @@ public class WallpaperManager {
/**
* Get the primary colors of a wallpaper.
*
* <p>You can expect null if:
* • Colors are still being processed by the system.
* • A live wallpaper doesn't implement {@link WallpaperService.Engine#onComputeColors()}.
* <p>This method can return {@code null} when:
* <ul>
* <li>Colors are still being processed by the system.</li>
* <li>The user has chosen to use a live wallpaper: live wallpapers might not
* implement
* {@link android.service.wallpaper.WallpaperService.Engine#onComputeColors()
* WallpaperService.Engine#onComputeColors()}.</li>
* </ul>
*
* @param which Wallpaper type. Must be either {@link #FLAG_SYSTEM} or
* {@link #FLAG_LOCK}.
@@ -929,7 +931,7 @@ public class WallpaperManager {
}
/**
* Get the primary colors of a wallpaper
* Get the primary colors of the wallpaper configured in the given user.
* @param which wallpaper type. Must be either {@link #FLAG_SYSTEM} or
* {@link #FLAG_LOCK}
* @param userId Owner of the wallpaper.
@@ -1559,11 +1561,13 @@ public class WallpaperManager {
* Specify extra padding that the wallpaper should have outside of the display.
* That is, the given padding supplies additional pixels the wallpaper should extend
* outside of the display itself.
*
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER_HINTS}.
*
* @param padding The number of pixels the wallpaper should extend beyond the display,
* on its left, top, right, and bottom sides.
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.SET_WALLPAPER_HINTS)
public void setDisplayPadding(Rect padding) {
try {
@@ -1600,11 +1604,11 @@ public class WallpaperManager {
}
/**
* Clear the wallpaper.
* Reset all wallpaper to the factory default.
*
* @hide
* <p>This method requires the caller to hold the permission
* {@link android.Manifest.permission#SET_WALLPAPER}.
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
public void clearWallpaper() {
clearWallpaper(FLAG_LOCK, mContext.getUserId());

View File

@@ -1428,7 +1428,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
void clearWallpaperLocked(boolean defaultFailed, int which, int userId, IRemoteCallback reply) {
if (which != FLAG_SYSTEM && which != FLAG_LOCK) {
throw new IllegalArgumentException("Must specify exactly one kind of wallpaper to read");
throw new IllegalArgumentException("Must specify exactly one kind of wallpaper to clear");
}
WallpaperData wallpaper = null;