Loading core/java/android/app/WallpaperManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,13 @@ public class WallpaperManager { /** * Returns the information about the home screen wallpaper if its current wallpaper is a live * wallpaper component. Otherwise, if the wallpaper is a static image, this returns null. * * <p> * In order to use this, apps should declare a {@code <queries>} tag with the action * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, * this method will return {@code null} if the caller doesn't otherwise have * <a href="{@docRoot}training/package-visibility">visibility</a> of the wallpaper package. * </p> */ public WallpaperInfo getWallpaperInfo() { return getWallpaperInfoForUser(mContext.getUserId()); Loading @@ -1520,6 +1527,13 @@ public class WallpaperManager { * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, this * returns null. * * <p> * In order to use this, apps should declare a {@code <queries>} tag with the action * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, * this method will return {@code null} if the caller doesn't otherwise have * <a href="{@docRoot}training/package-visibility">visibility</a> of the wallpaper package. * </p> * * @param which Specifies wallpaper to request (home or lock). * @throws IllegalArgumentException if {@code which} is not exactly one of * {{@link #FLAG_SYSTEM},{@link #FLAG_LOCK}}. Loading services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +18 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wallpaper; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.Manifest.permission.QUERY_ALL_PACKAGES; import static android.Manifest.permission.READ_WALLPAPER_INTERNAL; import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; import static android.app.WallpaperManager.COMMAND_REAPPLY; Loading Loading @@ -67,6 +66,7 @@ import android.content.ServiceConnection; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManagerInternal; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.UserInfo; Loading Loading @@ -759,6 +759,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub private final Context mContext; private final WindowManagerInternal mWindowManagerInternal; private final PackageManagerInternal mPackageManagerInternal; private final IPackageManager mIPackageManager; private final ActivityManager mActivityManager; private final MyPackageMonitor mMonitor; Loading Loading @@ -1604,6 +1605,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub context.getResources().getString(R.string.image_wallpaper_component)); mDefaultWallpaperComponent = WallpaperManager.getDefaultWallpaperComponent(context); mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class); mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class); mIPackageManager = AppGlobals.getPackageManager(); mAppOpsManager = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE); DisplayManager dm = mContext.getSystemService(DisplayManager.class); Loading Loading @@ -2283,20 +2285,23 @@ public class WallpaperManagerService extends IWallpaperManager.Stub @Override public WallpaperInfo getWallpaperInfoWithFlags(@SetWallpaperFlags int which, int userId) { final boolean allow = hasPermission(READ_WALLPAPER_INTERNAL) || hasPermission(QUERY_ALL_PACKAGES); if (allow) { userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, false, true, "getWallpaperInfo", null); synchronized (mLock) { WallpaperData wallpaper = (which == FLAG_LOCK) ? mLockWallpaperMap.get(userId) : mWallpaperMap.get(userId); if (wallpaper != null && wallpaper.connection != null) { return wallpaper.connection.mInfo; } if (wallpaper == null || wallpaper.connection == null || wallpaper.connection.mInfo == null) return null; WallpaperInfo info = wallpaper.connection.mInfo; if (hasPermission(READ_WALLPAPER_INTERNAL) || mPackageManagerInternal.canQueryPackage( Binder.getCallingUid(), info.getComponent().getPackageName())) { return info; } } return null; } Loading Loading
core/java/android/app/WallpaperManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -1499,6 +1499,13 @@ public class WallpaperManager { /** * Returns the information about the home screen wallpaper if its current wallpaper is a live * wallpaper component. Otherwise, if the wallpaper is a static image, this returns null. * * <p> * In order to use this, apps should declare a {@code <queries>} tag with the action * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, * this method will return {@code null} if the caller doesn't otherwise have * <a href="{@docRoot}training/package-visibility">visibility</a> of the wallpaper package. * </p> */ public WallpaperInfo getWallpaperInfo() { return getWallpaperInfoForUser(mContext.getUserId()); Loading @@ -1520,6 +1527,13 @@ public class WallpaperManager { * wallpaper component. Otherwise, if the wallpaper is a static image or is not set, this * returns null. * * <p> * In order to use this, apps should declare a {@code <queries>} tag with the action * {@code "android.service.wallpaper.WallpaperService"}. Otherwise, * this method will return {@code null} if the caller doesn't otherwise have * <a href="{@docRoot}training/package-visibility">visibility</a> of the wallpaper package. * </p> * * @param which Specifies wallpaper to request (home or lock). * @throws IllegalArgumentException if {@code which} is not exactly one of * {{@link #FLAG_SYSTEM},{@link #FLAG_LOCK}}. Loading
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +18 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.server.wallpaper; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.Manifest.permission.QUERY_ALL_PACKAGES; import static android.Manifest.permission.READ_WALLPAPER_INTERNAL; import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; import static android.app.WallpaperManager.COMMAND_REAPPLY; Loading Loading @@ -67,6 +66,7 @@ import android.content.ServiceConnection; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManagerInternal; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.UserInfo; Loading Loading @@ -759,6 +759,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub private final Context mContext; private final WindowManagerInternal mWindowManagerInternal; private final PackageManagerInternal mPackageManagerInternal; private final IPackageManager mIPackageManager; private final ActivityManager mActivityManager; private final MyPackageMonitor mMonitor; Loading Loading @@ -1604,6 +1605,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub context.getResources().getString(R.string.image_wallpaper_component)); mDefaultWallpaperComponent = WallpaperManager.getDefaultWallpaperComponent(context); mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class); mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class); mIPackageManager = AppGlobals.getPackageManager(); mAppOpsManager = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE); DisplayManager dm = mContext.getSystemService(DisplayManager.class); Loading Loading @@ -2283,20 +2285,23 @@ public class WallpaperManagerService extends IWallpaperManager.Stub @Override public WallpaperInfo getWallpaperInfoWithFlags(@SetWallpaperFlags int which, int userId) { final boolean allow = hasPermission(READ_WALLPAPER_INTERNAL) || hasPermission(QUERY_ALL_PACKAGES); if (allow) { userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, false, true, "getWallpaperInfo", null); synchronized (mLock) { WallpaperData wallpaper = (which == FLAG_LOCK) ? mLockWallpaperMap.get(userId) : mWallpaperMap.get(userId); if (wallpaper != null && wallpaper.connection != null) { return wallpaper.connection.mInfo; } if (wallpaper == null || wallpaper.connection == null || wallpaper.connection.mInfo == null) return null; WallpaperInfo info = wallpaper.connection.mInfo; if (hasPermission(READ_WALLPAPER_INTERNAL) || mPackageManagerInternal.canQueryPackage( Binder.getCallingUid(), info.getComponent().getPackageName())) { return info; } } return null; } Loading