Removing flag overrides. All flags should be defined as togglable flags instead.

Change-Id: Ia7b9ff84413096cd5b0c4a9a81a232019f2522d2
This commit is contained in:
Sunny Goyal 2019-09-11 16:51:50 -07:00
parent dc5d27c44e
commit 3e3d759db2
25 changed files with 94 additions and 156 deletions

View File

@ -84,8 +84,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
$(call all-java-files-under, src_shortcuts_overrides) \
$(call all-java-files-under, src_ui_overrides) \
$(call all-java-files-under, src_flags)
$(call all-java-files-under, src_ui_overrides)
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
# Proguard is disable for testing. Derivarive prjects to keep proguard enabled
@ -163,7 +162,6 @@ LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
$(call all-java-files-under, quickstep/src) \
$(call all-java-files-under, quickstep/recents_ui_overrides/src) \
$(call all-java-files-under, src_flags) \
$(call all-java-files-under, src_shortcuts_overrides)
LOCAL_RESOURCE_DIR := \

View File

@ -20,7 +20,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeStatesTouchController;
@ -51,7 +50,7 @@ public abstract class RecentsUiFactory {
.getMode().hasGestures;
list.add(new PortraitStatesTouchController(launcher, allowDragToOverview));
}
if (FeatureFlags.PULL_DOWN_STATUS_BAR && Utilities.IS_DEBUG_DEVICE
if (Utilities.IS_DEBUG_DEVICE
&& !launcher.getDeviceProfile().isMultiWindowMode
&& !launcher.getDeviceProfile().isVerticalBarLayout()) {
list.add(new StatusBarTouchController(launcher));

View File

@ -1,32 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.config;
import android.content.Context;
/**
* Defines a set of flags used to control various launcher behaviors
*/
public final class FeatureFlags extends BaseFlags {
private FeatureFlags() {
// Prevent instantiation
}
// Features to control Launcher3Go behavior
public static final boolean GO_DISABLE_WIDGETS = true;
public static final boolean LAUNCHER3_SPRING_ICONS = false;
}

View File

@ -37,6 +37,10 @@ import androidx.annotation.Nullable;
* <p> The widgets and shortcuts are organized using package name as its index.
*/
public class WidgetsModel {
// True is the widget support is disabled.
public static final boolean GO_DISABLE_WIDGETS = false;
private static final ArrayList<WidgetListRowEntry> EMPTY_WIDGET_LIST = new ArrayList<>();
/**

View File

@ -28,17 +28,15 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController;
import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.OverviewToAllAppsTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.QuickSwitchTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController;
import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController;
import com.android.launcher3.util.TouchController;
@ -164,8 +162,7 @@ public abstract class RecentsUiFactory {
}
}
if (FeatureFlags.PULL_DOWN_STATUS_BAR
&& !launcher.getDeviceProfile().isMultiWindowMode) {
if (!launcher.getDeviceProfile().isMultiWindowMode) {
list.add(new StatusBarTouchController(launcher));
}

View File

@ -44,7 +44,6 @@ import com.android.launcher3.BaseActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
import com.android.quickstep.TaskOverlayFactory;
@ -308,8 +307,7 @@ public class TaskThumbnailView extends View {
final Configuration configuration =
getContext().getResources().getConfiguration();
// Rotate the screenshot if not in multi-window mode
isRotated = FeatureFlags.OVERVIEW_USE_SCREENSHOT_ORIENTATION &&
configuration.orientation != mThumbnailData.orientation &&
isRotated = configuration.orientation != mThumbnailData.orientation &&
!mActivity.isInMultiWindowMode() &&
mThumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN;
// Scale the screenshot to always fit the width of the card.

View File

@ -17,7 +17,8 @@
package com.android.launcher3.uioverrides;
import android.provider.DeviceConfig;
import com.android.launcher3.config.BaseFlags.BaseTogglableFlag;
import com.android.launcher3.config.FeatureFlags.BaseTogglableFlag;
public class TogglableFlag extends BaseTogglableFlag {

View File

@ -1,8 +1,9 @@
package com.android.launcher3.config;
import com.android.launcher3.config.BaseFlags.BaseTogglableFlag;
import com.android.launcher3.config.FeatureFlags.BaseTogglableFlag;
import com.android.launcher3.uioverrides.TogglableFlag;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;

View File

@ -1,5 +1,8 @@
package com.android.launcher3.config;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.android.launcher3.config.FlagOverrideRule.FlagOverride;
import org.junit.Rule;
@ -7,9 +10,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Sample Robolectric test that demonstrates flag-overriding.
*/
@ -24,13 +24,12 @@ public class FlagOverrideSampleTest {
@FlagOverride(key = "EXAMPLE_FLAG", value = true)
@Test
public void withFlagOn() {
assertTrue(FeatureFlags.EXAMPLE_FLAG.get());
assertTrue(FeatureFlags.FAKE_LANDSCAPE_UI.get());
}
@FlagOverride(key = "EXAMPLE_FLAG", value = false)
@Test
public void withFlagOff() {
assertFalse(FeatureFlags.EXAMPLE_FLAG.get());
assertFalse(FeatureFlags.FAKE_LANDSCAPE_UI.get());
}
}

View File

@ -1,5 +1,7 @@
package com.android.launcher3;
import static android.os.Process.myUserHandle;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
@ -12,15 +14,13 @@ import android.util.Log;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.LoaderTask;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.util.ContentWriter;
import androidx.annotation.WorkerThread;
import static android.os.Process.myUserHandle;
public class AppWidgetsRestoredReceiver extends BroadcastReceiver {
private static final String TAG = "AWRestoredReceiver";
@ -50,7 +50,7 @@ public class AppWidgetsRestoredReceiver extends BroadcastReceiver {
@WorkerThread
public static void restoreAppWidgetIds(Context context, int[] oldWidgetIds, int[] newWidgetIds) {
AppWidgetHost appWidgetHost = new LauncherAppWidgetHost(context);
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
Log.e(TAG, "Skipping widget ID remap as widgets not supported");
appWidgetHost.deleteHost();
return;

View File

@ -29,7 +29,7 @@ import android.os.Handler;
import android.util.SparseArray;
import android.widget.Toast;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.widget.DeferredAppWidgetHostView;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.launcher3.widget.custom.CustomWidgetManager;
@ -71,7 +71,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
@Override
public void startListening() {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return;
}
mFlags |= FLAG_LISTENING;
@ -98,7 +98,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
@Override
public void stopListening() {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return;
}
mFlags &= ~FLAG_LISTENING;
@ -157,7 +157,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
@Override
public int allocateAppWidgetId() {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return AppWidgetManager.INVALID_APPWIDGET_ID;
}
@ -242,7 +242,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
public void startBindFlow(BaseActivity activity,
int appWidgetId, AppWidgetProviderInfo info, int requestCode) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
sendActionCancelled(activity, requestCode);
return;
}
@ -258,7 +258,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
public void startConfigActivity(BaseActivity activity, int widgetId, int requestCode) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
sendActionCancelled(activity, requestCode);
return;
}

View File

@ -26,7 +26,6 @@ import android.os.Process;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -45,11 +44,10 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusedItemDecorator;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import com.android.launcher3.util.ItemInfoMatcher;
@ -163,16 +161,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
}
private void onAppsUpdated() {
if (FeatureFlags.ALL_APPS_TABS_ENABLED) {
boolean hasWorkApps = false;
for (AppInfo app : mAllAppsStore.getApps()) {
if (mWorkMatcher.matches(app, null)) {
hasWorkApps = true;
break;
}
boolean hasWorkApps = false;
for (AppInfo app : mAllAppsStore.getApps()) {
if (mWorkMatcher.matches(app, null)) {
hasWorkApps = true;
break;
}
rebindAdapters(hasWorkApps);
}
rebindAdapters(hasWorkApps);
}
/**

View File

@ -28,7 +28,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.widget.custom.CustomAppWidgetProviderInfo;
@ -51,7 +51,7 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
@Override
public List<AppWidgetProviderInfo> getAllProviders(@Nullable PackageUserKey packageUser) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return Collections.emptyList();
}
if (packageUser == null) {
@ -82,7 +82,7 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
@Override
public boolean bindAppWidgetIdIfAllowed(int appWidgetId, AppWidgetProviderInfo info,
Bundle options) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return false;
}
if (appWidgetId <= LauncherAppWidgetInfo.CUSTOM_WIDGET_ID) {
@ -94,7 +94,7 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
@Override
public LauncherAppWidgetProviderInfo findProvider(ComponentName provider, UserHandle user) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return null;
}
for (AppWidgetProviderInfo info :
@ -117,7 +117,7 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
@Override
public HashMap<ComponentKey, AppWidgetProviderInfo> getAllProvidersMap() {
HashMap<ComponentKey, AppWidgetProviderInfo> result = new HashMap<>();
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return result;
}
for (UserHandle user : mUserManager.getUserProfiles()) {

View File

@ -21,7 +21,7 @@ import android.content.Context;
import androidx.annotation.Nullable;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.util.PackageUserKey;
import java.util.Collections;
@ -35,7 +35,7 @@ class AppWidgetManagerCompatVO extends AppWidgetManagerCompatVL {
@Override
public List<AppWidgetProviderInfo> getAllProviders(@Nullable PackageUserKey packageUser) {
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
return Collections.emptyList();
}
if (packageUser == null) {

View File

@ -16,6 +16,7 @@
package com.android.launcher3.compat;
import static com.android.launcher3.Utilities.getPrefs;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.content.Context;
@ -28,12 +29,12 @@ import android.os.UserHandle;
import android.text.TextUtils;
import android.util.SparseArray;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.SessionCommitReceiver;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.PackageUserKey;
@ -44,8 +45,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import static com.android.launcher3.Utilities.getPrefs;
public class PackageInstallerCompatVL extends PackageInstallerCompat {
private static final boolean DEBUG = false;
@ -160,7 +159,7 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat {
@Override
public void onCreated(int sessionId) {
SessionInfo sessionInfo = pushSessionDisplayToLauncher(sessionId);
if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS && sessionInfo != null) {
if (FeatureFlags.PROMISE_APPS_IN_ALL_APPS.get() && sessionInfo != null) {
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.getModel().onInstallSessionCreated(

View File

@ -25,6 +25,7 @@ import androidx.annotation.GuardedBy;
import androidx.annotation.Keep;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.BuildConfig;
import com.android.launcher3.Utilities;
import com.android.launcher3.uioverrides.TogglableFlag;
@ -39,7 +40,7 @@ import java.util.TreeMap;
* <p>All the flags should be defined here with appropriate default values.
*/
@Keep
public abstract class BaseFlags {
public final class FeatureFlags {
private static final Object sLock = new Object();
@GuardedBy("sLock")
@ -47,46 +48,47 @@ public abstract class BaseFlags {
static final String FLAGS_PREF_NAME = "featureFlags";
BaseFlags() {
throw new UnsupportedOperationException("Don't instantiate BaseFlags");
}
private FeatureFlags() { }
public static boolean showFlagTogglerUi(Context context) {
return Utilities.IS_DEBUG_DEVICE && Utilities.isDevelopersOptionsEnabled(context);
}
public static final boolean IS_DOGFOOD_BUILD = false;
public static final boolean IS_DOGFOOD_BUILD = BuildConfig.DEBUG;
/**
* Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature
* and should be modified at a project level.
*/
public static final boolean QSB_ON_FIRST_SCREEN = true;
/**
* Feature flag to handle define config changes dynamically instead of killing the process.
*
*
* To add a new flag that can be toggled through the flags UI:
*
* 1. Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"),
* and set a default value for the flag. This will be the default value on Debug builds.
*
* 2. Add your flag to mTogglableFlags.
*
* 3. Create a getter method (an 'is' method) for the flag by copying an existing one.
*
* 4. Create a getter method with the same name in the release flags copy of FeatureFlags.java.
* This should returns a constant (true/false). This will be the value of the flag used on
* release builds.
*/
// When enabled the promise icon is visible in all apps while installation an app.
public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false;
public static final TogglableFlag PROMISE_APPS_IN_ALL_APPS = new TogglableFlag(
"PROMISE_APPS_IN_ALL_APPS", false, "Add promise icon in all-apps");
// When enabled a promise icon is added to the home screen when install session is active.
public static final TogglableFlag PROMISE_APPS_NEW_INSTALLS =
new TogglableFlag("PROMISE_APPS_NEW_INSTALLS", true,
"Adds a promise icon to the home screen for new install sessions.");
// Enable moving the QSB on the 0th screen of the workspace
public static final boolean QSB_ON_FIRST_SCREEN = true;
public static final TogglableFlag EXAMPLE_FLAG = new TogglableFlag("EXAMPLE_FLAG", true,
"An example flag that doesn't do anything. Useful for testing");
//Feature flag to enable pulling down navigation shade from workspace.
public static final boolean PULL_DOWN_STATUS_BAR = true;
// Features to control Launcher3Go behavior
public static final boolean GO_DISABLE_WIDGETS = false;
// When enabled shows a work profile tab in all apps
public static final boolean ALL_APPS_TABS_ENABLED = true;
// When true, overview shows screenshots in the orientation they were taken rather than
// trying to make them fit the orientation the device is in.
public static final boolean OVERVIEW_USE_SCREENSHOT_ORIENTATION = true;
/**
* Feature flag to handle define config changes dynamically instead of killing the process.
*/
public static final TogglableFlag APPLY_CONFIG_AT_RUNTIME = new TogglableFlag(
"APPLY_CONFIG_AT_RUNTIME", true, "Apply display changes dynamically");
@ -130,13 +132,13 @@ public abstract class BaseFlags {
static List<TogglableFlag> getTogglableFlags() {
// By Java Language Spec 12.4.2
// https://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.2, the
// TogglableFlag instances on BaseFlags will be created before those on the FeatureFlags
// TogglableFlag instances on FeatureFlags will be created before those on the FeatureFlags
// subclass. This code handles flags that are redeclared in FeatureFlags, ensuring the
// FeatureFlags one takes priority.
SortedMap<String, TogglableFlag> flagsByKey = new TreeMap<>();
synchronized (sLock) {
for (TogglableFlag flag : sFlags) {
flagsByKey.put(((BaseTogglableFlag) flag).getKey(), flag);
flagsByKey.put(flag.getKey(), flag);
}
}
return new ArrayList<>(flagsByKey.values());

View File

@ -26,13 +26,13 @@ import android.view.MenuItem;
import android.widget.Toast;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags.BaseTogglableFlag;
import com.android.launcher3.uioverrides.TogglableFlag;
import androidx.preference.PreferenceDataStore;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceGroup;
import androidx.preference.SwitchPreference;
import com.android.launcher3.config.BaseFlags.BaseTogglableFlag;
import com.android.launcher3.uioverrides.TogglableFlag;
/**
* Dev-build only UI allowing developers to toggle flag settings. See {@link FeatureFlags}.

View File

@ -569,7 +569,7 @@ public class LoaderTask implements Runnable {
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
if (FeatureFlags.GO_DISABLE_WIDGETS) {
if (WidgetsModel.GO_DISABLE_WIDGETS) {
c.markDeleted("Only legacy shortcuts can have null package");
continue;
}
@ -830,7 +830,7 @@ public class LoaderTask implements Runnable {
allActivityList.addAll(apps);
}
if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
if (FeatureFlags.PROMISE_APPS_IN_ALL_APPS.get()) {
// get all active sessions and add them to the all apps list
for (PackageInstaller.SessionInfo info :
mPackageInstaller.getAllVerifiedSessions()) {

View File

@ -104,7 +104,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
for (int i = 0; i < N; i++) {
if (DEBUG) Log.d(TAG, "mAllAppsList.addPackage " + packages[i]);
iconCache.updateIconsForPkg(packages[i], mUser);
if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
if (FeatureFlags.PROMISE_APPS_IN_ALL_APPS.get()) {
appsList.removePackage(packages[i], mUser);
}
appsList.addPackage(context, packages[i], mUser);

View File

@ -19,7 +19,7 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.Utilities;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.shortcuts.ShortcutKey;
public class ShortcutUtil {
@ -44,7 +44,7 @@ public class ShortcutUtil {
private static boolean isActive(ItemInfo info) {
boolean isLoading = info instanceof WorkspaceItemInfo
&& ((WorkspaceItemInfo) info).hasPromiseIconUi();
return !isLoading && !info.isDisabled() && !FeatureFlags.GO_DISABLE_WIDGETS;
return !isLoading && !info.isDisabled() && !WidgetsModel.GO_DISABLE_WIDGETS;
}
private static boolean isApp(ItemInfo info) {

View File

@ -37,7 +37,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.popup.ArrowPopup;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
@ -158,7 +158,7 @@ public class OptionsPopupView extends ArrowPopup
R.drawable.ic_palette : R.drawable.ic_wallpaper;
options.add(new OptionItem(resString, resDrawable,
ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
if (!FeatureFlags.GO_DISABLE_WIDGETS) {
if (!WidgetsModel.GO_DISABLE_WIDGETS) {
options.add(new OptionItem(R.string.widget_button_text, R.drawable.ic_widget,
ControlType.WIDGETS_BUTTON, OptionsPopupView::onWidgetsClicked));
}

View File

@ -18,4 +18,5 @@ package com.android.launcher3;
public final class BuildConfig {
public static final String APPLICATION_ID = "com.android.launcher3";
public static final boolean DEBUG = false;
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.config;
import android.content.Context;
/**
* Defines a set of flags used to control various launcher behaviors
*/
public final class FeatureFlags extends BaseFlags {
private FeatureFlags() {
// Prevent instantiation
}
}

View File

@ -11,8 +11,6 @@ import android.os.UserHandle;
import android.util.Log;
import com.android.launcher3.AppFilter;
import com.android.launcher3.icons.ComponentWithLabel;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
@ -22,6 +20,8 @@ import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.ShortcutConfigActivityInfo;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.ComponentWithLabel;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.Preconditions;
@ -46,6 +46,9 @@ import androidx.annotation.Nullable;
*/
public class WidgetsModel {
// True is the widget support is disabled.
public static final boolean GO_DISABLE_WIDGETS = false;
private static final String TAG = "WidgetsModel";
private static final boolean DEBUG = false;

View File

@ -16,7 +16,7 @@
package com.android.launcher3.uioverrides;
import com.android.launcher3.config.BaseFlags.BaseTogglableFlag;
import com.android.launcher3.config.FeatureFlags.BaseTogglableFlag;
public class TogglableFlag extends BaseTogglableFlag {