From f768e865a1a98093593eb6812e7a4e3b306b01d3 Mon Sep 17 00:00:00 2001 From: Santiago Etchebehere Date: Thu, 6 Aug 2020 18:04:33 -0700 Subject: Add check for WallpaperEngine compatibility Add a method in SystemUI shared library so that WallpaperPicker can check if resizing is available. Bug: 163087197 Test: manually verified in earlier versions of Android 11 Change-Id: I0d4b4dfc067a63a372c1b2b0502c174df5013763 --- .../android/systemui/shared/system/WallpaperEngineCompat.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WallpaperEngineCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WallpaperEngineCompat.java index 4d968f1763ca..73dc60dbc7da 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WallpaperEngineCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WallpaperEngineCompat.java @@ -26,6 +26,17 @@ public class WallpaperEngineCompat { private static final String TAG = "WallpaperEngineCompat"; + /** + * Returns true if {@link IWallpaperEngine#scalePreview(Rect)} is available. + */ + public static boolean supportsScalePreview() { + try { + return IWallpaperEngine.class.getMethod("scalePreview", Rect.class) != null; + } catch (NoSuchMethodException | SecurityException e) { + return false; + } + } + private final IWallpaperEngine mWrappedEngine; public WallpaperEngineCompat(IWallpaperEngine wrappedEngine) { -- cgit v1.2.3-59-g8ed1b