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

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

Restore old StorageManager permission check

The old permission check cannot be removed because apps with
targetSDK < T should still have access to the wallpaper with
READ_EXTERNAL_STORAGE. It will be removed once all apps are required to
update their SDK to level 33 (T).

Bug: 274268760
Test: atest NoWallpaperPermissionsTest
Test: atest CtsDevicePolicyManagerTestCases
Change-Id: I1db76ea99f0ed9a4d04eda6b339deecc405ee750
parent 29664baf
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ import android.os.ShellCallback;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.IWallpaperService;
@@ -2209,7 +2210,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
    public ParcelFileDescriptor getWallpaperWithFeature(String callingPkg, String callingFeatureId,
            IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId,
            boolean getCropped) {
        checkPermission(READ_WALLPAPER_INTERNAL);
        final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL);
        if (!hasPrivilege) {
            mContext.getSystemService(StorageManager.class).checkPermissionReadImages(true,
                    Binder.getCallingPid(), Binder.getCallingUid(), callingPkg, callingFeatureId);
        }

        wallpaperUserId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), wallpaperUserId, false, true, "getWallpaper", null);