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

Commit 08c1bf52 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Address API council questions for Osmosis API visibility changes" into main

parents cc53d8d8 0faaa157
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1310,10 +1310,10 @@ package android.app {
  public class WallpaperManager {
    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void clearWallpaper(int, int);
    method @FloatRange(from=0.0f, to=1.0f) @RequiresPermission(android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT) public float getWallpaperDimAmount();
    method @FlaggedApi("com.android.server.backup.enable_cross_platform_transfer") @Nullable public android.os.ParcelFileDescriptor getWallpaperFile(int, boolean);
    method @FlaggedApi("com.android.server.backup.enable_cross_platform_transfer") @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_EXTERNAL_STORAGE, android.Manifest.permission.READ_WALLPAPER_INTERNAL}) public android.os.ParcelFileDescriptor getWallpaperFile(int, boolean);
    method @FlaggedApi("android.app.live_wallpaper_content_handling") @Nullable @RequiresPermission(android.Manifest.permission.READ_WALLPAPER_INTERNAL) public android.app.wallpaper.WallpaperInstance getWallpaperInstance(int);
    method @FlaggedApi("com.android.server.backup.enable_cross_platform_transfer") @RequiresPermission(android.Manifest.permission.READ_WALLPAPER_INTERNAL) public boolean isWallpaperBackupEligible(int);
    method @FlaggedApi("com.android.server.backup.enable_cross_platform_transfer") @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setBitmapWithDescription(@Nullable android.graphics.Bitmap, @NonNull android.app.wallpaper.WallpaperDescription, boolean, int) throws java.io.IOException;
    method @FlaggedApi("com.android.server.backup.enable_cross_platform_transfer") @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setBitmapWithDescription(@NonNull android.graphics.Bitmap, @NonNull android.app.wallpaper.WallpaperDescription, boolean, int) throws java.io.IOException;
    method public void setDisplayOffset(android.os.IBinder, int, int);
    method @FlaggedApi("com.android.window.flags.multi_crop") @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setStreamWithCrops(@NonNull java.io.InputStream, @NonNull android.util.SparseArray<android.graphics.Rect>, boolean, int) throws java.io.IOException;
    method @FlaggedApi("android.app.live_wallpaper_content_handling") @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setStreamWithDescription(@NonNull java.io.InputStream, @NonNull android.app.wallpaper.WallpaperDescription, boolean, int) throws java.io.IOException;
