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

Commit 161c47f7 authored by Ching-Sung Li's avatar Ching-Sung Li
Browse files

Remove flag related with new getBitmapCrops API

Flag: EXEMPT flag removal
Bug: 388961453
Test: atest WallpaperManagerTest
Change-Id: If23549ad65892b3e98ac6552b4faccb46e39ebcb
parent 59fbf3ea
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1290,9 +1290,7 @@ package android.app {
  public class WallpaperManager {
    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void clearWallpaper(int, int);
    method @FlaggedApi("android.app.customization_packs_apis") public static int getOrientation(@NonNull android.graphics.Point);
    method @FloatRange(from=0.0f, to=1.0f) @RequiresPermission(android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT) public float getWallpaperDimAmount();
    method @FlaggedApi("android.app.customization_packs_apis") @Nullable 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 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;
@@ -1301,10 +1299,6 @@ package android.app {
    method @FlaggedApi("android.app.live_wallpaper_content_handling") @RequiresPermission(allOf={android.Manifest.permission.SET_WALLPAPER_COMPONENT, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional=true) public boolean setWallpaperComponentWithDescription(@NonNull android.app.wallpaper.WallpaperDescription, int);
    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER_COMPONENT) public boolean setWallpaperComponentWithFlags(@NonNull android.content.ComponentName, int);
    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT) public void setWallpaperDimAmount(@FloatRange(from=0.0f, to=1.0f) float);
    field @FlaggedApi("android.app.customization_packs_apis") public static final int ORIENTATION_LANDSCAPE = 1; // 0x1
    field @FlaggedApi("android.app.customization_packs_apis") public static final int ORIENTATION_PORTRAIT = 0; // 0x0
    field @FlaggedApi("android.app.customization_packs_apis") public static final int ORIENTATION_SQUARE_LANDSCAPE = 3; // 0x3
    field @FlaggedApi("android.app.customization_packs_apis") public static final int ORIENTATION_SQUARE_PORTRAIT = 2; // 0x2
  }
}
+0 −1
Original line number Diff line number Diff line
@@ -536,7 +536,6 @@ package android.app {
    method @Nullable public android.graphics.Bitmap getBitmap();
    method @Nullable public android.graphics.Bitmap getBitmapAsUser(int, boolean, int);
    method @FlaggedApi("com.android.window.flags.multi_crop") @NonNull @RequiresPermission(android.Manifest.permission.READ_WALLPAPER_INTERNAL) public java.util.List<android.graphics.Rect> getBitmapCrops(@NonNull java.util.List<android.graphics.Point>, int, boolean);
    method @FlaggedApi("android.app.customization_packs_apis") @NonNull @RequiresPermission(android.Manifest.permission.READ_WALLPAPER_INTERNAL) public android.util.SparseArray<android.graphics.Rect> getBitmapCrops(int);
    method @FlaggedApi("com.android.window.flags.multi_crop") @NonNull public java.util.List<android.graphics.Rect> getBitmapCrops(@NonNull android.graphics.Point, @NonNull java.util.List<android.graphics.Point>, @Nullable java.util.Map<android.graphics.Point,android.graphics.Rect>);
    method public boolean isLockscreenLiveWallpaperEnabled();
    method @Nullable public android.graphics.Rect peekBitmapDimensions();
+0 −7
Original line number Diff line number Diff line
@@ -176,13 +176,6 @@ final class DisabledWallpaperManager extends WallpaperManager {
        return unsupported();
    }

    @Override
    @NonNull
    public SparseArray<Rect> getBitmapCrops(int which) {
        unsupported();
        return new SparseArray<>();
    }

    @Override
    public List<Rect> getBitmapCrops(@NonNull Point bitmapSize, @NonNull List<Point> displaySizes,
            @Nullable Map<Point, Rect> cropHints) {
+0 −59
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.app;
import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
import static android.Manifest.permission.READ_WALLPAPER_INTERNAL;
import static android.Manifest.permission.SET_WALLPAPER_DIM_AMOUNT;
import static android.app.Flags.FLAG_CUSTOMIZATION_PACKS_APIS;
import static android.app.Flags.FLAG_LIVE_WALLPAPER_CONTENT_HANDLING;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.ParcelFileDescriptor.MODE_READ_ONLY;
@@ -343,32 +342,24 @@ public class WallpaperManager {
     * Portrait orientation of most screens
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    public static final int ORIENTATION_PORTRAIT = 0;

    /**
     * Landscape orientation of most screens
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    public static final int ORIENTATION_LANDSCAPE = 1;

    /**
     * Portrait orientation with similar width and height (e.g. the inner screen of a foldable)
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    public static final int ORIENTATION_SQUARE_PORTRAIT = 2;

    /**
     * Landscape orientation with similar width and height (e.g. the inner screen of a foldable)
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    public static final int ORIENTATION_SQUARE_LANDSCAPE = 3;

    /**
@@ -377,8 +368,6 @@ public class WallpaperManager {
     * @return the corresponding {@link ScreenOrientation}.
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    public static @ScreenOrientation int getOrientation(@NonNull Point screenSize) {
        float ratio = ((float) screenSize.x) / screenSize.y;
        // ratios between 3/4 and 4/3 are considered square
@@ -1664,52 +1653,6 @@ public class WallpaperManager {
        }
    }

    /**
     * For the current user, if the wallpaper of the specified destination is an ImageWallpaper,
     * return the custom crops of the wallpaper, that have been provided for example via
     * {@link #setStreamWithCrops}. These crops are relative to the original bitmap.
     * <p>
     * This method helps apps that change wallpapers provide an undo option. Calling
     * {@link #setStreamWithCrops(InputStream, SparseArray, boolean, int)} with this SparseArray and
     * the current original bitmap file, that can be obtained with {@link #getWallpaperFile(int,
     * boolean)} with {@code getCropped=false}, will exactly lead to the current wallpaper state.
     *
     * @param which wallpaper type. Must be either {@link #FLAG_SYSTEM} or {@link #FLAG_LOCK}.
     * @return A map from {{@link #ORIENTATION_PORTRAIT}, {@link #ORIENTATION_LANDSCAPE},
     *          {@link #ORIENTATION_SQUARE_PORTRAIT}, {{@link #ORIENTATION_SQUARE_LANDSCAPE}}} to
     *          Rect, representing the custom cropHints. The map can be empty and will only contains
     *          entries for screen orientations for which a custom crop was provided. If no custom
     *          crop is provided for an orientation, the system will infer the crop based on the
     *          custom crops of the other orientations; or center-align the full image if no custom
     *          crops are provided at all.
     *          <p>
     *          Return an empty map if the wallpaper is not an ImageWallpaper. Also return
     *          an empty map when called with which={@link #FLAG_LOCK} if there is a shared
     *          home + lock wallpaper.
     *
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @TestApi
    @RequiresPermission(READ_WALLPAPER_INTERNAL)
    @NonNull
    public SparseArray<Rect> getBitmapCrops(@SetWallpaperFlags int which) {
        checkExactlyOneWallpaperFlagSet(which);
        try {
            Bundle bundle = sGlobals.mService.getCurrentBitmapCrops(which, mContext.getUserId());
            SparseArray<Rect> result = new SparseArray<>();
            if (bundle == null) return result;
            for (String key : bundle.keySet()) {
                int intKey = Integer.parseInt(key);
                Rect rect = bundle.getParcelable(key, Rect.class);
                result.put(intKey, rect);
            }
            return result;
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * For preview purposes.
     * Return how a bitmap of a given size would be cropped for a given list of display sizes, if
@@ -1955,8 +1898,6 @@ public class WallpaperManager {
     *                   which={@link #FLAG_LOCK} if there is a shared home + lock wallpaper.
     * @hide
     */
    @FlaggedApi(FLAG_CUSTOMIZATION_PACKS_APIS)
    @SystemApi
    @Nullable
    public ParcelFileDescriptor getWallpaperFile(@SetWallpaperFlags int which, boolean getCropped) {
        return getWallpaperFile(which, mContext.getUserId(), getCropped);
+0 −8
Original line number Diff line number Diff line
@@ -23,14 +23,6 @@ flag {
  is_exported: true
}

flag {
    name: "customization_packs_apis"
    is_exported: true
    namespace: "systemui"
    description: "Move APIs related to bitmap and crops to @SystemApi."
    bug: "372344184"
}

flag {
  name: "accurate_wallpaper_downsampling"
  namespace: "systemui"