diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-04-21 15:16:11 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-04-21 23:12:50 +0000 |
commit | 1ed6c4adde9c2ce597deb3e57600c664684eb639 (patch) | |
tree | d64684cd85fd48cbda755183912ea7f47da1ea48 /src/com/android/launcher3/Utilities.java | |
parent | cc8f9e0af7f9acc6f03a1a0173d3e118b4e96ae5 (diff) | |
download | android_packages_apps_Trebuchet-1ed6c4adde9c2ce597deb3e57600c664684eb639.tar.gz android_packages_apps_Trebuchet-1ed6c4adde9c2ce597deb3e57600c664684eb639.tar.bz2 android_packages_apps_Trebuchet-1ed6c4adde9c2ce597deb3e57600c664684eb639.zip |
Showing a toast when changing wallaper is disabled
Bug: 27940102
Change-Id: I373093d9b85dca356aaa8798931d5315981fd74c
(cherry picked from commit 2afb636180fbc6832274aab1f8ac6e5407ae191a)
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index dd9b5fc40..d6d351790 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -19,6 +19,7 @@ package com.android.launcher3; 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.BitmapDrawable; 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 @@ public final class Utilities { 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 |