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

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

Allow reading wallpaper with MANAGE_EXTERNAL_STORAGE

We keep the legacy StorageManager check since some CTS still rely on it.

Flag: EXEMPT small easy-to-revert fix
Bug: 341974583
Test: treehugger
Change-Id: Ife0f4c957694d25e8f5230ac2eb11244a70bb866
parent 38407174
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wallpaper;

import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_WALLPAPER_INTERNAL;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import static android.app.WallpaperManager.COMMAND_REAPPLY;
@@ -2209,7 +2210,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
    public ParcelFileDescriptor getWallpaperWithFeature(String callingPkg, String callingFeatureId,
            IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId,
            boolean getCropped) {
        final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL);
        final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL)
                || hasPermission(MANAGE_EXTERNAL_STORAGE);
        if (!hasPrivilege) {
            mContext.getSystemService(StorageManager.class).checkPermissionReadImages(true,
                    Binder.getCallingPid(), Binder.getCallingUid(), callingPkg, callingFeatureId);