diff options
12 files changed, 27 insertions, 29 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index c7fac87e3..f372d9518 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -365,7 +365,7 @@ public class Launcher extends Activity ? app.getInvariantDeviceProfile().landscapeProfile : app.getInvariantDeviceProfile().portraitProfile; - if (Utilities.isNycOrAbove() && isInMultiWindowMode()) { + if (Utilities.ATLEAST_NOUGAT && isInMultiWindowMode()) { Display display = getWindowManager().getDefaultDisplay(); Point mwSize = new Point(); display.getSize(mwSize); @@ -466,7 +466,7 @@ public class Launcher extends Activity private void loadExtractedColorsAndColorItems() { // TODO: do this in pre-N as well, once the extraction part is complete. - if (Utilities.isNycOrAbove()) { + if (Utilities.ATLEAST_NOUGAT) { mExtractedColors.load(this); mHotseat.updateColor(mExtractedColors, !mPaused); mWorkspace.getPageIndicator().updateColor(mExtractedColors); @@ -913,7 +913,7 @@ public class Launcher extends Activity mLauncherCallbacks.onStop(); } - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { mAppWidgetHost.stopListening(); } } @@ -927,7 +927,7 @@ public class Launcher extends Activity mLauncherCallbacks.onStart(); } - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { mAppWidgetHost.startListening(); } } diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 1ee4a1a37..2a43aad23 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -115,7 +115,7 @@ public class LauncherAppState { filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE); filter.addAction(Intent.ACTION_MANAGED_PROFILE_UNLOCKED); // For extracting colors from the wallpaper - if (Utilities.isNycOrAbove()) { + if (Utilities.ATLEAST_NOUGAT) { // TODO: add a broadcast entry to the manifest for pre-N. filter.addAction(Intent.ACTION_WALLPAPER_CHANGED); } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 55bd0a45a..955f51f5f 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -2692,7 +2692,7 @@ public class LauncherModel extends BroadcastReceiver * use partial updates similar to {@link UserManagerCompat} */ public void refreshShortcutsIfRequired() { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { sWorker.removeCallbacks(mShortcutPermissionCheckRunnable); sWorker.post(mShortcutPermissionCheckRunnable); } diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 95e3d8269..13a69f21c 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -84,13 +84,11 @@ public final class Utilities { private static final int[] sLoc0 = new int[2]; private static final int[] sLoc1 = new int[2]; - public static boolean isNycMR1OrAbove() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1; - } + public static final boolean ATLEAST_NOUGAT_MR1 = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1; - public static boolean isNycOrAbove() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; - } + public static final boolean ATLEAST_NOUGAT = + Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; public static final boolean ATLEAST_MARSHMALLOW = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; @@ -137,7 +135,7 @@ public final class Utilities { } public static boolean getAllowRotationDefaultValue(Context context) { - if (isNycOrAbove()) { + if (ATLEAST_NOUGAT) { // If the device was scaled, used the original dimensions to determine if rotation // is allowed of not. Resources res = context.getResources(); @@ -619,7 +617,7 @@ public final class Utilities { } public static boolean isWallpaperAllowed(Context context) { - if (isNycOrAbove()) { + if (ATLEAST_NOUGAT) { try { WallpaperManager wm = context.getSystemService(WallpaperManager.class); return (Boolean) wm.getClass().getDeclaredMethod("isSetWallpaperAllowed") diff --git a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java index c7a529d07..84e82e3eb 100644 --- a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java +++ b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java @@ -23,7 +23,7 @@ public class AlphabeticIndexCompat { BaseIndex index = null; try { - if (Utilities.isNycOrAbove()) { + if (Utilities.ATLEAST_NOUGAT) { index = new AlphabeticIndexVN(context); } } catch (Exception e) { diff --git a/src/com/android/launcher3/compat/UserManagerCompat.java b/src/com/android/launcher3/compat/UserManagerCompat.java index a5f8dd296..b40eaa260 100644 --- a/src/com/android/launcher3/compat/UserManagerCompat.java +++ b/src/com/android/launcher3/compat/UserManagerCompat.java @@ -32,9 +32,9 @@ public abstract class UserManagerCompat { public static UserManagerCompat getInstance(Context context) { synchronized (sInstanceLock) { if (sInstance == null) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { sInstance = new UserManagerCompatVNMr1(context.getApplicationContext()); - } else if (Utilities.isNycOrAbove()) { + } else if (Utilities.ATLEAST_NOUGAT) { sInstance = new UserManagerCompatVN(context.getApplicationContext()); } else if (Utilities.ATLEAST_MARSHMALLOW) { sInstance = new UserManagerCompatVM(context.getApplicationContext()); diff --git a/src/com/android/launcher3/dragndrop/DragDriver.java b/src/com/android/launcher3/dragndrop/DragDriver.java index 4db8c07d5..d0c8e1690 100644 --- a/src/com/android/launcher3/dragndrop/DragDriver.java +++ b/src/com/android/launcher3/dragndrop/DragDriver.java @@ -92,7 +92,7 @@ public abstract class DragDriver { public static DragDriver create(Context context, DragController dragController, DragObject dragObject, DragOptions options) { - if (Utilities.isNycOrAbove() && options.systemDndStartPoint != null) { + if (Utilities.ATLEAST_NOUGAT && options.systemDndStartPoint != null) { return new SystemDragDriver(dragController, context, dragObject); } else { return new InternalDragDriver(dragController); diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index 59d18c23a..961877911 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -390,7 +390,7 @@ public class DragLayer extends InsettableFrameLayout { @TargetApi(Build.VERSION_CODES.N) private void handleSystemDragStart(DragEvent event) { - if (!FeatureFlags.LAUNCHER3_USE_SYSTEM_DRAG_DRIVER || !Utilities.isNycOrAbove()) { + if (!FeatureFlags.LAUNCHER3_USE_SYSTEM_DRAG_DRIVER || !Utilities.ATLEAST_NOUGAT) { return; } if (mLauncher.isWorkspaceLocked()) { diff --git a/src/com/android/launcher3/dynamicui/ExtractionUtils.java b/src/com/android/launcher3/dynamicui/ExtractionUtils.java index 1e663a9ae..1cf5d55e0 100644 --- a/src/com/android/launcher3/dynamicui/ExtractionUtils.java +++ b/src/com/android/launcher3/dynamicui/ExtractionUtils.java @@ -62,7 +62,7 @@ public class ExtractionUtils { } private static boolean hasWallpaperIdChanged(Context context) { - if (!Utilities.isNycOrAbove()) { + if (!Utilities.ATLEAST_NOUGAT) { // TODO: update an id in sharedprefs in onWallpaperChanged broadcast, and read it here. return false; } @@ -74,7 +74,7 @@ public class ExtractionUtils { @TargetApi(Build.VERSION_CODES.N) public static int getWallpaperId(WallpaperManager wallpaperManager) { - return Utilities.isNycOrAbove() ? + return Utilities.ATLEAST_NOUGAT ? wallpaperManager.getWallpaperId(WallpaperManager.FLAG_SYSTEM) : -1; } diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java index fd647c79a..599dcd0d3 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationTask.java +++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java @@ -42,7 +42,7 @@ import java.util.Locale; */ public class GridSizeMigrationTask { - public static boolean ENABLED = Utilities.isNycOrAbove(); + public static boolean ENABLED = Utilities.ATLEAST_NOUGAT; private static final String TAG = "GridSizeMigrationTask"; private static final boolean DEBUG = true; diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java index 9037af4d2..c2c7c1772 100644 --- a/src/com/android/launcher3/shortcuts/DeepShortcutManager.java +++ b/src/com/android/launcher3/shortcuts/DeepShortcutManager.java @@ -91,7 +91,7 @@ public class DeepShortcutManager { */ @TargetApi(25) public void unpinShortcut(final ShortcutKey key) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { String packageName = key.componentName.getPackageName(); String id = key.getId(); UserHandleCompat user = key.user; @@ -113,7 +113,7 @@ public class DeepShortcutManager { */ @TargetApi(25) public void pinShortcut(final ShortcutKey key) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { String packageName = key.componentName.getPackageName(); String id = key.getId(); UserHandleCompat user = key.user; @@ -132,7 +132,7 @@ public class DeepShortcutManager { @TargetApi(25) public void startShortcut(String packageName, String id, Rect sourceBounds, Bundle startActivityOptions, UserHandleCompat user) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { try { mLauncherApps.startShortcut(packageName, id, sourceBounds, startActivityOptions, user.getUser()); @@ -146,7 +146,7 @@ public class DeepShortcutManager { @TargetApi(25) public Drawable getShortcutIconDrawable(ShortcutInfoCompat shortcutInfo, int density) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { try { Drawable icon = mLauncherApps.getShortcutIconDrawable( shortcutInfo.getShortcutInfo(), density); @@ -191,7 +191,7 @@ public class DeepShortcutManager { @TargetApi(25) private List<ShortcutInfoCompat> query(int flags, String packageName, ComponentName activity, List<String> shortcutIds, UserHandleCompat user) { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { ShortcutQuery q = new ShortcutQuery(); q.setQueryFlags(flags); if (packageName != null) { @@ -222,7 +222,7 @@ public class DeepShortcutManager { @TargetApi(25) public boolean hasHostPermission() { - if (Utilities.isNycMR1OrAbove()) { + if (Utilities.ATLEAST_NOUGAT_MR1) { try { return mLauncherApps.hasShortcutHostPermission(); } catch (SecurityException|IllegalStateException e) { diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java index afd9b8395..b61d6095f 100644 --- a/src/com/android/launcher3/util/PackageManagerHelper.java +++ b/src/com/android/launcher3/util/PackageManagerHelper.java @@ -69,7 +69,7 @@ public class PackageManagerHelper { // The value of FLAG_SUSPENDED was reused by a hidden constant // ApplicationInfo.FLAG_PRIVILEGED prior to N, so only check for suspended flag on N // or later. - if (Utilities.isNycOrAbove()) { + if (Utilities.ATLEAST_NOUGAT) { return (info.flags & FLAG_SUSPENDED) != 0; } else { return false; |