+16 −5
Original line number Diff line number Diff line
@@ -1970,6 +1970,7 @@ public class WallpaperManager {
     *     defined kind of wallpaper, either {@link #FLAG_SYSTEM} or
     *     {@link #FLAG_LOCK}.
     * @param userId The user or profile whose imagery is to be retrieved
     * @throws SecurityException as described in {@link #getWallpaperFile(int)}
     *
     * @see #FLAG_LOCK
     * @see #FLAG_SYSTEM
@@ -1977,6 +1978,7 @@ public class WallpaperManager {
     * @hide
     */
    @UnsupportedAppUsage
    @RequiresPermission(anyOf = {MANAGE_EXTERNAL_STORAGE, READ_WALLPAPER_INTERNAL})
    public ParcelFileDescriptor getWallpaperFile(@SetWallpaperFlags int which, int userId) {
        return getWallpaperFile(which, userId, /* getCropped = */ true);
    }
@@ -1993,12 +1995,14 @@ public class WallpaperManager {
     *                   ImageWallpaper wallpaper. Return {@code null} if the wallpaper is not an
     *                   ImageWallpaper. Also return {@code null} when called with
     *                   which={@link #FLAG_LOCK} if there is a shared home + lock wallpaper.
     * @throws SecurityException as described in {@link #getWallpaperFile(int)}
     * @hide
     */
    @FlaggedApi(FLAG_ENABLE_CROSS_PLATFORM_TRANSFER)
    @UnsupportedAppUsage
    @SystemApi
    @Nullable
    @RequiresPermission(anyOf = {MANAGE_EXTERNAL_STORAGE, READ_WALLPAPER_INTERNAL})
    public ParcelFileDescriptor getWallpaperFile(@SetWallpaperFlags int which, boolean getCropped) {
        return getWallpaperFile(which, mContext.getUserId(), getCropped);
    }
@@ -2437,6 +2441,7 @@ public class WallpaperManager {
     *
     * @throws IOException If an error occurs when attempting to set the wallpaper
     *     to the provided image.
     * @throws IllegalArgumentException if the Bitmap is null
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public void setBitmap(Bitmap bitmap) throws IOException {
@@ -2469,7 +2474,7 @@ public class WallpaperManager {
     * @throws IOException If an error occurs when attempting to set the wallpaper
     *     to the provided image.
     * @throws IllegalArgumentException If the {@code visibleCropHint} rectangle is
     *     empty or invalid.
     *     empty or invalid or if the Bitmap is null
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public int setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup)
@@ -2496,6 +2501,7 @@ public class WallpaperManager {
     * @return An integer ID assigned to the newly active wallpaper; or zero on failure.
     *
     * @throws IOException
     * @throws IllegalArgumentException if the Bitmap is null
     */
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public int setBitmap(Bitmap fullImage, Rect visibleCropHint,
@@ -2509,6 +2515,7 @@ public class WallpaperManager {
     * Like {@link #setBitmap(Bitmap, Rect, boolean, int)}, but allows to pass in an explicit user
     * id. If the user id doesn't match the user id the process is running under, calling this
     * requires permission {@link android.Manifest.permission#INTERACT_ACROSS_USERS_FULL}.
     * @throws IllegalArgumentException if the Bitmap is null
     * @hide
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
@@ -2562,6 +2569,7 @@ public class WallpaperManager {
     *                  than the screen dimensions to apply a horizontal parallax effect. If the
     *                  map is empty or some entries are missing, the system will apply a default
     *                  strategy to position the wallpaper for any unspecified screen dimensions.
     * @throws IllegalArgumentException if the Bitmap is null
     * @hide
     */
    @FlaggedApi(FLAG_MULTI_CROP)
@@ -2584,22 +2592,26 @@ public class WallpaperManager {
     * @param allowBackup {@code true} if the OS is permitted to back up this wallpaper
     *                    image for restore to a future device; {@code false} otherwise.
     * @param which       Flags indicating which wallpaper(s) to configure with the new imagery.
     * @throws IllegalArgumentException if the Bitmap is null
     * @hide
     */
    @FlaggedApi(FLAG_ENABLE_CROSS_PLATFORM_TRANSFER)
    @UnsupportedAppUsage
    @SystemApi
    @RequiresPermission(android.Manifest.permission.SET_WALLPAPER)
    public int setBitmapWithDescription(@Nullable Bitmap fullImage,
    public int setBitmapWithDescription(@NonNull Bitmap fullImage,
            @NonNull WallpaperDescription description, boolean allowBackup,
            @SetWallpaperFlags int which) throws IOException {
        return setBitmapWithDescription(fullImage, description, allowBackup, which,
                mContext.getUserId());
    }

    private int setBitmapWithDescription(@Nullable Bitmap fullImage,
    private int setBitmapWithDescription(@NonNull Bitmap fullImage,
            @NonNull WallpaperDescription description, boolean allowBackup,
            @SetWallpaperFlags int which, int userId) throws IOException {
        if (fullImage == null) {
            throw new IllegalArgumentException("Bitmap cannot be null");
        }
        if (sGlobals.mService == null) {
            Log.w(TAG, "WallpaperService not running");
            throw new RuntimeException(new DeadSystemException());
@@ -3630,13 +3642,12 @@ public class WallpaperManager {
    /**
     * Is the current system wallpaper eligible for backup?
     *
     * Only the OS itself may use this method.
     * @hide
     */
    @SystemApi
    @FlaggedApi(FLAG_ENABLE_CROSS_PLATFORM_TRANSFER)
    @RequiresPermission(READ_WALLPAPER_INTERNAL)
    public boolean isWallpaperBackupEligible(int which) {
    public boolean isWallpaperBackupEligible(@SetWallpaperFlags int which) {
        if (sGlobals.mService == null) {
            Log.w(TAG, "WallpaperService not running");
            throw new RuntimeException(new DeadSystemException());