summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2017-09-06 21:25:54 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-09-06 21:25:54 (GMT)
commit9c1607886b87734f5ec36a87f62dcaabb78bdf20 (patch)
treefaea8d11f401d898375b24e2cda9ee8c9e8ef49b
parent9fad935b0396b73b47f71ebc9f98dfe7b3f3ebc0 (diff)
parent2b1073994cf7e46eec65bc65efd2f4d7997bd485 (diff)
downloadandroid_packages_apps_Trebuchet-9c1607886b87734f5ec36a87f62dcaabb78bdf20.zip
android_packages_apps_Trebuchet-9c1607886b87734f5ec36a87f62dcaabb78bdf20.tar.gz
android_packages_apps_Trebuchet-9c1607886b87734f5ec36a87f62dcaabb78bdf20.tar.bz2
Merge "Try-catching getColorHints in wallpapermanager compat." into ub-launcher3-dorval-polish2
-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);
}