Loading core/api/test-current.txt +7 −0 Original line number Diff line number Diff line Loading @@ -510,7 +510,10 @@ 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 @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 static int getOrientation(@NonNull android.graphics.Point); method @Nullable public android.os.ParcelFileDescriptor getWallpaperFile(int, boolean); method public boolean isLockscreenLiveWallpaperEnabled(); method @Nullable public android.graphics.Rect peekBitmapDimensions(); method @Nullable public android.graphics.Rect peekBitmapDimensions(int); Loading @@ -520,6 +523,10 @@ package android.app { method public void setWallpaperZoomOut(@NonNull android.os.IBinder, float); method public boolean shouldEnableWideColorGamut(); method public boolean wallpaperSupportsWcg(int); field public static final int ORIENTATION_LANDSCAPE = 1; // 0x1 field public static final int ORIENTATION_PORTRAIT = 0; // 0x0 field public static final int ORIENTATION_SQUARE_LANDSCAPE = 3; // 0x3 field public static final int ORIENTATION_SQUARE_PORTRAIT = 2; // 0x2 } public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable { Loading core/java/android/app/DisabledWallpaperManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,13 @@ 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) { Loading core/java/android/app/WallpaperManager.java +59 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.annotation.RawRes; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; Loading Loading @@ -375,24 +376,32 @@ public class WallpaperManager { * Portrait orientation of most screens * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_PORTRAIT = 0; /** * Landscape orientation of most screens * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_LANDSCAPE = 1; /** * Portrait orientation with similar width and height (e.g. the inner screen of a foldable) * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_SQUARE_PORTRAIT = 2; /** * Landscape orientation with similar width and height (e.g. the inner screen of a foldable) * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_SQUARE_LANDSCAPE = 3; /** Loading @@ -401,6 +410,8 @@ public class WallpaperManager { * @return the corresponding {@link ScreenOrientation}. * @hide */ @SuppressLint("UnflaggedApi") @TestApi 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 Loading Loading @@ -1692,6 +1703,52 @@ 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> * 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 */ @SuppressLint("UnflaggedApi") @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 Loading Loading @@ -1937,6 +1994,8 @@ public class WallpaperManager { * which={@link #FLAG_LOCK} if there is a shared home + lock wallpaper. * @hide */ @SuppressLint("UnflaggedApi") @TestApi @Nullable public ParcelFileDescriptor getWallpaperFile(@SetWallpaperFlags int which, boolean getCropped) { return getWallpaperFile(which, mContext.getUserId(), getCropped); Loading Loading
core/api/test-current.txt +7 −0 Original line number Diff line number Diff line Loading @@ -510,7 +510,10 @@ 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 @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 static int getOrientation(@NonNull android.graphics.Point); method @Nullable public android.os.ParcelFileDescriptor getWallpaperFile(int, boolean); method public boolean isLockscreenLiveWallpaperEnabled(); method @Nullable public android.graphics.Rect peekBitmapDimensions(); method @Nullable public android.graphics.Rect peekBitmapDimensions(int); Loading @@ -520,6 +523,10 @@ package android.app { method public void setWallpaperZoomOut(@NonNull android.os.IBinder, float); method public boolean shouldEnableWideColorGamut(); method public boolean wallpaperSupportsWcg(int); field public static final int ORIENTATION_LANDSCAPE = 1; // 0x1 field public static final int ORIENTATION_PORTRAIT = 0; // 0x0 field public static final int ORIENTATION_SQUARE_LANDSCAPE = 3; // 0x3 field public static final int ORIENTATION_SQUARE_PORTRAIT = 2; // 0x2 } public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable { Loading
core/java/android/app/DisabledWallpaperManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,13 @@ 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) { Loading
core/java/android/app/WallpaperManager.java +59 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.annotation.RawRes; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; Loading Loading @@ -375,24 +376,32 @@ public class WallpaperManager { * Portrait orientation of most screens * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_PORTRAIT = 0; /** * Landscape orientation of most screens * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_LANDSCAPE = 1; /** * Portrait orientation with similar width and height (e.g. the inner screen of a foldable) * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_SQUARE_PORTRAIT = 2; /** * Landscape orientation with similar width and height (e.g. the inner screen of a foldable) * @hide */ @SuppressLint("UnflaggedApi") @TestApi public static final int ORIENTATION_SQUARE_LANDSCAPE = 3; /** Loading @@ -401,6 +410,8 @@ public class WallpaperManager { * @return the corresponding {@link ScreenOrientation}. * @hide */ @SuppressLint("UnflaggedApi") @TestApi 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 Loading Loading @@ -1692,6 +1703,52 @@ 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> * 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 */ @SuppressLint("UnflaggedApi") @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 Loading Loading @@ -1937,6 +1994,8 @@ public class WallpaperManager { * which={@link #FLAG_LOCK} if there is a shared home + lock wallpaper. * @hide */ @SuppressLint("UnflaggedApi") @TestApi @Nullable public ParcelFileDescriptor getWallpaperFile(@SetWallpaperFlags int which, boolean getCropped) { return getWallpaperFile(which, mContext.getUserId(), getCropped); Loading