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
This commit is contained in:
Santiago Etchebehere
2020-08-06 18:04:33 -07:00
parent b0c1ac5b2e
commit f768e865a1

View File

@@ -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) {