Cleaning Utilities.java
> Removing some unused methods
> Moving some specialized methods to corresponding classes
> Removing GridProvider check as it is released
Bug: 257555083
Test: Presubmit
Change-Id: Ib0f8c673d018071d3f4b7d9247e0a35718ab009c
Merged-In: Ib0f8c673d018071d3f4b7d9247e0a35718ab009c
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index c0a00c2..9f54f09 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -607,15 +607,16 @@
* Get the icon bounds on the view depending on the layout type.
*/
public void getIconBounds(int iconSize, Rect outBounds) {
- Utilities.setRectToViewCenter(this, iconSize, outBounds);
+ outBounds.set(0, 0, iconSize, iconSize);
if (mLayoutHorizontal) {
+ int top = (getHeight() - iconSize) / 2;
if (mIsRtl) {
- outBounds.offsetTo(getWidth() - iconSize - getPaddingRight(), outBounds.top);
+ outBounds.offsetTo(getWidth() - iconSize - getPaddingRight(), top);
} else {
- outBounds.offsetTo(getPaddingLeft(), outBounds.top);
+ outBounds.offsetTo(getPaddingLeft(), top);
}
} else {
- outBounds.offsetTo(outBounds.left, getPaddingTop());
+ outBounds.offset((getWidth() - iconSize) / 2, getPaddingTop());
}
}
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index ca92aa4..4bb9f06 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -307,8 +307,7 @@
}
public static String getCurrentGridName(Context context) {
- return Utilities.isGridOptionsEnabled(context)
- ? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null) : null;
+ return Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null);
}
private String initGrid(Context context, String gridName) {
@@ -383,10 +382,6 @@
allAppsBorderSpaces = displayOption.allAppsBorderSpaces;
allAppsIconSize = displayOption.allAppsIconSizes;
allAppsIconTextSize = displayOption.allAppsIconTextSizes;
- if (!Utilities.isGridOptionsEnabled(context)) {
- allAppsIconSize = iconSize;
- allAppsIconTextSize = iconTextSize;
- }
if (devicePaddingId != 0) {
devicePaddings = new DevicePaddings(context, devicePaddingId);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index a507532..743e3ae 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -26,20 +26,13 @@
import android.app.ActivityManager;
import android.app.Person;
import android.app.WallpaperManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.database.ContentObserver;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.LightingColorFilter;
@@ -51,7 +44,6 @@
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.os.DeadObjectException;
@@ -71,15 +63,12 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.Interpolator;
-import android.widget.LinearLayout;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
-import com.android.launcher3.graphics.GridCustomizationsProvider;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.icons.ShortcutCachingLogic;
import com.android.launcher3.icons.ThemedIconDrawable;
@@ -91,7 +80,6 @@
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.util.IntArray;
-import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
@@ -100,10 +88,8 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
-import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -117,8 +103,6 @@
private static final Pattern sTrimPattern =
Pattern.compile("^[\\s|\\p{javaSpaceChar}]*(.*)[\\s|\\p{javaSpaceChar}]*$");
- private static final int[] sLoc0 = new int[2];
- private static final int[] sLoc1 = new int[2];
private static final Matrix sMatrix = new Matrix();
private static final Matrix sInverseMatrix = new Matrix();
@@ -167,14 +151,6 @@
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
- // An intent extra to indicate the horizontal scroll of the wallpaper.
- public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
- public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";
-
- // An intent extra to indicate the launch source by launcher.
- public static final String EXTRA_WALLPAPER_LAUNCH_SOURCE =
- "com.android.wallpaper.LAUNCH_SOURCE";
-
public static boolean IS_RUNNING_IN_TEST_HARNESS =
ActivityManager.isRunningInTestHarness();
@@ -186,12 +162,6 @@
return Log.isLoggable(propertyName, Log.VERBOSE);
}
- public static boolean existsStyleWallpapers(Context context) {
- ResolveInfo ri = context.getPackageManager().resolveActivity(
- PackageManagerHelper.getStyleWallpapersIntent(context), 0);
- return ri != null;
- }
-
/**
* Given a coordinate relative to the descendant, find the coordinate in a parent view's
* coordinates.
@@ -305,9 +275,9 @@
* Sets {@param out} to be same as {@param in} by rounding individual values
*/
public static void roundArray(float[] in, int[] out) {
- for (int i = 0; i < in.length; i++) {
- out[i] = Math.round(in[i]);
- }
+ for (int i = 0; i < in.length; i++) {
+ out[i] = Math.round(in[i]);
+ }
}
public static void offsetPoints(float[] points, float offsetX, float offsetY) {
@@ -328,80 +298,8 @@
localY < (v.getHeight() + slop);
}
- public static int[] getCenterDeltaInScreenSpace(View v0, View v1) {
- v0.getLocationInWindow(sLoc0);
- v1.getLocationInWindow(sLoc1);
-
- sLoc0[0] += (v0.getMeasuredWidth() * v0.getScaleX()) / 2;
- sLoc0[1] += (v0.getMeasuredHeight() * v0.getScaleY()) / 2;
- sLoc1[0] += (v1.getMeasuredWidth() * v1.getScaleX()) / 2;
- sLoc1[1] += (v1.getMeasuredHeight() * v1.getScaleY()) / 2;
- return new int[] {sLoc1[0] - sLoc0[0], sLoc1[1] - sLoc0[1]};
- }
-
- /**
- * Helper method to set rectOut with rectFSrc.
- */
- public static void setRect(RectF rectFSrc, Rect rectOut) {
- rectOut.left = (int) rectFSrc.left;
- rectOut.top = (int) rectFSrc.top;
- rectOut.right = (int) rectFSrc.right;
- rectOut.bottom = (int) rectFSrc.bottom;
- }
-
public static void scaleRectFAboutCenter(RectF r, float scale) {
- scaleRectFAboutPivot(r, scale, r.centerX(), r.centerY());
- }
-
- public static void scaleRectFAboutPivot(RectF r, float scale, float px, float py) {
- if (scale != 1.0f) {
- r.offset(-px, -py);
- r.left = r.left * scale;
- r.top = r.top * scale ;
- r.right = r.right * scale;
- r.bottom = r.bottom * scale;
- r.offset(px, py);
- }
- }
-
- public static void scaleRectAboutCenter(Rect r, float scale) {
- if (scale != 1.0f) {
- int cx = r.centerX();
- int cy = r.centerY();
- r.offset(-cx, -cy);
- scaleRect(r, scale);
- r.offset(cx, cy);
- }
- }
-
- public static void scaleRect(Rect r, float scale) {
- if (scale != 1.0f) {
- r.left = (int) (r.left * scale + 0.5f);
- r.top = (int) (r.top * scale + 0.5f);
- r.right = (int) (r.right * scale + 0.5f);
- r.bottom = (int) (r.bottom * scale + 0.5f);
- }
- }
-
- public static void insetRect(Rect r, Rect insets) {
- r.left = Math.min(r.right, r.left + insets.left);
- r.top = Math.min(r.bottom, r.top + insets.top);
- r.right = Math.max(r.left, r.right - insets.right);
- r.bottom = Math.max(r.top, r.bottom - insets.bottom);
- }
-
- public static float shrinkRect(Rect r, float scaleX, float scaleY) {
- float scale = Math.min(Math.min(scaleX, scaleY), 1.0f);
- if (scale < 1.0f) {
- int deltaX = (int) (r.width() * (scaleX - scale) * 0.5f);
- r.left += deltaX;
- r.right -= deltaX;
-
- int deltaY = (int) (r.height() * (scaleY - scale) * 0.5f);
- r.top += deltaY;
- r.bottom -= deltaY;
- }
- return scale;
+ scaleRectFAboutCenter(r, scale, scale);
}
/**
@@ -419,6 +317,33 @@
r.offset(px, py);
}
+ public static void scaleRectAboutCenter(Rect r, float scale) {
+ if (scale != 1.0f) {
+ int cx = r.centerX();
+ int cy = r.centerY();
+ r.offset(-cx, -cy);
+ r.left = (int) (r.left * scale + 0.5f);
+ r.top = (int) (r.top * scale + 0.5f);
+ r.right = (int) (r.right * scale + 0.5f);
+ r.bottom = (int) (r.bottom * scale + 0.5f);
+ r.offset(cx, cy);
+ }
+ }
+
+ public static float shrinkRect(Rect r, float scaleX, float scaleY) {
+ float scale = Math.min(Math.min(scaleX, scaleY), 1.0f);
+ if (scale < 1.0f) {
+ int deltaX = (int) (r.width() * (scaleX - scale) * 0.5f);
+ r.left += deltaX;
+ r.right -= deltaX;
+
+ int deltaY = (int) (r.height() * (scaleY - scale) * 0.5f);
+ r.top += deltaY;
+ r.bottom -= deltaY;
+ }
+ return scale;
+ }
+
/**
* Maps t from one range to another range.
* @param t The value to map.
@@ -454,30 +379,6 @@
}
/**
- * Bounds parameter to the range [0, 1]
- */
- public static float saturate(float a) {
- return boundToRange(a, 0, 1.0f);
- }
-
- /**
- * Returns the compliment (1 - a) of the parameter.
- */
- public static float comp(float a) {
- return 1 - a;
- }
-
- /**
- * Returns the "probabilistic or" of a and b. (a + b - ab).
- * Useful beyond probability, can be used to combine two unit progresses for example.
- */
- public static float or(float a, float b) {
- float satA = saturate(a);
- float satB = saturate(b);
- return satA + satB - (satA * satB);
- }
-
- /**
* Trims the string, removing all whitespace at the beginning and end of the string.
* Non-breaking whitespaces are also removed.
*/
@@ -536,7 +437,6 @@
return ResourceUtils.roundPxValueFromFloat(value);
}
-
public static String createDbSelectionQuery(String columnName, IntArray values) {
return String.format(Locale.ENGLISH, "%s IN (%s)", columnName, values.toConcatString());
}
@@ -560,18 +460,6 @@
}
/**
- * Using the view's bounds and icon size, calculate where the icon bounds will
- * be if it was positioned at the center of the view.
- */
- public static void setRectToViewCenter(View iconView, int iconSize, Rect outBounds) {
- int top = (iconView.getHeight() - iconSize) / 2;
- int left = (iconView.getWidth() - iconSize) / 2;
- int right = left + iconSize;
- int bottom = top + iconSize;
- outBounds.set(left, top, right, bottom);
- }
-
- /**
* Ensures that a value is within given bounds. Specifically:
* If value is less than lowerBound, return lowerBound; else if value is greater than upperBound,
* return upperBound; else return value unchanged.
@@ -646,42 +534,6 @@
|| e.getCause() instanceof DeadObjectException;
}
- public static boolean isGridOptionsEnabled(Context context) {
- return isComponentEnabled(context.getPackageManager(),
- context.getPackageName(),
- GridCustomizationsProvider.class.getName());
- }
-
- private static boolean isComponentEnabled(PackageManager pm, String pkgName, String clsName) {
- ComponentName componentName = new ComponentName(pkgName, clsName);
- int componentEnabledSetting = pm.getComponentEnabledSetting(componentName);
-
- switch (componentEnabledSetting) {
- case PackageManager.COMPONENT_ENABLED_STATE_DISABLED:
- return false;
- case PackageManager.COMPONENT_ENABLED_STATE_ENABLED:
- return true;
- case PackageManager.COMPONENT_ENABLED_STATE_DEFAULT:
- default:
- // We need to get the application info to get the component's default state
- try {
- PackageInfo packageInfo = pm.getPackageInfo(pkgName,
- PackageManager.GET_PROVIDERS | PackageManager.GET_DISABLED_COMPONENTS);
-
- if (packageInfo.providers != null) {
- return Arrays.stream(packageInfo.providers).anyMatch(
- pi -> pi.name.equals(clsName) && pi.isEnabled());
- }
-
- // the component is not declared in the AndroidManifest
- return false;
- } catch (PackageManager.NameNotFoundException e) {
- // the package isn't installed on the device
- return false;
- }
- }
- }
-
/**
* Utility method to post a runnable on the handler, skipping the synchronization barriers.
*/
@@ -691,12 +543,6 @@
handler.sendMessage(msg);
}
- public static void unregisterReceiverSafely(Context context, BroadcastReceiver receiver) {
- try {
- context.unregisterReceiver(receiver);
- } catch (IllegalArgumentException e) {}
- }
-
/**
* Returns the full drawable for info without any flattening or pre-processing.
*
@@ -794,14 +640,6 @@
}
}
- /**
- * @return true is the extra is either null or is of type {@param type}
- */
- public static boolean isValidExtraType(Intent intent, String key, Class type) {
- Object extra = intent.getParcelableExtra(key);
- return extra == null || type.isInstance(extra);
- }
-
public static float squaredHypot(float x, float y) {
return x * x + y * y;
}
@@ -812,18 +650,6 @@
}
/**
- * Helper method to create a content provider
- */
- public static ContentObserver newContentObserver(Handler handler, Consumer<Uri> command) {
- return new ContentObserver(handler) {
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- command.accept(uri);
- }
- };
- }
-
- /**
* Rotates `inOutBounds` by `delta` 90-degree increments. Rotation is visually CCW. Parent
* sizes represent the "space" that will rotate carrying inOutBounds along with it to determine
* the final bounds.
@@ -871,16 +697,6 @@
ColorUtils.blendARGB(0, color, tintAmount));
}
- /**
- * Sets start margin on the provided {@param view} to be {@param margin}.
- * Assumes {@param view} is a child of {@link LinearLayout}
- */
- public static void setStartMarginForView(View view, int margin) {
- LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) view.getLayoutParams();
- lp.setMarginStart(margin);
- view.setLayoutParams(lp);
- }
-
public static Rect getViewBounds(@NonNull View v) {
int[] pos = new int[2];
v.getLocationOnScreen(pos);
@@ -921,12 +737,4 @@
}
return options;
}
-
- public static boolean bothNull(@Nullable Object a, @Nullable Object b) {
- return a == null && b == null;
- }
-
- public static boolean bothNonNull(@Nullable Object a, @Nullable Object b) {
- return a != null && b != null;
- }
}
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index e8759da..dd00f07 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -616,11 +616,14 @@
public void drawDot(Canvas canvas) {
if (!mForceHideDot && ((mDotInfo != null && mDotInfo.hasDot()) || mDotScale > 0)) {
Rect iconBounds = mDotParams.iconBounds;
+ // FolderIcon draws the icon to be top-aligned (with padding) & horizontally-centered
+ int iconSize = mActivity.getDeviceProfile().iconSizePx;
+ iconBounds.left = (getWidth() - iconSize) / 2;
+ iconBounds.right = iconBounds.left + iconSize;
+ iconBounds.top = getPaddingTop();
+ iconBounds.bottom = iconBounds.top + iconSize;
- Utilities.setRectToViewCenter(this, mActivity.getDeviceProfile().iconSizePx,
- iconBounds);
- iconBounds.offsetTo(iconBounds.left, getPaddingTop());
- float iconScale = (float) mBackground.previewSize / iconBounds.width();
+ float iconScale = (float) mBackground.previewSize / iconSize;
Utilities.scaleRectAboutCenter(iconBounds, iconScale);
// If we are animating to the accepting state, animate the dot out.
diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java
index 1ced0b1..c21fc38 100644
--- a/src/com/android/launcher3/model/ModelUtils.java
+++ b/src/com/android/launcher3/model/ModelUtils.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.model;
-import static com.android.launcher3.Utilities.isValidExtraType;
-
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
@@ -149,4 +147,12 @@
info.intent = launchIntent;
return info;
}
+
+ /**
+ * @return true if the extra is either null or is of type {@param type}
+ */
+ private static boolean isValidExtraType(Intent intent, String key, Class type) {
+ Object extra = intent.getParcelableExtra(key);
+ return extra == null || type.isInstance(extra);
+ }
}
diff --git a/src/com/android/launcher3/util/BgObjectWithLooper.java b/src/com/android/launcher3/util/BgObjectWithLooper.java
index 1483c43..adc3c7d 100644
--- a/src/com/android/launcher3/util/BgObjectWithLooper.java
+++ b/src/com/android/launcher3/util/BgObjectWithLooper.java
@@ -15,10 +15,15 @@
*/
package com.android.launcher3.util;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
import android.os.Looper;
import androidx.annotation.WorkerThread;
+import java.util.function.Consumer;
+
/**
* Utility class to define an object which does most of it's processing on a
* dedicated background thread.
@@ -43,4 +48,16 @@
*/
@WorkerThread
protected abstract void onInitialized(Looper looper);
+
+ /**
+ * Helper method to create a content provider
+ */
+ protected static ContentObserver newContentObserver(Handler handler, Consumer<Uri> command) {
+ return new ContentObserver(handler) {
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ command.accept(uri);
+ }
+ };
+ }
}
diff --git a/src/com/android/launcher3/util/SimpleBroadcastReceiver.java b/src/com/android/launcher3/util/SimpleBroadcastReceiver.java
index 4dfa5cc..0a23506 100644
--- a/src/com/android/launcher3/util/SimpleBroadcastReceiver.java
+++ b/src/com/android/launcher3/util/SimpleBroadcastReceiver.java
@@ -52,4 +52,15 @@
}
context.registerReceiver(this, filter, flags);
}
+
+ /**
+ * Unregisters the receiver ignoring any errors
+ */
+ public void unregisterReceiverSafely(Context context) {
+ try {
+ context.unregisterReceiver(this);
+ } catch (IllegalArgumentException e) {
+ // It was probably never registered or already unregistered. Ignore.
+ }
+ }
}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index d301925..b3c376f 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -15,9 +15,6 @@
*/
package com.android.launcher3.views;
-import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR;
-import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_LAUNCH_SOURCE;
-import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS;
@@ -51,6 +48,7 @@
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
+import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
import java.util.ArrayList;
@@ -62,6 +60,13 @@
public class OptionsPopupView extends ArrowPopup<Launcher>
implements OnClickListener, OnLongClickListener {
+ // An intent extra to indicate the horizontal scroll of the wallpaper.
+ private static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
+ private static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";
+ // An intent extra to indicate the launch source by launcher.
+ private static final String EXTRA_WALLPAPER_LAUNCH_SOURCE =
+ "com.android.wallpaper.LAUNCH_SOURCE";
+
private final ArrayMap<View, OptionItem> mItemMap = new ArrayMap<>();
private RectF mTargetRect;
private boolean mShouldAddArrow;
@@ -180,10 +185,11 @@
*/
public static ArrayList<OptionItem> getOptions(Launcher launcher) {
ArrayList<OptionItem> options = new ArrayList<>();
- int resString = Utilities.existsStyleWallpapers(launcher) ?
- R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
- int resDrawable = Utilities.existsStyleWallpapers(launcher) ?
- R.drawable.ic_palette : R.drawable.ic_wallpaper;
+ boolean styleWallpaperExists = styleWallpapersExists(launcher);
+ int resString = styleWallpaperExists
+ ? R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
+ int resDrawable = styleWallpaperExists
+ ? R.drawable.ic_palette : R.drawable.ic_wallpaper;
options.add(new OptionItem(launcher,
resString,
resDrawable,
@@ -251,7 +257,7 @@
.putExtra(EXTRA_WALLPAPER_OFFSET,
launcher.getWorkspace().getWallpaperOffsetForCenterPage())
.putExtra(EXTRA_WALLPAPER_LAUNCH_SOURCE, "app_launched_launcher");
- if (!Utilities.existsStyleWallpapers(launcher)) {
+ if (!styleWallpapersExists(launcher)) {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
} else {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "focus_wallpaper");
@@ -299,4 +305,9 @@
this.clickListener = clickListener;
}
}
+
+ private static boolean styleWallpapersExists(Context context) {
+ return context.getPackageManager().resolveActivity(
+ PackageManagerHelper.getStyleWallpapersIntent(context), 0) != null;
+ }
}