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

Commit f2519814 authored by Oleksandr Peletskyi's avatar Oleksandr Peletskyi
Browse files

Added restriction that disallows ability to set wallpaper.

BUG: 24890474

Change-Id: I424aa80d914e3b6f3f9eba8ccb4802bad6f54907
parent 84867864
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5705,6 +5705,7 @@ package android.app {
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
    method public boolean isWallpaperSupported();
    method public android.graphics.drawable.Drawable peekDrawable();
    method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -29264,6 +29265,7 @@ package android.os {
    field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user";
    field public static final java.lang.String DISALLOW_SAFE_BOOT = "no_safe_boot";
    field public static final java.lang.String DISALLOW_SET_USER_ICON = "no_set_user_icon";
    field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper";
    field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location";
    field public static final java.lang.String DISALLOW_SMS = "no_sms";
    field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
+2 −0
Original line number Diff line number Diff line
@@ -5838,6 +5838,7 @@ package android.app {
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
    method public boolean isWallpaperSupported();
    method public android.graphics.drawable.Drawable peekDrawable();
    method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -31310,6 +31311,7 @@ package android.os {
    field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user";
    field public static final java.lang.String DISALLOW_SAFE_BOOT = "no_safe_boot";
    field public static final java.lang.String DISALLOW_SET_USER_ICON = "no_set_user_icon";
    field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper";
    field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location";
    field public static final java.lang.String DISALLOW_SMS = "no_sms";
    field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
+2 −0
Original line number Diff line number Diff line
@@ -5707,6 +5707,7 @@ package android.app {
    method public static android.app.WallpaperManager getInstance(android.content.Context);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method public boolean hasResourceWallpaper(int);
    method public boolean isWallpaperSettingAllowed();
    method public boolean isWallpaperSupported();
    method public android.graphics.drawable.Drawable peekDrawable();
    method public android.graphics.drawable.Drawable peekFastDrawable();
@@ -29274,6 +29275,7 @@ package android.os {
    field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user";
    field public static final java.lang.String DISALLOW_SAFE_BOOT = "no_safe_boot";
    field public static final java.lang.String DISALLOW_SET_USER_ICON = "no_set_user_icon";
    field public static final java.lang.String DISALLOW_SET_WALLPAPER = "no_set_wallpaper";
    field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location";
    field public static final java.lang.String DISALLOW_SMS = "no_sms";
    field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
+5 −0
Original line number Diff line number Diff line
@@ -113,4 +113,9 @@ interface IWallpaperManager {
     * Check whether wallpapers are supported for the calling user.
     */
    boolean isWallpaperSupported(in String callingPackage);
    
    /**
     * Check whether setting of wallpapers are allowed for the calling user.
     */
    boolean isWallpaperSettingAllowed(in String callingPackage);
}
+43 −21
Original line number Diff line number Diff line
@@ -74,7 +74,8 @@ import java.util.concurrent.TimeUnit;
 * {@link #getInstance(android.content.Context) getInstance()}.
 *
 * <p> An app can check whether wallpapers are supported for the current user, by calling
 * {@link #isWallpaperSupported()}.
 * {@link #isWallpaperSupported()}, and whether setting of wallpapers is allowed, by calling
 * {@link #isWallpaperSettingAllowed()}.
 */
public class WallpaperManager {
    private static String TAG = "WallpaperManager";
@@ -1306,7 +1307,8 @@ public class WallpaperManager {

    /**
     * Returns whether wallpapers are supported for the calling user. If this function returns
     * false, any attempts to changing the wallpaper will have no effect.
     * {@code false}, any attempts to changing the wallpaper will have no effect,
     * and any attempt to obtain of the wallpaper will return {@code null}.
     */
    public boolean isWallpaperSupported() {
        if (sGlobals.mService == null) {
@@ -1321,6 +1323,26 @@ public class WallpaperManager {
        return false;
    }

    /**
     * Returns whether the calling package is allowed to set the wallpaper for the calling user.
     * If this function returns {@code false}, any attempts to change the wallpaper will have
     * no effect. Always returns {@code true} for device owner and profile owner.
     *
     * @see android.os.UserManager#DISALLOW_SET_WALLPAPER
     */
    public boolean isWallpaperSettingAllowed() {
        if (sGlobals.mService == null) {
            Log.w(TAG, "WallpaperService not running");
        } else {
            try {
                return sGlobals.mService.isWallpaperSettingAllowed(mContext.getOpPackageName());
            } catch (RemoteException e) {
                // Ignore
            }
        }
        return false;
    }

    /**
     * Clear the offsets previously associated with this window through
     * {@link #setWallpaperOffsets(IBinder, float, float)}.  This reverts
Loading