Showing a toast when changing wallaper is disabled
Bug: 27940102
Change-Id: I373093d9b85dca356aaa8798931d5315981fd74c
(cherry picked from commit 2afb636180fbc6832274aab1f8ac6e5407ae191a)
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index dd9b5fc..d6d3517 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -19,6 +19,7 @@
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.SearchManager;
+import android.app.WallpaperManager;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ActivityNotFoundException;
@@ -45,6 +46,7 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
+import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.PowerManager;
import android.text.Spannable;
@@ -828,6 +830,17 @@
return ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode();
}
+ public static boolean isWallapaperAllowed(Context context) {
+ if (isNycOrAbove()) {
+ try {
+ WallpaperManager wm = context.getSystemService(WallpaperManager.class);
+ return (Boolean) wm.getClass().getDeclaredMethod("isWallpaperSettingAllowed")
+ .invoke(wm);
+ } catch (Exception e) { }
+ }
+ return true;
+ }
+
/**
* An extension of {@link BitmapDrawable} which returns the bitmap pixel size as intrinsic size.
* This allows the badging to be done based on the action bitmap size rather than