Add privileged permission for reading the current wallpaper image

OEMs can therefore arrange factory-default access to have access prior
to setup or user interaction.

Bug: 30770233
Bug: 64029450
Test: manual

Change-Id: I2cb30721f2a64ef50275b711ca10ca571248504a
This commit is contained in:
Christopher Tate
2017-08-14 16:45:03 -07:00
parent fe97799d5d
commit 8a71c48d1c
3 changed files with 16 additions and 2 deletions

View File

@@ -201,6 +201,7 @@ package android {
field public static final java.lang.String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
field public static final java.lang.String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
field public static final java.lang.String READ_VOICEMAIL = "com.android.voicemail.permission.READ_VOICEMAIL";
field public static final java.lang.String READ_WALLPAPER_INTERNAL = "android.permission.READ_WALLPAPER_INTERNAL";
field public static final java.lang.String READ_WIFI_CREDENTIAL = "android.permission.READ_WIFI_CREDENTIAL";
field public static final java.lang.String REAL_GET_TASKS = "android.permission.REAL_GET_TASKS";
field public static final java.lang.String REBOOT = "android.permission.REBOOT";

View File

@@ -1984,6 +1984,15 @@
android:description="@string/permdesc_setWallpaperHints"
android:protectionLevel="normal" />
<!-- Allow the app to read the system wallpaper image without
holding the READ_EXTERNAL_STORAGE permission.
<p>Not for use by third-party applications.
@hide
@SystemApi
-->
<permission android:name="android.permission.READ_WALLPAPER_INTERNAL"
android:protectionLevel="signature|privileged" />
<!-- ============================================ -->
<!-- Permissions for changing the system clock -->
<!-- ============================================ -->

View File

@@ -1606,8 +1606,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
@Override
public ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb,
final int which, Bundle outParams, int wallpaperUserId) {
enforceCallingOrSelfPermissionAndAppOp(android.Manifest.permission.READ_EXTERNAL_STORAGE,
callingPkg, Binder.getCallingUid(), "read wallpaper");
final int hasPrivilege = mContext.checkCallingOrSelfPermission(
android.Manifest.permission.READ_WALLPAPER_INTERNAL);
if (hasPrivilege != PackageManager.PERMISSION_GRANTED) {
enforceCallingOrSelfPermissionAndAppOp(android.Manifest.permission.READ_EXTERNAL_STORAGE,
callingPkg, Binder.getCallingUid(), "read wallpaper");
}
wallpaperUserId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
Binder.getCallingUid(), wallpaperUserId, false, true, "getWallpaper", null);