From 4b90dbe9678e5582c2ccf76edd35ce9185060b84 Mon Sep 17 00:00:00 2001 From: Raj Garg Date: Fri, 23 Sep 2022 17:04:29 +0000 Subject: [PATCH] Revert "Introducing new variable to enable/disable shortcuts." Revert "Introducing new variable to enable/disable shortcuts." Revert submission 19632697-cherrypick-GO-DISABLE-SHORTCUTS-tyyzrpy9oe Reason for revert: Reverting changes for the recent feature built by me. This CL was a part of the feature. Please take a call if we should revert it or not. Reverted Changes: Ib373b042f:Introducing new variable to enable/disable shortcu... I4274cb468:Introducing new variable to enable/disable shortcu... Change-Id: I81f338be71185cb008e81b020c5b3a7b01b64c58 --- go/src/com/android/launcher3/model/WidgetsModel.java | 4 +--- .../launcher3/icons/ShortcutCachingLogic.java | 4 ++-- src/com/android/launcher3/model/BgDataModel.java | 4 ++-- .../android/launcher3/shortcuts/ShortcutRequest.java | 12 ++++++------ src/com/android/launcher3/util/ShortcutUtil.java | 2 +- src/com/android/launcher3/views/AppLauncher.java | 4 ++-- .../com/android/launcher3/model/WidgetsModel.java | 2 -- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/go/src/com/android/launcher3/model/WidgetsModel.java b/go/src/com/android/launcher3/model/WidgetsModel.java index 9a000d6b52..1aa5d03f6d 100644 --- a/go/src/com/android/launcher3/model/WidgetsModel.java +++ b/go/src/com/android/launcher3/model/WidgetsModel.java @@ -41,10 +41,8 @@ import java.util.Set; */ public class WidgetsModel { - // True if the widget support is disabled. + // True is the widget support is disabled. public static final boolean GO_DISABLE_WIDGETS = true; - // True if the shortcut support is disabled. - public static final boolean GO_DISABLE_SHORTCUTS = true; public static final boolean GO_DISABLE_NOTIFICATION_DOTS = true; private static final ArrayList EMPTY_WIDGET_LIST = new ArrayList<>(); diff --git a/src/com/android/launcher3/icons/ShortcutCachingLogic.java b/src/com/android/launcher3/icons/ShortcutCachingLogic.java index 1dc6751a34..6a8f34a93d 100644 --- a/src/com/android/launcher3/icons/ShortcutCachingLogic.java +++ b/src/com/android/launcher3/icons/ShortcutCachingLogic.java @@ -16,7 +16,7 @@ package com.android.launcher3.icons; -import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_SHORTCUTS; +import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS; import android.content.ComponentName; import android.content.Context; @@ -94,7 +94,7 @@ public class ShortcutCachingLogic implements CachingLogic { * Launcher specific checks */ public static Drawable getIcon(Context context, ShortcutInfo shortcutInfo, int density) { - if (GO_DISABLE_SHORTCUTS) { + if (GO_DISABLE_WIDGETS) { return null; } try { diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java index ffb0f2f40e..de23c4b31f 100644 --- a/src/com/android/launcher3/model/BgDataModel.java +++ b/src/com/android/launcher3/model/BgDataModel.java @@ -17,7 +17,7 @@ package com.android.launcher3.model; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY; -import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_SHORTCUTS; +import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS; import static com.android.launcher3.shortcuts.ShortcutRequest.PINNED; import static java.util.stream.Collectors.groupingBy; @@ -286,7 +286,7 @@ public class BgDataModel { * shortcuts and unpinning any extra shortcuts. */ public synchronized void updateShortcutPinnedState(Context context, UserHandle user) { - if (GO_DISABLE_SHORTCUTS) { + if (GO_DISABLE_WIDGETS) { return; } diff --git a/src/com/android/launcher3/shortcuts/ShortcutRequest.java b/src/com/android/launcher3/shortcuts/ShortcutRequest.java index 07d3292e3e..5291ce4620 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutRequest.java +++ b/src/com/android/launcher3/shortcuts/ShortcutRequest.java @@ -16,7 +16,7 @@ package com.android.launcher3.shortcuts; -import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_SHORTCUTS; +import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS; import android.content.ComponentName; import android.content.Context; @@ -46,7 +46,7 @@ public class ShortcutRequest { | ShortcutQuery.FLAG_MATCH_MANIFEST; public static final int PINNED = ShortcutQuery.FLAG_MATCH_PINNED; - private final ShortcutQuery mQuery = GO_DISABLE_SHORTCUTS ? null : new ShortcutQuery(); + private final ShortcutQuery mQuery = GO_DISABLE_WIDGETS ? null : new ShortcutQuery(); private final Context mContext; private final UserHandle mUserHandle; @@ -73,7 +73,7 @@ public class ShortcutRequest { * @return A list of ShortcutInfo's associated with the given package. */ public ShortcutRequest forPackage(String packageName, @Nullable List shortcutIds) { - if (!GO_DISABLE_SHORTCUTS && packageName != null) { + if (!GO_DISABLE_WIDGETS && packageName != null) { mQuery.setPackage(packageName); mQuery.setShortcutIds(shortcutIds); } @@ -81,7 +81,7 @@ public class ShortcutRequest { } public ShortcutRequest withContainer(@Nullable ComponentName activity) { - if (!GO_DISABLE_SHORTCUTS) { + if (!GO_DISABLE_WIDGETS) { if (activity == null) { mFailed = true; } else { @@ -92,7 +92,7 @@ public class ShortcutRequest { } public QueryResult query(int flags) { - if (GO_DISABLE_SHORTCUTS || mFailed) { + if (GO_DISABLE_WIDGETS || mFailed) { return QueryResult.DEFAULT; } mQuery.setQueryFlags(flags); @@ -108,7 +108,7 @@ public class ShortcutRequest { public static class QueryResult extends ArrayList { - static final QueryResult DEFAULT = new QueryResult(GO_DISABLE_SHORTCUTS); + static final QueryResult DEFAULT = new QueryResult(GO_DISABLE_WIDGETS); private final boolean mWasSuccess; diff --git a/src/com/android/launcher3/util/ShortcutUtil.java b/src/com/android/launcher3/util/ShortcutUtil.java index 79cafa04a2..91cf835287 100644 --- a/src/com/android/launcher3/util/ShortcutUtil.java +++ b/src/com/android/launcher3/util/ShortcutUtil.java @@ -34,7 +34,7 @@ public class ShortcutUtil { * Returns true when we should show depp shortcuts in shortcut menu for the item. */ public static boolean supportsDeepShortcuts(ItemInfo info) { - return isActive(info) && isApp(info) && !WidgetsModel.GO_DISABLE_SHORTCUTS; + return isActive(info) && isApp(info) && !WidgetsModel.GO_DISABLE_WIDGETS; } /** diff --git a/src/com/android/launcher3/views/AppLauncher.java b/src/com/android/launcher3/views/AppLauncher.java index dc07e45e11..19e66abd78 100644 --- a/src/com/android/launcher3/views/AppLauncher.java +++ b/src/com/android/launcher3/views/AppLauncher.java @@ -16,7 +16,7 @@ package com.android.launcher3.views; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; -import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_SHORTCUTS; +import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS; import android.app.ActivityOptions; import android.content.ActivityNotFoundException; @@ -190,7 +190,7 @@ public interface AppLauncher extends ActivityContext { */ default void startShortcut(String packageName, String id, Rect sourceBounds, Bundle startActivityOptions, UserHandle user) { - if (GO_DISABLE_SHORTCUTS) { + if (GO_DISABLE_WIDGETS) { return; } try { diff --git a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java index 13ad7a4ec5..702f3430aa 100644 --- a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java +++ b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java @@ -62,8 +62,6 @@ public class WidgetsModel { // True is the widget support is disabled. public static final boolean GO_DISABLE_WIDGETS = false; - // True is the shortcut support is disabled. - public static final boolean GO_DISABLE_SHORTCUTS = false; public static final boolean GO_DISABLE_NOTIFICATION_DOTS = false; private static final String TAG = "WidgetsModel";