summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Bertschler <bmario@google.com>2017-09-06 20:37:18 (GMT)
committerMario Bertschler <bmario@google.com>2017-09-06 21:06:09 (GMT)
commit2b1073994cf7e46eec65bc65efd2f4d7997bd485 (patch)
tree74d1dd8e0a87427405d9910a715582c92518019d
parentf7db42f5ab79da8e0b0e91418399a93b79e28327 (diff)
downloadandroid_packages_apps_Trebuchet-2b1073994cf7e46eec65bc65efd2f4d7997bd485.zip
android_packages_apps_Trebuchet-2b1073994cf7e46eec65bc65efd2f4d7997bd485.tar.gz
android_packages_apps_Trebuchet-2b1073994cf7e46eec65bc65efd2f4d7997bd485.tar.bz2
Try-catching getColorHints in wallpapermanager compat.
Change-Id: I1b2fbbdfeecb46d1864dad888f4c7e9765a25715
-rw-r--r--src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java b/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
index 4787514..28b780a 100644
--- a/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
+++ b/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
@@ -33,11 +33,15 @@ public class WallpaperManagerCompatVOMR1 extends WallpaperManagerCompat {
private static final String TAG = "WMCompatVOMR1";
private final WallpaperManager mWm;
- private final Method mWCColorHintsMethod;
+ private Method mWCColorHintsMethod;
WallpaperManagerCompatVOMR1(Context context) throws Exception {
mWm = context.getSystemService(WallpaperManager.class);
- mWCColorHintsMethod = WallpaperColors.class.getDeclaredMethod("getColorHints");
+ try {
+ mWCColorHintsMethod = WallpaperColors.class.getDeclaredMethod("getColorHints");
+ } catch (Exception exc) {
+ Log.e(TAG, "getColorHints not available", exc);
+ }
}
@Nullable
@@ -49,12 +53,10 @@ public class WallpaperManagerCompatVOMR1 extends WallpaperManagerCompat {
@Override
public void addOnColorsChangedListener(final OnColorsChangedListenerCompat listener) {
OnColorsChangedListener onChangeListener = new OnColorsChangedListener() {
+ @Override
public void onColorsChanged(WallpaperColors colors, int which) {
listener.onColorsChanged(convertColorsObject(colors), which);
}
- public void onColorsChanged(WallpaperColors colors, int which, int userId) {
- onColorsChanged(colors, which);
- }
};
mWm.addOnColorsChangedListener(onChangeListener, null);
}
@@ -71,7 +73,9 @@ public class WallpaperManagerCompatVOMR1 extends WallpaperManagerCompat {
int tertiaryVal = tertiary != null ? tertiary.toArgb() : 0;
int colorHints = 0;
try {
- colorHints = (Integer) mWCColorHintsMethod.invoke(colors);
+ if (mWCColorHintsMethod != null) {
+ colorHints = (Integer) mWCColorHintsMethod.invoke(colors);
+ }
} catch (Exception exc) {
Log.e(TAG, "error calling color hints", exc);
}