diff options
| author | 2020-08-06 18:04:33 -0700 | |
|---|---|---|
| committer | 2020-08-06 18:07:39 -0700 | |
| commit | f768e865a1a98093593eb6812e7a4e3b306b01d3 (patch) | |
| tree | 0580dc3befa824375041448127166b16ace011ce | |
| parent | b0c1ac5b2efdf26733ef2182e1ba8c2143b8fa55 (diff) | |
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
| -rw-r--r-- | packages/SystemUI/shared/src/com/android/systemui/shared/system/WallpaperEngineCompat.java | 11 |
1 files changed, 11 insertions, 0 deletions
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) { |