Merge "Separating the config and flags in different directories so that it is easier to override one or the other" into ub-launcher3-master

This commit is contained in:
TreeHugger Robot 2017-03-07 22:42:13 +00:00 committed by Android (Google) Code Review
commit 93ce56fdb2
28 changed files with 70 additions and 82 deletions

View File

@ -31,6 +31,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
$(call all-java-files-under, src_config) \
$(call all-java-files-under, src_flags) \
$(call all-proto-files-under, protos)
LOCAL_RESOURCE_DIR := \

View File

@ -38,7 +38,7 @@ android {
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src', 'src_config']
java.srcDirs = ['src', 'src_flags']
manifest.srcFile 'AndroidManifest-common.xml'
proto.srcDirs 'protos/'
}

View File

@ -51,7 +51,7 @@ import com.android.launcher3.accessibility.DragAndDropAccessibilityDelegate;
import com.android.launcher3.accessibility.FolderAccessibilityHelper;
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.util.CellAndSpan;
@ -568,7 +568,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
try {
dispatchRestoreInstanceState(states);
} catch (IllegalArgumentException ex) {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw ex;
}
// Mismatched viewId / viewType preventing restore. Skip restore on production builds.

View File

@ -22,7 +22,7 @@ import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewGroup;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderPagedView;
import com.android.launcher3.util.FocusLogic;
@ -93,7 +93,7 @@ public class FocusHelper {
}
if (!(v.getParent() instanceof ShortcutAndWidgetContainer)) {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw new IllegalStateException("Parent of the focused item is not supported.");
} else {
return false;

View File

@ -28,7 +28,6 @@ import android.view.Display;
import android.view.WindowManager;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.util.Thunk;
@ -335,7 +334,7 @@ public class InvariantDeviceProfile {
}
public int getAllAppsButtonRank() {
if (ProviderConfig.IS_DOGFOOD_BUILD && FeatureFlags.NO_ALL_APPS_ICON) {
if (FeatureFlags.IS_DOGFOOD_BUILD && FeatureFlags.NO_ALL_APPS_ICON) {
throw new IllegalAccessError("Accessing all apps rank when all-apps is disabled");
}
return numHotseatIcons / 2;

View File

@ -91,7 +91,6 @@ import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PinItemRequestCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
@ -3386,7 +3385,7 @@ public class Launcher extends BaseActivity
Object tag = v.getTag();
String desc = "Collision while binding workspace item: " + item
+ ". Collides with " + tag;
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw (new RuntimeException(desc));
} else {
Log.d(TAG, desc);

View File

@ -26,7 +26,7 @@ import android.util.Log;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.model.GridSizeMigrationTask;
import com.android.launcher3.util.ConfigMonitor;
@ -38,7 +38,7 @@ import java.util.concurrent.ExecutionException;
public class LauncherAppState {
public static final boolean PROFILE_STARTUP = ProviderConfig.IS_DOGFOOD_BUILD;
public static final boolean PROFILE_STARTUP = FeatureFlags.IS_DOGFOOD_BUILD;
// We do not need any synchronization for this variable as its only written on UI thread.
private static LauncherAppState INSTANCE;

View File

@ -44,7 +44,7 @@ import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
@ -1371,7 +1371,7 @@ public class LauncherModel extends BroadcastReceiver
return Utilities.longCompare(lhs.screenId, rhs.screenId);
}
default:
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw new RuntimeException("Unexpected container type when " +
"sorting workspace items.");
}

View File

@ -47,14 +47,12 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.ViewGroup;
import com.android.launcher3.AutoInstallsLayout.LayoutParserCallback;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.LauncherSettings.WorkspaceScreens;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dynamicui.ExtractionUtils;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.provider.LauncherDbUtils;
@ -77,7 +75,7 @@ public class LauncherProvider extends ContentProvider {
private static final int DATABASE_VERSION = 27;
public static final String AUTHORITY = ProviderConfig.AUTHORITY;
public static final String AUTHORITY = (BuildConfig.APPLICATION_ID + ".settings").intern();
static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
@ -102,7 +100,7 @@ public class LauncherProvider extends ContentProvider {
@Override
public boolean onCreate() {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
Log.d(TAG, "Launcher process started");
}
mListenerHandler = new Handler(mListenerWrapper);

View File

@ -22,8 +22,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.BaseColumns;
import com.android.launcher3.config.ProviderConfig;
/**
* Settings related utilities.
*/
@ -101,7 +99,7 @@ public class LauncherSettings {
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse("content://" +
ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
LauncherProvider.AUTHORITY + "/" + TABLE_NAME);
/**
* The rank of this screen -- ie. how it is ordered relative to the other screens.
@ -121,7 +119,7 @@ public class LauncherSettings {
* The content:// style URL for this table
*/
public static final Uri CONTENT_URI = Uri.parse("content://" +
ProviderConfig.AUTHORITY + "/" + TABLE_NAME);
LauncherProvider.AUTHORITY + "/" + TABLE_NAME);
/**
* The content:// style URL for a given row, identified by its id.
@ -131,7 +129,7 @@ public class LauncherSettings {
* @return The unique content URL for the specified row.
*/
public static Uri getContentUri(long id) {
return Uri.parse("content://" + ProviderConfig.AUTHORITY +
return Uri.parse("content://" + LauncherProvider.AUTHORITY +
"/" + TABLE_NAME + "/" + id);
}
@ -280,7 +278,7 @@ public class LauncherSettings {
public static final class Settings {
public static final Uri CONTENT_URI = Uri.parse("content://" +
ProviderConfig.AUTHORITY + "/settings");
LauncherProvider.AUTHORITY + "/settings");
public static final String METHOD_CLEAR_EMPTY_DB_FLAG = "clear_empty_db_flag";
public static final String METHOD_WAS_EMPTY_DB_CREATED = "get_empty_db_flag";

View File

@ -51,7 +51,7 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
@ -575,7 +575,7 @@ public final class Utilities {
try {
c.close();
} catch (IOException e) {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
Log.d(TAG, "Error closing", e);
}
}

View File

@ -64,7 +64,6 @@ import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.badge.FolderBadgeInfo;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
@ -2618,7 +2617,7 @@ public class Workspace extends PagedView
CellLayout parentCell = getParentCellLayoutForView(cell);
if (parentCell != null) {
parentCell.removeView(cell);
} else if (ProviderConfig.IS_DOGFOOD_BUILD) {
} else if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw new NullPointerException("mDragInfo.cell has null parent");
}
addInScreen(cell, container, screenId, mTargetCell[0], mTargetCell[1],
@ -2951,7 +2950,7 @@ public class Workspace extends PagedView
ItemInfo item = d.dragInfo;
if (item == null) {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw new NullPointerException("DragObject has null info");
}
return;
@ -3608,7 +3607,7 @@ public class Workspace extends PagedView
mDragInfo.container, mDragInfo.screenId);
if (cellLayout != null) {
cellLayout.onDropChild(mDragInfo.cell);
} else if (ProviderConfig.IS_DOGFOOD_BUILD) {
} else if (FeatureFlags.IS_DOGFOOD_BUILD) {
throw new RuntimeException("Invalid state: cellLayout == null in "
+ "Workspace#onDropCompleted. Please file a bug. ");
};
@ -3634,7 +3633,7 @@ public class Workspace extends PagedView
CellLayout parentCell = getParentCellLayoutForView(v);
if (parentCell != null) {
parentCell.removeView(v);
} else if (ProviderConfig.IS_DOGFOOD_BUILD) {
} else if (FeatureFlags.IS_DOGFOOD_BUILD) {
// When an app is uninstalled using the drop target, we wait until resume to remove
// the icon. We also remove all the corresponding items from the workspace at
// {@link Launcher#bindComponentsRemoved}. That call can come before or after

View File

@ -24,7 +24,7 @@ import android.util.Log;
import com.android.launcher3.AppInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.discovery.AppDiscoveryAppInfo;
import com.android.launcher3.discovery.AppDiscoveryItem;
import com.android.launcher3.discovery.AppDiscoveryUpdateState;
@ -440,7 +440,7 @@ public class AlphabeticalAppsList {
if (info != null) {
mPredictedApps.add(info);
} else {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
Log.e(TAG, "Predicted app not found: " + ck);
}
}

View File

@ -69,7 +69,6 @@ import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragController.DragListener;
import com.android.launcher3.dragndrop.DragLayer;
@ -591,7 +590,7 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
dragLayer.addView(this);
mDragController.addDropTarget(this);
} else {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
Log.e(TAG, "Opening folder (" + this + ") which already has a parent:"
+ getParent());
}

View File

@ -29,7 +29,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppWidgetHostView;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.FolderIcon;
/**
@ -138,7 +138,7 @@ public class DragPreviewProvider {
}
public final void generateDragOutline(Canvas canvas) {
if (ProviderConfig.IS_DOGFOOD_BUILD && generatedDragOutline != null) {
if (FeatureFlags.IS_DOGFOOD_BUILD && generatedDragOutline != null) {
throw new RuntimeException("Drag outline generated twice");
}

View File

@ -31,7 +31,7 @@ import android.util.SparseArray;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.R;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import java.nio.ByteBuffer;
@ -86,7 +86,7 @@ public class HolographicOutlineHelper {
* bitmap.
*/
public void applyExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas) {
if (ProviderConfig.IS_DOGFOOD_BUILD && srcDst.getConfig() != Bitmap.Config.ALPHA_8) {
if (FeatureFlags.IS_DOGFOOD_BUILD && srcDst.getConfig() != Bitmap.Config.ALPHA_8) {
throw new RuntimeException("Outline blue is only supported on alpha bitmaps");
}

View File

@ -6,9 +6,8 @@ import android.os.Message;
import android.util.Log;
import android.util.Pair;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import java.io.BufferedReader;
import java.io.File;
@ -40,7 +39,7 @@ public final class FileLog {
private static File sLogsDirectory = null;
public static void setDir(File logsDir) {
if (ProviderConfig.IS_DOGFOOD_BUILD || Utilities.IS_DEBUG_DEVICE) {
if (FeatureFlags.IS_DOGFOOD_BUILD || Utilities.IS_DEBUG_DEVICE) {
synchronized (DATE_FORMAT) {
// If the target directory changes, stop any active thread.
if (sHandler != null && !logsDir.equals(sLogsDirectory)) {
@ -77,7 +76,7 @@ public final class FileLog {
}
public static void print(String tag, String msg, Exception e) {
if (!ProviderConfig.IS_DOGFOOD_BUILD) {
if (!FeatureFlags.IS_DOGFOOD_BUILD) {
return;
}
String out = String.format("%s %s %s", DATE_FORMAT.format(new Date()), tag, msg);
@ -103,7 +102,7 @@ public final class FileLog {
* @param out if not null, all the persisted logs are copied to the writer.
*/
public static void flushAll(PrintWriter out) throws InterruptedException {
if (!ProviderConfig.IS_DOGFOOD_BUILD) {
if (!FeatureFlags.IS_DOGFOOD_BUILD) {
return;
}
CountDownLatch latch = new CountDownLatch(1);
@ -136,7 +135,7 @@ public final class FileLog {
@Override
public boolean handleMessage(Message msg) {
if (sLogsDirectory == null || !ProviderConfig.IS_DOGFOOD_BUILD) {
if (sLogsDirectory == null || !FeatureFlags.IS_DOGFOOD_BUILD) {
return true;
}
switch (msg.what) {

View File

@ -29,8 +29,7 @@ import com.android.launcher3.DropTarget;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
@ -61,7 +60,7 @@ public class UserEventDispatcher {
private static final String TAG = "UserEvent";
private static final boolean IS_VERBOSE =
ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
FeatureFlags.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(LogConfig.USEREVENT);
private static UserEventDispatcher sInstance;
private static final Object LOCK = new Object();

View File

@ -27,8 +27,7 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.logging.LoggerUtils;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.DumpTargetWrapper;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
@ -36,7 +35,6 @@ import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.model.nano.LauncherDumpProto;
import com.android.launcher3.model.nano.LauncherDumpProto.ContainerType;
import com.android.launcher3.model.nano.LauncherDumpProto.DumpTarget;
import com.android.launcher3.model.nano.LauncherDumpProto.ItemType;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.MultiHashMap;
@ -242,7 +240,7 @@ public class BgDataModel {
switch (item.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
folders.remove(item.id);
if (ProviderConfig.IS_DOGFOOD_BUILD) {
if (FeatureFlags.IS_DOGFOOD_BUILD) {
for (ItemInfo info : itemsIdMap) {
if (info.container == item.id) {
// We are deleting a folder which still contains items that

View File

@ -3,9 +3,7 @@ package com.android.launcher3.model;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Process;
import android.os.UserHandle;
import android.util.Log;
@ -19,8 +17,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.ShortcutConfigActivityInfo;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.Preconditions;
@ -79,7 +76,7 @@ public class WidgetsModel {
}
setWidgetsAndShortcuts(widgetsAndShortcuts, context);
} catch (Exception e) {
if (!ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isBinderSizeError(e)) {
if (!FeatureFlags.IS_DOGFOOD_BUILD && Utilities.isBinderSizeError(e)) {
// the returned value may be incomplete and will not be refreshed until the next
// time Launcher starts.
// TODO: after figuring out a repro step, introduce a dirty bit to check when

View File

@ -37,6 +37,7 @@ import com.android.launcher3.DefaultLayoutParser;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherFiles;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.LauncherSettings.Settings;
@ -46,7 +47,6 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.GridSizeMigrationTask;
import com.android.launcher3.util.LongArrayMap;
@ -112,7 +112,7 @@ public class ImportDataTask {
screenOps.add(ContentProviderOperation.newInsert(
LauncherSettings.WorkspaceScreens.CONTENT_URI).withValues(v).build());
}
mContext.getContentResolver().applyBatch(ProviderConfig.AUTHORITY, screenOps);
mContext.getContentResolver().applyBatch(LauncherProvider.AUTHORITY, screenOps);
importWorkspaceItems(allScreens.get(0), screenIdMap);
GridSizeMigrationTask.markForMigration(mContext, mMaxGridSizeX, mMaxGridSizeY, mHotseatSize);
@ -289,7 +289,7 @@ public class ImportDataTask {
}
if (insertOperations.size() >= BATCH_INSERT_SIZE) {
mContext.getContentResolver().applyBatch(ProviderConfig.AUTHORITY,
mContext.getContentResolver().applyBatch(LauncherProvider.AUTHORITY,
insertOperations);
insertOperations.clear();
}
@ -300,7 +300,7 @@ public class ImportDataTask {
throw new Exception("Insufficient data");
}
if (!insertOperations.isEmpty()) {
mContext.getContentResolver().applyBatch(ProviderConfig.AUTHORITY,
mContext.getContentResolver().applyBatch(LauncherProvider.AUTHORITY,
insertOperations);
insertOperations.clear();
}
@ -319,7 +319,7 @@ public class ImportDataTask {
mHotseatSize = (int) hotseatItems.keyAt(hotseatItems.size() - 1) + 1;
if (!insertOperations.isEmpty()) {
mContext.getContentResolver().applyBatch(ProviderConfig.AUTHORITY,
mContext.getContentResolver().applyBatch(LauncherProvider.AUTHORITY,
insertOperations);
}
}

View File

@ -19,7 +19,7 @@ package com.android.launcher3.util;
import android.os.Looper;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
/**
* A set of utility methods for thread verification.
@ -27,25 +27,25 @@ import com.android.launcher3.config.ProviderConfig;
public class Preconditions {
public static void assertNotNull(Object o) {
if (ProviderConfig.IS_DOGFOOD_BUILD && o == null) {
if (FeatureFlags.IS_DOGFOOD_BUILD && o == null) {
throw new IllegalStateException();
}
}
public static void assertWorkerThread() {
if (ProviderConfig.IS_DOGFOOD_BUILD && !isSameLooper(LauncherModel.getWorkerLooper())) {
if (FeatureFlags.IS_DOGFOOD_BUILD && !isSameLooper(LauncherModel.getWorkerLooper())) {
throw new IllegalStateException();
}
}
public static void assertUIThread() {
if (ProviderConfig.IS_DOGFOOD_BUILD && !isSameLooper(Looper.getMainLooper())) {
if (FeatureFlags.IS_DOGFOOD_BUILD && !isSameLooper(Looper.getMainLooper())) {
throw new IllegalStateException();
}
}
public static void assertNonUiThread() {
if (ProviderConfig.IS_DOGFOOD_BUILD && isSameLooper(Looper.getMainLooper())) {
if (FeatureFlags.IS_DOGFOOD_BUILD && isSameLooper(Looper.getMainLooper())) {
throw new IllegalStateException();
}
}

View File

@ -10,7 +10,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.config.FeatureFlags;
/**
* An extension of {@link SQLiteOpenHelper} with utility methods for a single table cache DB.
@ -19,7 +19,7 @@ import com.android.launcher3.config.ProviderConfig;
public abstract class SQLiteCacheHelper {
private static final String TAG = "SQLiteCacheHelper";
private static final boolean NO_ICON_CACHE = ProviderConfig.IS_DOGFOOD_BUILD &&
private static final boolean NO_ICON_CACHE = FeatureFlags.IS_DOGFOOD_BUILD &&
Utilities.isPropertyEnabled(LogConfig.MEMORY_ONLY_ICON_CACHE);
private final String mTableName;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 The Android Open Source Project
* 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.
@ -14,11 +14,11 @@
* limitations under the License.
*/
package com.android.launcher3.config;
package com.android.launcher3;
public class ProviderConfig {
public static final String AUTHORITY = "com.android.launcher3.settings".intern();
public static final boolean IS_DOGFOOD_BUILD = true;
/**
* Config file used by Make. This file is automatically generated when using gradle.
*/
public class BuildConfig {
public static final String APPLICATION_ID = "com.android.launcher3";
}

View File

@ -20,6 +20,9 @@ package com.android.launcher3.config;
* Defines a set of flags used to control various launcher behaviors
*/
public final class FeatureFlags {
public static final boolean IS_DOGFOOD_BUILD = true;
private FeatureFlags() {}
// Custom flags go below this

View File

@ -10,9 +10,9 @@ import android.net.Uri;
import android.util.Pair;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.Provider;
@ -178,6 +178,6 @@ public class AddWorkspaceItemsTaskTest extends BaseModelUpdateTaskTestCase {
v.put(LauncherSettings.WorkspaceScreens.SCREEN_RANK, i);
ops.add(ContentProviderOperation.newInsert(uri).withValues(v).build());
}
getMockContentResolver().applyBatch(ProviderConfig.AUTHORITY, ops);
getMockContentResolver().applyBatch(LauncherProvider.AUTHORITY, ops);
}
}

View File

@ -23,7 +23,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherModel.BaseModelUpdateTask;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.Provider;
import com.android.launcher3.util.TestLauncherProvider;
@ -64,7 +64,7 @@ public class BaseModelUpdateTaskTestCase extends ProviderTestCase2<TestLauncherP
public Callbacks callbacks;
public BaseModelUpdateTaskTestCase() {
super(TestLauncherProvider.class, ProviderConfig.AUTHORITY);
super(TestLauncherProvider.class, LauncherProvider.AUTHORITY);
}
@Override

View File

@ -1,7 +1,6 @@
package com.android.launcher3.model;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Point;
@ -10,9 +9,9 @@ import android.test.suitebuilder.annotation.MediumTest;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.model.GridSizeMigrationTask.MultiStepMigrationTask;
import com.android.launcher3.util.TestLauncherProvider;
@ -40,7 +39,7 @@ public class GridSizeMigrationTaskTest extends ProviderTestCase2<TestLauncherPro
private InvariantDeviceProfile mIdp;
public GridSizeMigrationTaskTest() {
super(TestLauncherProvider.class, ProviderConfig.AUTHORITY);
super(TestLauncherProvider.class, LauncherProvider.AUTHORITY);
}
@Override