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

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

Replace legacy StorageManager check

Replace the legacy check with a MANAGE_EXTERNAL_STORAGE check, which
is the expected behaviour and consistant with the doc.

Flag: NA (very small fix, easy to revert and does't need dogfood)
Test: presubmit
Bug: 341974583
Change-Id: I4e3f270240e818c6996d9f4c27eb78874e1b7b0b
parent ae648c05
Loading
Loading
Loading
Loading
+2 −5
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;
@@ -100,7 +101,6 @@ 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;
@@ -2207,10 +2207,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId,
            boolean getCropped) {
        final boolean hasPrivilege = hasPermission(READ_WALLPAPER_INTERNAL);
        if (!hasPrivilege) {
            mContext.getSystemService(StorageManager.class).checkPermissionReadImages(true,
                    Binder.getCallingPid(), Binder.getCallingUid(), callingPkg, callingFeatureId);
        }
        if (!hasPrivilege) checkPermission(MANAGE_EXTERNAL_STORAGE);

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