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

Commit b5564892 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Update read wallpaper methods (U and above)

The following methods in WallpaperManager:
  - getDrawable()
  - getDrawable(int which)
  - peekDrawable()
  - peekDrawable(int which)
  - getFastDrawable()
  - getFastDrawable(int which)
  - peekFastDrawable()
  - peekFastDrawable(int which)
  - getWallpaperFile(int which)

Have been changed in T to return the default system wallpaper data unless the caller has the internal permission READ_WALLPAPER_INTERNAL (or MANAGE_EXTERNAL_STORAGE).

The READ_WALLPAPER_INTERNAL permission has been added in the SystemUI and shell AndroidManifest.

This CL also stops returning the cached wallpaper if an app doesn't hold
the READ_WALLPAPER_INTERNAL permission.

Test: treehugger
Test: atest CtsScopedStorageDeviceOnlyTest
Test: atest ScopedStorageHostTest
Test: atest CtsAppOpsTestCases
Test: atest CtsWallpaperTestCases
Test: atest NoWallpaperPermissionsTest
Test: atest LauncherIronwoodIntegrationTests (see
HomescreenCustomizationTests#testChangeWallpaper)
Bug: 261906287
Bug: 239784307

Change-Id: I8f90fbe78668e4e1d09188196180ca39c6b760b1
parent b29ba60e
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -7549,23 +7549,23 @@ package android.app {
    method public android.content.Intent getCropAndSetWallpaperIntent(android.net.Uri);
    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 @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable getDrawable();
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable getDrawable(int);
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable getFastDrawable();
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) 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);
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.os.ParcelFileDescriptor getWallpaperFile(int);
    method public int getWallpaperId(int);
    method public android.app.WallpaperInfo getWallpaperInfo();
    method @Nullable public android.app.WallpaperInfo getWallpaperInfo(int);
    method public boolean hasResourceWallpaper(@RawRes int);
    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 @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable peekDrawable();
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable peekDrawable(int);
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) public android.graphics.drawable.Drawable peekFastDrawable();
    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, "android.permission.READ_WALLPAPER_INTERNAL"}) 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;
+1 −1
Original line number Diff line number Diff line
@@ -473,7 +473,7 @@ package android.app {
    method @Nullable public android.graphics.Rect peekBitmapDimensions(int);
    method public void setWallpaperZoomOut(@NonNull android.os.IBinder, float);
    method public boolean shouldEnableWideColorGamut();
    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public boolean wallpaperSupportsWcg(int);
    method public boolean wallpaperSupportsWcg(int);
  }

  public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable {
+214 −14

File changed.

Preview size limit exceeded, changes collapsed.

+1 −2
Original line number Diff line number Diff line
@@ -4036,8 +4036,7 @@
        android:description="@string/permdesc_setWallpaperHints"
        android:protectionLevel="normal" />

    <!-- Allow the app to read the system wallpaper image without
        holding the READ_EXTERNAL_STORAGE permission.
    <!-- Allow the app to read the system and lock wallpaper images.
        <p>Not for use by third-party applications.
        @hide
        @SystemApi
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
        <permission name="android.permission.READ_NETWORK_USAGE_HISTORY"/>
        <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
        <permission name="android.permission.READ_PRECISE_PHONE_STATE"/>
        <permission name="android.permission.READ_WALLPAPER_INTERNAL"/>
        <permission name="android.permission.REAL_GET_TASKS"/>
        <permission name="android.permission.REQUEST_NETWORK_SCORES"/>
        <permission name="android.permission.RECEIVE_MEDIA_RESOURCE_USAGE"/>
Loading