Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c823df14 authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Add API to read the current wallpaper's ID" into nyc-dev

parents b2303ddd e409f0e4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5723,6 +5723,7 @@ package android.app {
    method public android.graphics.drawable.Drawable getFastDrawable();
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.os.ParcelFileDescriptor getWallpaperFile(int);
    method public int getWallpaperId(int);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
+1 −0
Original line number Diff line number Diff line
@@ -5857,6 +5857,7 @@ package android.app {
    method public android.graphics.drawable.Drawable getFastDrawable();
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.os.ParcelFileDescriptor getWallpaperFile(int);
    method public int getWallpaperId(int);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
+1 −0
Original line number Diff line number Diff line
@@ -5727,6 +5727,7 @@ package android.app {
    method public android.graphics.drawable.Drawable getFastDrawable();
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.os.ParcelFileDescriptor getWallpaperFile(int);
    method public int getWallpaperId(int);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
+5 −0
Original line number Diff line number Diff line
@@ -61,6 +61,11 @@ interface IWallpaperManager {
    ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, int which,
            out Bundle outParams, int userId);

    /**
     * Retrieve the given user's current wallpaper ID of the given kind.
     */
    int getWallpaperIdForUser(int which, int userId);

    /**
     * If the current system wallpaper is a live wallpaper component, return the
     * information about that wallpaper.  Otherwise, if it is a static image,
+32 −0
Original line number Diff line number Diff line
@@ -725,6 +725,38 @@ public class WallpaperManager {
        }
    }

    /**
     * Get the ID of the current wallpaper of the given kind.  If there is no
     * such wallpaper configured, returns a negative number.
     *
     * @param which The wallpaper whose ID is to be returned.  Must be a single
     *     defined kind of wallpaper, either {@link #FLAG_SET_SYSTEM} or
     *     {@link #FLAG_SET_LOCK}.
     * @return The positive numeric ID of the current wallpaper of the given kind,
     *     or a negative value if no such wallpaper is configured.
     */
    public int getWallpaperId(int which) {
        return getWallpaperIdForUser(which, mContext.getUserId());
    }

    /**
     * Get the ID of the given user's current wallpaper of the given kind.  If there
     * is no such wallpaper configured, returns a negative number.
     * @hide
     */
    public int getWallpaperIdForUser(int which, int userId) {
        try {
            if (sGlobals.mService == null) {
                Log.w(TAG, "WallpaperService not running");
                return -1;
            } else {
                return sGlobals.mService.getWallpaperIdForUser(which, userId);
            }
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets an Intent that will launch an activity that crops the given
     * image and sets the device's wallpaper. If there is a default HOME activity
Loading