Merge "Revert "Introducing new variable to enable/disable shortcuts."" into tm-qpr-dev am: 698239e16a
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20033817 Change-Id: I1a36a8b8cef9038d95bc226f902f0b13f1acf12b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -41,10 +41,8 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class WidgetsModel {
|
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;
|
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;
|
public static final boolean GO_DISABLE_NOTIFICATION_DOTS = true;
|
||||||
|
|
||||||
private static final ArrayList<WidgetsListBaseEntry> EMPTY_WIDGET_LIST = new ArrayList<>();
|
private static final ArrayList<WidgetsListBaseEntry> EMPTY_WIDGET_LIST = new ArrayList<>();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.launcher3.icons;
|
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.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -101,7 +101,7 @@ public class ShortcutCachingLogic implements CachingLogic<ShortcutInfo> {
|
|||||||
* Launcher specific checks
|
* Launcher specific checks
|
||||||
*/
|
*/
|
||||||
public static Drawable getIcon(Context context, ShortcutInfo shortcutInfo, int density) {
|
public static Drawable getIcon(Context context, ShortcutInfo shortcutInfo, int density) {
|
||||||
if (GO_DISABLE_SHORTCUTS) {
|
if (GO_DISABLE_WIDGETS) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ package com.android.launcher3.model;
|
|||||||
|
|
||||||
import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY;
|
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 com.android.launcher3.shortcuts.ShortcutRequest.PINNED;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.groupingBy;
|
import static java.util.stream.Collectors.groupingBy;
|
||||||
@@ -286,7 +286,7 @@ public class BgDataModel {
|
|||||||
* shortcuts and unpinning any extra shortcuts.
|
* shortcuts and unpinning any extra shortcuts.
|
||||||
*/
|
*/
|
||||||
public synchronized void updateShortcutPinnedState(Context context, UserHandle user) {
|
public synchronized void updateShortcutPinnedState(Context context, UserHandle user) {
|
||||||
if (GO_DISABLE_SHORTCUTS) {
|
if (GO_DISABLE_WIDGETS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.launcher3.shortcuts;
|
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.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -46,7 +46,7 @@ public class ShortcutRequest {
|
|||||||
| ShortcutQuery.FLAG_MATCH_MANIFEST;
|
| ShortcutQuery.FLAG_MATCH_MANIFEST;
|
||||||
public static final int PINNED = ShortcutQuery.FLAG_MATCH_PINNED;
|
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 Context mContext;
|
||||||
private final UserHandle mUserHandle;
|
private final UserHandle mUserHandle;
|
||||||
@@ -73,7 +73,7 @@ public class ShortcutRequest {
|
|||||||
* @return A list of ShortcutInfo's associated with the given package.
|
* @return A list of ShortcutInfo's associated with the given package.
|
||||||
*/
|
*/
|
||||||
public ShortcutRequest forPackage(String packageName, @Nullable List<String> shortcutIds) {
|
public ShortcutRequest forPackage(String packageName, @Nullable List<String> shortcutIds) {
|
||||||
if (!GO_DISABLE_SHORTCUTS && packageName != null) {
|
if (!GO_DISABLE_WIDGETS && packageName != null) {
|
||||||
mQuery.setPackage(packageName);
|
mQuery.setPackage(packageName);
|
||||||
mQuery.setShortcutIds(shortcutIds);
|
mQuery.setShortcutIds(shortcutIds);
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public class ShortcutRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ShortcutRequest withContainer(@Nullable ComponentName activity) {
|
public ShortcutRequest withContainer(@Nullable ComponentName activity) {
|
||||||
if (!GO_DISABLE_SHORTCUTS) {
|
if (!GO_DISABLE_WIDGETS) {
|
||||||
if (activity == null) {
|
if (activity == null) {
|
||||||
mFailed = true;
|
mFailed = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -92,7 +92,7 @@ public class ShortcutRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public QueryResult query(int flags) {
|
public QueryResult query(int flags) {
|
||||||
if (GO_DISABLE_SHORTCUTS || mFailed) {
|
if (GO_DISABLE_WIDGETS || mFailed) {
|
||||||
return QueryResult.DEFAULT;
|
return QueryResult.DEFAULT;
|
||||||
}
|
}
|
||||||
mQuery.setQueryFlags(flags);
|
mQuery.setQueryFlags(flags);
|
||||||
@@ -108,7 +108,7 @@ public class ShortcutRequest {
|
|||||||
|
|
||||||
public static class QueryResult extends ArrayList<ShortcutInfo> {
|
public static class QueryResult extends ArrayList<ShortcutInfo> {
|
||||||
|
|
||||||
static final QueryResult DEFAULT = new QueryResult(GO_DISABLE_SHORTCUTS);
|
static final QueryResult DEFAULT = new QueryResult(GO_DISABLE_WIDGETS);
|
||||||
|
|
||||||
private final boolean mWasSuccess;
|
private final boolean mWasSuccess;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ShortcutUtil {
|
|||||||
* Returns true when we should show depp shortcuts in shortcut menu for the item.
|
* Returns true when we should show depp shortcuts in shortcut menu for the item.
|
||||||
*/
|
*/
|
||||||
public static boolean supportsDeepShortcuts(ItemInfo info) {
|
public static boolean supportsDeepShortcuts(ItemInfo info) {
|
||||||
return isActive(info) && isApp(info) && !WidgetsModel.GO_DISABLE_SHORTCUTS;
|
return isActive(info) && isApp(info) && !WidgetsModel.GO_DISABLE_WIDGETS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
package com.android.launcher3.views;
|
package com.android.launcher3.views;
|
||||||
|
|
||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
|
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.app.ActivityOptions;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
@@ -190,7 +190,7 @@ public interface AppLauncher extends ActivityContext {
|
|||||||
*/
|
*/
|
||||||
default void startShortcut(String packageName, String id, Rect sourceBounds,
|
default void startShortcut(String packageName, String id, Rect sourceBounds,
|
||||||
Bundle startActivityOptions, UserHandle user) {
|
Bundle startActivityOptions, UserHandle user) {
|
||||||
if (GO_DISABLE_SHORTCUTS) {
|
if (GO_DISABLE_WIDGETS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ public class WidgetsModel {
|
|||||||
|
|
||||||
// True is the widget support is disabled.
|
// True is the widget support is disabled.
|
||||||
public static final boolean GO_DISABLE_WIDGETS = false;
|
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;
|
public static final boolean GO_DISABLE_NOTIFICATION_DOTS = false;
|
||||||
|
|
||||||
private static final String TAG = "WidgetsModel";
|
private static final String TAG = "WidgetsModel";
|
||||||
|
|||||||
Reference in New Issue
Block a user